Need private packages and team management tools?Check out npm Teams »

key-value-join

0.0.0 • Public • Published

key-value-join

⛓ Join object entries to create a string representation

const join = require('key-value-join');
 
join({a: 1, b: 2}; // a:1,b:2
 
join({a: 1, b: 2}, '=', '&'); // a=1&b=2
 
join({a: 1, b: 2, c: undefined, d: false}, '=', '&', ([key, value]) => !!value); // a=1&b=2

Arguments

Argument Type Default Purpose
0 Object N/A The object to convert
1 String : Key-value delimiter
2 String , List items delimiter
3 Function ()=>true Function to filter object entries †

† Filter function receives one array containing [key, value]

const filter = ([key, value]) => Boolean(value)

Transpiled version

Environments which exclude node_modules from the transpiling pipeline should include the "browser" entry instead of "main". This exposes an ES5 commonjs module.

Also available for explicit import:

const join = require('join/dist');

Install

npm i key-value-join

DownloadsWeekly Downloads

0

Version

0.0.0

License

MIT

Unpacked Size

3.09 kB

Total Files

4

Last publish

Collaborators

  • avatar