quick-format-unescaped
Advanced tools
Comparing version 4.0.3 to 4.0.4
12
index.js
@@ -38,7 +38,8 @@ 'use strict' | ||
break | ||
if (args[a] == null) break | ||
if (lastPos < i) | ||
str += f.slice(lastPos, i) | ||
if (args[a] == null) break | ||
str += Number(args[a]) | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
@@ -48,7 +49,8 @@ case 105: // 'i' | ||
break | ||
if (args[a] == null) break | ||
if (lastPos < i) | ||
str += f.slice(lastPos, i) | ||
if (args[a] == null) break | ||
str += Math.floor(Number(args[a])) | ||
lastPos = i = i + 2 | ||
lastPos = i + 2 | ||
i++ | ||
break | ||
@@ -60,5 +62,5 @@ case 79: // 'O' | ||
break | ||
if (args[a] === undefined) break | ||
if (lastPos < i) | ||
str += f.slice(lastPos, i) | ||
if (args[a] === undefined) break | ||
var type = typeof args[a] | ||
@@ -65,0 +67,0 @@ if (type === 'string') { |
{ | ||
"name": "quick-format-unescaped", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "Solves a problem with util.format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -110,1 +110,28 @@ 'use strict'; | ||
assert.equal(format('foo %% %s', ['bar']), 'foo % bar') | ||
assert.equal(format('%s - %d', ['foo', undefined]), 'foo - %d') | ||
assert.equal(format('%s - %f', ['foo', undefined]), 'foo - %f') | ||
assert.equal(format('%s - %i', ['foo', undefined]), 'foo - %i') | ||
assert.equal(format('%s - %O', ['foo', undefined]), 'foo - %O') | ||
assert.equal(format('%s - %o', ['foo', undefined]), 'foo - %o') | ||
assert.equal(format('%s - %j', ['foo', undefined]), 'foo - %j') | ||
assert.equal(format('%s - %s', ['foo', undefined]), 'foo - undefined') | ||
assert.equal(format('%s - %%', ['foo', undefined]), 'foo - %') | ||
assert.equal(format('%s - %d', ['foo', null]), 'foo - %d') | ||
assert.equal(format('%s - %f', ['foo', null]), 'foo - %f') | ||
assert.equal(format('%s - %i', ['foo', null]), 'foo - %i') | ||
assert.equal(format('%s - %O', ['foo', null]), 'foo - null') | ||
assert.equal(format('%s - %o', ['foo', null]), 'foo - null') | ||
assert.equal(format('%s - %j', ['foo', null]), 'foo - null') | ||
assert.equal(format('%s - %s', ['foo', null]), 'foo - null') | ||
assert.equal(format('%s - %%', ['foo', null]), 'foo - %') | ||
assert.equal(format('%d%d', [11, 22]), '1122') | ||
assert.equal(format('%d%s', [11, 22]), '1122') | ||
assert.equal(format('%d%o', [11, { aa: 22 }]), '11{"aa":22}') | ||
assert.equal(format('%d%d%d', [11, 22, 33]), '112233') | ||
assert.equal(format('%d%d%s', [11, 22, 33]), '112233') | ||
assert.equal(format('%d%o%d%s', [11, { aa: 22 }, 33, 'sss']), '11{"aa":22}33sss') | ||
assert.equal(format('%d%%%d', [11, 22]), '11%22') | ||
assert.equal(format('%d%%%s', [11, 22]), '11%22') |
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
12829
244