This commit is contained in:
eric sciple 2020-01-24 12:20:19 -05:00
parent beb1329f9f
commit 2b95e76931
7736 changed files with 1874747 additions and 51184 deletions

6
node_modules/left-pad/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,6 @@
language: node_js
node_js:
- "6"
- "5"
- "4"
- "0.12"

14
node_modules/left-pad/COPYING generated vendored Normal file
View file

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2014 Azer Koçulu <azer@roadbeats.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

36
node_modules/left-pad/README.md generated vendored Normal file
View file

@ -0,0 +1,36 @@
## left-pad
String left pad
[![Build Status][travis-image]][travis-url]
## Install
```bash
$ npm install left-pad
```
## Usage
```js
const leftPad = require('left-pad')
leftPad('foo', 5)
// => " foo"
leftPad('foobar', 6)
// => "foobar"
leftPad(1, 2, '0')
// => "01"
leftPad(17, 5, 0)
// => "00017"
```
**NOTE:** The third argument should be a single `char`. However the module doesn't throw an error if you supply more than one `char`s. See [#28](https://github.com/stevemao/left-pad/pull/28).
**NOTE:** Characters having code points outside of [BMP plan](https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane) are considered a two distinct characters. See [#58](https://github.com/stevemao/left-pad/issues/58).
[travis-image]: https://travis-ci.org/stevemao/left-pad.svg?branch=master
[travis-url]: https://travis-ci.org/stevemao/left-pad

9
node_modules/left-pad/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
// Type definitions for left-pad 1.2.0
// Project: https://github.com/stevemao/left-pad
// Definitions by: Zlatko Andonovski, Andrew Yang, Chandler Fang and Zac Xu
declare function leftPad(str: string|number, len: number, ch?: string|number): string;
declare namespace leftPad { }
export = leftPad;

52
node_modules/left-pad/index.js generated vendored Normal file
View file

@ -0,0 +1,52 @@
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details. */
'use strict';
module.exports = leftPad;
var cache = [
'',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' '
];
function leftPad (str, len, ch) {
// convert `str` to a `string`
str = str + '';
// `len` is the `pad`'s length now
len = len - str.length;
// doesn't need to pad
if (len <= 0) return str;
// `ch` defaults to `' '`
if (!ch && ch !== 0) ch = ' ';
// convert `ch` to a `string` cuz it could be a number
ch = ch + '';
// cache common use cases
if (ch === ' ' && len < 10) return cache[len] + str;
// `pad` starts with an empty string
var pad = '';
// loop
while (true) {
// add `ch` to `pad` if `len` is odd
if (len & 1) pad += ch;
// divide `len` by 2, ditch the remainder
len >>= 1;
// "double" the `ch` so this operation count grows logarithmically on `len`
// each time `ch` is "doubled", the `len` would need to be "doubled" too
// similar to finding a value in binary search tree, hence O(log(n))
if (len) ch += ch;
// `len` is 0, exit the loop
else break;
}
// pad `str`!
return pad + str;
}

71
node_modules/left-pad/package.json generated vendored Normal file
View file

@ -0,0 +1,71 @@
{
"_args": [
[
"left-pad@1.3.0",
"/Users/eric/repos/actions/setup-node"
]
],
"_development": true,
"_from": "left-pad@1.3.0",
"_id": "left-pad@1.3.0",
"_inBundle": false,
"_integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
"_location": "/left-pad",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "left-pad@1.3.0",
"name": "left-pad",
"escapedName": "left-pad",
"rawSpec": "1.3.0",
"saveSpec": null,
"fetchSpec": "1.3.0"
},
"_requiredBy": [
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
"_spec": "1.3.0",
"_where": "/Users/eric/repos/actions/setup-node",
"author": {
"name": "azer"
},
"bugs": {
"url": "https://github.com/stevemao/left-pad/issues"
},
"description": "String left pad",
"devDependencies": {
"benchmark": "^2.1.0",
"fast-check": "0.0.8",
"tape": "*"
},
"homepage": "https://github.com/stevemao/left-pad#readme",
"keywords": [
"leftpad",
"left",
"pad",
"padding",
"string",
"repeat"
],
"license": "WTFPL",
"main": "index.js",
"maintainers": [
{
"name": "Cameron Westland",
"email": "camwest@gmail.com"
}
],
"name": "left-pad",
"repository": {
"url": "git+ssh://git@github.com/stevemao/left-pad.git",
"type": "git"
},
"scripts": {
"bench": "node perf/perf.js",
"test": "node test"
},
"types": "index.d.ts",
"version": "1.3.0"
}

17
node_modules/left-pad/perf/O(n).js generated vendored Normal file
View file

@ -0,0 +1,17 @@
'use strict';
module.exports = function (str, len, ch) {
str = str + '';
len = len - str.length;
if (len <= 0) return str;
if (!ch && ch !== 0) ch = ' ';
ch = ch + '';
while (len--) {
str = ch + str;
}
return str;
}

13
node_modules/left-pad/perf/es6Repeat.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
'use strict';
module.exports = function (str, len, ch) {
str = str + '';
len = len - str.length;
if (len <= 0) return str;
if (!ch && ch !== 0) ch = ' ';
ch = ch + '';
return ch.repeat(len) + str;
};

40
node_modules/left-pad/perf/perf.js generated vendored Normal file
View file

@ -0,0 +1,40 @@
'use strict';
var oN = require('./O(n)');
var es6Repeat = require('./es6Repeat');
var current = require('../');
var Benchmark = require('benchmark');
var str = "abcd"
var len = 100;
function buildSuite (note, fns, args) {
console.log(note);
var suite = new Benchmark.Suite;
Object.keys(fns).forEach(function (name) {
suite.add(name, function () {
fns[name].apply(null, args);
});
});
suite.on('cycle', function (event) {
console.log(String(event.target));
}).on('complete', function () {
console.log('Fastest is ' + this.filter('fastest').map('name'));
});
return suite;
}
var fns = {
'O(n)': oN,
'ES6 Repeat': es6Repeat,
'Current': current
};
buildSuite('-> pad 100 spaces to str of len 4', fns, ['abcd', 104, ' ']).run();
buildSuite('-> pad 10 spaces to str of len 4', fns, ['abcd', 14, ' ']).run();
buildSuite('-> pad 9 spaces to str of len 4', fns, ['abcd', 13, ' ']).run();
buildSuite('-> pad 100 to str of len 100', fns, ['0012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456789', 200, ' ']).run();
buildSuite('-> pad 10 to str of len 100', fns, ['0012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456789', 110, ' ']).run();
buildSuite('-> pad 9 to str of len 100', fns, ['0012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456789', 109, ' ']).run();

88
node_modules/left-pad/test.js generated vendored Normal file
View file

@ -0,0 +1,88 @@
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details. */
var leftPad = require("./");
var test = require("tape");
var fc = require("fast-check");
test('edge cases', function (assert) {
assert.plan(12);
assert.strictEqual(leftPad('foobar', 6), 'foobar');
assert.strictEqual(leftPad('foobar', 5), 'foobar');
assert.strictEqual(leftPad('foobar', -1), 'foobar');
assert.strictEqual(leftPad('foobar', 6, '1'), 'foobar');
assert.strictEqual(leftPad('foobar', 5, '1'), 'foobar');
assert.strictEqual(leftPad('foobar', -1, '1'), 'foobar');
assert.strictEqual(leftPad('foobar', 8, ''), ' foobar');
assert.strictEqual(leftPad('foobar', 8, false), ' foobar', 'false default to space');
assert.strictEqual(leftPad('foobar', 8, 0), '00foobar', '0 is treated as 0');
assert.strictEqual(leftPad(0, 3, 1), '110', 'integer for str is converted to string');
assert.strictEqual(leftPad(true, 7), ' true', 'boolean for str is converted to string');
assert.strictEqual(leftPad('', 2), ' ', 'empty str for str');
});
test('spaces for ch', function (assert) {
assert.plan(12);
// default to space if not specified
assert.strictEqual(leftPad('foo', 2), 'foo');
assert.strictEqual(leftPad('foo', 3), 'foo');
assert.strictEqual(leftPad('foo', 4), ' foo');
assert.strictEqual(leftPad('foo', 5), ' foo');
assert.strictEqual(leftPad('foo', 12), ' foo');
assert.strictEqual(leftPad('foo', 13), ' foo');
// explicit space param
assert.strictEqual(leftPad('foo', 2, ' '), 'foo');
assert.strictEqual(leftPad('foo', 3, ' '), 'foo');
assert.strictEqual(leftPad('foo', 4, ' '), ' foo');
assert.strictEqual(leftPad('foo', 5, ' '), ' foo');
assert.strictEqual(leftPad('foo', 12, ' '), ' foo');
assert.strictEqual(leftPad('foo', 13, ' '), ' foo');
});
test('non spaces for ch', function (assert) {
assert.plan(7);
assert.strictEqual(leftPad(1, 2, 0), '01');
assert.strictEqual(leftPad(1, 2, '-'), '-1');
assert.strictEqual(leftPad('foo', 4, '*'), '*foo', '0b1 len');
assert.strictEqual(leftPad('foo', 5, '*'), '**foo', '0b10 len');
assert.strictEqual(leftPad('foo', 6, '*'), '***foo', '0b11 len');
assert.strictEqual(leftPad('foo', 7, '*'), '****foo', '0b001 len');
assert.strictEqual(leftPad('foo', 103, '*'), '****************************************************************************************************foo', '100 pad');
});
var runProperty = function(assert, name, checkFn) {
var prop = fc.property(fc.string(), fc.nat(1000), fc.char(), checkFn);
var result = fc.check(prop);
var message = '';
if (result.failed) {
message = 'Property "' + name + '" failed on counterexample ' + JSON.stringify(result.counterexample) + ' (seed: ' + result.seed + ')';
}
assert.strictEqual(message, '', name);
};
test('properties', function (assert) {
assert.plan(4);
runProperty(assert, 'starts by ch', function(str, len, ch) {
var beg = leftPad(str, len, ch).substr(0, len -str.length);
for (var idx = 0 ; idx != beg.length ; ++idx)
if (beg[idx] !== ch)
return false;
return true;
});
runProperty(assert, 'ends by str', function(str, len, ch) {
var out = leftPad(str, len, ch);
for (var idx = 0 ; idx != str.length ; ++idx)
if (str[str.length -idx -1] !== out[out.length -idx -1])
return false;
return true;
});
runProperty(assert, 'len char long if padded (unchanged otherwise)', function(str, len, ch) {
var out = leftPad(str, len, ch);
return str.length < len ? out.length === len : str === out;
});
runProperty(assert, 'no ch equivalent to space', function(str, len) {
return leftPad(str, len) === leftPad(str, len, ' ');
});
});