mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-23 14:24:46 +00:00
.
This commit is contained in:
parent
a004f0ae58
commit
fc725ba36b
7280 changed files with 19 additions and 1796407 deletions
17
node_modules/left-pad/perf/O(n).js
generated
vendored
17
node_modules/left-pad/perf/O(n).js
generated
vendored
|
@ -1,17 +0,0 @@
|
|||
'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
13
node_modules/left-pad/perf/es6Repeat.js
generated
vendored
|
@ -1,13 +0,0 @@
|
|||
'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
40
node_modules/left-pad/perf/perf.js
generated
vendored
|
@ -1,40 +0,0 @@
|
|||
'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();
|
Loading…
Add table
Add a link
Reference in a new issue