hidash

Yet another mixin extension of lodash, with join product, toDictionary and filtermap

npm install hidash
6 downloads in the last week
19 downloads in the last month

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 (x > 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

npm loves you