first commit
This commit is contained in:
6
node_modules/string.prototype.repeat/.editorconfig
generated
vendored
Normal file
6
node_modules/string.prototype.repeat/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
2
node_modules/string.prototype.repeat/.gitattributes
generated
vendored
Normal file
2
node_modules/string.prototype.repeat/.gitattributes
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Automatically normalize line endings for all text-based files
|
||||
* text=auto
|
||||
7
node_modules/string.prototype.repeat/.travis.yml
generated
vendored
Normal file
7
node_modules/string.prototype.repeat/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
version: ~> 1.0
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
import:
|
||||
- ljharb/travis-ci:node/all.yml
|
||||
- ljharb/travis-ci:node/pretest.yml
|
||||
20
node_modules/string.prototype.repeat/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/string.prototype.repeat/LICENSE-MIT.txt
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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.
|
||||
43
node_modules/string.prototype.repeat/README.md
generated
vendored
Normal file
43
node_modules/string.prototype.repeat/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# ES6 `String.prototype.repeat` polyfill [](https://travis-ci.org/mathiasbynens/String.prototype.repeat)
|
||||
|
||||
A robust & optimized polyfill for [the `String.prototype.repeat` method in ECMAScript 6](http://ecma-international.org/ecma-262/6.0/#sec-string.prototype.repeat).
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-string.prototype.repeat).
|
||||
|
||||
Other polyfills for `String.prototype.repeat` are available:
|
||||
|
||||
* <https://github.com/paulmillr/es6-shim/blob/d8c4ec246a15e7df55da60b7f9b745af84ca9021/es6-shim.js#L146-L154> by [Paul Miller](http://paulmillr.com/) (~~[fails 8 tests](https://github.com/paulmillr/es6-shim/issues/164)~~ now passes all tests)
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install string.prototype.repeat
|
||||
```
|
||||
|
||||
Then, in [Node.js](https://nodejs.org/):
|
||||
|
||||
```js
|
||||
var repeat = require('string.prototype.repeat');
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="https://bundle.run/string.prototype.repeat"></script>
|
||||
```
|
||||
|
||||
> **NOTE**: It's recommended that you install this module using a package manager
|
||||
> such as `npm`, because loading multiple polyfills from a CDN (such as `bundle.run`)
|
||||
> will lead to duplicated code.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
This polyfill is available under the [MIT](https://mths.be/mit) license.
|
||||
3
node_modules/string.prototype.repeat/auto.js
generated
vendored
Normal file
3
node_modules/string.prototype.repeat/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/*! https://mths.be/repeat v1.0.0 by @mathias */
|
||||
|
||||
require('./shim')();
|
||||
29
node_modules/string.prototype.repeat/implementation.js
generated
vendored
Normal file
29
node_modules/string.prototype.repeat/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*! https://mths.be/repeat v1.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible');
|
||||
var ToString = require('es-abstract/2019/ToString');
|
||||
var ToInteger = require('es-abstract/2019/ToInteger');
|
||||
|
||||
module.exports = function repeat(count) {
|
||||
var O = RequireObjectCoercible(this);
|
||||
var string = ToString(O);
|
||||
var n = ToInteger(count);
|
||||
// Account for out-of-bounds indices
|
||||
if (n < 0 || n == Infinity) {
|
||||
throw RangeError('String.prototype.repeat argument must be greater than or equal to 0 and not be Infinity');
|
||||
}
|
||||
|
||||
var result = '';
|
||||
while (n) {
|
||||
if (n % 2 == 1) {
|
||||
result += string;
|
||||
}
|
||||
if (n > 1) {
|
||||
string += string;
|
||||
}
|
||||
n >>= 1;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
20
node_modules/string.prototype.repeat/index.js
generated
vendored
Normal file
20
node_modules/string.prototype.repeat/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*! https://mths.be/repeat v1.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var callBind = require('es-abstract/helpers/callBind');
|
||||
var define = require('define-properties');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var boundRepeat = callBind(getPolyfill());
|
||||
|
||||
define(boundRepeat, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = boundRepeat;
|
||||
49
node_modules/string.prototype.repeat/package.json
generated
vendored
Normal file
49
node_modules/string.prototype.repeat/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "string.prototype.repeat",
|
||||
"version": "1.0.0",
|
||||
"description": "A robust & optimized `String.prototype.repeat` polyfill, based on the ECMAScript 6 specification.",
|
||||
"homepage": "https://mths.be/repeat",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./auto": "./auto.js",
|
||||
"./shim": "./shim.js",
|
||||
"./getPolyfill": "./getPolyfill.js",
|
||||
"./implementation": "./implementation.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"keywords": [
|
||||
"string",
|
||||
"repeat",
|
||||
"es6",
|
||||
"ecmascript",
|
||||
"polyfill"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/String.prototype.repeat.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/String.prototype.repeat/issues",
|
||||
"scripts": {
|
||||
"pretest": "es-shim-api --bound",
|
||||
"test": "npm run tests-only",
|
||||
"tests-only": "tape 'tests/*.js'",
|
||||
"cover": "istanbul cover --report html --verbose --dir coverage tape 'tests/*.js'"
|
||||
},
|
||||
"dependencies": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.1.2",
|
||||
"function-bind": "^1.1.1",
|
||||
"functions-have-names": "^1.2.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"tape": "^5.0.0"
|
||||
}
|
||||
}
|
||||
9
node_modules/string.prototype.repeat/polyfill.js
generated
vendored
Normal file
9
node_modules/string.prototype.repeat/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*! https://mths.be/repeat v1.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return String.prototype.repeat || implementation;
|
||||
};
|
||||
17
node_modules/string.prototype.repeat/shim.js
generated
vendored
Normal file
17
node_modules/string.prototype.repeat/shim.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/*! https://mths.be/repeat v1.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimRepeat() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
if (String.prototype.repeat !== polyfill) {
|
||||
define(String.prototype, { repeat: polyfill });
|
||||
}
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
12
node_modules/string.prototype.repeat/tests/index.js
generated
vendored
Normal file
12
node_modules/string.prototype.repeat/tests/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var repeat = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
runTests(repeat, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
30
node_modules/string.prototype.repeat/tests/shimmed.js
generated
vendored
Normal file
30
node_modules/string.prototype.repeat/tests/shimmed.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var repeat = require('../');
|
||||
repeat.shim();
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var bind = require('function-bind');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(String.prototype.repeat.length, 1, 'String#repeat has a length of 1');
|
||||
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(String.prototype.repeat.name, 'repeat', 'String#repeat has name "repeat"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (st) {
|
||||
st.equal(false, isEnumerable.call(String.prototype, 'repeat'), 'String#repeat is not enumerable');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(bind.call(Function.call, String.prototype.repeat), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
44
node_modules/string.prototype.repeat/tests/tests.js
generated
vendored
Normal file
44
node_modules/string.prototype.repeat/tests/tests.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(repeat, t) {
|
||||
t.test('cast count argument', function(st) {
|
||||
st.equal(repeat('abc'), '');
|
||||
st.equal(repeat('abc', undefined), '');
|
||||
st.equal(repeat('abc', null), '');
|
||||
st.equal(repeat('abc', false), '');
|
||||
st.equal(repeat('abc', NaN), '');
|
||||
st.equal(repeat('abc', 'abc'), '');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('invalid numeric count', function(st) {
|
||||
st['throws'](function() { repeat('abc', -Infinity); }, RangeError);
|
||||
st['throws'](function() { repeat('abc', -1); }, RangeError);
|
||||
st['throws'](function() { repeat('abc', +Infinity); }, RangeError);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('valid numeric count', function(st) {
|
||||
st.equal(repeat('abc', -0), '');
|
||||
st.equal(repeat('abc', +0), '');
|
||||
st.equal(repeat('abc', 1), 'abc');
|
||||
st.equal(repeat('abc', 2), 'abcabc');
|
||||
st.equal(repeat('abc', 3), 'abcabcabc');
|
||||
st.equal(repeat('abc', 4), 'abcabcabcabc');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('nullish this object', function(st) {
|
||||
st['throws'](function() { repeat(undefined); }, TypeError);
|
||||
st['throws'](function() { repeat(undefined, 4); }, TypeError);
|
||||
st['throws'](function() { repeat(null); }, TypeError);
|
||||
st['throws'](function() { repeat(null, 4); }, TypeError);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('cast this object', function(st) {
|
||||
st.equal(repeat(42, 4), '42424242');
|
||||
st.equal(repeat({ 'toString': function() { return 'abc'; } }, 2), 'abcabc');
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user