HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/svg-sprite-data/index.js
var sprite = require("./lib/svg-sprite");

/**
 * @param config
 * @returns {SpriteData}
 * @constructor
 */
function SpriteData(config) {
    this.tasks = {};
    this.counter = 0;
    this.svgs = sprite.createSprite(config);
    return this;
}

/**
 * Main Export
 * @param config
 */
module.exports = SpriteData;

/**
 * @param path
 * @param contents
 */
SpriteData.prototype.add = function (path, contents) {

    if (this.svgs) {
        this.svgs.addFile(path, contents, this.counter, this.tasks);
        this.counter = this.counter += 1;
    }

    return this;
};

/**
 * @param {Function} cb
 * @param config
 */
SpriteData.prototype.compile = function (config, cb) {

    if(typeof config === 'function' && !cb) {
      cb = config;
      config = {};
    }

    this.svgs._processFiles(this.tasks, config, function () {

        var svg = this.svgs.toSVG(false);
        var data = this.svgs.data;

        cb(null, {
            svg: svg,
            data: data
        });

        this.svgs._reset();

    }.bind(this));
};