Socket
Socket
Sign inDemoInstall

quick-format-unescaped

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quick-format-unescaped - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

.github/workflows/ci.yml

20

index.js

@@ -21,8 +21,5 @@ 'use strict'

}
if (typeof f !== 'string') {
return f
}
var argLen = args.length
if (argLen === 0) return f
var x = ''
var argLen = args ? args.length : 0
if (argLen === 0) return f === undefined ? '' : f
var str = ''

@@ -37,2 +34,3 @@ var a = 1 - offset

case 100: // 'd'
case 102: // 'f'
if (a >= argLen)

@@ -46,2 +44,11 @@ break

break
case 105: // 'i'
if (a >= argLen)
break
if (lastPos < i)
str += f.slice(lastPos, i)
if (args[a] == null) break
str += Math.floor(Number(args[a]))
lastPos = i = i + 2
break
case 79: // 'O'

@@ -87,2 +94,3 @@ case 111: // 'o'

i++
a--
break

@@ -89,0 +97,0 @@ }

{
"name": "quick-format-unescaped",
"version": "4.0.1",
"version": "4.0.2",
"description": "Solves a problem with util.format",

@@ -5,0 +5,0 @@ "main": "index.js",

'use strict';
const assert = require('assert');
const assert = require('assert').strict;
const format = require('../');
const util = require('util');
// const symbol = Symbol('foo');
// assert.equal(format([]), '');

@@ -34,2 +37,4 @@ // assert.equal(format(['']), '');

assert.equal(format('%d', [42]), '42');
assert.equal(format('%f', [42.99]), '42.99');
assert.equal(format('%i', [42.99]), '42');
assert.equal(format('%s', [42]), '42');

@@ -44,2 +49,3 @@ assert.equal(format('%j', [42]), '42');

assert.equal(format('%d', [null]), '%d');
assert.equal(format('%i', [null]), '%i');
assert.equal(format('%s', [null]), 'null');

@@ -51,3 +57,8 @@ assert.equal(format('%j', [null]), 'null');

assert.equal(format('%d', ['42']), '42');
assert.equal(format('%i', ['42']), '42');
assert.equal(format('%i', ['42.99']), '42');
assert.equal(format('%s %i', ['foo', 42.99]), 'foo 42');
assert.equal(format('%d %d', ['42']), '42 %d');
assert.equal(format('%i %i', ['42']), '42 %i');
assert.equal(format('%i %i', ['42.99']), '42 %i');
assert.equal(format('foo %d', ['42']), 'foo 42');

@@ -77,2 +88,6 @@ assert.equal(format('%s', ['42']), '42');

assert.equal(format(null, [null, 'foo']), null);
assert.equal(format(null, [undefined, 'foo']), null);
assert.equal(format(), util.format());
assert.equal(format('foo %o', [{foo: 'foo'}]), 'foo {"foo":"foo"}')

@@ -94,2 +109,3 @@ assert.equal(format('foo %O', [{foo: 'foo'}]), 'foo {"foo":"foo"}')

// // assert.equal(format(['%%%s%%', 'hi']), '%hi%');

@@ -106,1 +122,2 @@ // // assert.equal(format(['%%%s%%%%', 'hi']), '%hi%%');

assert.equal(format('foo %%', ['foo']), 'foo %')
assert.equal(format('foo %% %s', ['bar']), 'foo % bar')
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc