Socket
Socket
Sign inDemoInstall

simple-swizzle

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    simple-swizzle

Simply swizzle your arguments


Version published
Weekly downloads
15M
increased by1.31%
Maintainers
1
Install size
58.9 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 16 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc