0.0.0 • Published 5 years ago

key-value-join v0.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

key-value-join npm.io npm.io

⛓ 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

ArgumentTypeDefaultPurpose
0ObjectN/AThe object to convert
1String:Key-value delimiter
2String,List items delimiter
3Function()=>trueFunction 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');