fanh

0.0.10 • Public • Published

🍣 #WIP 🍣

Fluent and natty henchman

Hope'll come up with a better phrase...!

Yet another JS utility library...!

  • Boolean utilities

    • NOT - Get the reversed boolean value, useful for avoiding the "!"
    if (NOT(isValid)) {
      // Do this...!
    }
    • AND - Returns true if all arguments are true
    const isNumber = AND(typeof val === 'number', val === val)
    • OR - Returns true if any of arguments is true
    const isNil = OR(val === null, val === undefined)
    • invert - Get the inverted version of the given function, useful for things like:
    const isNOTNumber = invert(isNumber)
  • Function utilities

    • noOp - It just an empty function that takes nothing and does nothing
    const { onSubmit = noOp } = props
  • Timing utilities

    • delay - Return a promise which resolves after some milliseconds
    await delay(16)
  • Array utilities

    • dedupe - Create a new array without duplicated elements
    const uniqueNames = dedupe('js', 'sushi', 'js', 'fanh')
    // Result would be: ['js', 'sushi', 'fanh']
    • findBy - Find a element which has a field equal to given value
    const fanh = findBy(coders, 'name', 'fanh')
    // Result would be a coder with name: fanh

Package Sidebar

Install

npm i fanh

Weekly Downloads

2

Version

0.0.10

License

ISC

Unpacked Size

13.4 kB

Total Files

4

Last publish

Collaborators

  • hoangph271