quick-format-unescaped
Advanced tools
Comparing version 3.0.0 to 3.0.1
15
index.js
@@ -55,3 +55,4 @@ 'use strict' | ||
str += '\'' + args[a] + '\'' | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
@@ -61,7 +62,9 @@ } | ||
str += args[a].name || '<anonymous>' | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
} | ||
str += ss(args[a]) | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
@@ -74,3 +77,4 @@ case 115: // 's' | ||
str += String(args[a]) | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
@@ -81,3 +85,4 @@ case 37: // '%' | ||
str += '%' | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
@@ -84,0 +89,0 @@ } |
{ | ||
"name": "quick-format-unescaped", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Solves a problem with util.format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,10 +11,18 @@ # quick-format-unescaped | ||
```js | ||
var format = require('quick-format') | ||
format('hello %s %j %d', 'world', [{obj: true}, 4, {another: 'obj'}]) | ||
var format = require('quick-format-unescaped') | ||
format('hello %s %j %d', ['world', [{obj: true}, 4, {another: 'obj'}]]) | ||
``` | ||
## options | ||
## format(fmt, parameters, [options]) | ||
### stringify | ||
### fmt | ||
A `printf`-like format string. Example: `'hello %s %j %d'` | ||
### parameters | ||
Array of values to be inserted into the `format` string. Example: `['world', {obj:true}]` | ||
### options.stringify | ||
Passing an options object as the third parameter with a `stringify` will mean | ||
@@ -21,0 +29,0 @@ any objects will be passed to the supplied function instead of an the |
@@ -27,34 +27,39 @@ 'use strict'; | ||
// assert.equal(format(['%d', 42.0]), '42'); | ||
// assert.equal(format(['%d', 42]), '42'); | ||
// assert.equal(format(['%s', 42]), '42'); | ||
// assert.equal(format(['%j', 42]), '42'); | ||
assert.equal(format('%d', [42.0]), '42'); | ||
assert.equal(format('%d', [42]), '42'); | ||
assert.equal(format('%s', [42]), '42'); | ||
assert.equal(format('%j', [42]), '42'); | ||
assert.equal(format(['%d', undefined]), '%d'); | ||
assert.equal(format(['%s', undefined]), 'undefined'); | ||
assert.equal(format(['%j', undefined]), '%j'); | ||
assert.equal(format('%d', [undefined]), '%d'); | ||
assert.equal(format('%s', [undefined]), 'undefined'); | ||
assert.equal(format('%j', [undefined]), '%j'); | ||
assert.equal(format(['%d', null]), '%d'); | ||
assert.equal(format(['%s', null]), 'null'); | ||
assert.equal(format(['%j', null]), 'null'); | ||
assert.equal(format('%d', [null]), '%d'); | ||
assert.equal(format('%s', [null]), 'null'); | ||
assert.equal(format('%j', [null]), 'null'); | ||
// assert.equal(format(['%d', '42.0']), '42'); | ||
// assert.equal(format(['%d', '42']), '42'); | ||
// assert.equal(format(['%s', '42']), '42'); | ||
// assert.equal(format(['%j', '42']), '"42"'); | ||
assert.equal(format('%d', ['42.0']), '42'); | ||
assert.equal(format('%d', ['42']), '42'); | ||
assert.equal(format('%s', ['42']), '42'); | ||
// assert.equal(format('%j', ['42']), '"42"'); | ||
// assert.equal(format(['%%s%s', 'foo']), '%sfoo'); | ||
// assert.equal(format('%%s%s', ['foo']), '%sfoo'); | ||
// assert.equal(format(['%s']), '%s'); | ||
// assert.equal(format(['%s', undefined]), 'undefined'); | ||
// assert.equal(format(['%s', 'foo']), 'foo'); | ||
assert.equal(format(['%s', '\"quoted\"']), '\"quoted\"'); | ||
assert.equal(format(['%j', { s: '\"quoted\"' }]), '{\"s\":\"\\"quoted\\"\"}'); | ||
// assert.equal(format(['%s:%s']), '%s:%s'); | ||
// assert.equal(format(['%s:%s', undefined]), 'undefined:%s'); | ||
// assert.equal(format(['%s:%s', 'foo']), 'foo:%s'); | ||
// assert.equal(format(['%s:%s', 'foo', 'bar']), 'foo:bar'); | ||
// assert.equal(format(['%s:%s', 'foo', 'bar', 'baz']), 'foo:bar baz'); | ||
assert.equal(format('%s', []), '%s'); | ||
assert.equal(format('%s', [undefined]), 'undefined'); | ||
assert.equal(format('%s', ['foo']), 'foo'); | ||
assert.equal(format('%s', ['\"quoted\"']), '\"quoted\"'); | ||
assert.equal(format('%j', [{ s: '\"quoted\"' }]), '{\"s\":\"\\"quoted\\"\"}'); | ||
assert.equal(format('%s:%s', []), '%s:%s'); | ||
assert.equal(format('%s:%s', [undefined]), 'undefined:%s'); | ||
assert.equal(format('%s:%s', ['foo']), 'foo:%s'); | ||
assert.equal(format('%s:%s', ['foo', 'bar']), 'foo:bar'); | ||
assert.equal(format('%s:%s', ['foo', 'bar', 'baz']), 'foo:bar baz'); | ||
assert.equal(format('%s%s', []), '%s%s'); | ||
assert.equal(format('%s%s', [undefined]), 'undefined%s'); | ||
assert.equal(format('%s%s', ['foo']), 'foo%s'); | ||
assert.equal(format('%s%s', ['foo', 'bar']), 'foobar'); | ||
assert.equal(format('%s%s', ['foo', 'bar', 'baz']), 'foobar baz'); | ||
// // assert.equal(format(['%%%s%%', 'hi']), '%hi%'); | ||
@@ -61,0 +66,0 @@ // // assert.equal(format(['%%%s%%%%', 'hi']), '%hi%%'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9229
7
182
67