package/package.json000644 000767 000024 0000002327 13055320453013023 0ustar00000000 000000 { "name": "arr-map", "description": "Faster, node.js focused alternative to JavaScript's native array map.", "version": "2.0.2", "homepage": "https://github.com/jonschlinkert/arr-map", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "repository": "jonschlinkert/arr-map", "bugs": { "url": "https://github.com/jonschlinkert/arr-map/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha", "benchmark": "node benchmark" }, "dependencies": { "make-iterator": "^1.0.0" }, "devDependencies": { "array-map": "^0.0.0", "benchmarked": "^0.2.5", "braces": "^2.0.3", "chalk": "^1.1.3", "glob": "^7.1.1", "gulp-format-md": "^0.1.11", "micromatch": "^2.3.11", "mocha": "^3.2.0" }, "keywords": [ "arr", "array", "map" ], "verb": { "toc": false, "layout": "default", "tasks": [ "readme" ], "related": { "list": [ "arr-diff", "arr-filter", "arr-flatten", "arr-reduce" ] }, "plugins": [ "gulp-format-md" ], "lint": { "reflinks": true } } } package/README.md000644 000767 000024 0000006710 13054673006012020 0ustar00000000 000000 # arr-map [![NPM version](https://img.shields.io/npm/v/arr-map.svg?style=flat)](https://www.npmjs.com/package/arr-map) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-map.svg?style=flat)](https://npmjs.org/package/arr-map) [![NPM total downloads](https://img.shields.io/npm/dt/arr-map.svg?style=flat)](https://npmjs.org/package/arr-map) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-map.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-map) > Faster, node.js focused alternative to JavaScript's native array map. ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install --save arr-map ``` ## Why use this? JavaScript's native `Array.map()` is slow, and other popular array map libraries are focused on browser compatibility, which makes them bloated or less than idea for non-browser usage. This implementation is focused on node.js usage keeping it light and fast. ## Usage ```js var map = require('arr-map'); map(['a', 'b', 'c'], function(ele) { return ele + ele; }); //=> ['aa', 'bb', 'cc'] map(['a', 'b', 'c'], function(ele, i) { return i + ele; }); //=> ['0a', '1b', '2c'] ``` ## About ### Related projects * [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://github.com/jonschlinkert/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.") * [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.") * [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") * [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce "Fast array reduce that also loops over sparse elements.") ### Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). ### 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 ``` ### 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 ``` ### Author **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) ### License Copyright © 2017, [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.4.2, on February 28, 2017._package/LICENSE000644 000767 000024 0000002100 12504425211011523 0ustar00000000 000000 The MIT License (MIT) Copyright (c) 2015, 2017, 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. package/index.js000644 000767 000024 0000000707 13054672662012215 0ustar00000000 000000 /*! * arr-map * * Copyright (c) 2015, 2017, Jon Schlinkert. * Released under the MIT License. */ 'use strict'; var iterator = require('make-iterator'); module.exports = function map(arr, fn, thisArg) { if (arr == null) return []; fn = iterator(fn, thisArg); var len = arr.length; var res = new Array(len); for (var i = 0; i < len; i++) { res[i] = fn(arr[i], i, arr); } return res; };