Convert BemCell to "nested & origin" path
Based on slow @bem/fs-scheme/lib/schemes/nested.js

@param {Object} dep
@param {String} tech
@param {String} layer
@return {String}
164051
function bemPath(dep, tech, layer) {
  const cell = {
    entity: {
      block: dep.block,
      elem: dep.elem || '',
      mod: dep.mod ? dep.mod : {},
    },
    layer: layer || '',
    tech: tech || '',
  };

  const folder = path.join(
    cell.layer,
    cell.entity.block,
    cell.entity.elem ? (bp_.delims.elem + cell.entity.elem) : '',
    cell.entity.mod.name ? (bp_.delims.mod.name + cell.entity.mod.name) : ''
  );

  return path.join(folder,
    b_(cell.entity) + (cell.tech ? '.' + cell.tech : ''));
}
259084
function _getLayerJson(layer, callback) {
    var url = null;
    if(layer.layers !== undefined || ((layer.kind || layer.type) !== undefined)) {
      // layer object contains the layer data
      _.defer(function() { callback(layer); });
      return;
    } else if(layer.table !== undefined && layer.user !== undefined) {
      // layer object points to cartodbjson
      url = cartodbUrl(layer);
    } else if(layer.indexOf) {
      // fetch from url
      url = layer;
    }
    if(url) {
      cdb.core.Loader.get(url, callback);
    } else {
      _.defer(function() { callback(null); });
    }
  }
612289
def layer(command=None, *args):
    ''
    if not command:
        return eval([['hint', 'layer']])  # fall back to buildin layer macro
    else:
        lst = [['layer']]
        for arg in args:
            lst.append([command, arg])
            lst.append(['layer'])
        return eval(lst)
542900
def force_include_layer(repository, digest, layer)
      unless File.exist? tmp_file(layer)
        logger.debug "Getting blob #{digest} to write to #{layer}"
        fullpath = "/v2/#{repository}/blobs/#{digest}"
        request = Resources::Registry::Proxy.get(fullpath)
        File.open(tmp_file(layer), 'wb', 0600) do |file|
          file.write request.body
        end
        logger.debug "Wrote blob #{digest} to #{layer}"
      end
    end
826306
public static Point parentToLayer(Layer parent, Layer layer, XY point, Point into) {
    into.set(point);
    Layer immediateParent = layer.parent();
    if (immediateParent != parent) parentToLayer(parent, immediateParent, into, into);
    parentToLayer(layer, into, into);
    return into;
  }
746676
function(filePath, baseURL, System) {
      // Convert file paths to module name by stripping the baseURL and the ".js" extension
      if (System.defaultJSExtensions) {
        filePath = filePath.replace(/\.js$/, '');
      }
      return filePath
        .replace(new RegExp('^' + baseURL.replace('/', '\/')), '');
    }
752775
def contracts_source_path_with_stem(stem):
    """"""
    return {
        'lib': _BASE.joinpath(stem, 'lib'),
        'raiden': _BASE.joinpath(stem, 'raiden'),
        'test': _BASE.joinpath(stem, 'test'),
        'services': _BASE.joinpath(stem, 'services'),
    }
1373597
def _layer_to_path_gen(layer):
    
    draw = False
    for x, y in zip(*layer):
        if np.isnan(x) or np.isnan(y):
            draw = False
        elif not draw:
            yield 'M {} {}'.format(x, y)
            draw = True
        else:
            yield 'L {} {}'.format(x, y)
611757
function (opts) {
        var layerName = opts.name,
            layer = null

        this.children.forEach(function (item) {
            if (item instanceof TMXLayer && item.layerName == layerName) {
                layer = item
            }
        })
        if (layer !== null) {
            return layer
        }
    }
1250916
function bemDirs(bemdeps) {
  const dirFilter = {};
  bemdeps.forEach((dep) => {
    const depPath = bemPath(dep);
    const depDir = path.dirname(depPath);
    dirFilter[depDir] = true;
  });

  return Object.keys(dirFilter);
}
16467
function(layer, callback) {
    layer = layer == undefined ? 0: layer;
    var self = this;
    this.getTiles(function(urls) {
      if(!urls) {
        callback(null);
        return;
      }
      if(callback) {
        callback(self._tileJSONfromTiles(layer, urls));
      }
    });
  }
964447
function transpileDerivedExchangeFiles (folder, pattern = '.js') {

    // exchanges.json accounts for ids included in exchanges.cfg
    const ids = require ('../exchanges.json').ids;

    const classNames = fs.readdirSync (folder)
        .filter (file => file.includes (pattern) && ids.includes (path.basename (file, pattern)))
        .map (file => transpileDerivedExchangeFile (folder, file))

    if (classNames.length === 0)
        return null

    let classes = {}
    classNames.forEach (({ className, baseClass }) => {
        classes[className] = baseClass
    })

    return classes
}
1268846
function (layer) {
		if (this.hasLayer(layer)) {
			return this;
		}

		layer.addEventParent(this);

		var id = L.stamp(layer);

		this._layers[id] = layer;

		if (this._map) {
			// Use the original map addLayer.
			this._map._originalAddLayer(layer);
		}

		return this.fire('layeradd', {layer: layer});
	}
330054
function(path, opts) {
        opts = opts || {};
        this.dir = PATH.resolve(path.path || path);
        this.projectRoot = opts.projectRoot || PATH.resolve('');

        // NOTE: keep this.path for backwards compatibility
        this.path = this.bemDir = PATH.join(this.dir, '.bem');

        path = PATH.relative(this.projectRoot, this.dir);
        this.cache = useCache;
        for(var e in exceptLevels) {
            var except = exceptLevels[e];
            if (path.substr(0, except.length) === except) {
                this.cache = !this.cache;
                break;
            }
        }

        // NOTE: tech modules cache
        this._techsCache = {};
    }
1155538
function() {
        this.log('bem.decl.%s(%s)', this.cmd, JSON.stringify(this.decls));

        return BEM.decl[this.cmd]({
            output: this.getPath(),
            declaration: this.decls.map(function(d) {
                return PATH.resolve(this.root, d);
            }, this)
        });
    }
1110023
function convertMatches(files, options, dest) {
    return files.map(function(source) {
      return {
        src: source,
        dest: path.join(
          // Build a destination from the new source if no dest
          // was specified
          dest != null ? dest : path.dirname(source).replace(options.srcPrefix + sep, ''),
          path.basename(source)
        )
      }
    })
  }
695702
function bemDeclLoader(source) {
  // this.cacheable(false);
  const callback = this.async();

  // Prepare options
  const options = {
    levels: [],
  };
  Object.assign(options, loaderUtils.getOptions(this));

  // Load deps
  const self = this;
  bemDeps.load({levels: options.levels}).then((relations) => {
    // Sort relations to have deterministic result
    relations = relations.map((item) => {
      return [JSON.stringify(item), item];
    }).sort(function(a, b) {
      return a===b ? 0 : a[0] > b[0] ? 1 : -1;
    }).map((mapped) => {
      return mapped[1];
    });

    const bemDecl = nodeEval(source);

    // Resolve deps
    return bemDeps.resolve(bemDecl, relations).entities;
  }).then((bemDeps) => {
    // Mark dependecies
    depsForDeps(bemDeps, options.levels).then((dirs) => {
      dirs.forEach((dirName) => {
        self.addContextDependency(dirName);
      });

      callback(null, 'module.exports = ' + JSON.stringify(bemDeps) + ';');
    }).catch(callback);
  }).catch(callback);
}