Sha256: ebb345ff1b07f7e338f040713e44e7d5f627112f12bd7ccde3b8bd7f1f136524

Contents?: true

Size: 598 Bytes

Versions: 28

Compression:

Stored size: 598 Bytes

Contents

var generate = require('css-tree').generate;

function Index() {
    this.seed = 0;
    this.map = Object.create(null);
}

Index.prototype.resolve = function(str) {
    var index = this.map[str];

    if (!index) {
        index = ++this.seed;
        this.map[str] = index;
    }

    return index;
};

module.exports = function createDeclarationIndexer() {
    var ids = new Index();

    return function markDeclaration(node) {
        var id = generate(node);

        node.id = ids.resolve(id);
        node.length = id.length;
        node.fingerprint = null;

        return node;
    };
};

Version data entries

28 entries across 27 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.18.0 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.18.2 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.16.1 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.15.2 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.18.4 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.18.1 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.14.0 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
tang-0.2.1 spec/tang_app/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
tang-0.2.0 spec/tang_app/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
tang-0.1.0 spec/tang_app/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
tang-0.0.9 spec/tang_app/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
enju_library-0.3.8 spec/dummy/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
jester-data-8.0.0 node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js