🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

anyorder

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anyorder

Call function with any order of arguments

2.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

Anyorder

Call function with any order of arguments.

What for?

Anyorder could be used when order of parameters need to be other then it is. It's not very common situation, but sometimes it could be useful. For example to avoid boolean trap in addEventListener.

How to use?

In node.js:

const anyorder = require('anyorder');
const fs = require('fs');
const read = anyorder('function, string', fs.readFile);

read((error, data) => {
    console.log(error || data)
}, 'README.md');

In browser:

const addListener = window.addEventListener.bind(window);
const add = anyorder('string, function, boolean', addListener);

add('load', true, (event) => {
    console.log(event);
});

Environments

In old node.js environments that supports es5 only, anyorder could be used with:

var anyorder = require('anyorder/legacy');

License

MIT

Keywords

arguments

FAQs

Package last updated on 20 Feb 2018

Did you know?

Socket

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