object-format

0.0.9 • Public • Published

object-format

NPM

Return Formatted Text, and Values, from an Object.

Please use object-joinx instead.

var format = require('object-format');
// format(<object>, <format>, <separator>, <start index>, <values target>);
 
format({a: 'back', b: 'to'}, '%k = $%i', ' AND ', 1, val=[]);
// "a = $1 AND b = $2", val = ["back", "to"]
 
format({a: 'the', b: 'future'}, '%k = $%i', ' OR ', 1);
// "a = $1 OR b = $2"
 
format({a: 'in', b: '1985'}, "%k = '%v'", ' AND ');
// "a = 'in' AND b = '1985'"
 
format({a: 'to', b: '1955'}, "%k = '%v'");
// "a = 'to',b = '1955'"

Readme

Keywords

Package Sidebar

Install

npm i object-format

Weekly Downloads

3

Version

0.0.9

License

MIT

Last publish

Collaborators

  • wolfram77