hidash

0.2.0 • Public • Published

Hidash

A mixin extension of lodash

Source: hidash.js

filtermap(array, f)

Filter and map at the same time

Example:

 _.filtermap([1,2,3], function(x) { if (> 1) return x * x; });

Parameters:

  • {Array} array - The array to filter-map
  • {Function} f - function(item, k) => result or undefined

If the function returns undefined, the item will be filtered out.

Return:

{Array} the resulting lodash array

Go: TOC

product(array, other, f)

Get a join product of two arrays

Parameters:

  • {Array} array - The first array
  • {Array} other - The other array
  • {Function} f - (item1, item2) => result. If the function returns undefined, the pair will be filtered out.

Return:

{Array} - the resulting product.

Go: TOC

omap(array, keyfn, valfn)

Map an array (or a dictionary) of items to a dictionary.

Parameters:

  • {Array} array - The array to convert
  • {Function | String} keyfn - Either function (item, key) => newkey or just property name. If unspecified, the key remains the same.
  • {Function | String} valfn - Either function (item, kew) => newkey, property name or undefined. If unspecified, the value remains the same

Return:

{*} A dictionary.

Go: TOC

—generated by apidox

Dependencies (1)

Dev Dependencies (1)

Package Sidebar

Install

npm i hidash

Weekly Downloads

2

Version

0.2.0

License

MIT

Last publish

Collaborators

  • spion