0.1.0 • Published 7 years ago

shale v0.1.0

Weekly downloads
5
License
Apache v2
Repository
github
Last release
7 years ago

shale

A Javascript library for creating and manipulating immutable objects

shale : object

Kind: global namespace

shale.array : object

Kind: static namespace of shale

array.hashcode(arr) ⇒

A function that returns a hashcode for an array. You should never need to call this directly, just call shale.hashcode

Kind: static method of array
Returns: an hashcode for arr

ParamDescription
arrthe array to hash

array.compact(arr) ⇒

A function that compacts an array into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of array
Returns: an immutable representation of arr

ParamDescription
arrthe array to compact

array.equals(arr1, arr2) ⇒

A function that compares two arrays for deep equality. You should never call this directly, use shale.equals

Kind: static method of array
Returns: true if arr1 is equal to arr2, false otherwise

ParamDescription
arr1an array to compare
arr2an array to compare

array.slice(arr, begin, end) ⇒

A function that slices an array or an immutable array. This doesn't modify the source array.

Kind: static method of array
Returns: an immutable slice of val

ParamDescription
arrthe array or immutable array to slice
beginthe beginning index
endthe ending index

array.push(arr, end) ⇒

A function that pushes any number of elements onto an array or an immutable array. This doesn't modify the source array.

Kind: static method of array
Returns: an immutable array equivalent to ...arr, ...elements

ParamDescription
arrthe array or immutable array to 'push' onto
...elementsany number of elements to push onto the end of the arr
endthe ending index

array.pop(arr) ⇒

A function that 'pops' one element off the source array. This doesn't modify the source array, it returns an immutable copy of the array, minus the last element.

Kind: static method of array
Returns: an immutable array that is a copy of arr, with the last element removed

ParamDescription
arrthe array or immutable array to 'pop'

array.map(arr, func) ⇒

A function that maps every element of an array to a new array using a mapping function. This is equivalent to array.map, but the returned array is immutable

Kind: static method of array
Returns: an immutable array that is a mapped copy of the original

ParamDescription
arrthe array to map
functhe mapping function

array.filter(arr, func) ⇒

A function that filters elements from an array using a filter function. This is equivalent to array.filter, but the returned array is immutable

Kind: static method of array
Returns: an immutable array that is a filter copy of the original

ParamDescription
arrthe array to filter
functhe filter function

array.sort(arr, func) ⇒

A function that sorts an array or an immutable array. This doesn't modify the original array, but returns an immutable sorted copy.

Kind: static method of array
Returns: an immutable array that is a sorted immutable copy of the original

ParamDescription
arrthe array to filter
functhe sorting function

shale.boolean : object

Kind: static namespace of shale

boolean.hashcode(val) ⇒

A function that returns a hashcode for a boolean. You should never need to call this directly, just call shale.hashcode

Kind: static method of boolean
Returns: an hashcode for val

ParamDescription
valthe boolean to hash

boolean.compact(val) ⇒

A function that compacts a boolean into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of boolean
Returns: an immutable representation of val

ParamDescription
valthe boolean to compact

boolean.equals(val1, val2) ⇒

A function that compares two booleans for equality. You should never call this directly, use shale.equals

Kind: static method of boolean
Returns: true if val1 is equal to val2, false otherwise

ParamDescription
val1a boolean to compare
val2a boolean to compare

shale.null : object

Kind: static namespace of shale

null.hashcode(val) ⇒

A function that returns a hashcode for a null. You should never need to call this directly, just call shale.hashcode

Kind: static method of null
Returns: an hashcode for val

ParamDescription
valthe null to hash

null.compact(val) ⇒

A function that compacts a null into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of null
Returns: an immutable representation of val

ParamDescription
valthe null to compact

null.equals(val1, val2) ⇒

A function that compares two nulls for equality. You should never call this directly, use shale.equals

Kind: static method of null
Returns: true if val1 is equal to val2, false otherwise

ParamDescription
val1a null to compare
val2a null to compare

shale.number : object

Kind: static namespace of shale

number.hashcode(val) ⇒

