Skip to content

Yet another lodash extension with filtermap, join product and toDictionary

Notifications You must be signed in to change notification settings

doxout/node-hidash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Yet another lodash extension with filtermap, join product and toDictionary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published