[Pkg-javascript-commits] [node-repeat-element] 02/04: New upstream version 1.1.2+github

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Mon Oct 17 17:45:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-repeat-element.

commit c7d00782f8286f3f5987d5fc40e73c7335a52e74
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Mon Oct 17 23:03:54 2016 +0530

    New upstream version 1.1.2+github
---
 .editorconfig                       | 17 ++++++++++++
 .gitattributes                      | 14 ++++++++++
 .gitignore                          | 12 +++++++++
 .jshintrc                           | 18 +++++++++++++
 .verb.md                            | 54 +++++++++++++++++++++++++++++++++++++
 benchmark/check.js                  | 38 ++++++++++++++++++++++++++
 benchmark/code/array-from.js        |  9 +++++++
 benchmark/code/array-map-call.js    |  7 +++++
 benchmark/code/array-map-valueOf.js |  5 ++++
 benchmark/code/current.js           |  1 +
 benchmark/code/for-concat.js        | 11 ++++++++
 benchmark/code/for-join-1.js        | 10 +++++++
 benchmark/code/for-join-2.js        |  9 +++++++
 benchmark/code/for-length.js        | 17 ++++++++++++
 benchmark/code/for-new-array-1.js   | 11 ++++++++
 benchmark/code/for-new-array-2.js   | 11 ++++++++
 benchmark/code/for-push.js          | 11 ++++++++
 benchmark/code/new-array-map-1.js   |  7 +++++
 benchmark/code/new-array-map-2.js   |  8 ++++++
 benchmark/code/repeat-element.js    |  3 +++
 benchmark/code/while-array-1.js     | 11 ++++++++
 benchmark/code/while-array-2.js     | 12 +++++++++
 benchmark/code/while-array-3.js     | 12 +++++++++
 benchmark/code/while-bitwise.js     | 16 +++++++++++
 benchmark/code/while-concat.js      | 11 ++++++++
 benchmark/code/while-exp.js         | 11 ++++++++
 benchmark/code/while-new-array-1.js | 11 ++++++++
 benchmark/code/while-new-array-2.js | 12 +++++++++
 benchmark/code/while-push.js        | 11 ++++++++
 benchmark/code/while-stack.js       | 15 +++++++++++
 benchmark/code/while-unshift.js     | 11 ++++++++
 benchmark/fixtures/0.js             |  3 +++
 benchmark/fixtures/1.js             |  3 +++
 benchmark/fixtures/100.js           |  4 +++
 benchmark/fixtures/2.js             |  3 +++
 benchmark/fixtures/2000.js          |  4 +++
 benchmark/fixtures/20000.js         |  4 +++
 benchmark/fixtures/25.js            |  3 +++
 benchmark/fixtures/250.js           |  4 +++
 benchmark/fixtures/3.js             |  3 +++
 benchmark/fixtures/4.js             |  3 +++
 benchmark/fixtures/5.js             |  3 +++
 benchmark/fixtures/50.js            |  4 +++
 benchmark/index.js                  | 12 +++++++++
 benchmark/last.md                   | 11 ++++++++
 test.js                             | 39 +++++++++++++++++++++++++++
 46 files changed, 509 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..192641a
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[test/fixtures/*]
+insert_final_newline = false
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..759c2c5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,14 @@
+# Enforce Unix newlines
+*.*     text eol=lf
+*.css   text eol=lf
+*.html  text eol=lf
+*.js    text eol=lf
+*.json  text eol=lf
+*.less  text eol=lf
+*.md    text eol=lf
+*.yml   text eol=lf
+
+*.jpg binary
+*.gif binary
+*.png binary
+*.jpeg binary
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..20d5293
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*.sublime-*
+_gh_pages
+actual
+bower_components
+node_modules
+npm-debug.log
+temp
+test/actual
+tmp
+TODO.md
+vendor
+*.DS_Store
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..96d4b14
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,18 @@
+{
+  "asi": false,
+  "boss": true,
+  "curly": true,
+  "eqeqeq": true,
+  "eqnull": true,
+  "esnext": true,
+  "immed": true,
+  "latedef": true,
+  "laxcomma": false,
+  "newcap": true,
+  "noarg": true,
+  "node": true,
+  "sub": true,
+  "undef": true,
+  "unused": true,
+  "mocha": true
+}
\ No newline at end of file
diff --git a/.verb.md b/.verb.md
new file mode 100644
index 0000000..0dc5a23
--- /dev/null
+++ b/.verb.md
@@ -0,0 +1,54 @@
+# {%= name %} {%= badge("fury") %}
+
+> {%= description %}
+
+## Install
+{%= include("install-npm", {save: true}) %}
+
+## Usage
+
+```js
+var repeat = require('{%= name %}');
+
+repeat('a', 5);
+//=> ['a', 'a', 'a', 'a', 'a']
+
+repeat('a', 1);
+//=> ['a']
+
+repeat('a', 0);
+//=> []
+
+repeat(null, 5)
+//» [ null, null, null, null, null ]
+
+repeat({some: 'object'}, 5)
+//» [ { some: 'object' },
+//    { some: 'object' },
+//    { some: 'object' },
+//    { some: 'object' },
+//    { some: 'object' } ]
+
+repeat(5, 5)
+//» [ 5, 5, 5, 5, 5 ]
+```
+
+## Related projects
+{%= related(['repeat-string']) %}
+
+## Running tests
+{%= include("tests") %}
+
+## Contributing
+{%= include("contributing") %}
+
+## Author
+{%= include("author") %}
+
+## License
+{%= copyright() %}
+{%= license() %}
+
+***
+
+{%= include("footer") %}
diff --git a/benchmark/check.js b/benchmark/check.js
new file mode 100755
index 0000000..2345c74
--- /dev/null
+++ b/benchmark/check.js
@@ -0,0 +1,38 @@
+'use strict';
+
+var chalk = require('chalk');
+var path = require('path');
+var glob = require('glob');
+var repeat = require('../');
+
+/**
+ * Sanity check. Run to ensure that all fns return the same result.
+ */
+
+var fixtures = glob.sync(__dirname + '/fixtures/*.js').map(require);
+var expected = fixtures.map(fixture => repeat.apply(repeat, fixture).length);
+
+glob.sync(__dirname + '/code/*.js').forEach(function (fp) {
+  var fn = require(path.resolve(__dirname, 'code', fp));
+  var name = path.basename(fp, path.extname(fp));
+  var problems = [];
+
+  fixtures.forEach(function (fixture, idx) {
+    var answer = fn.apply(fn, fixture).length;
+
+    if (answer !== expected[idx]) {
+      problems.push(['repeat(' + fixture.join(', ') + ').length', answer, expected[idx]]);
+    }
+  });
+
+  if (problems.length === 0) {
+    console.log(' ' + chalk.bold.green('✔') + ' ' + chalk.bold(name));
+  } else {
+    console.log(' ' + chalk.bold.red('✖') + ' ' + chalk.bold(name));
+
+    problems.forEach(function (item, idx, arr) {
+      var str = item[0] + ' gave ' + item[1] + ', expected ' + item[2];
+      console.log((idx === arr.length - 1 ? ' ┗ ' : ' ┣ ') + chalk.red(str));
+    });
+  }
+});
diff --git a/benchmark/code/array-from.js b/benchmark/code/array-from.js
new file mode 100644
index 0000000..a9d898f
--- /dev/null
+++ b/benchmark/code/array-from.js
@@ -0,0 +1,9 @@
+'use strict';
+
+function getThis() {
+  return this;
+}
+
+module.exports = function repeat(ele, num) {
+  return Array.from({length: num}, getThis, ele);
+};
diff --git a/benchmark/code/array-map-call.js b/benchmark/code/array-map-call.js
new file mode 100644
index 0000000..db3af1f
--- /dev/null
+++ b/benchmark/code/array-map-call.js
@@ -0,0 +1,7 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  return Array.prototype.map.call([] + Array(num + 1), function () {
+    return ele;
+  });
+};
diff --git a/benchmark/code/array-map-valueOf.js b/benchmark/code/array-map-valueOf.js
new file mode 100644
index 0000000..bf8145a
--- /dev/null
+++ b/benchmark/code/array-map-valueOf.js
@@ -0,0 +1,5 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  return Array.apply(null, Array(num)).map(String.prototype.valueOf, ele);
+};
diff --git a/benchmark/code/current.js b/benchmark/code/current.js
new file mode 100644
index 0000000..bf59a72
--- /dev/null
+++ b/benchmark/code/current.js
@@ -0,0 +1 @@
+module.exports = require('../..');
diff --git a/benchmark/code/for-concat.js b/benchmark/code/for-concat.js
new file mode 100644
index 0000000..ac15db5
--- /dev/null
+++ b/benchmark/code/for-concat.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var arr = [];
+
+  for (var i = 0; i < num; i++) {
+    arr = arr.concat(ele);
+  }
+
+  return arr;
+};
diff --git a/benchmark/code/for-join-1.js b/benchmark/code/for-join-1.js
new file mode 100755
index 0000000..47e8647
--- /dev/null
+++ b/benchmark/code/for-join-1.js
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var arr = [];
+
+  for (; 0 < num; num -= 1, arr[num] = ele);
+  num++;
+
+  return arr;
+};
diff --git a/benchmark/code/for-join-2.js b/benchmark/code/for-join-2.js
new file mode 100644
index 0000000..c1fe039
--- /dev/null
+++ b/benchmark/code/for-join-2.js
@@ -0,0 +1,9 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var arr = [];
+
+  for (; 0 < num; arr[--num] = ele);
+
+  return arr;
+};
diff --git a/benchmark/code/for-length.js b/benchmark/code/for-length.js
new file mode 100644
index 0000000..eb44cc0
--- /dev/null
+++ b/benchmark/code/for-length.js
@@ -0,0 +1,17 @@
+'use strict';
+
+module.exports = repeat;
+
+function repeat(ele, num) {
+  if (num === 0) return [];
+
+  var res = [ele];
+  var len = res.length;
+
+  if (len < num) {
+    for (var i = num - 1 - len; i >= 0; i--) {
+      res[i + len] = res[i % len];
+    }
+  }
+  return res;
+}
diff --git a/benchmark/code/for-new-array-1.js b/benchmark/code/for-new-array-1.js
new file mode 100755
index 0000000..d7ba888
--- /dev/null
+++ b/benchmark/code/for-new-array-1.js
@@ -0,0 +1,11 @@
+module.exports = repeat;
+
+function repeat(ele, num) {
+  var arr = new Array(num);
+
+  for (var i = 0; i < num; i++) {
+    arr[i] = ele;
+  }
+
+  return arr;
+}
diff --git a/benchmark/code/for-new-array-2.js b/benchmark/code/for-new-array-2.js
new file mode 100644
index 0000000..d6d2677
--- /dev/null
+++ b/benchmark/code/for-new-array-2.js
@@ -0,0 +1,11 @@
+module.exports = repeat;
+
+function repeat(ele, num) {
+  var arr = new Array(num);
+
+  for (var i = num - 1; i >= 0; i--) {
+    arr[i] = ele;
+  }
+
+  return arr;
+}
diff --git a/benchmark/code/for-push.js b/benchmark/code/for-push.js
new file mode 100644
index 0000000..7c6e1dc
--- /dev/null
+++ b/benchmark/code/for-push.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var arr = [];
+
+  for (var i = num; i > 0; i--) {
+    arr.push(ele);
+  }
+
+  return arr;
+};
diff --git a/benchmark/code/new-array-map-1.js b/benchmark/code/new-array-map-1.js
new file mode 100644
index 0000000..c343a71
--- /dev/null
+++ b/benchmark/code/new-array-map-1.js
@@ -0,0 +1,7 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  return Array.apply([], new Array(num)).map(function (nil) {
+    return ele;
+  });
+};
diff --git a/benchmark/code/new-array-map-2.js b/benchmark/code/new-array-map-2.js
new file mode 100644
index 0000000..9734f06
--- /dev/null
+++ b/benchmark/code/new-array-map-2.js
@@ -0,0 +1,8 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  return Array(num + 1).join(1).split('').map(function (nil) {
+    return ele;
+  });
+};
+
diff --git a/benchmark/code/repeat-element.js b/benchmark/code/repeat-element.js
new file mode 100755
index 0000000..0f85e82
--- /dev/null
+++ b/benchmark/code/repeat-element.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('../..');
\ No newline at end of file
diff --git a/benchmark/code/while-array-1.js b/benchmark/code/while-array-1.js
new file mode 100755
index 0000000..9256044
--- /dev/null
+++ b/benchmark/code/while-array-1.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(val, num) {
+  var arr = [];
+
+  while (num--) {
+    arr[num] = val;
+  }
+
+  return arr;
+};
diff --git a/benchmark/code/while-array-2.js b/benchmark/code/while-array-2.js
new file mode 100755
index 0000000..1d04a55
--- /dev/null
+++ b/benchmark/code/while-array-2.js
@@ -0,0 +1,12 @@
+'use strict';
+
+module.exports = function repeat(val, num) {
+  var arr = [];
+  var i = 0;
+
+  while (num--) {
+    arr[i++] = val;
+  }
+
+  return arr;
+};
diff --git a/benchmark/code/while-array-3.js b/benchmark/code/while-array-3.js
new file mode 100755
index 0000000..353a506
--- /dev/null
+++ b/benchmark/code/while-array-3.js
@@ -0,0 +1,12 @@
+'use strict';
+
+module.exports = function(val, num) {
+  return repeat(val, num, []);
+};
+
+function repeat(val, num, arr) {
+  while (num--) {
+    arr[num] = val;
+  }
+  return arr;
+}
diff --git a/benchmark/code/while-bitwise.js b/benchmark/code/while-bitwise.js
new file mode 100644
index 0000000..8ccf248
--- /dev/null
+++ b/benchmark/code/while-bitwise.js
@@ -0,0 +1,16 @@
+
+module.exports = repeat;
+
+function repeat(ele, num) {
+  var arr = [ele];
+  var res = [];
+
+  while (num > 0) {
+    if (num & 1) {
+      res.push.apply(res, arr);
+    }
+    num >>= 1;
+    arr.push.apply(arr, arr);
+  }
+  return res;
+}
diff --git a/benchmark/code/while-concat.js b/benchmark/code/while-concat.js
new file mode 100755
index 0000000..94158ae
--- /dev/null
+++ b/benchmark/code/while-concat.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var res = [];
+
+  while (num--) {
+    res = res.concat(ele);
+  }
+
+  return res;
+};
diff --git a/benchmark/code/while-exp.js b/benchmark/code/while-exp.js
new file mode 100644
index 0000000..c985523
--- /dev/null
+++ b/benchmark/code/while-exp.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var res = [ele];
+
+  while (res.length < num) {
+    res = res.concat(res);
+  }
+
+  return res.slice(0, num);
+};
diff --git a/benchmark/code/while-new-array-1.js b/benchmark/code/while-new-array-1.js
new file mode 100644
index 0000000..aaf9096
--- /dev/null
+++ b/benchmark/code/while-new-array-1.js
@@ -0,0 +1,11 @@
+module.exports = repeat;
+
+function repeat(ele, num) {
+  var arr = new Array(num);
+
+  while (num--) {
+    arr[num] = ele;
+  }
+
+  return arr;
+}
diff --git a/benchmark/code/while-new-array-2.js b/benchmark/code/while-new-array-2.js
new file mode 100644
index 0000000..694aeea
--- /dev/null
+++ b/benchmark/code/while-new-array-2.js
@@ -0,0 +1,12 @@
+module.exports = repeat;
+
+function repeat(ele, num) {
+  var arr = new Array(num);
+  var i = 0;
+
+  while (num--) {
+    arr[i++] = ele;
+  }
+
+  return arr;
+}
diff --git a/benchmark/code/while-push.js b/benchmark/code/while-push.js
new file mode 100644
index 0000000..cf71c96
--- /dev/null
+++ b/benchmark/code/while-push.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var arr = [];
+
+  while (num--) {
+    arr.push(ele);
+  }
+
+  return arr;
+};
diff --git a/benchmark/code/while-stack.js b/benchmark/code/while-stack.js
new file mode 100644
index 0000000..2f975b0
--- /dev/null
+++ b/benchmark/code/while-stack.js
@@ -0,0 +1,15 @@
+'use strict';
+
+module.exports = function repeat(ele, num) {
+  var res = [ele];
+  var max = num;
+
+  while (num--) {
+    res.push.apply(res, res);
+    if (res.length >= max) {
+      break;
+    }
+  }
+
+  return res.slice(0, max);
+};
diff --git a/benchmark/code/while-unshift.js b/benchmark/code/while-unshift.js
new file mode 100755
index 0000000..9b1dc10
--- /dev/null
+++ b/benchmark/code/while-unshift.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function repeat(val, amount) {
+  var res = [];
+
+  while (amount--) {
+    res.unshift(val);
+  }
+
+  return res;
+};
diff --git a/benchmark/fixtures/0.js b/benchmark/fixtures/0.js
new file mode 100755
index 0000000..53f16e3
--- /dev/null
+++ b/benchmark/fixtures/0.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['afa', 0];
\ No newline at end of file
diff --git a/benchmark/fixtures/1.js b/benchmark/fixtures/1.js
new file mode 100755
index 0000000..01a8a3c
--- /dev/null
+++ b/benchmark/fixtures/1.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['abc', 1];
\ No newline at end of file
diff --git a/benchmark/fixtures/100.js b/benchmark/fixtures/100.js
new file mode 100755
index 0000000..87ea1f0
--- /dev/null
+++ b/benchmark/fixtures/100.js
@@ -0,0 +1,4 @@
+'use strict';
+
+module.exports = ['fas', 100];
+
diff --git a/benchmark/fixtures/2.js b/benchmark/fixtures/2.js
new file mode 100644
index 0000000..a0608a3
--- /dev/null
+++ b/benchmark/fixtures/2.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['def', 2];
\ No newline at end of file
diff --git a/benchmark/fixtures/2000.js b/benchmark/fixtures/2000.js
new file mode 100755
index 0000000..2769f08
--- /dev/null
+++ b/benchmark/fixtures/2000.js
@@ -0,0 +1,4 @@
+'use strict';
+
+module.exports = ['lll', 2000];
+
diff --git a/benchmark/fixtures/20000.js b/benchmark/fixtures/20000.js
new file mode 100644
index 0000000..fcc0285
--- /dev/null
+++ b/benchmark/fixtures/20000.js
@@ -0,0 +1,4 @@
+'use strict';
+
+module.exports = ['lll', 20000];
+
diff --git a/benchmark/fixtures/25.js b/benchmark/fixtures/25.js
new file mode 100755
index 0000000..aad5d68
--- /dev/null
+++ b/benchmark/fixtures/25.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['iai', 25];
\ No newline at end of file
diff --git a/benchmark/fixtures/250.js b/benchmark/fixtures/250.js
new file mode 100755
index 0000000..6751c83
--- /dev/null
+++ b/benchmark/fixtures/250.js
@@ -0,0 +1,4 @@
+'use strict';
+
+module.exports = ['bbb', 250];
+
diff --git a/benchmark/fixtures/3.js b/benchmark/fixtures/3.js
new file mode 100644
index 0000000..3d143fb
--- /dev/null
+++ b/benchmark/fixtures/3.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['ghi', 3];
\ No newline at end of file
diff --git a/benchmark/fixtures/4.js b/benchmark/fixtures/4.js
new file mode 100644
index 0000000..ad88e61
--- /dev/null
+++ b/benchmark/fixtures/4.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['xyz', 4];
\ No newline at end of file
diff --git a/benchmark/fixtures/5.js b/benchmark/fixtures/5.js
new file mode 100755
index 0000000..6c32928
--- /dev/null
+++ b/benchmark/fixtures/5.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = ['fff', 5];
\ No newline at end of file
diff --git a/benchmark/fixtures/50.js b/benchmark/fixtures/50.js
new file mode 100755
index 0000000..09b9ca2
--- /dev/null
+++ b/benchmark/fixtures/50.js
@@ -0,0 +1,4 @@
+'use strict';
+
+module.exports = ['xyz', 50];
+
diff --git a/benchmark/index.js b/benchmark/index.js
new file mode 100755
index 0000000..fb03629
--- /dev/null
+++ b/benchmark/index.js
@@ -0,0 +1,12 @@
+'use strict';
+
+var Suite = require('benchmarked');
+
+var suite = new Suite({
+  result: false,
+  fixtures: 'fixtures/{3,5,25,2000}.js',
+  add: 'code/{current,while-push-new-array}.js',
+  cwd: __dirname
+});
+
+suite.run();
diff --git a/benchmark/last.md b/benchmark/last.md
new file mode 100644
index 0000000..6966ac5
--- /dev/null
+++ b/benchmark/last.md
@@ -0,0 +1,11 @@
+#1: 2000.js
+  current.js x 291,925 ops/sec ±0.66% (97 runs sampled)
+
+#2: 25.js
+  current.js x 9,940,492 ops/sec ±0.72% (93 runs sampled)
+
+#3: 3.js
+  current.js x 18,709,467 ops/sec ±0.97% (95 runs sampled)
+
+#4: 5.js
+  current.js x 17,771,539 ops/sec ±0.77% (95 runs sampled)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..3717d08
--- /dev/null
+++ b/test.js
@@ -0,0 +1,39 @@
+/*!
+ * repeat-element <https://github.com/jonschlinkert/repeat-element>
+ *
+ * Copyright (c) 2014 Jon Schlinkert, contributors.
+ * Licensed under the MIT License
+ */
+
+'use strict';
+
+/* deps: mocha */
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+var argv = require('minimist')(process.argv.slice(2));
+var files = fs.readdirSync('./benchmark/code');
+var repeat = require('./');
+
+var keys = Object.keys(argv);
+if (keys && keys[1]) {
+  var lib = files.filter(function (fp) {
+    return keys[1] === path.basename(fp, path.extname(fp));
+  });
+  repeat = require(path.resolve('./benchmark/code/' + lib[0]));
+}
+
+it('should repeat the given string:', function () {
+  assert.deepEqual(repeat('a', 5), ['a', 'a', 'a', 'a', 'a']);
+  assert.deepEqual(repeat('a', 50), ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a','a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a','a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a','a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a','a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a']);
+  assert.deepEqual(repeat('a', 1), ['a']);
+  assert.deepEqual(repeat('a', 0), []);
+});
+
+it('should repeat the given object:', function () {
+  assert.deepEqual(repeat({a: 'b'}, 5), [{a: 'b'},{a: 'b'},{a: 'b'},{a: 'b'},{a: 'b'}]);
+});
+
+it('should repeat null:', function () {
+  assert.deepEqual(repeat(null, 5), [null, null, null, null, null]);
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-repeat-element.git



More information about the Pkg-javascript-commits mailing list