lib/level.js
function(opts) {

        var level = this;

        if (!opts) opts = {
            opts: false
        };

        // clone opts
        opts = bemUtil.extend({}, opts);

        // set default options
        opts.from || (opts.from = '.');

        // initial value initializer
        opts.init || (opts.init = function() {
            return [];
        });

        // paths filter function
        opts.filter || (opts.filter = function(path) {
            return !this.isIgnorablePath(path);
        });

        // matcher function
        opts.matcher || (opts.matcher = function(path) {
            return this.matchAny(path);
        });

        // result creator function
        opts.creator || (opts.creator = function(res, match) {
            if (match && match.tech) res.push(match);
            return res;
        });

        /**
         * Introspection function.
         *
         * @param {String} [from]  Relative path to subdirectory of level directory to start introspection from.
         * @param {*} [res]  Initial introspection value to extend.
         * @return {*}
         */
        return function(from, res) {

            if (opts.opts === false) {
                level.scanFiles();
                return level.files.blocks;
            }

            from = PATH.resolve(level.dir, from || opts.from);
            res || (res = opts.init.call(level));

            bemUtil.fsWalkTree(from, function(path) {
                    res = opts.creator.call(level, res, opts.matcher.call(level, path));
                },
                opts.filter,
                level);

            return res;

        };

    }
function(opts) {

        var level = this;

        if (!opts) opts = {
            opts: false
        };

        // clone opts
        opts = bemUtil.extend({}, opts);

        // set default options
        opts.from || (opts.from = '.');

        // initial value initializer
        opts.init || (opts.init = function() {
            return [];
        });

        // paths filter function
        opts.filter || (opts.filter = function(path) {
            return !this.isIgnorablePath(path);
        });

        // matcher function
        opts.matcher || (opts.matcher = function(path) {
            return this.matchAny(path);
        });

        // result creator function
        opts.creator || (opts.creator = function(res, match) {
            if (match && match.tech) res.push(match);
            return res;
        });

        /**
         * Introspection function.
         *
         * @param {String} [from]  Relative path to subdirectory of level directory to start introspection from.
         * @param {*} [res]  Initial introspection value to extend.
         * @return {*}
         */
        return function(from, res) {

            if (opts.opts === false) {
                level.scanFiles();
                return level.files.blocks;
            }

            from = PATH.resolve(level.dir, from || opts.from);
            res || (res = opts.init.call(level));

            bemUtil.fsWalkTree(from, function(path) {
                    res = opts.creator.call(level, res, opts.matcher.call(level, path));
                },
                opts.filter,
                level);

            return res;

        };

    }
function ( opts ) { var level = this ; if ( ! opts ) opts = { opts : false } ; // clone opts opts = bemUtil . extend ( { } , opts ) ; // set default options opts . from || ( opts . from = '.' ) ; // initial value initializer opts . init || ( opts . init = function ( ) { return [ ] ; } ) ; // paths filter function opts . filter || ( opts . filter = function ( path ) { return ! this . isIgnorablePath ( path ) ; } ) ; // matcher function opts . matcher || ( opts . matcher = function ( path ) { return this . matchAny ( path ) ; } ) ; // result creator function opts . creator || ( opts . creator = function ( res , match ) { if ( match && match . tech ) res . push ( match ) ; return res ; } ) ; /**
         * Introspection function.
         *
         * @param {String} [from]  Relative path to subdirectory of level directory to start introspection from.
         * @param {*} [res]  Initial introspection value to extend.
         * @return {*}
         */ return function ( from , res ) { if ( opts . opts === false ) { level . scanFiles ( ) ; return level . files . blocks ; } from = PATH . resolve ( level . dir , from || opts . from ) ; res || ( res = opts . init . call ( level ) ) ; bemUtil . fsWalkTree ( from , function ( path ) { res = opts . creator . call ( level , res , opts . matcher . call ( level , path ) ) ; } , opts . filter , level ) ; return res ; } ; }
Creates preconfigured introspection functions.

@param {Object} [opts]  Introspector options.
@param {String} [opts.from]  Relative path to subdirectory of level directory to start introspection from.
@param {Function} [opts.init]  Function to return initial value of introspection.
@param {Function} [opts.filter]  Function to filter paths to introspect, must return {Boolean}.
@param {Function} [opts.matcher]  Function to perform match of paths, must return introspected value.
@param {Function} [opts.creator]  Function to modify introspection object with matched value, must return new introspection.
@return {Function}  Introspection function.
Creates preconfigured introspection functions .