-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e50595b
commit 41c9616
Showing
13 changed files
with
106 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": "airbnb-base", | ||
"env": { | ||
"mocha": true, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"arrowFunctions": true | ||
} | ||
}, | ||
"rules": { | ||
"no-extend-native": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
const _ = require('lodash'); | ||
|
||
const doesObjectPropertyExists = (object, path) => { | ||
const values = [undefined, null, ''] | ||
if (values.indexOf(_.get(object, path)) > -1 ) return false; | ||
return true | ||
const values = [undefined, null, '']; | ||
if (values.indexOf(_.get(object, path)) > -1) return false; | ||
return true; | ||
}; | ||
|
||
module.exports = doesObjectPropertyExists; | ||
module.exports = doesObjectPropertyExists; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
const doesPropertyExists = require('./doesPropertyExists'); | ||
|
||
module.exports = doesPropertyExists; | ||
module.exports = doesPropertyExists; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const getDirectories = (srcpath) => { | ||
return fs | ||
.readdirSync(srcpath) | ||
.filter(file => fs.lstatSync(path.join(srcpath, file)).isDirectory()) | ||
}; | ||
const getDirectories = srcpath => fs | ||
.readdirSync(srcpath) | ||
.filter(file => fs.lstatSync(path.join(srcpath, file)).isDirectory()); | ||
|
||
module.exports = getDirectories; | ||
module.exports = getDirectories; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
require('should'); | ||
const mkdirp = require('mkdirp'); | ||
const rmdir = require('rmdir'); | ||
const log = require('../logger'); | ||
const async = require('async'); | ||
const getDirectories = require('./getDirectories'); | ||
|
||
|
||
describe('Get Directoriess', () => { | ||
before((done) => { | ||
async.series([ | ||
(callback) => { | ||
mkdirp('./tmp/test1', callback); | ||
}, | ||
(callback) => { | ||
mkdirp('./tmp/test2', callback); | ||
} | ||
], done); | ||
|
||
}); | ||
before((done) => { | ||
async.series([ | ||
(callback) => { | ||
mkdirp('./tmp/test1', callback); | ||
}, | ||
(callback) => { | ||
mkdirp('./tmp/test2', callback); | ||
}, | ||
], done); | ||
}); | ||
|
||
it('Should get all the directories', (done) => { | ||
const directories = getDirectories('tmp'); | ||
directories.length.should.be.exactly(2); | ||
directories[0].should.be.exactly('test1'); | ||
directories[1].should.be.exactly('test2'); | ||
done(); | ||
}); | ||
it('Should get all the directories', (done) => { | ||
const directories = getDirectories('tmp'); | ||
directories.length.should.be.exactly(2); | ||
directories[0].should.be.exactly('test1'); | ||
directories[1].should.be.exactly('test2'); | ||
done(); | ||
}); | ||
|
||
after((done) => { | ||
rmdir('./tmp', done); | ||
}); | ||
|
||
}); | ||
after((done) => { | ||
rmdir('./tmp', done); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./getDirectories'); | ||
module.exports = require('./getDirectories'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
const requireDoesPropertyExists = require('./doesPropertyExists'); | ||
const requireGetDirectories = require('./getDirectories'); | ||
const requireLogger = require('./logger'); | ||
const requireNormalize = require('./normalize'); | ||
|
||
const sroUtils = { | ||
doesPropertyExists: require('./doesPropertyExists'), | ||
getDirectories: require('./getDirectories'), | ||
logger: require('./logger'), | ||
normalize: require('./normalize'), | ||
doesPropertyExists: requireDoesPropertyExists, | ||
getDirectories: requireGetDirectories, | ||
logger: requireLogger, | ||
normalize: requireNormalize, | ||
}; | ||
|
||
module.exports = sroUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./logger.js'); | ||
module.exports = require('./logger.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
const bunyan = require('bunyan'); | ||
const bformat = require('bunyan-format'); | ||
|
||
const logger = (moduleName) => bunyan.createLogger({ | ||
name: moduleName, | ||
level: 'debug' | ||
const logger = moduleName => bunyan.createLogger({ | ||
name: moduleName, | ||
level: 'debug', | ||
}); | ||
|
||
module.exports = logger; | ||
module.exports = logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./normalize'); | ||
module.exports = require('./normalize'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
String.prototype.normalize = function() { | ||
return this.split(/\W+/g).join('_'); | ||
}; | ||
String.prototype.normalize = function normalize() { | ||
return this.split(/\W+/g).join('_'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters