{"_id":"dup","_rev":"404049","name":"dup","description":"Initialize an array of arrays to a constant","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"time":{"modified":"2021-08-04T04:42:33.000Z","created":"2013-04-10T01:32:26.714Z","1.0.0":"2014-04-28T23:54:31.084Z","0.0.0":"2013-04-10T01:32:26.714Z"},"users":{},"author":{"name":"Mikola Lysenko"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/dup.git"},"versions":{"1.0.0":{"name":"dup","version":"1.0.0","description":"Initialize an array of arrays to a constant","main":"dup.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"~0.4.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/dup.git"},"keywords":["dup","initialize","array","constant","numeric","rep","zeros","matlab","clear","ndarray","grid","matrix","vector","tensor"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"66f747c219c492e9450d2d5b7bf8fb5c74d57dc2","bugs":{"url":"https://github.com/mikolalysenko/dup/issues"},"homepage":"https://github.com/mikolalysenko/dup","_id":"dup@1.0.0","dist":{"shasum":"51fc5ac685f8196469df0b905e934b20af5b4029","size":2367,"noattachment":false,"key":"/dup/-/dup-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/dup/download/dup-1.0.0.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"publish_time":1398729271084,"_cnpm_publish_time":1398729271084,"_hasShrinkwrap":false},"0.0.0":{"name":"dup","version":"0.0.0","description":"Initialize an array of arrays to a constant","main":"dup.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"~0.4.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/dup.git"},"keywords":["dup","initialize","array","constant","numeric","rep","zeros","matlab","clear","ndarray","grid","matrix","vector","tensor"],"author":{"name":"Mikola Lysenko"},"license":"MIT","readmeFilename":"README.md","gitHead":"66f747c219c492e9450d2d5b7bf8fb5c74d57dc2","_id":"dup@0.0.0","dist":{"shasum":"680c4c51ace6ab9fe3bc6e48d9cab26c0396abd7","size":1695,"noattachment":false,"key":"/dup/-/dup-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/dup/download/dup-0.0.0.tgz"},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"publish_time":1365557546714,"_cnpm_publish_time":1365557546714,"_hasShrinkwrap":false}},"readme":"# dup\nInitializes an n-dimensional array to a constant value.\n\n## Install\n\n    npm install dup\n    \n## Example\n\n```javascript\nvar dup = require(\"dup\")\n\nconsole.log(dup(5))\n\n//Prints:\n//\n//    [0, 0, 0, 0, 0]\n//\n\n\nconsole.log(dup([3,2], 1))\n\n//Prints:\n//\n//    [[1, 1],\n//     [1, 1],\n//     [1, 1]]\n//\n```\n\n## `require(\"dup\")(shape[, value])`\nInitializes an array to a constant value\n\n* `shape` Either an array of dimensions or a scalar, representing the shape of the array to create.\n* `value` The value to initialize the array with.  Default is 0\n\n**Returns** An n-dimensional array with the given shape and value\n\n## Rationale\nI often find myself using [numeric.js'](http://www.numericjs.com/) `rep` method in my projects.  However, for many things pulling in all of numeric.js is total overkill, especially for code that ultimately needs to run on the browser.  So I decided to make this library which just implements the `rep` and nothing else in the spirit of promoting modularity by smaller and more numerous packages.\n\n# Credits\n(c) 2013 Mikola Lysenko. MIT License","_attachments":{},"homepage":"https://github.com/mikolalysenko/dup","bugs":{"url":"https://github.com/mikolalysenko/dup/issues"},"license":"MIT"}