added unit testing, and started implementing unit tests...phew
This commit is contained in:
21
node_modules/simple-swizzle/LICENSE
generated
vendored
Normal file
21
node_modules/simple-swizzle/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Josh Junon
|
||||
|
||||
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.
|
39
node_modules/simple-swizzle/README.md
generated
vendored
Normal file
39
node_modules/simple-swizzle/README.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# simple-swizzle [](https://travis-ci.org/Qix-/node-simple-swizzle) [](https://coveralls.io/r/Qix-/node-simple-swizzle)
|
||||
|
||||
> [Swizzle](https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)) your function arguments; pass in mixed arrays/values and get a clean array
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var swizzle = require('simple-swizzle');
|
||||
|
||||
function myFunc() {
|
||||
var args = swizzle(arguments);
|
||||
// ...
|
||||
return args;
|
||||
}
|
||||
|
||||
myFunc(1, [2, 3], 4); // [1, 2, 3, 4]
|
||||
myFunc(1, 2, 3, 4); // [1, 2, 3, 4]
|
||||
myFunc([1, 2, 3, 4]); // [1, 2, 3, 4]
|
||||
```
|
||||
|
||||
Functions can also be wrapped to automatically swizzle arguments and be passed
|
||||
the resulting array.
|
||||
|
||||
```js
|
||||
var swizzle = require('simple-swizzle');
|
||||
|
||||
var swizzledFn = swizzle.wrap(function (args) {
|
||||
// ...
|
||||
return args;
|
||||
});
|
||||
|
||||
swizzledFn(1, [2, 3], 4); // [1, 2, 3, 4]
|
||||
swizzledFn(1, 2, 3, 4); // [1, 2, 3, 4]
|
||||
swizzledFn([1, 2, 3, 4]); // [1, 2, 3, 4]
|
||||
```
|
||||
|
||||
## License
|
||||
Licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
You can find a copy of it in [LICENSE](LICENSE).
|
29
node_modules/simple-swizzle/index.js
generated
vendored
Normal file
29
node_modules/simple-swizzle/index.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var isArrayish = require('is-arrayish');
|
||||
|
||||
var concat = Array.prototype.concat;
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
var swizzle = module.exports = function swizzle(args) {
|
||||
var results = [];
|
||||
|
||||
for (var i = 0, len = args.length; i < len; i++) {
|
||||
var arg = args[i];
|
||||
|
||||
if (isArrayish(arg)) {
|
||||
// http://jsperf.com/javascript-array-concat-vs-push/98
|
||||
results = concat.call(results, slice.call(arg));
|
||||
} else {
|
||||
results.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
swizzle.wrap = function (fn) {
|
||||
return function () {
|
||||
return fn(swizzle(arguments));
|
||||
};
|
||||
};
|
71
node_modules/simple-swizzle/package.json
generated
vendored
Normal file
71
node_modules/simple-swizzle/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "simple-swizzle@^0.2.2",
|
||||
"_id": "simple-swizzle@0.2.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
|
||||
"_location": "/simple-swizzle",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "simple-swizzle@^0.2.2",
|
||||
"name": "simple-swizzle",
|
||||
"escapedName": "simple-swizzle",
|
||||
"rawSpec": "^0.2.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.2.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/color-string"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
|
||||
"_shasum": "a4da6b635ffcccca33f70d17cb92592de95e557a",
|
||||
"_spec": "simple-swizzle@^0.2.2",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/color-string",
|
||||
"author": {
|
||||
"name": "Qix",
|
||||
"url": "http://github.com/qix-"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/qix-/node-simple-swizzle/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"is-arrayish": "^0.3.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Simply swizzle your arguments",
|
||||
"devDependencies": {
|
||||
"coffee-script": "^1.9.3",
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "^0.3.17",
|
||||
"mocha": "^2.2.5",
|
||||
"should": "^7.0.1",
|
||||
"xo": "^0.7.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/qix-/node-simple-swizzle#readme",
|
||||
"keywords": [
|
||||
"argument",
|
||||
"arguments",
|
||||
"swizzle",
|
||||
"swizzling",
|
||||
"parameter",
|
||||
"parameters",
|
||||
"mixed",
|
||||
"array"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "simple-swizzle",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/qix-/node-simple-swizzle.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "mocha --compilers coffee:coffee-script/register"
|
||||
},
|
||||
"version": "0.2.2"
|
||||
}
|
Reference in New Issue
Block a user