JSPM

arraymap

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 42
  • Score
    100M100P100Q63931F
  • License MIT

Curried function deriving new array values by applying provided function to each item/index of provided array. Fast and compatible with modern or old browsers.

Package Exports

  • arraymap

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (arraymap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

arraymap

Curried function deriving new array values by applying provided function to each item/index of provided array. Fast and compatible with modern or old browsers.

Build Status Code Climate js-standard-style

npm install arraymap --save

You can also use Duo, Bower or download the files manually.

npm stats

npm NPM downloads David

Overview

Optionally, a dot-notation formatted string may be provided for item property access.

API Example

Pointful
var map = require('arraymap')
var characters = ['a', 'b', 'c']
var codepoints = (letter) => punycode.ucs2.decode(letter)[0]

map(codepoints, characters)
//=> [ 97, 98, 99 ]
Pointful (dot-notation object access)
var map = require('arraymap')
var collection = [ { letter: 'a' }, { letter: 'b' }, { letter: 'c' }  ]

map('letter', collection)
//=> ['a', 'b', 'c']
Pointfree Style
var map = require('arraymap')
var collection = [ { letter: 'a' }, { letter: 'b' }, { letter: 'c' }  ]
var promise = Promise.resolve(collection)

promise.then(map('letter'))
//=> ['a', 'b', 'c']

API

map(fn, list)

arguments
  • fn (Function|String).
  • list (array).
returns
  • (array) Array resulting from applying provided function fn to each item of list.

Alternatives

Contributing

SEE: contributing.md

Licenses

GitHub license