Utility set for JS.
- Written in LiveScript.
- Inspired by prelude-ls, underscore and fast.js.
- See method index below
- Github pages with more detailed examples are coming soon...
var sortPostsByName = prelude.array.sortBy(function (post) { return post.name; });
var sorted_posts = sortPostsByName posts
npm install prelude
All functions with 2 or more arguments are curried and generally return
copies of their inputs, thus treating them as immutable (with the exception
of object.mixin
where this behavior is not always wanted).
Array prelude.array.<method>
- empty
- has
- contains
- clone
- head
- first
- tail
- last
- initial
- slice
- concat
- flatten
- reverse
- each
- map
- filter
- shuffle
- every
- some
- zip
- zipWith
- partition
- unique
- uniqueBy
- difference
- intersection
- union
- sortBy
- countBy
- groupBy
- splitAt
- index
- indices
- findIndex
- findIndices
Object prelude.object.<method>
- empty
- has
- contains
- keys
- values
- clone
- flatten
- each
- map
- filter
- every
- some
- partition
- keyOf
- keysOf
- findKey
- findKeys
- fromPairs
- toPairs
- fill
- deepFill
- mixin
- deepMixin
- freeze
- deepFreeze
- toJSON
- fromJSON
- definePublic
- definePrivate
- defineStatic
- defineMeta
String prelude.string.<method>
- empty
- contains
- trim
- trimLeft
- trimRight
- repeat
- reverse
- capitalize
- capitalizeSentence
- decapitalize
- decapitalizeSentence
- camelize
- dasherize
Number prelude.number.<method>
- even
- odd
- random
- range
- gcd
- lcm
Fn prelude.fn.<method>
- id
- curry
- compose
- apply
- applyTo
- applyNew
- flip
- delay
- interval
- immediate
- tryCatch
Type prelude.type.<method>
- getType
- isNumber
- isString
- isBoolean
- isFunction
- isArray
- isSet
- isObject
- isMap
- isArguments
- isDate
- isError
- isRegExp
- isSymbol
- isDefined
- isNull
- isUndefined
- isUUID
- isInteger
- inRange