版博士V2.0程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.md 3.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # array-each [![NPM version](https://img.shields.io/npm/v/array-each.svg?style=flat)](https://www.npmjs.com/package/array-each) [![NPM monthly downloads](https://img.shields.io/npm/dm/array-each.svg?style=flat)](https://npmjs.org/package/array-each) [![NPM total downloads](https://img.shields.io/npm/dt/array-each.svg?style=flat)](https://npmjs.org/package/array-each) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/array-each.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/array-each)
  2. > Loop over each item in an array and call the given function on every element.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save array-each
  7. ```
  8. ## Usage
  9. ### [each](index.js#L34)
  10. Loop over each item in an array and call the given function on every element.
  11. **Params**
  12. * `array` **{Array}**
  13. * `fn` **{Function}**
  14. * `thisArg` **{Object}**: (optional) pass a `thisArg` to be used as the context in which to call the function.
  15. * `returns` **{undefined}**
  16. **Example**
  17. ```js
  18. each(['a', 'b', 'c'], function(ele) {
  19. return ele + ele;
  20. });
  21. //=> ['aa', 'bb', 'cc']
  22. each(['a', 'b', 'c'], function(ele, i) {
  23. return i + ele;
  24. });
  25. //=> ['0a', '1b', '2c']
  26. ```
  27. ## About
  28. ### Related projects
  29. * [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.")
  30. * [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map "Faster, node.js focused alternative to JavaScript's native array map.")
  31. * [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map "Returns an array of mapped values from an array or object.")
  32. ### Contributing
  33. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  34. ### Building docs
  35. _(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.)_
  36. To generate the readme, run the following command:
  37. ```sh
  38. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  39. ```
  40. ### Running tests
  41. 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:
  42. ```sh
  43. $ npm install && npm test
  44. ```
  45. ### Author
  46. **Jon Schlinkert**
  47. * [github/jonschlinkert](https://github.com/jonschlinkert)
  48. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  49. ### License
  50. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  51. Released under the [MIT License](LICENSE).
  52. ***
  53. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 26, 2017._