Skip to content
This repository has been archived by the owner on Feb 6, 2018. It is now read-only.

Commit

Permalink
perf: use arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
blond committed Apr 14, 2016
1 parent f63519f commit 9f00044
Showing 1 changed file with 17 additions and 27 deletions.
44 changes: 17 additions & 27 deletions lib/walkers/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,24 @@ module.exports = function (info, add, callback) {
return callback(err);
}

files.forEach(processFile);
files.forEach(basename => {
const splited = basename.split('.');

// has tech
if (splited.length > 1) {
const entity = parseEntityName(splited.shift());

if (entity) {
add({
path: path.join(levelpath, basename),
entity: entity,
tech: splited.join('.'),
level: levelpath
});
}
}
});

callback();
});

/**
* Processes file.
*
* If file name is valid BEM entity with tech extention
* then will be called `add` with info about this file.
*
* @param {string} basename - the file name (the last portion of a path).
*/
function processFile (basename) {
const splited = basename.split('.');

// has tech
if (splited.length > 1) {
const entity = parseEntityName(splited.shift());

if (entity) {
add({
path: path.join(levelpath, basename),
entity: entity,
tech: splited.join('.'),
level: levelpath
});
}
}
}
};

0 comments on commit 9f00044

Please sign in to comment.