A function that returns a hashcode for a number. You should never need to call this directly, just call shale.hashcode

Kind: static method of number
Returns: an hashcode for val

ParamDescription
valthe number to hash

number.compact(val) ⇒

A function that compacts a number into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of number
Returns: an immutable representation of val

ParamDescription
valthe number to compact

number.equals(val1, val2) ⇒

A function that compares two numbers for equality. You should never call this directly, use shale.equals

Kind: static method of number
Returns: true if val1 is equal to val2, false otherwise

ParamDescription
val1a number to compare
val2a number to compare

shale.object : object

Kind: static namespace of shale

object.hashcode(val) ⇒

A function that returns a hashcode for an object. You should never need to call this directly, just call shale.hashcode

Kind: static method of object
Returns: an hashcode for val

ParamDescription
valthe object to hash

object.compact(val) ⇒

A function that compacts an object into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of object
Returns: an immutable representation of val

ParamDescription
valthe object to compact

object.equals(val1, val2) ⇒

A function that compares two objects for deep equality. You should never call this directly, use shale.equals

Kind: static method of object
Returns: true if val1 is equal to val2, false otherwise

ParamDescription
val1an object to compare
val2an object to compare

object.patch(target) ⇒

A function that "patches" one object with others. This works like Object.assign, but without modifying the target object

Kind: static method of object
Returns: an immutable representation of the patched target

ParamDescription
targetthe target object to "patch"
...sourcesany number of source objects to patch target with

object.filter(obj, filter) ⇒

A function that returns a "filtered" copy of an object. This works like array.filter, but on each key-value pair of the object

Kind: static method of object
Returns: a filtered representation of obj

ParamDescription
objthe target object to "filter"
filtera filtering function (value, key, obj) => boolean

object.map(obj, ma) ⇒

A function that returns a "mapped" copy of an object. This works like array.map, but on each key-value pair of the object

Kind: static method of object
Returns: a mapped representation of obj

ParamDescription
objthe target object to "map"
maa mapping function (value, key, obj) => newValue

shale.string : object

Kind: static namespace of shale

string.hashcode(val) ⇒

A function that returns a hashcode for a string. You should never need to call this directly, just call shale.hashcode

Kind: static method of string
Returns: an hashcode for val

ParamDescription
valthe string to hash

string.compact(val) ⇒

A function that compacts a string into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of string
Returns: an immutable representation of val

ParamDescription
valthe string to compact

string.equals(val1, val2) ⇒

A function that compares two strings for equality. You should never call this directly, use shale.equals

Kind: static method of string
Returns: true if val1 is equal to val2, false otherwise

ParamDescription
val1a string to compare
val2a string to compare

shale.undefined : object

Kind: static namespace of shale

undefined.hashcode(val) ⇒

A function that returns a hashcode for an undefined. You should never need to call this directly, just call shale.hashcode

Kind: static method of undefined
Returns: an hashcode for val

ParamDescription
valthe undefined to hash

undefined.compact(val) ⇒

A function that compacts an undefined into an immutable representation. You should never need to call this directly, just call shale.compact

Kind: static method of undefined
Returns: an immutable representation of val

ParamDescription
valthe undefined to compact

undefined.equals(val1, val2) ⇒

A function that compares two undefineds for equality. You should never call this directly, use shale.equals

Kind: static method of undefined
Returns: true if val1 is equal to val2, false otherwise

ParamDescription
val1an undefined to compare
val2an undefined null to compare

shale.type ⇒

A function that returns the type of a value

Kind: static constant of shale
Returns: a type string

ParamDescription
valthe value to check

shale.hashcode(val) ⇒

A function that returns the shale hashcode of a value

Kind: static method of shale
Returns: a 32-bit hashcode

ParamDescription
valthe value to check

shale.compact(val) ⇒

A function that compacts a value into an immutable representation

Kind: static method of shale
Returns: an immutable representation of val

ParamDescription
valthe value to compact

shale.equals(val1, val2) ⇒

A function that checks if two values are equal

Kind: static method of shale
Returns: a boolean, true if val1 is equal to val2

ParamDescription
val1a value to compare
val2a value to compare