simple-swizzle

Simply swizzle your arguments

fixed incorrect string handling in 0.2.1
Last updated 9 years ago by qix .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install simple-swizzle 
SYNC missed versions from official npm registry.

simple-swizzle Travis-CI.org Build Status Coveralls.io Coverage Rating

Swizzle your function arguments; pass in mixed arrays/values and get a clean array

Usage

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.

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. You can find a copy of it in LICENSE.

Current Tags

  • 0.2.2                                ...           latest (8 years ago)

4 Versions

  • 0.2.2                                ...           8 years ago
  • 0.2.1                                ...           9 years ago
  • 0.2.0 [deprecated]           ...           9 years ago
  • 0.1.0 [deprecated]           ...           9 years ago
Maintainers (2)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |