Socket
Socket
Sign inDemoInstall

fauxdash

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fauxdash

I don't know it's not lodash


Version published
Maintainers
1
Install size
26.4 kB
Created

Changelog

Source

1.7.3 (2022-03-31)

Bug Fixes

  • correct use of mapCall to default to passing an object when no properties were found (c32bac8)
  • improve calls that iterate instance properties by including first prototype as well (1f8ca9d)

Readme

Source

fauxdash

This is because I got tired of writing the same kinds of things over and didn't want the to import 3-5 full dependencies. This is for Node 6 forward only. It should probably never be used outside my own projects.

API

any(list, [predicate])

Returns true if anything in the list passes the predicate. The predicate defaults to unit (x => x) so, "is anything in this list truthy?" is the default.

applyWhen(fn, args)

Returns a promise for the application of the function call fn where it will apply the args passed (an array) but only after resolving any promises in the list first.

bindAll(obj)

Binds every method in the obj's prototype chain to it. Every last one.

contains(list, value)

Returns a boolean indicating the value's presence in the list.

clone(obj)

Creates a deep clone of the obj.

defaults(obj, ...defaults)

Returns a new object with missing keys backfilled from objects passed in defaults. Uses left-to-right ordering. Will not over-write values.

each(obj, iterator)

Executes the iterator for every key-value-pair in obj. Calls iterator with value, key arguments.

exists(value)

Shorthand for checking value against undefined and null.

filter(list, [predicate])

Returns list without

find(list, [predicate])

Returns the first item in the list that matches predicate where predicate defaults to unit.

flatten(nestedArray)

Returns single dimensional array.

future()

Returns a hash with promise, resolve, reject properties.

getArguments(fn)

Returns a list of the arguments contained in the function fn.

has(obj, propertyName)

Returns a boolean indicating if obj has a property named propertyName. Ignores properties set to undefined or null.

intersection(list1, list2)

Returns a list of the items contained in both lists.

last(list, [predicate])

Returns the last occurence of an item matching predicate where predicate defaults to unit.

lift(asyncFn)

Returns a promisified version of the Node-style async function asyncFn.

map(obj, iterator)

Returns an array based on running iterator against every key value pair in obj. Calls iterator with value, key argument ordering.

mapCall(method, map)

Takes a method that accepts a context arg and then a series of arguments that require a mapping from an incoming object.

Returns a new function that takes a context argument and an object to be mapped across the rest of the arguments.

matches(filter)

Creates a new function that compares a value for deep equality to make comparisons simpler and repeatable.

melter(target, ...args)

Combines objects in the args onto the target and rebinds any functions to the new target. Will not work on arrow functions! (their this is inherited from lexical scope and cannot be set via bind).

memoize(function)

Returns a memoized instance of the function which will memoize results based on a WeakSet of arguments passed.

merge(...objects)

Deep merges objects provided with the latter overriding the former.

omit(obj, ...keys)

Returns a new version of obj without the keys.

noop

parseFunction(fn)

Returns an object with the properties name and arguments.

reduce(obj, iterator, accumulator)

Returns a reduction over the key value pairs in obj calling iterator. Calls iterator with accumulator, value, key argument order.

sequence(...functions)

Executes the list of functions in order and returns a list with the ordered results. Functions can return a promise.

sortBy(list, identity)

Returns list sorted by the result returned from identity for each item.

transform(obj, aliases, [...omit])

Renames keys in obj using the aliases lookup. Will omit any key in omit.

trim(list)

Returns a new list with the space trimmed from every item.

trimString()

Trims space from str.

type(obj)

Returns the obj's prototype name.

uniq(list)

Returns a unique list of values from list.

unique(list, identity)

Return a unique list of values from list based on the result of the identity function for each item.

values(obj)

Return the values from an Object. (like Object.values)

without(list1, list2)

Return a unique set of list1 without any of the values from list2.

Type Tests

All of the following return a boolean based on the type of the value passed:

  • isDate(value)
  • isEqual(value)
  • isFunction(value)
  • isNumber(value)
  • isObject(value)
  • isPlainObject(value)
  • isPromisey(value)
  • isStub(value)
  • isString(value)

FAQs

Last updated on 31 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc