CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
1# quick-format-unescaped2 3## unescaped ?4 5Sometimes you want to embed the results of quick-format into another string, 6and then escape the whole string. 7 8## usage9 10```js11var format = require('quick-format-unescaped')12format('hello %s %j %d', ['world', [{obj: true}, 4, {another: 'obj'}]])13```14 15## format(fmt, parameters, [options])16 17### fmt18 19A `printf`-like format string. Example: `'hello %s %j %d'`20 21### parameters22 23Array of values to be inserted into the `format` string. Example: `['world', {obj:true}]`24 25### options.stringify26 27Passing an options object as the third parameter with a `stringify` will mean 28any objects will be passed to the supplied function instead of an the 29internal `tryStringify` function. This can be useful when using augmented30capability serializers such as [`fast-safe-stringify`](http://github.com/davidmarkclements/fast-safe-stringify) or [`fast-redact`](http://github.com/davidmarkclements/fast-redact).  31 32## caveats33 34By default `quick-format-unescaped` uses  `JSON.stringify` instead of `util.inspect`, this means functions *will not be serialized*.35 36## Benchmarks37 38### Node 8.11.239 40```41util*100000: 350.325ms42quick*100000: 268.141ms43utilWithTailObj*100000: 586.387ms44quickWithTailObj*100000: 280.200ms45util*100000: 325.735ms46quick*100000: 270.251ms47utilWithTailObj*100000: 492.270ms48quickWithTailObj*100000: 261.797ms49```50 51### Node 10.4.052 53```54util*100000: 301.035ms55quick*100000: 217.005ms56utilWithTailObj*100000: 404.778ms57quickWithTailObj*100000: 236.176ms58util*100000: 286.349ms59quick*100000: 214.646ms60utilWithTailObj*100000: 388.574ms61quickWithTailObj*100000: 226.036ms62```63 64## Acknowledgements65 66Sponsored by [nearForm](http://www.nearform.com)67