crackle
v0.1.0Crackle
JavaScript predicate, comparator, equality, and utility functions
Crackle is collection of useful JavaScript functions for both the browser and server. Specifically it focuses on collection predicate operations, such as "all or nothing" verification, and also makes working with sets of jQuery Objects easier.
##Getting started
###Node.js
Install Crackle with NPM (Node Package Manager).
$ npm install crackle
var Crackle = require('crackle');
###Web browser
Download and include crackle.min.js.
<script src="crackle.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
var values = [1, 2, 3];
var Is = Crackle.is;
if (Is(1).in(values)) {
alert(Crackle.not(values).in([1, 2, 3, 4, 5]));
}
</script>
##API
###Value predicates
Return true
if value self
exists in an Array that
.
Return true
if all values in Array self
satisfy Function predicate
.
Return true
if all values in Array self
satisfy String type
.
.is(self).instanceof(predicate)
Return true
if all values in Array self
are instanceof Constructor.
###Object predicates
Return true
if key
exists in Object self
.
.is(self).key(property).defined()
Return true
if key
exists for each Object in Array self
.
.is(self).key(property).all(predicate)
Return true
if Object[property]
satisfies Function predicate
for each Object in Array self
.
###jQuery
Return jQuery Object (Array) from HTML String (Array).
Return HTML String (Array) from jQuery Object (Array).
Return true
if DOM node self
and that
have the same HTML content or are the same ID.
###Utility
Return elements of Array self
not in Array that
.
Source Code
github.com/wayoutmind/crackl...Metadata
- Unknown
- *
- Fredrick Galoso
- released 5/29/2012