Prime-Util
Your utilities for prime
Install
npm install prime-util
Current Modules Docs
prime/bound
Provides an alternative way to bind class methods. Stores references to bound methods internally without any manual setup and does not modify the original methods.
var bound = var MyPrime =
prime/parentize
Parentize makes it easier to call overridden parent methods.
var parentize = var array = var A = var B = var b = console // logs "b,c,d"
prime/options
Provide "setOptions" method.
var prime = var Options = var A = var a = 'b': 'B' 'c': 'e': 'E'console; // {'a': 'aaa', 'b': 'B', 'c': {'d': 'ddd', 'e': 'E'}}
array/associate
Creates an object with key-value pairs based on the array of keywords passed in and the current content of the array.
var animals = 'Cow' 'Pig' 'Dog' 'Cat'var sounds = 'Moo' 'Oink' 'Woof' 'Miao'// returns {'Cow': 'Moo', 'Pig': 'Oink', 'Dog': 'Woof', 'Cat': 'Miao'}
array/include
Pushes the passed element into the array if it's not already present (case and type sensitive).
// returns ['Cow', 'Pig', 'Dog', 'Cat'] // returns ['Cow', 'Pig', 'Dog']
array/empty
Empties an array.
var myArray = 'old' 'data') // myArray is now []
array/pick
Returns the first defined value of the array passed in, or null.
// "foo" // "bar"
object/fromPath
Returns the value from an object by its path
// 'red'
Removed Modules
The following modules have been removed:
- prime/mixin - use
mixin
property of prime - array/clean - use (mout/array/compact)
- array/invoke - use (mout/array/invoke)
- array/contains - use (mout/array/contains)
- array/append - use (mout/array/append)
- array/random - use (mout/random/choice)
- array/combine - use (mout/array/combine)
- array/find - use (mout/array/find)
- object/merge - use (mout/array/merge)