New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
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
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created

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

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