Package Exports
- orb-functions
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 (orb-functions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
orb-functions
orb-functions exposes a few useful functions to make programming using map, reduce, filter and other similar constructs less verbose.
Installation
Browser Installation. The module is exported as orbfns global variable.
<script src="https://cdn.jsdelivr.net/npm/orb-functions@1.0.0/dist/index.js"></script>
Node Installation
npm install orb-functions
self
// Example
const input = [1, 2, 3]
const toObject = ({items, key: kfn = self, value: vfn = self}) =>
items.reduce((c /** container */, v) => (c[kfn(v)] = vfn(v), c), {})
toObject({items: input})
// Output {1:1, 2:2, 3:3}
toObject({items: input, value: Math.square})
// Output {1:1, 2:4, 3:6}