npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shale

v0.1.0

Published

A Javascript library for creating and manipulating immutable objects

Downloads

5

Readme

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

| Param | Description | | --- | --- | | arr | the 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

| Param | Description | | --- | --- | | arr | the 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

| Param | Description | | --- | --- | | arr1 | an array to compare | | arr2 | an 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

| Param | Description | | --- | --- | | arr | the array or immutable array to slice | | begin | the beginning index | | end | the 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 ]

| Param | Description | | --- | --- | | arr | the array or immutable array to 'push' onto | | ...elements | any number of elements to push onto the end of the arr | | end | the 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

| Param | Description | | --- | --- | | arr | the 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

| Param | Description | | --- | --- | | arr | the array to map | | func | the 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

| Param | Description | | --- | --- | | arr | the array to filter | | func | the 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

| Param | Description | | --- | --- | | arr | the array to filter | | func | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | a boolean to compare | | val2 | a 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | a null to compare | | val2 | a 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | a number to compare | | val2 | a 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | an object to compare | | val2 | an 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

| Param | Description | | --- | --- | | target | the target object to "patch" | | ...sources | any 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

| Param | Description | | --- | --- | | obj | the target object to "filter" | | filter | a 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

| Param | Description | | --- | --- | | obj | the target object to "map" | | ma | a 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | a string to compare | | val2 | a 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | an undefined to compare | | val2 | an undefined null to compare |

shale.type ⇒

A function that returns the type of a value

Kind: static constant of shale
Returns: a type string

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val | the 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

| Param | Description | | --- | --- | | val1 | a value to compare | | val2 | a value to compare |