0.2.2 • Published 7 years ago

ecma-utils v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

ECMA-UTILS

Ecma utils is a library created for use in many different projects. As such it doesn't strictly adhere to one paradigm or coding style over another. That being said, most of the functions I've been writing lately are to help with writing functional programming.

INSTALL
  npm i ecma-utils
  # or...
  yarn add ecma-utils
IS

The is class is a collection of static methods used for type validation. It is very simple to read and understand.

if (is.array(someThing)) {
  console.log('jump for joy')
}
if (is.not(is.object(someItems)) {
  console.log('Hey! That's a no object!')
}
UTILS

The utils module is a bunch of lambda abstraction type functions. The typical kit is in there, compose, map, reduce, pluck, an assortment of array and string functions. This module is under the most development/testing at the moment. As such it is incomplete and subject to great change in both how it works and how it is used.

CACHE-ME

The cache-me module is built to wrap object methods with a private cache. At the moment it only works for objects and methods, pass a list of strings as methods to wrap (to customize caching) or don't and the module will wrap each method on the object with a cache.

    const abacus = {
      add() {/*...*/},
      mult() {/*...*/},
      rand() {/*...*/}
    }
    
    // Cache only the add and mult methods on abacus
    cacheMe(myObject, 'add', 'mult')
Here is a list of all functions needing testing in utils

isCallable isObject isDefined isBool isNone not isNeg noop bool int sum list keys set get at zip unzipWith apply lastItem lastIndex head pluck pluckN immutableSplice count push map filter reduce padList tap lTap minOf maxOf inRange divideBy divide match replaceAll str strMatchRE strMatchStr strToRegExp ifOrElse orElse initializeToType compose runWith

 


Comments, Suggestions, Talky-talks?

Troubles, Issues, Uh-ohs and Boom-booms?

Thanks and Appreciation