Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
27
node_modules/cpsenize/.npmignore
generated
vendored
Normal file
27
node_modules/cpsenize/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
22
node_modules/cpsenize/LICENSE
generated
vendored
Normal file
22
node_modules/cpsenize/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Maurice Butler
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
21
node_modules/cpsenize/README.md
generated
vendored
Normal file
21
node_modules/cpsenize/README.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# cpsenize
|
||||
|
||||
Wraps synchronous functions with a cps (callback passing style) function
|
||||
|
||||
|
||||
``` javascript
|
||||
|
||||
var cpsenize = require('cpsenize');
|
||||
|
||||
function add(a, b){
|
||||
return a + b;
|
||||
}
|
||||
|
||||
var cpsAdd = cpsenize(add);
|
||||
|
||||
cpsAdd(5, 6, function(error, result){
|
||||
console.log(result); // 11
|
||||
});
|
||||
|
||||
|
||||
```
|
||||
21
node_modules/cpsenize/index.js
generated
vendored
Normal file
21
node_modules/cpsenize/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
function cpsenize(fn){
|
||||
return function(){
|
||||
var args = Array.prototype.slice.call(arguments),
|
||||
callback = args.pop(),
|
||||
context = this,
|
||||
result,
|
||||
error;
|
||||
|
||||
try {
|
||||
result = fn.apply(context, args);
|
||||
}
|
||||
catch(exception){
|
||||
error = exception;
|
||||
}
|
||||
|
||||
callback(error, result);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = cpsenize;
|
||||
62
node_modules/cpsenize/package.json
generated
vendored
Normal file
62
node_modules/cpsenize/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "cpsenize@^1.0.0",
|
||||
"_id": "cpsenize@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-duA1ISByaq9aqRYKS67l5nJ94NM=",
|
||||
"_location": "/cpsenize",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cpsenize@^1.0.0",
|
||||
"name": "cpsenize",
|
||||
"escapedName": "cpsenize",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/kgo"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cpsenize/-/cpsenize-1.0.0.tgz",
|
||||
"_shasum": "76e0352120726aaf5aa9160a4baee5e6727de0d3",
|
||||
"_spec": "cpsenize@^1.0.0",
|
||||
"_where": "D:\\dev\\xmap\\cm-oauth\\node_modules\\kgo",
|
||||
"author": {
|
||||
"name": "Maurice Butler",
|
||||
"email": "maurice.butler@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/MauriceButler/cpsenize/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Wraps synchronous functions with a cps (callback passing style) function",
|
||||
"homepage": "https://github.com/MauriceButler/cpsenize#readme",
|
||||
"keywords": [
|
||||
"callback",
|
||||
"passing",
|
||||
"style",
|
||||
"cb",
|
||||
"cps",
|
||||
"sync",
|
||||
"async",
|
||||
"wrap",
|
||||
"wrapper",
|
||||
"function",
|
||||
"method",
|
||||
"error",
|
||||
"catch"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "cpsenize",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MauriceButler/cpsenize.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node ./tests"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
67
node_modules/cpsenize/tests/index.js
generated
vendored
Normal file
67
node_modules/cpsenize/tests/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
var test = require('tape'),
|
||||
cpsenize = require('../');
|
||||
|
||||
function add(a, b, goBang){
|
||||
if(goBang){
|
||||
throw new Error('BANG!!!');
|
||||
}
|
||||
|
||||
var result = a + b;
|
||||
|
||||
if(this.c){
|
||||
result += this.c;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
test('works', function(t){
|
||||
t.plan(2);
|
||||
|
||||
var foo = cpsenize(add);
|
||||
|
||||
foo(5, 6, function(error, result){
|
||||
t.notOk(error, 'no error');
|
||||
t.equal(result, 11, 'correct result');
|
||||
});
|
||||
});
|
||||
|
||||
test('works with context', function(t){
|
||||
t.plan(2);
|
||||
|
||||
var foo = {
|
||||
add: cpsenize(add),
|
||||
c: 10
|
||||
};
|
||||
|
||||
foo.add(5, 6, function(error, result){
|
||||
t.notOk(error, 'no error');
|
||||
t.equal(result, 21, 'correct result');
|
||||
});
|
||||
});
|
||||
|
||||
test('works with context and bind', function(t){
|
||||
t.plan(2);
|
||||
|
||||
var foo = {
|
||||
add: cpsenize(add),
|
||||
c: 10
|
||||
};
|
||||
|
||||
foo.add.bind({c:20})(5, 6, function(error, result){
|
||||
t.notOk(error, 'no error');
|
||||
t.equal(result, 31, 'correct result');
|
||||
});
|
||||
});
|
||||
|
||||
test('errors', function(t){
|
||||
t.plan(3);
|
||||
|
||||
var foo = cpsenize(add);
|
||||
|
||||
foo(5, 6, true, function(error, result){
|
||||
t.ok(error instanceof Error, 'has error');
|
||||
t.equal(error.message, 'BANG!!!', 'correct error');
|
||||
t.notOk(result, 'no result');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user