This commit is contained in:
Dawid Dziurla 2020-03-26 15:37:35 +01:00
parent d9becc67b6
commit 9308795b8b
No known key found for this signature in database
GPG key ID: 7B6D8368172E9B0B
964 changed files with 104265 additions and 16 deletions

9
node_modules/quick-format-unescaped/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,9 @@
language: node_js
sudo: false
node_js:
- 6
- 8
- 10
- 11
script:
- npm test

21
node_modules/quick-format-unescaped/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-2019 David Mark Clements
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

24
node_modules/quick-format-unescaped/benchmark.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
var bench = require('fastbench')
var utilFormat = require('util').format
var quickFormat = require('./')
var run = bench([
function util(cb) {
utilFormat('%s %j %d', 'a', {a: {x: 1}}, 1)
setImmediate(cb)
},
function quick(cb) {
quickFormat('%s %j %d', 'a', [{a: {x: 1}}, 1], null)
setImmediate(cb)
},
function utilWithTailObj(cb) {
utilFormat('hello %s %j %d', 'world', {obj: true}, 4, {another: 'obj'})
setImmediate(cb)
},
function quickWithTailObj(cb) {
quickFormat('hello %s %j %d', 'world', [{obj: true}, 4, {another: 'obj'}], null)
setImmediate(cb)
}
], 100000)
run(run)

105
node_modules/quick-format-unescaped/index.js generated vendored Normal file
View file

@ -0,0 +1,105 @@
'use strict'
function tryStringify (o) {
try { return JSON.stringify(o) } catch(e) { return '"[Circular]"' }
}
module.exports = format
function format(f, args, opts) {
var ss = (opts && opts.stringify) || tryStringify
var offset = 1
if (f === null) {
f = args[0]
offset = 0
}
if (typeof f === 'object' && f !== null) {
var len = args.length + offset
if (len === 1) return f
var objects = new Array(len)
objects[0] = ss(f)
for (var index = 1; index < len; index++) {
objects[index] = ss(args[index])
}
return objects.join(' ')
}
var argLen = args.length
if (argLen === 0) return f
var x = ''
var str = ''
var a = 1 - offset
var lastPos = 0
var flen = (f && f.length) || 0
for (var i = 0; i < flen;) {
if (f.charCodeAt(i) === 37 && i + 1 < flen) {
switch (f.charCodeAt(i + 1)) {
case 100: // 'd'
if (a >= argLen)
break
if (lastPos < i)
str += f.slice(lastPos, i)
if (args[a] == null) break
str += Number(args[a])
lastPos = i = i + 2
break
case 79: // 'O'
case 111: // 'o'
case 106: // 'j'
if (a >= argLen)
break
if (lastPos < i)
str += f.slice(lastPos, i)
if (args[a] === undefined) break
var type = typeof args[a]
if (type === 'string') {
str += '\'' + args[a] + '\''
lastPos = i + 2
i++
break
}
if (type === 'function') {
str += args[a].name || '<anonymous>'
lastPos = i + 2
i++
break
}
str += ss(args[a])
lastPos = i + 2
i++
break
case 115: // 's'
if (a >= argLen)
break
if (lastPos < i)
str += f.slice(lastPos, i)
str += String(args[a])
lastPos = i + 2
i++
break
case 37: // '%'
if (lastPos < i)
str += f.slice(lastPos, i)
str += '%'
lastPos = i + 2
i++
break
}
++a
}
++i
}
if (lastPos === 0)
str = f
else if (lastPos < flen) {
str += f.slice(lastPos)
}
while (a < argLen) {
x = args[a++]
if (x === null || (typeof x !== 'object')) {
str += ' ' + String(x)
} else {
str += ' ' + ss(x)
}
}
return str
}

54
node_modules/quick-format-unescaped/package.json generated vendored Normal file
View file

