diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..973d098 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +es6 diff --git a/and.js b/and.js index 8fbd379..accdf5f 100644 --- a/and.js +++ b/and.js @@ -1,3 +1,5 @@ +"use strict"; + /** * @module 101/and */ @@ -9,8 +11,6 @@ * @param {*} b - any value * @return {*} a && b */ -module.exports = and; - -function and (a, b) { +module.exports = function (a, b) { return a && b; -} +}; \ No newline at end of file diff --git a/es6/and.es6 b/es6/and.es6 new file mode 100644 index 0000000..3cb718a --- /dev/null +++ b/es6/and.es6 @@ -0,0 +1,12 @@ +/** + * @module 101/and + */ + +/** + * Functional version of && + * @function module:101/and + * @param {*} a - any value + * @param {*} b - any value + * @return {*} a && b + */ +export default (a, b) => a && b; diff --git a/es6/or.es6 b/es6/or.es6 new file mode 100644 index 0000000..d064a2a --- /dev/null +++ b/es6/or.es6 @@ -0,0 +1,13 @@ +/** + * @module 101/or + */ + +/** + * Functional version of || + * @function module:101/or + * @param {*} a - any value + * @param {*} b - any value + * @return {*} a || b + */ + +export default (a, b) => a || b; diff --git a/or.js b/or.js index c7b85db..ae7c1bd 100644 --- a/or.js +++ b/or.js @@ -1,3 +1,5 @@ +"use strict"; + /** * @module 101/or */ @@ -10,8 +12,6 @@ * @return {*} a || b */ -module.exports = or; - -function or (a, b) { +module.exports = function (a, b) { return a || b; -} +}; \ No newline at end of file diff --git a/package.json b/package.json index 6e85cb1..d239763 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,9 @@ "description": "common javascript utils that can be required selectively that assume es5+", "main": "index.js", "scripts": { - "test": "lab -c -t 100 test", - "test-watch": "nodemon --exec lab -c test" + "test": "npm run-script to5; lab -c -t 100 test", + "test-watch": "npm run-script to5; nodemon --exec lab -c test", + "to5": "babel es6/*.es6 --out-dir ./; mv es6/*.js ./" }, "repository": { "type": "git", @@ -30,6 +31,7 @@ }, "homepage": "https://github.com/tjmehta/101", "devDependencies": { + "babel": "^4.0.1", "coveralls": "^2.11.2", "lab": "^4.6.2" },