lib/level.js
function(path) {
        if (PATH.isAbsolute(path)) path = PATH.relative(this.dir, path);

        var matchTechs = this.matchTechsOrder().map(function(t) {
                return this.getTech(t);
            }, this);

        return this.matchOrder().reduce(function(match, matcher) {

            // Skip if already matched
            if (match) return match;

            // Try matcher
            match = this.match(matcher, path);

            // Skip if not matched
            if (!match) return false;

            // Try to match for tech
            match.tech = matchTechs.reduce(function(tech, t) {
                if (tech || !t.matchSuffix(match.suffix)) return tech;
                return t.getTechName();
            }, match.tech);

            return match;

        }.bind(this), false);
    }
function(path) {
        if (PATH.isAbsolute(path)) path = PATH.relative(this.dir, path);

        var matchTechs = this.matchTechsOrder().map(function(t) {
                return this.getTech(t);
            }, this);

        return this.matchOrder().reduce(function(match, matcher) {

            // Skip if already matched
            if (match) return match;

            // Try matcher
            match = this.match(matcher, path);

            // Skip if not matched
            if (!match) return false;

            // Try to match for tech
            match.tech = matchTechs.reduce(function(tech, t) {
                if (tech || !t.matchSuffix(match.suffix)) return tech;
                return t.getTechName();
            }, match.tech);

            return match;

        }.bind(this), false);
    }
function ( path ) { if ( PATH . isAbsolute ( path ) ) path = PATH . relative ( this . dir , path ) ; var matchTechs = this . matchTechsOrder ( ) . map ( function ( t ) { return this . getTech ( t ) ; } , this ) ; return this . matchOrder ( ) . reduce ( function ( match , matcher ) { // Skip if already matched if ( match ) return match ; // Try matcher match = this . match ( matcher , path ) ; // Skip if not matched if ( ! match ) return false ; // Try to match for tech match . tech = matchTechs . reduce ( function ( tech , t ) { if ( tech || ! t . matchSuffix ( match . suffix ) ) return tech ; return t . getTechName ( ) ; } , match . tech ) ; return match ; } . bind ( this ) , false ) ; }
Match path against all matchers and return first match.

Match object will contain `block`, `suffix` and `tech` fields
and can also contain any of the `elem`, `mod` and `val` fields
or all of them.

@param {String} path  Path to match (absolute or relative).
@return {Boolean|Object}  BEM entity object in case of positive match and false otherwise.
Match path against all matchers and return first match .