ecma-utils
v0.2.2
Published
A collection of ECMAScript utilities for use in any JavaScript projects.
Downloads
18
Maintainers
Readme
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?
- email Michael Rosata [email protected]
Troubles, Issues, Uh-ohs and Boom-booms?
Thanks and Appreciation
- RollupJs
- BabelJs
- Mocha Testing Framework
- Chai Testing Library
- Istanbul Code Coverage
- NPM and Yarn package management.