fanh

Fluent and natty henchman

Usage no npm install needed!

<script type="module">
  import fanh from 'https://cdn.skypack.dev/fanh';
</script>

README

🍣 #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