Skip to content
/ Q.JS Public

A set of functions for making assertions and queue/list/array processing more straight forward.

Notifications You must be signed in to change notification settings

rudenoise/Q.JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Q(estion/ueue)

A set of functions for making assertions and queue/list/array processing more straight forward.

It has very high unit test coverage so can confidently be used to reduce the number assertion based tests in other areas.

Methods starting is* return boolean for first argument.

The rest allow creation of functions that iterate over lists (fold and map are probably most usefull).

Q is heavily inspired by Scheme and the exercises in the Little Schemer by Daniel P Freidman and Matthhias Felleisen.

isF(untion)
isO(bject)
isA(rray)
isS(tring)
isN(umber)
isE(mpty)A(rr)
isE(mpty)S(tr)
isEq(al)
isU(ndefined)
areEq(ual)
inA(rray)

List processing, uses iterative or recursive technique (set to iterative by default - although some JS engines are tail recursion optimised and run faster than iteration)

h(head) - returns the head of a list h([1,2,3]);//1
t(ail) - returns the tail of a list Q.t([1,2,3]);//[2,3]
cons(concat in front)

objHas - obj = {a: {b: {c: 1}}} -> objHas(obj, "a.b.c") // true Q.objHas(obj, "a.x.y.z") // false

Code comments should describe usage

Q.JS by Joel Hughes is licensed under a Creative Commons Attribution 3.0 Unported License
This work is licenced under the Creative Commons Attribution 3.0 Unported License. To view a copy of this licence, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.

About

A set of functions for making assertions and queue/list/array processing more straight forward.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages