From a6a9fe86c77db3c07a739ee1abb56011e9c52947 Mon Sep 17 00:00:00 2001 From: Manish Jain Date: Wed, 26 Apr 2017 12:01:02 +0530 Subject: [PATCH] Wed, Apr 26, 2017 12:01:02 PM --- javascript-concept-practice/index.html | 3 +- .../JavaScript-currying-functions.js | 29 ++++++++++++++ npm-debug.log | 40 ------------------- 3 files changed, 31 insertions(+), 41 deletions(-) create mode 100644 javascript-concept-practice/javascript-advance/JavaScript-currying-functions.js delete mode 100644 npm-debug.log diff --git a/javascript-concept-practice/index.html b/javascript-concept-practice/index.html index a420d82..1266aef 100644 --- a/javascript-concept-practice/index.html +++ b/javascript-concept-practice/index.html @@ -12,6 +12,7 @@ - + + \ No newline at end of file diff --git a/javascript-concept-practice/javascript-advance/JavaScript-currying-functions.js b/javascript-concept-practice/javascript-advance/JavaScript-currying-functions.js new file mode 100644 index 0000000..f270971 --- /dev/null +++ b/javascript-concept-practice/javascript-advance/JavaScript-currying-functions.js @@ -0,0 +1,29 @@ +'use strict' + +var avg = function(...n){ + let tot = 0; + for(let i = 0 ; i < n.length ; i++){ + tot += n[i] + } + + return tot/n.length; +} + +var spiceUp = function(fn,...n){ + return function(...m){ + return fn.apply(this,n.concat(m)); + };; +} + +var doAvg = spiceUp(avg,1,2,3); +console.log(doAvg(4,5,6)); + +var sayWhat = function(a){ + return function(b){ + return function(c){ + console.log('saying ',a,' to ',b,' using ',c); + } + } +} + +sayWhat('hello')('toFriends')('javaScript') \ No newline at end of file diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index 9e4351b..0000000 --- a/npm-debug.log +++ /dev/null @@ -1,40 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', -1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', -1 verbose cli 'start', -1 verbose cli 'run' ] -2 info using npm@2.14.7 -3 info using node@v4.2.2 -4 verbose run-script [ 'prestart', 'start', 'poststart' ] -5 info prestart javascript-web-application@0.0.0 -6 info start javascript-web-application@0.0.0 -7 verbose unsafe-perm in lifecycle true -8 info javascript-web-application@0.0.0 Failed to exec start script -9 verbose stack Error: javascript-web-application@0.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" "run"` -9 verbose stack Exit status 1 -9 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16) -9 verbose stack at emitTwo (events.js:87:13) -9 verbose stack at EventEmitter.emit (events.js:172:7) -9 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14) -9 verbose stack at emitTwo (events.js:87:13) -9 verbose stack at ChildProcess.emit (events.js:172:7) -9 verbose stack at maybeClose (internal/child_process.js:818:16) -9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) -10 verbose pkgid javascript-web-application@0.0.0 -11 verbose cwd D:\Javascript-concepts -12 error Windows_NT 6.3.9600 -13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" "run" -14 error node v4.2.2 -15 error npm v2.14.7 -16 error code ELIFECYCLE -17 error javascript-web-application@0.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" "run"` -17 error Exit status 1 -18 error Failed at the javascript-web-application@0.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" "run"'. -18 error This is most likely a problem with the javascript-web-application package, -18 error not with npm itself. -18 error Tell the author that this fails on your system: -18 error tsc && concurrently "npm run tsc:w" "npm run lite" "run" -18 error You can get their info via: -18 error npm owner ls javascript-web-application -18 error There is likely additional logging output above. -19 verbose exit [ 1, true ]