qm-js
v0.5.4
Published
A modular utility library for JavasScript
Downloads
1
Readme
QuartermasterJS
QuartermasterJS is a small, modular JavaScript library providing:
- functional style programming with
filter
,map
,fold
andreduce
functions - reactive programming constructs: signal, event streams and promises
- promise based modules for browser based JavaScript,
domready
,script-loader
andajax
- a
webstorage
module with a consistent API for local, session and cookie based storage - a small, simple module management system using named modules
with
require
anddefine
Quartermaster started out as a small core library for use by other modules, e.g.
reactive event streams and signals and promise based APIs such as domready
.
QuartermasterJS has no other dependencies.
The core module provides most of the common higher order
functions e.g 'forEach
, filter
, and map
used in functional programming.
Other modules can be used as required to provide additional functions for
working with arrays and objects.
Sub Modules
- 'qm-js/lib/array' - provides
tail
,head
,drop
,take
,partition
,zip
,compact
,flatten
- 'qm-js/lib/object' - provides versions of
filter
andmap
which return transformed objects - 'qm-js/lib/function' - provides
partial
,partialr
,curry
- 'qm-js/lib/promise' -
Promise.resolve
,Promise.reject
,Promise.all
,Promise.race
andPromise.defer
- 'qm-js/lib/reactive'- provides EventStream and Signal classes
- 'qm-js/lib/option' - based on Scala's
Option
type for representing optional values - 'qm-js/lib/try' - based on Scala's
Try
to represent a computation that may either result in an exception or return a successfully computed value - 'qm-js/lib/lens' - functional lens implementation
- 'qm-js/lib/collection' - provides
BoundedStack
andOrderedMap
implementations
Installation
npm install qm-js
For use in the browser, you can use any of the popular tools such as
Browserify or webpack to
package Quartermaster and any its modules according to your current
workflow or needs. All of Quartermaster's components are simple CommonJS
modules using module.exports
.
Quartermaster also provides a small (792 bytes minified), simple module system
that can be used. A version of Quartermaster for use with this module system can
found under lib/module
.
See the project wiki for more information.