pax_global_header00006660000000000000000000000064140334362130014511gustar00rootroot0000000000000052 comment=f2314f3fcf642c7c1c30cdefbd087a1da775e0d7 repeat-element-1.1.4/000077500000000000000000000000001403343621300144235ustar00rootroot00000000000000repeat-element-1.1.4/.editorconfig000066400000000000000000000004411403343621300170770ustar00rootroot00000000000000# http://editorconfig.org/ root = true [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true [{**/{actual,fixtures,expected,templates}/**,*.md}] trim_trailing_whitespace = false insert_final_newline = false repeat-element-1.1.4/.eslintrc.json000066400000000000000000000073251403343621300172260ustar00rootroot00000000000000{ "extends": [ "eslint:recommended" ], "env": { "browser": false, "es6": true, "node": true, "mocha": true }, "parserOptions":{ "ecmaVersion": 9, "sourceType": "module", "ecmaFeatures": { "modules": true, "experimentalObjectRestSpread": true } }, "globals": { "document": false, "navigator": false, "window": false }, "rules": { "accessor-pairs": 2, "arrow-spacing": [2, { "before": true, "after": true }], "block-spacing": [2, "always"], "brace-style": [2, "1tbs", { "allowSingleLine": true }], "comma-dangle": [2, "never"], "comma-spacing": [2, { "before": false, "after": true }], "comma-style": [2, "last"], "constructor-super": 2, "curly": [2, "multi-line"], "dot-location": [2, "property"], "eol-last": 2, "eqeqeq": [2, "allow-null"], "generator-star-spacing": [2, { "before": true, "after": true }], "handle-callback-err": [2, "^(err|error)$" ], "indent": [2, 2, { "SwitchCase": 1 }], "key-spacing": [2, { "beforeColon": false, "afterColon": true }], "keyword-spacing": [2, { "before": true, "after": true }], "new-cap": [2, { "newIsCap": true, "capIsNew": false }], "new-parens": 2, "no-array-constructor": 2, "no-caller": 2, "no-class-assign": 2, "no-cond-assign": 2, "no-const-assign": 2, "no-control-regex": 2, "no-debugger": 2, "no-delete-var": 2, "no-dupe-args": 2, "no-dupe-class-members": 2, "no-dupe-keys": 2, "no-duplicate-case": 2, "no-empty-character-class": 2, "no-eval": 2, "no-ex-assign": 2, "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 2, "no-extra-parens": [2, "functions"], "no-fallthrough": 2, "no-floating-decimal": 2, "no-func-assign": 2, "no-implied-eval": 2, "no-inner-declarations": [2, "functions"], "no-invalid-regexp": 2, "no-irregular-whitespace": 2, "no-iterator": 2, "no-label-var": 2, "no-labels": 2, "no-lone-blocks": 2, "no-mixed-spaces-and-tabs": 2, "no-multi-spaces": 2, "no-multi-str": 2, "no-multiple-empty-lines": [2, { "max": 1 }], "no-native-reassign": 0, "no-negated-in-lhs": 2, "no-new": 2, "no-new-func": 2, "no-new-object": 2, "no-new-require": 2, "no-new-wrappers": 2, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 2, "no-proto": 0, "no-redeclare": 2, "no-regex-spaces": 2, "no-return-assign": 2, "no-self-compare": 2, "no-sequences": 2, "no-shadow-restricted-names": 2, "no-spaced-func": 2, "no-sparse-arrays": 2, "no-this-before-super": 2, "no-throw-literal": 2, "no-trailing-spaces": 0, "no-undef": 2, "no-undef-init": 2, "no-unexpected-multiline": 2, "no-unneeded-ternary": [2, { "defaultAssignment": false }], "no-unreachable": 2, "no-unused-vars": [2, { "vars": "all", "args": "none" }], "no-useless-call": 0, "no-with": 2, "one-var": [0, { "initialized": "never" }], "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], "padded-blocks": [0, "never"], "quotes": [2, "single", "avoid-escape"], "radix": 2, "semi": [2, "always"], "semi-spacing": [2, { "before": false, "after": true }], "space-before-blocks": [2, "always"], "space-before-function-paren": [2, "never"], "space-in-parens": [2, "never"], "space-infix-ops": 2, "space-unary-ops": [2, { "words": true, "nonwords": false }], "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], "use-isnan": 2, "valid-typeof": 2, "wrap-iife": [2, "any"], "yoda": [2, "never"] } } repeat-element-1.1.4/.gitattributes000066400000000000000000000003551403343621300173210ustar00rootroot00000000000000# 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 binaryrepeat-element-1.1.4/.gitignore000066400000000000000000000004561403343621300164200ustar00rootroot00000000000000# always ignore files *.DS_Store .idea .vscode *.sublime-* # test related, or directories generated by tests test/actual actual coverage .nyc* # npm node_modules npm-debug.log # yarn yarn.lock yarn-error.log # misc _gh_pages _draft _drafts bower_components vendor temp tmp TODO.md package-lock.jsonrepeat-element-1.1.4/.travis.yml000066400000000000000000000001121403343621300165260ustar00rootroot00000000000000sudo: false language: node_js node_js: - 'node' - '6' - '5' - '4' repeat-element-1.1.4/.verb.md000066400000000000000000000006351403343621300157650ustar00rootroot00000000000000## Usage ```js const 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 ] ``` repeat-element-1.1.4/LICENSE000066400000000000000000000021031403343621300154240ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015-present, Jon Schlinkert. 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. repeat-element-1.1.4/README.md000066400000000000000000000055361403343621300157130ustar00rootroot00000000000000# repeat-element [![NPM version](https://img.shields.io/npm/v/repeat-element.svg?style=flat)](https://www.npmjs.com/package/repeat-element) [![NPM monthly downloads](https://img.shields.io/npm/dm/repeat-element.svg?style=flat)](https://npmjs.org/package/repeat-element) [![NPM total downloads](https://img.shields.io/npm/dt/repeat-element.svg?style=flat)](https://npmjs.org/package/repeat-element) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repeat-element.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repeat-element) > Create an array by repeating the given value n times. Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install --save repeat-element ``` ## Usage ```js const repeat = require('repeat-element'); 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 ] ``` ## About
Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Running Tests Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: ```sh $ npm install && npm test ```
Building docs _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ To generate the readme, run the following command: ```sh $ npm install -g verbose/verb#dev verb-generate-readme && verb ```
### Contributors | **Commits** | **Contributor** | | --- | --- | | 17 | [jonschlinkert](https://github.com/jonschlinkert) | | 3 | [LinusU](https://github.com/LinusU) | | 1 | [architectcodes](https://github.com/architectcodes) | ### Author **Jon Schlinkert** * [GitHub Profile](https://github.com/jonschlinkert) * [Twitter Profile](https://twitter.com/jonschlinkert) * [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) ### License Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). Released under the [MIT License](LICENSE). *** _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 19, 2018._repeat-element-1.1.4/benchmark/000077500000000000000000000000001403343621300163555ustar00rootroot00000000000000repeat-element-1.1.4/benchmark/check.js000077500000000000000000000022501403343621300177720ustar00rootroot00000000000000'use strict'; const chalk = require('chalk'); const path = require('path'); const glob = require('glob'); const repeat = require('../'); /** * Sanity check. Run to ensure that all fns return the same result. */ let fixtures = glob.sync(__dirname + '/fixtures/*.js').map(require); let expected = fixtures.map(fixture => repeat.apply(repeat, fixture).length); glob.sync(__dirname + '/code/*.js').forEach(function (fp) { let fn = require(path.resolve(__dirname, 'code', fp)); let name = path.basename(fp, path.extname(fp)); let problems = []; fixtures.forEach(function (fixture, idx) { let 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) { let str = item[0] + ' gave ' + item[1] + ', expected ' + item[2]; console.log((idx === arr.length - 1 ? ' ┗ ' : ' ┣ ') + chalk.red(str)); }); } }); repeat-element-1.1.4/benchmark/code/000077500000000000000000000000001403343621300172675ustar00rootroot00000000000000repeat-element-1.1.4/benchmark/code/array-from.js000066400000000000000000000002301403343621300216770ustar00rootroot00000000000000'use strict'; function getThis() { return this; } module.exports = function repeat(ele, num) { return Array.from({length: num}, getThis, ele); }; repeat-element-1.1.4/benchmark/code/array-map-call.js000066400000000000000000000002321403343621300224240ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { return Array.prototype.map.call([] + Array(num + 1), function () { return ele; }); }; repeat-element-1.1.4/benchmark/code/array-map-valueOf.js000066400000000000000000000002121403343621300231100ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { return Array.apply(null, Array(num)).map(String.prototype.valueOf, ele); }; repeat-element-1.1.4/benchmark/code/current.js000066400000000000000000000000431403343621300213040ustar00rootroot00000000000000module.exports = require('../..'); repeat-element-1.1.4/benchmark/code/for-concat.js000066400000000000000000000002401403343621300216540ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var arr = []; for (var i = 0; i < num; i++) { arr = arr.concat(ele); } return arr; }; repeat-element-1.1.4/benchmark/code/for-join-1.js000077500000000000000000000002251403343621300215100ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var arr = []; for (; 0 < num; num -= 1, arr[num] = ele); num++; return arr; }; repeat-element-1.1.4/benchmark/code/for-join-2.js000066400000000000000000000002041403343621300215030ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var arr = []; for (; 0 < num; arr[--num] = ele); return arr; }; repeat-element-1.1.4/benchmark/code/for-length.js000066400000000000000000000004151403343621300216720ustar00rootroot00000000000000'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; } repeat-element-1.1.4/benchmark/code/for-new-array-1.js000077500000000000000000000002341403343621300224560ustar00rootroot00000000000000module.exports = repeat; function repeat(ele, num) { var arr = new Array(num); for (var i = 0; i < num; i++) { arr[i] = ele; } return arr; } repeat-element-1.1.4/benchmark/code/for-new-array-2.js000066400000000000000000000002411403343621300224520ustar00rootroot00000000000000module.exports = repeat; function repeat(ele, num) { var arr = new Array(num); for (var i = num - 1; i >= 0; i--) { arr[i] = ele; } return arr; } repeat-element-1.1.4/benchmark/code/for-push.js000066400000000000000000000002301403343621300213630ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var arr = []; for (var i = num; i > 0; i--) { arr.push(ele); } return arr; }; repeat-element-1.1.4/benchmark/code/new-array-map-1.js000066400000000000000000000002231403343621300224400ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { return Array.apply([], new Array(num)).map(function (nil) { return ele; }); }; repeat-element-1.1.4/benchmark/code/new-array-map-2.js000066400000000000000000000002251403343621300224430ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { return Array(num + 1).join(1).split('').map(function (nil) { return ele; }); }; repeat-element-1.1.4/benchmark/code/repeat-element.js000077500000000000000000000000611403343621300225340ustar00rootroot00000000000000'use strict'; module.exports = require('../..');repeat-element-1.1.4/benchmark/code/while-array-1.js000077500000000000000000000002111403343621300222040ustar00rootroot00000000000000'use strict'; module.exports = function repeat(val, num) { var arr = []; while (num--) { arr[num] = val; } return arr; }; repeat-element-1.1.4/benchmark/code/while-array-2.js000077500000000000000000000002261403343621300222130ustar00rootroot00000000000000'use strict'; module.exports = function repeat(val, num) { var arr = []; var i = 0; while (num--) { arr[i++] = val; } return arr; }; repeat-element-1.1.4/benchmark/code/while-array-3.js000077500000000000000000000002631403343621300222150ustar00rootroot00000000000000'use strict'; module.exports = function(val, num) { return repeat(val, num, []); }; function repeat(val, num, arr) { while (num--) { arr[num] = val; } return arr; } repeat-element-1.1.4/benchmark/code/while-bitwise.js000066400000000000000000000003511403343621300224000ustar00rootroot00000000000000 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; } repeat-element-1.1.4/benchmark/code/while-concat.js000077500000000000000000000002201403343621300221770ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var res = []; while (num--) { res = res.concat(ele); } return res; }; repeat-element-1.1.4/benchmark/code/while-exp.js000066400000000000000000000002541403343621300215300ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var res = [ele]; while (res.length < num) { res = res.concat(res); } return res.slice(0, num); }; repeat-element-1.1.4/benchmark/code/while-new-array-1.js000066400000000000000000000002161403343621300227750ustar00rootroot00000000000000module.exports = repeat; function repeat(ele, num) { var arr = new Array(num); while (num--) { arr[num] = ele; } return arr; } repeat-element-1.1.4/benchmark/code/while-new-array-2.js000066400000000000000000000002331403343621300227750ustar00rootroot00000000000000module.exports = repeat; function repeat(ele, num) { var arr = new Array(num); var i = 0; while (num--) { arr[i++] = ele; } return arr; } repeat-element-1.1.4/benchmark/code/while-push.js000066400000000000000000000002101403343621300217030ustar00rootroot00000000000000'use strict'; module.exports = function repeat(ele, num) { var arr = []; while (num--) { arr.push(ele); } return arr; }; repeat-element-1.1.4/benchmark/code/while-stack.js000066400000000000000000000003451403343621300220420ustar00rootroot00000000000000'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); }; repeat-element-1.1.4/benchmark/code/while-unshift.js000077500000000000000000000002211403343621300224110ustar00rootroot00000000000000'use strict'; module.exports = function repeat(val, amount) { var res = []; while (amount--) { res.unshift(val); } return res; }; repeat-element-1.1.4/benchmark/fixtures/000077500000000000000000000000001403343621300202265ustar00rootroot00000000000000repeat-element-1.1.4/benchmark/fixtures/0.js000077500000000000000000000000531403343621300207240ustar00rootroot00000000000000'use strict'; module.exports = ['afa', 0];repeat-element-1.1.4/benchmark/fixtures/1.js000077500000000000000000000000531403343621300207250ustar00rootroot00000000000000'use strict'; module.exports = ['abc', 1];repeat-element-1.1.4/benchmark/fixtures/100.js000077500000000000000000000000571403343621300210710ustar00rootroot00000000000000'use strict'; module.exports = ['fas', 100]; repeat-element-1.1.4/benchmark/fixtures/2.js000066400000000000000000000000531403343621300207230ustar00rootroot00000000000000'use strict'; module.exports = ['def', 2];repeat-element-1.1.4/benchmark/fixtures/2000.js000077500000000000000000000000601403343621300211440ustar00rootroot00000000000000'use strict'; module.exports = ['lll', 2000]; repeat-element-1.1.4/benchmark/fixtures/20000.js000066400000000000000000000000611403343621300212220ustar00rootroot00000000000000'use strict'; module.exports = ['lll', 20000]; repeat-element-1.1.4/benchmark/fixtures/25.js000077500000000000000000000000541403343621300210140ustar00rootroot00000000000000'use strict'; module.exports = ['iai', 25];repeat-element-1.1.4/benchmark/fixtures/250.js000077500000000000000000000000571403343621300210770ustar00rootroot00000000000000'use strict'; module.exports = ['bbb', 250]; repeat-element-1.1.4/benchmark/fixtures/3.js000066400000000000000000000000531403343621300207240ustar00rootroot00000000000000'use strict'; module.exports = ['ghi', 3];repeat-element-1.1.4/benchmark/fixtures/4.js000066400000000000000000000000531403343621300207250ustar00rootroot00000000000000'use strict'; module.exports = ['xyz', 4];repeat-element-1.1.4/benchmark/fixtures/5.js000077500000000000000000000000531403343621300207310ustar00rootroot00000000000000'use strict'; module.exports = ['fff', 5];repeat-element-1.1.4/benchmark/fixtures/50.js000077500000000000000000000000561403343621300210140ustar00rootroot00000000000000'use strict'; module.exports = ['xyz', 50]; repeat-element-1.1.4/benchmark/index.js000077500000000000000000000003361403343621300200270ustar00rootroot00000000000000'use strict'; const Suite = require('benchmarked'); const suite = new Suite({ result: false, fixtures: 'fixtures/{3,5,25,2000}.js', code: 'code/{current,while-push-new-array}.js', cwd: __dirname }); suite.run(); repeat-element-1.1.4/benchmark/last.md000066400000000000000000000004271403343621300176450ustar00rootroot00000000000000#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) repeat-element-1.1.4/index.js000066400000000000000000000006151403343621300160720ustar00rootroot00000000000000/*! * repeat-element * * Copyright (c) 2015-present, Jon Schlinkert. * Licensed under the MIT license. */ 'use strict'; module.exports = function repeat(ele, num) { if (Array.prototype.fill) { return new Array(num).fill(ele); } var arr = new Array(num); for (var i = 0; i < num; i++) { arr[i] = ele; } return arr; }; repeat-element-1.1.4/package.json000066400000000000000000000017411403343621300167140ustar00rootroot00000000000000{ "name": "repeat-element", "description": "Create an array by repeating the given value n times.", "version": "1.1.4", "homepage": "https://github.com/jonschlinkert/repeat-element", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "repository": "jonschlinkert/repeat-element", "bugs": { "url": "https://github.com/jonschlinkert/repeat-element/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "devDependencies": { "benchmarked": "^2.0.0", "chalk": "^2.4.1", "glob": "^7.1.2", "gulp-format-md": "^1.0.0", "minimist": "^1.2.0", "mocha": "^3.5.3" }, "keywords": [ "array", "element", "repeat", "string" ], "verb": { "toc": false, "layout": "default", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "lint": { "reflinks": true } } } repeat-element-1.1.4/test.js000066400000000000000000000025511403343621300157430ustar00rootroot00000000000000/*! * repeat-element * * Copyright (c) 2014 Jon Schlinkert, contributors. * Licensed under the MIT License */ 'use strict'; require('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]); });