@ -0,0 +1,54 @@
{
"_from": "quick-format-unescaped@^3.0.3",
"_id": "quick-format-unescaped@3.0.3",
"_inBundle": false,
"_integrity": "sha512-dy1yjycmn9blucmJLXOfZDx1ikZJUi6E8bBZLnhPG5gBrVhHXx2xVyqqgKBubVNEXmx51dBACMHpoMQK/N/AXQ==",
"_location": "/quick-format-unescaped",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "quick-format-unescaped@^3.0.3",
"name": "quick-format-unescaped",
"escapedName": "quick-format-unescaped",
"rawSpec": "^3.0.3",
"saveSpec": null,
"fetchSpec": "^3.0.3"
},
"_requiredBy": [
"/pino"
],
"_resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-3.0.3.tgz",
"_shasum": "fb3e468ac64c01d22305806c39f121ddac0d1fb9",
"_spec": "quick-format-unescaped@^3.0.3",
"_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino",
"author": {
"name": "David Mark Clements"
},
"bugs": {
"url": "https://github.com/davidmarkclements/quick-format/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Solves a problem with util.format",
"devDependencies": {
"fastbench": "^1.0.1"
},
"directories": {
"test": "test"
},
"homepage": "https://github.com/davidmarkclements/quick-format#readme",
"keywords": [],
"license": "MIT",
"main": "index.js",
"name": "quick-format-unescaped",
"repository": {
"type": "git",
"url": "git+https://github.com/davidmarkclements/quick-format.git"
},
"scripts": {
"test": "node test"
},
"version": "3.0.3"
}

66
node_modules/quick-format-unescaped/readme.md generated vendored Normal file
View file

@ -0,0 +1,66 @@
# quick-format-unescaped
## unescaped ?
Sometimes you want to embed the results of quick-format into another string,
and then escape the whole string.
## usage
```js
var format = require('quick-format-unescaped')
format('hello %s %j %d', ['world', [{obj: true}, 4, {another: 'obj'}]])
```
## format(fmt, parameters, [options])
### 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
any objects will be passed to the supplied function instead of an the
internal `tryStringify` function. This can be useful when using augmented
capability serializers such as [`fast-safe-stringify`](http://github.com/davidmarkclements/fast-safe-stringify) or [`fast-redact`](http://github.com/davidmarkclements/fast-redact).
## caveats
By default `quick-format-unescaped` uses `JSON.stringify` instead of `util.inspect`, this means functions *will not be serialized*.
## Benchmarks
### Node 8.11.2
```
util*100000: 350.325ms
quick*100000: 268.141ms
utilWithTailObj*100000: 586.387ms
quickWithTailObj*100000: 280.200ms
util*100000: 325.735ms
quick*100000: 270.251ms
utilWithTailObj*100000: 492.270ms
quickWithTailObj*100000: 261.797ms
```
### Node 10.4.0
```
util*100000: 301.035ms
quick*100000: 217.005ms
utilWithTailObj*100000: 404.778ms
quickWithTailObj*100000: 236.176ms
util*100000: 286.349ms
quick*100000: 214.646ms
utilWithTailObj*100000: 388.574ms
quickWithTailObj*100000: 226.036ms
```
## Acknowledgements
Sponsored by [nearForm](http://www.nearform.com)

78
node_modules/quick-format-unescaped/test/index.js generated vendored Normal file
View file

@ -0,0 +1,78 @@
'use strict';
const assert = require('assert');
const format = require('../');
// assert.equal(format([]), '');
// assert.equal(format(['']), '');
// assert.equal(format([[]]), '[]');
// assert.equal(format([{}]), '{}');
// assert.equal(format([null]), 'null');
// assert.equal(format([true]), 'true');
// assert.equal(format([false]), 'false');
// assert.equal(format(['test']), 'test');
// // // CHECKME this is for console.log() compatibility - but is it *right*?
// assert.equal(format(['foo', 'bar', 'baz']), 'foo bar baz');
// ES6 Symbol handling
const symbol = Symbol('foo')
assert.equal(format(null, [symbol]), symbol);
assert.equal(format('foo', [symbol]), 'foo Symbol(foo)');
assert.equal(format('%s', [symbol]), 'Symbol(foo)');
assert.equal(format('%j', [symbol]), 'undefined');
assert.throws(function() {
format(['%d', symbol]);
}, TypeError);
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', [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('%%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', []), '%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(null, ['foo', null, 'bar']), 'foo null bar');
assert.equal(format(null, ['foo', undefined, 'bar']), 'foo undefined bar');
assert.equal(format(null, [null, 'foo']), 'null foo');
assert.equal(format(null, [undefined, 'foo']), 'undefined foo');
// // assert.equal(format(['%%%s%%', 'hi']), '%hi%');
// // assert.equal(format(['%%%s%%%%', 'hi']), '%hi%%');
// (function() {
// var o = {};
// o.o = o;
// assert.equal(format(['%j', o]), '[Circular]');
// })();