1.2.1 • Published 1 year ago

nz-lodash v1.2.1

Weekly downloads
4
License
-
Repository
-
Last release
1 year ago

@nz/lodash

utilities functions that i think will be used in many apps. Basically every time you do an array method, or object method, or any other function that is not specific to an app and would be used in many apps, that mainly is using javascript vanilla should be placed here.

API

/**
 * Find an element in the array and replace that element
 * @param {array} the array to do the work on
 * @param {predicate} the predicate function to find the first element that match
 * @param {newValue} the replacement value
 * @returns {void}
 */
findAndReplace<T = any>(
  array: T[], 
  predicate: (val: T) => boolean, 
  newValue: T
)
/**
 * given an array we will find an item and remove it
 * @param arr the array to work on
 * @param predicate comparing items until this returns true
 */
findAndRemove<T>(arr: T[], predicate: (value: T) => boolean)

the library also contain base64 image manipulation to file and vice versa.

/**
 * return true if the browser is firefox
 * @returns if the browser is firefox
 */
isFirefox(): boolean