Comparing version 0.1.0 to 0.2.0
@@ -6,3 +6,2 @@ | ||
* The first array will be modified. | ||
* @version 0.1.1 (2012/06/10) | ||
*/ | ||
@@ -9,0 +8,0 @@ function append(arr1, arr2) { |
@@ -6,3 +6,2 @@ var indexOf = require('./indexOf'); | ||
* Does not allow duplicates and is case and type sensitive. | ||
* @version 0.1.0 (2012/01/28) | ||
*/ | ||
@@ -9,0 +8,0 @@ function combine(arr1, arr2) { |
@@ -5,3 +5,2 @@ var filter = require('./filter'); | ||
* Remove all null/undefined items from array. | ||
* @version 0.1.0 (2011/11/15) | ||
*/ | ||
@@ -8,0 +7,0 @@ function compact(arr) { |
@@ -5,3 +5,2 @@ var indexOf = require('./indexOf'); | ||
* If array contains values. | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -8,0 +7,0 @@ function contains(arr, val) { |
@@ -9,3 +9,2 @@ var unique = require('./unique'); | ||
* Return a new Array with elements that aren't present in the other Arrays. | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -12,0 +11,0 @@ function difference(arr) { |
@@ -5,3 +5,2 @@ | ||
* Array every | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function every(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* Array filter | ||
* @version 0.4.0 (2012/07/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function filter(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ var some = require('./some'); | ||
* Returns first item that matches criteria | ||
* @version 0.3.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function find(arr, iterator, thisObj){ |
@@ -30,3 +30,2 @@ var isArray = require('../lang/isArray'); | ||
* If `shallow` is true, it will only flatten one level. | ||
* @version 0.1.0 (2012/08/02) | ||
*/ | ||
@@ -33,0 +32,0 @@ function flatten(arr, shallow) { |
@@ -5,3 +5,2 @@ | ||
* Array forEach | ||
* @version 0.8.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function forEach(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ | ||
* Array.indexOf | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function indexOf(arr, item, fromIndex) { |
@@ -6,3 +6,2 @@ var difference = require('./difference'); | ||
* Insert item into array if not already present. | ||
* @version 0.2.0 (2012/01/28) | ||
*/ | ||
@@ -9,0 +8,0 @@ function insert(arr, rest_items) { |
@@ -10,3 +10,2 @@ var unique = require('./unique'); | ||
* - based on underscore.js implementation | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -13,0 +12,0 @@ function intersection(arr) { |
@@ -6,3 +6,2 @@ var forEach = require('./forEach'); | ||
* needed. | ||
* @version 0.1.0 (2012/10/02) | ||
*/ | ||
@@ -9,0 +8,0 @@ function invoke(arr, methodName, var_args){ |
@@ -10,3 +10,2 @@ var filter = require('./filter'); | ||
* Null values and empty strings will be excluded. | ||
* @version 0.1.0 (2012/08/24) | ||
*/ | ||
@@ -13,0 +12,0 @@ function join(items, separator) { |
@@ -5,3 +5,2 @@ | ||
* Array lastIndexOf | ||
* @version 0.4.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function lastIndexOf(arr, item, fromIndex) { |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* Array map | ||
* @version 0.5.0 (2012/11/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function map(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* Return maximum value inside array | ||
* @version 0.1.0 (2012/01/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function max(arr, iterator){ |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* Return minimum value inside array | ||
* @version 0.1.0 (2012/01/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function min(arr, iterator){ |
@@ -5,3 +5,2 @@ var randInt = require('../random/randInt'); | ||
* Remove a random item from the Array and return it | ||
* @version 0.1.0 (2012/04/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pick(arr){ |
@@ -6,3 +6,2 @@ var map = require('./map'); | ||
* Extract a list of property values. | ||
* @version 0.1.0 (2012/06/04) | ||
*/ | ||
@@ -9,0 +8,0 @@ function pluck(arr, propName){ |
@@ -5,3 +5,2 @@ var countSteps = require('../math/countSteps'); | ||
* Returns an Array of numbers inside range. | ||
* @version 0.1.0 (2011/11/15) | ||
*/ | ||
@@ -8,0 +7,0 @@ function range(start, stop, step) { |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* Array reduce | ||
* @version 0.3.0 (2012/07/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reduce(arr, fn, initVal) { |
@@ -5,3 +5,2 @@ | ||
* Array reduceRight | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reduceRight(arr, fn, initVal) { |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* Array reject | ||
* @version 0.1.0 (2012/09/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reject(arr, callback, thisObj) { |
@@ -6,3 +6,2 @@ var indexOf = require('./indexOf'); | ||
* (it won't remove duplicates, just a single item) | ||
* @version 0.1.1 (2012/03/13) | ||
*/ | ||
@@ -9,0 +8,0 @@ function remove(arr, item){ |
@@ -5,3 +5,2 @@ var indexOf = require('./indexOf'); | ||
* Remove all instances of an item from array. | ||
* @version 0.1.1 (2012/01/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function removeAll(arr, item){ |
@@ -6,3 +6,2 @@ var randInt = require('../random/randInt'); | ||
* Shuffle array items. | ||
* @version 0.2.0 (2011/11/17) | ||
*/ | ||
@@ -9,0 +8,0 @@ function shuffle(arr) { |
@@ -5,3 +5,2 @@ | ||
* Array some | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function some(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ | ||
* Merge sort (http://en.wikipedia.org/wiki/Merge_sort) | ||
* @version 0.1.0 (2012/05/23) | ||
*/ | ||
@@ -8,0 +7,0 @@ function mergeSort(arr, compareFn) { |
@@ -5,3 +5,2 @@ | ||
* Split array into a fixed number of segments. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -8,0 +7,0 @@ function split(array, segments) { |
@@ -10,3 +10,2 @@ var isFunction = require('../lang/isFunction'); | ||
* value. | ||
* @version 0.1.0 (2012/08/02) | ||
*/ | ||
@@ -13,0 +12,0 @@ function toLookup(arr, key) { |
@@ -5,3 +5,2 @@ var unique = require('./unique'); | ||
* Concat multiple arrays and remove duplicates | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -8,0 +7,0 @@ function union(arrs) { |
@@ -6,3 +6,2 @@ var indexOf = require('./indexOf'); | ||
* @return {array} Array of unique items | ||
* @version 0.1.0 (2011/10/18) | ||
*/ | ||
@@ -9,0 +8,0 @@ function unique(arr){ |
@@ -9,3 +9,2 @@ var unique = require('./unique'); | ||
* - like ptyhon's `symmetric_difference` | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -12,0 +11,0 @@ function xor(arr1, arr2) { |
@@ -7,3 +7,2 @@ var max = require('./max'); | ||
* corresponding position. | ||
* @version 0.1.0 (2012/10/30) | ||
*/ | ||
@@ -10,0 +9,0 @@ function zip(arr){ |
@@ -6,3 +6,2 @@ var make = require('./make_'); | ||
/** | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -9,0 +8,0 @@ module.exports = make(arrContains, objContains); |
@@ -6,3 +6,2 @@ var make = require('./make_'); | ||
/** | ||
* @version 0.1.0 (2012/11/03) | ||
*/ | ||
@@ -9,0 +8,0 @@ module.exports = make(arrEvery, objEvery); |
@@ -5,3 +5,2 @@ var forEach = require('./forEach'); | ||
* filter collection values, returns array. | ||
* @version 0.3.0 (2012/11/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function filter(list, iterator, context) { |
@@ -7,3 +7,2 @@ var make = require('./make_'); | ||
* Find value that returns true on iterator check. | ||
* @version 0.2.0 (2012/11/19) | ||
*/ | ||
@@ -10,0 +9,0 @@ module.exports = make(arrFind, objFind); |
@@ -6,3 +6,2 @@ var make = require('./make_'); | ||
/** | ||
* @version 0.1.1 (2012/10/30) | ||
*/ | ||
@@ -9,0 +8,0 @@ module.exports = make(arrForEach, objForEach); |
@@ -5,3 +5,2 @@ | ||
* internal method used to create other collection modules. | ||
* @version 0.2.0 (2012/10/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function makeCollectionMethod(arrMethod, objMethod, defaultReturn) { |
@@ -7,3 +7,2 @@ var isObject = require('../lang/isObject'); | ||
* Map collection values, returns Array. | ||
* @version 0.2.0 (2012/11/19) | ||
*/ | ||
@@ -10,0 +9,0 @@ function map(list, callback, thisObj) { |
@@ -7,3 +7,2 @@ var make = require('./make_'); | ||
* Get maximum value inside collection | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -10,0 +9,0 @@ module.exports = make(arrMax, objMax); |
@@ -7,3 +7,2 @@ var make = require('./make_'); | ||
* Get minimum value inside collection. | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -10,0 +9,0 @@ module.exports = make(arrMin, objMin); |
@@ -5,3 +5,2 @@ var map = require('./map'); | ||
* Extract a list of property values. | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pluck(list, key) { |
@@ -6,3 +6,2 @@ var make = require('./make_'); | ||
/** | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -9,0 +8,0 @@ module.exports = make(arrReduce, objReduce); |
@@ -5,3 +5,2 @@ var filter = require('./filter'); | ||
* Inverse or collection/filter | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reject(list, iterator, context) { |
@@ -6,3 +6,2 @@ var isArray = require('../lang/isArray'); | ||
* Get collection size | ||
* @version 0.2.0 (2012/11/16) | ||
*/ | ||
@@ -9,0 +8,0 @@ function size(list) { |
@@ -6,3 +6,2 @@ var make = require('./make_'); | ||
/** | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -9,0 +8,0 @@ module.exports = make(arrSome, objSome); |
@@ -7,6 +7,11 @@ # lang # | ||
## clone(val):* | ||
## deepClone(val, [instanceClone]):* | ||
Deep clone native types like Object, Array, RegExp, Date and primitives. | ||
The `instanceClone` function will be invoked to clone objects that are not | ||
"plain" objects (as defined by [`isPlainObject`](#isPlainObject)) if it is | ||
provided. If `instanceClone` is not specified, it will not attempt to clone | ||
non-plain objects, and will copy the object reference. | ||
### Example | ||
@@ -16,3 +21,3 @@ | ||
var a = {foo:'bar', obj: {a:1, b:2}}; | ||
var b = clone(a); // {foo:'bar', obj: {a:1, b:2}} | ||
var b = deepClone(a); // {foo:'bar', obj: {a:1, b:2}} | ||
console.log( a === b ); // false | ||
@@ -22,3 +27,3 @@ console.log( a.obj === b.obj ); // false | ||
var c = [1, 2, [3, 4]]; | ||
var d = clone(c); // [1, 2, [3, 4]] | ||
var d = deepClone(c); // [1, 2, [3, 4]] | ||
var e = c.concat(); // [1, 2, [3, 4]] | ||
@@ -29,2 +34,8 @@ | ||
console.log( e[2] === d[2] ); // true | ||
function Custom() { } | ||
function cloneCustom(x) { return new Custom(); } | ||
var f = { test: new Custom() }; | ||
var g = deepClone(f, cloneCustom); | ||
g.test === f.test // false, since new Custom instance will be created | ||
``` | ||
@@ -224,2 +235,8 @@ | ||
## isPlainObject(val):Boolean | ||
If the value is an Object created by the Object constructor. | ||
## isRegExp(val):Boolean | ||
@@ -226,0 +243,0 @@ |
@@ -52,18 +52,21 @@ # object # | ||
Mixes objects into the target object, recursively mixing existing child objects | ||
and arrays as well. | ||
as well. | ||
It will only recursively mix objects if both (existing and new) values are | ||
plain objects. | ||
Returns the target object. Like [`merge()`](#merge), but mutates the target | ||
object, and does not clone child objects. | ||
var target = { | ||
foo: { | ||
name: "foo", | ||
id: 1, | ||
vals: [1, 2] | ||
} | ||
}; | ||
```js | ||
var target = { | ||
foo: { | ||
name: "foo", | ||
id: 1 | ||
} | ||
}; | ||
deepMixIn(target, { foo: { id: 2, vals: [5] } }); | ||
// note that arrays are also merged and not replaced | ||
console.log(target); // { foo: { name: "foo", id: 2, vals : [5, 2] } } | ||
deepMixIn(target, { foo: { id: 2 } }); | ||
console.log(target); // { foo: { name: "foo", id: 2 } } | ||
``` | ||
@@ -70,0 +73,0 @@ See: [`mixIn()`](#mixIn), [`merge()`](#merge), [`deepFillIn()`](#deepFillIn) |
@@ -13,3 +13,2 @@ | ||
* @return {Function} Wrapped Function. | ||
* @version 0.1.0 (2011/02/18) | ||
*/ | ||
@@ -16,0 +15,0 @@ function bind(fn, context, args){ |
@@ -6,3 +6,2 @@ | ||
* each other. | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -9,0 +8,0 @@ function compose() { |
@@ -9,3 +9,2 @@ | ||
* Creates a partially applied function. | ||
* @version 0.1.0 (2012/11/16) | ||
*/ | ||
@@ -12,0 +11,0 @@ function curry(fn, var_args){ |
@@ -5,3 +5,2 @@ | ||
* Debounce callback execution | ||
* @version 0.1.0 (2012/11/27) | ||
*/ | ||
@@ -8,0 +7,0 @@ function debounce(fn, threshold, isAsap){ |
@@ -5,3 +5,2 @@ | ||
* Returns a function that call a method on the passed object | ||
* @version 0.1.0 (2012/06/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function func(name){ |
@@ -5,3 +5,2 @@ | ||
* Returns a function that gets a property of the passed object | ||
* @version 0.1.0 (2012/06/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function prop(name){ |
@@ -7,3 +7,2 @@ | ||
* items during a forEach loop) | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -10,0 +9,0 @@ function series(){ |
var now = require('../time/now'); | ||
/** | ||
* @version 0.1.0 (2012/11/27) | ||
*/ | ||
@@ -6,0 +5,0 @@ function throttle(fn, delay){ |
@@ -6,2 +6,3 @@ | ||
module.exports = { | ||
'VERSION' : '0.2.0', | ||
'array' : require('./array'), | ||
@@ -8,0 +9,0 @@ 'collection' : require('./collection'), |
@@ -6,5 +6,5 @@ | ||
module.exports = { | ||
'clone' : require('./lang/clone'), | ||
'createObject' : require('./lang/createObject'), | ||
'ctorApply' : require('./lang/ctorApply'), | ||
'deepClone' : require('./lang/deepClone'), | ||
'defaults' : require('./lang/defaults'), | ||
@@ -24,2 +24,3 @@ 'inheritPrototype' : require('./lang/inheritPrototype'), | ||
'isObject' : require('./lang/isObject'), | ||
'isPlainObject' : require('./lang/isPlainObject'), | ||
'isRegExp' : require('./lang/isRegExp'), | ||
@@ -26,0 +27,0 @@ 'isString' : require('./lang/isString'), |
@@ -9,3 +9,2 @@ var mixIn = require('../object/mixIn'); | ||
* @return {object} Created object. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -12,0 +11,0 @@ function createObject(parent, props){ |
@@ -7,3 +7,2 @@ | ||
* Do fn.apply on a constructor. | ||
* @version 0.1.0 (2011/11/24) | ||
*/ | ||
@@ -10,0 +9,0 @@ function ctorApply(ctor, args) { |
@@ -6,3 +6,2 @@ var toArray = require('./toArray'); | ||
* Return first non void argument | ||
* @version 0.1.0 (2012/02/28) | ||
*/ | ||
@@ -9,0 +8,0 @@ function defaults(var_args){ |
@@ -8,3 +8,2 @@ var createObject = require('./createObject'); | ||
* @param {object} parent Parent Object | ||
* @version 0.1.0 (2011/02/18) | ||
*/ | ||
@@ -11,0 +10,0 @@ function inheritPrototype(child, parent){ |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.2.0 (2011/12/05) | ||
*/ | ||
@@ -6,0 +5,0 @@ var isArgs = isKind(arguments, 'Arguments')? |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.2.0 (2011/12/06) | ||
*/ | ||
@@ -5,0 +4,0 @@ var isArray = Array.isArray || function (val) { |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isBoolean(val) { |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isDate(val) { |
@@ -7,3 +7,2 @@ var isNumber = require('./isNumber'); | ||
* Check if value is finite | ||
* @version 0.1.2 (2012/12/09) | ||
*/ | ||
@@ -10,0 +9,0 @@ function isFinite(val){ |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isFunction(val) { |
var kindOf = require('./kindOf'); | ||
/** | ||
* Check if value is from a specific "kind". | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -6,0 +5,0 @@ function isKind(val, kind){ |
@@ -5,3 +5,2 @@ var isNumber = require('./isNumber'); | ||
* Check if value is NaN for realz | ||
* @version 0.1.2 (2012/11/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function isNaN(val){ |
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isNull(val){ |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isNumber(val) { |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isObject(val) { |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isRegExp(val) { |
var isKind = require('./isKind'); | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isString(val) { |
@@ -5,3 +5,2 @@ | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -8,0 +7,0 @@ function isUndef(val){ |
@@ -9,3 +9,2 @@ | ||
* Gets the "kind" of value. (e.g. "String", "Number", etc) | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -12,0 +11,0 @@ function kindOf(val) { |
@@ -7,3 +7,2 @@ var kindOf = require('./kindOf'); | ||
* Convert array-like object into array | ||
* @version 0.3.1 (2012/08/30) | ||
*/ | ||
@@ -10,0 +9,0 @@ function toArray(val){ |
@@ -1,10 +0,8 @@ | ||
var floor = require('./floor'); | ||
/** | ||
* Round value up with a custom radix. | ||
* @version 0.1.0 (2012/11/30) | ||
*/ | ||
function ceil(val, step){ | ||
step = step || 1; | ||
return val % step? floor(val + Math.abs(step), step) : val; | ||
step = Math.abs(step || 1); | ||
return Math.ceil(val / step) * step; | ||
} | ||
@@ -14,2 +12,1 @@ | ||
/** | ||
* Clamps value inside range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function clamp(val, min, max){ |
/** | ||
* Count number of full steps. | ||
* @version 0.2.0 (2011/10/21) | ||
*/ | ||
function countSteps(val, step, overflow){ | ||
//if (val/step == 0) mod oveflow will return NaN, so ~~ converts it to 0 | ||
return overflow? ~~(Math.floor(val / step) % overflow) : Math.floor(val / step); | ||
val = Math.floor(val / step); | ||
if (overflow) { | ||
return val % overflow; | ||
} | ||
return val; | ||
} | ||
module.exports = countSteps; | ||
@@ -1,11 +0,10 @@ | ||
var countSteps = require('./countSteps'); | ||
/** | ||
* Floor value to full steps. | ||
* @version 0.2.0 (2012/11/30) | ||
*/ | ||
function floor(val, step){ | ||
step = step || 1; | ||
return countSteps(val, step) * step; | ||
step = Math.abs(step || 1); | ||
return Math.floor(val / step) * step; | ||
} | ||
module.exports = floor; | ||
/** | ||
* Checks if value is inside the range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function inRange(val, min, max, threshold){ |
/** | ||
* Check if value is close to target. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function isNear(val, target, threshold){ |
@@ -5,3 +5,2 @@ | ||
* IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -8,0 +7,0 @@ function lerp(ratio, start, end){ |
/** | ||
* Loops value inside range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function loop(val, min, max){ |
@@ -6,3 +6,2 @@ var lerp = require('./lerp'); | ||
* @example map(3, 0, 4, -1, 1) -> 0.5 | ||
* @version 0.1.1 (2011/10/21) | ||
*/ | ||
@@ -9,0 +8,0 @@ function map(val, min1, max1, min2, max2){ |
/** | ||
* Gets normalized ratio of value inside range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function norm(val, min, max){ |
@@ -1,10 +0,8 @@ | ||
var floor = require('./floor'); | ||
/** | ||
* Round number to a specific radix | ||
* @version 0.1.0 (2012/11/27) | ||
*/ | ||
function round(value, radix){ | ||
radix = radix || 1; // default round 1 | ||
return floor(value + radix / 2, radix); | ||
return Math.round(value / radix) * radix; | ||
} | ||
@@ -11,0 +9,0 @@ |
@@ -11,3 +11,2 @@ var enforcePrecision = require('./enforcePrecision'); | ||
* Abbreviate number if bigger than 1000. (eg: 2.5K, 17.5M, 3.4B, ...) | ||
* @version 0.2.0 (2012/11/30) | ||
*/ | ||
@@ -14,0 +13,0 @@ function abbreviateNumber(val, nDecimals, dict){ |
@@ -5,3 +5,2 @@ | ||
* Converts number into currency format | ||
* @version 0.4.0 (2012/01/09) | ||
*/ | ||
@@ -8,0 +7,0 @@ var currencyFormatter = { |
@@ -7,3 +7,2 @@ | ||
* 0.61` | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -10,0 +9,0 @@ function enforcePrecision(val, nDecimalDigits){ |
/** | ||
* @constant Maximum 32-bit signed integer value. (2^31 - 1) | ||
* @version 0.1.1 (2012/02/17) | ||
*/ | ||
@@ -5,0 +4,0 @@ |
/** | ||
* @constant Maximum 32-bit unsigned integet value (2^32 - 1) | ||
* @version 0.1.1 (2012/02/17) | ||
*/ | ||
@@ -5,0 +4,0 @@ |
/** | ||
* @constant Minimum 32-bit signed integer value (-2^31). | ||
* @version 0.1.1 (2012/02/17) | ||
*/ | ||
@@ -5,0 +4,0 @@ |
@@ -5,3 +5,2 @@ var lpad = require('../string/lpad'); | ||
* Add padding zeros if n.length < minLength. | ||
* @version 0.2.0 (2011/11/1) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pad(n, minLength){ |
@@ -5,3 +5,2 @@ | ||
* http://en.wikipedia.org/wiki/Circular_shift | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -8,0 +7,0 @@ function rol(val, shift){ |
@@ -5,3 +5,2 @@ | ||
* http://en.wikipedia.org/wiki/Circular_shift | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -8,0 +7,0 @@ function ror(val, shift){ |
@@ -5,3 +5,2 @@ | ||
* Get sign of the value. | ||
* @version 0.1.0 (2011/11/25) | ||
*/ | ||
@@ -8,0 +7,0 @@ function sign(val) { |
@@ -8,3 +8,2 @@ | ||
* Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7 | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -11,0 +10,0 @@ function toInt(val){ |
@@ -6,3 +6,2 @@ | ||
* IMPORTANT: Value will wrap at 2^32. | ||
* @version 0.2.0 (2011/11/25) | ||
*/ | ||
@@ -9,0 +8,0 @@ function toUInt(val){ |
@@ -6,3 +6,2 @@ var MAX_INT = require('./MAX_INT'); | ||
* IMPORTANT: value wil wrap at 2^31, if negative will return 0. | ||
* @version 0.3.0 (2011/11/25) | ||
*/ | ||
@@ -9,0 +8,0 @@ function toUInt31(val){ |
@@ -1,20 +0,28 @@ | ||
var forEach = require('../array/forEach'); | ||
var forOwn = require('./forOwn'); | ||
var isPlainObject = require('../lang/isPlainObject'); | ||
/** | ||
* Deeply copy missing properties in the obj from the defaults. | ||
* @version 0.1.0 (2012/12/19) | ||
* Deeply copy missing properties in the target from the defaults. | ||
*/ | ||
function deepFillIn(obj, var_defaults){ | ||
forEach(Array.prototype.slice.call(arguments, 1), function(base){ | ||
forOwn(base, function(val, key){ | ||
var curVal = obj[key]; | ||
if (curVal == null) { | ||
obj[key] = val; | ||
} else if (typeof curVal === 'object' && typeof val === 'object') { | ||
deepFillIn(curVal, val); | ||
} | ||
}); | ||
}); | ||
return obj; | ||
function deepFillIn(target, defaults){ | ||
var i = 0, | ||
n = arguments.length, | ||
obj; | ||
while(++i < n) { | ||
obj = arguments[i]; | ||
if (obj) { | ||
forOwn(obj, function(newValue, key) { | ||
var curValue = target[key]; | ||
if (curValue == null) { | ||
target[key] = newValue; | ||
} else if (isPlainObject(curValue) | ||
&& isPlainObject(newValue)) { | ||
deepFillIn(curValue, newValue); | ||
} | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
@@ -21,0 +29,0 @@ |
@@ -1,8 +0,7 @@ | ||
// use collection/forEach since we also deep merge arrays during the process | ||
var forEach = require('../collection/forEach'); | ||
var forOwn = require('./forOwn'); | ||
var isPlainObject = require('../lang/isPlainObject'); | ||
/** | ||
* Mixes objects into the target object, recursively mixing existing child | ||
* objects and arrays. | ||
* @version 0.1.1 (2012/11/08) | ||
* objects. | ||
*/ | ||
@@ -17,3 +16,3 @@ function deepMixIn(target, objects) { | ||
if (obj) { | ||
forEach(obj, copyProp, target); | ||
forOwn(obj, copyProp, target); | ||
} | ||
@@ -27,6 +26,3 @@ } | ||
var existing = this[key]; | ||
// WTFJS: `typeof null === 'object'` so we check if val is truthy. | ||
// need to use `typeof` check instead of lang/isObject since we also | ||
// need to deep merge arrays | ||
if (val && typeof val === 'object' && typeof existing === 'object') { | ||
if (isPlainObject(val) && isPlainObject(existing)) { | ||
deepMixIn(existing, val); | ||
@@ -33,0 +29,0 @@ } else { |
@@ -6,3 +6,2 @@ var forEach = require('../array/forEach'); | ||
* Copy missing properties in the obj from the defaults. | ||
* @version 0.1.0 (2012/02/25) | ||
*/ | ||
@@ -9,0 +8,0 @@ function fillIn(obj, var_defaults){ |
@@ -6,3 +6,2 @@ var forOwn = require('./forOwn'); | ||
* true. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -9,0 +8,0 @@ function filterValues(obj, callback, thisObj) { |
@@ -28,3 +28,2 @@ | ||
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation | ||
* @version 0.2.0 (2012/10/30) | ||
*/ | ||
@@ -31,0 +30,0 @@ function forIn(obj, fn, thisObj){ |
@@ -8,3 +8,2 @@ var hasOwn = require('./hasOwn'); | ||
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation | ||
* @version 0.4.0 (2012/10/30) | ||
*/ | ||
@@ -11,0 +10,0 @@ function forOwn(obj, fn, thisObj){ |
@@ -5,3 +5,2 @@ | ||
* get "nested" object property | ||
* @version 0.1.0 (2012/01/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function get(obj, prop){ |
@@ -7,3 +7,2 @@ var get = require('./get'); | ||
* Check if object has nested property. | ||
* @version 0.2.0 (2012/03/14) | ||
*/ | ||
@@ -10,0 +9,0 @@ function has(obj, prop){ |
@@ -5,3 +5,2 @@ | ||
* Safer Object.hasOwnProperty | ||
* @version 0.1.0 (2012/01/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function hasOwn(obj, prop){ |
@@ -5,3 +5,2 @@ var forOwn = require('./forOwn'); | ||
* Get object keys | ||
* @version 0.3.0 (2011/12/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ var keys = Object.keys || function (obj) { |
@@ -6,3 +6,2 @@ var forOwn = require('./forOwn'); | ||
* `callback`. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -9,0 +8,0 @@ function mapValues(obj, callback, thisObj) { |
var hasOwn = require('./hasOwn'); | ||
var clone = require('../lang/clone'); | ||
var deepClone = require('../lang/deepClone'); | ||
var isObject = require('../lang/isObject'); | ||
@@ -7,3 +7,2 @@ | ||
* Deep merge objects. | ||
* @version 0.2.0 (2012/07/13) | ||
*/ | ||
@@ -16,3 +15,3 @@ function merge() { | ||
// objects are passed by reference | ||
target = clone( arguments[0] ); | ||
target = deepClone( arguments[0] ); | ||
@@ -32,3 +31,3 @@ while (obj = arguments[i++]) { | ||
// make sure arrays, regexp, date, objects are cloned | ||
target[key] = clone(val); | ||
target[key] = deepClone(val); | ||
} | ||
@@ -35,0 +34,0 @@ |
@@ -9,3 +9,2 @@ var forOwn = require('./forOwn'); | ||
* @return {object} Target Object. | ||
* @version 0.1.4 (2012/10/29) | ||
*/ | ||
@@ -12,0 +11,0 @@ function mixIn(target, objects){ |
@@ -5,3 +5,2 @@ var forEach = require('../array/forEach'); | ||
* Create nested object if non-existent | ||
* @version 0.1.0 (2012/01/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function namespace(obj, path){ |
@@ -5,3 +5,2 @@ | ||
* Return a copy of the object, filtered to only have values for the whitelisted keys. | ||
* @version 0.1.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pick(obj, var_keys){ |
@@ -5,3 +5,2 @@ var namespace = require('./namespace'); | ||
* set "nested" object property | ||
* @version 0.1.0 (2012/01/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function set(obj, prop, val){ |
@@ -5,3 +5,2 @@ var forOwn = require('./forOwn'); | ||
* Get object size | ||
* @version 0.1.1 (2012/01/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function size(obj) { |
@@ -5,3 +5,2 @@ var forOwn = require('./forOwn'); | ||
* Object some | ||
* @version 0.2.0 (2012/11/16) | ||
*/ | ||
@@ -8,0 +7,0 @@ function some(obj, callback, thisObj) { |
@@ -5,3 +5,2 @@ var has = require('./has'); | ||
* Unset object property. | ||
* @version 0.2.0 (2012/01/31) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unset(obj, prop){ |
@@ -5,3 +5,2 @@ var forOwn = require('./forOwn'); | ||
* Get object values | ||
* @version 0.2.0 (2011/12/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ function values(obj) { |
{ | ||
"name": "mout", | ||
"description": "Modular Utilities", | ||
"version": "0.1.0", | ||
"homepage": "http://mout.github.com/mout/", | ||
"author": { | ||
"name": "Miller Medeiros", | ||
"url": "http://blog.millermedeiros.com" | ||
}, | ||
"version": "0.2.0", | ||
"homepage": "http://moutjs.com/", | ||
"contributors": [ | ||
"Adam Nowotny", | ||
"André Cruz", | ||
"Conrad Zimmerman (http://www.conradz.com)", | ||
"Friedemann Altrock <frodenius@gmail.com>", | ||
"Jarrod Overson (http://jarrodoverson.com)", | ||
"Miller Medeiros <contact@millermedeiros.com> (http://blog.millermedeiros.com)", | ||
"Zach Shipley" | ||
], | ||
"keywords": [ | ||
@@ -11,0 +16,0 @@ "utilities", |
@@ -5,3 +5,2 @@ var getQuery = require('./getQuery'); | ||
* Checks if query string contains parameter. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function contains(url, paramName) { |
@@ -6,3 +6,2 @@ var typecast = require('../string/typecast'); | ||
* Decode query string into an object of keys => vals. | ||
* @version 0.3.0 (2012/09/26) | ||
*/ | ||
@@ -9,0 +8,0 @@ function decode(queryStr, shouldTypecast) { |
@@ -5,3 +5,2 @@ var forOwn = require('../object/forOwn'); | ||
* Encode object into a query string. | ||
* @version 0.3.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function encode(obj){ |
@@ -6,3 +6,2 @@ var typecast = require('../string/typecast'); | ||
* Get query parameter value. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -9,0 +8,0 @@ function getParam(url, param, shouldTypecast){ |
@@ -5,3 +5,2 @@ | ||
* Gets full query as string with all special chars decoded. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function getQuery(url) { |
@@ -6,3 +6,2 @@ var decode = require('./decode'); | ||
* Get query string, parses and decodes it. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -9,0 +8,0 @@ function parse(url, shouldTypecast) { |
@@ -5,3 +5,2 @@ | ||
* Set query string parameter value | ||
* @version 0.1.0 (2012/10/11) | ||
*/ | ||
@@ -8,0 +7,0 @@ function setParam(url, paramName, value){ |
@@ -7,3 +7,2 @@ var randInt = require('./randInt'); | ||
* or from the array (if single argument is an array). | ||
* @version 0.1.1 (2011/12/08) | ||
*/ | ||
@@ -10,0 +9,0 @@ function choice(items) { |
@@ -10,3 +10,2 @@ var randHex = require('./randHex'); | ||
* the default PRNG. | ||
* @version 0.1.1 (2012/11/29) | ||
*/ | ||
@@ -13,0 +12,0 @@ function guid() { |
@@ -7,3 +7,2 @@ var random = require('./random'); | ||
* Returns random number inside range | ||
* @version 0.4.0 (2012/04/24) | ||
*/ | ||
@@ -10,0 +9,0 @@ function rand(min, max){ |
@@ -5,3 +5,2 @@ var random = require('./random'); | ||
* Returns random bit (0 or 1) | ||
* @version 0.2.0 (2012/11/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function randomBit() { |
@@ -7,3 +7,2 @@ var MIN_INT = require('../number/MIN_INT'); | ||
* Gets random integer inside range or snap to min/max values. | ||
* @version 0.6.0 (2012/04/24) | ||
*/ | ||
@@ -10,0 +9,0 @@ function randInt(min, max){ |
/** | ||
* Just a wrapper to Math.random. No methods inside amd-utils should call | ||
* Just a wrapper to Math.random. No methods inside mout/random should call | ||
* Math.random() directly so we can inject the pseudo-random number | ||
* generator if needed (ie. in case we need a seeded random or a better | ||
* algorithm than the native one) | ||
* @version 0.1.0 (2012/11/29) | ||
*/ | ||
@@ -10,0 +9,0 @@ function random(){ |
@@ -5,3 +5,2 @@ var random = require('./random'); | ||
* Returns random sign (-1 or 1) | ||
* @version 0.2.0 (2012/11/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function randomSign() { |
169
README.md
@@ -1,9 +0,7 @@ | ||
# mout # | ||
![mout](http://moutjs.com/logo.png "Modular JavaScript Utilties") | ||
Modular JavaScript Utilities. | ||
http://moutjs.com/ | ||
http://mout.github.com/ | ||
[![Build Status](https://travis-ci.org/mout/mout.png?branch=master)](https://travis-ci.org/mout/mout) | ||
[![Build Status](https://secure.travis-ci.org/mout/mout.png)](https://travis-ci.org/mout/mout) | ||
All code is library agnostic and consist mostly of helper methods that aren't | ||
@@ -44,163 +42,20 @@ directly related with the DOM, the purpose of this library isn't to replace | ||
## API Documentation ## | ||
## Node.js ## | ||
Online documentation can be found at http://moutjs.com/ or inside the | ||
`doc` folder. | ||
mout also works on [node.js](http://nodejs.org), just run: | ||
npm install mout | ||
It will download mout from the NPM repository and convert the AMD modules into | ||
a node.js compatible format using | ||
[nodefy](https://github.com/millermedeiros/nodefy), there is no extra | ||
overhead, you can use it like a regular node.js package. | ||
## FAQ / Wiki / IRC ## | ||
// you can load individual methods | ||
var map = require('mout/array/map'); | ||
map([1, 2], function(v){ return val * val; }); // [1, 4] | ||
For more info about project structure, design decisions, tips, how to | ||
contribute, build system, etc, please check the [project | ||
wiki](https://github.com/mout/mout/wiki). | ||
// a single package | ||
var stringUtils = require('mout/string'); | ||
stringUtils.camelCase('Foo Bar'); // "fooBar" | ||
We also have an IRC channel [#moutjs on | ||
irc.freenode.net](http://webchat.freenode.net/) | ||
// or the whole lib | ||
var utils = require('mout'); | ||
console.log( utils.math.clamp(100, 0, 50) ); // 50 | ||
## Important ## | ||
Since code is very modular (broken into multiple files) it is really important | ||
that you run an optimizer before deploying the code to a server, otherwise you | ||
may end up having too many file requests which can [degrade load-time | ||
performance](http://developer.yahoo.com/performance/rules.html#num_http) a lot. | ||
See [RequireJS optimization](http://requirejs.org/docs/optimization.html) for | ||
more info. | ||
## Contributing ## | ||
Fork the project on Github: https://github.com/mout/mout | ||
> "Write clearly, don't be too clever" - The Elements of Programming Style | ||
Avoid unnamed functions and follow the other modules structure. By only using | ||
named functions it will be easier to extract the code from the AMD module if | ||
needed and it will also give better error messages, JavaScript minifiers like | ||
[Google Closure Compiler](http://code.google.com/closure/compiler/) and | ||
[UglifyJS](https://github.com/mishoo/UglifyJS) will make sure code is as | ||
small/optimized as possible. | ||
> "Make it clear before you make it faster." - The Elements of Programming Style | ||
Be sure to always create tests for each proposed module. Features will only be | ||
merged if they contain proper tests and documentation. | ||
> "Good code is its own best documentation." - Steve McConnell | ||
We should do a code review before merging to make sure names makes sense and | ||
implementation is as good as possible. | ||
Check the [contributors list at github](https://github.com/mout/mout/contributors). | ||
## Build Script ## | ||
The build script have a set of very helpful commands, run `npm install --dev` | ||
(only required once) and then check the available commands: | ||
node build --help | ||
### Keeping packages and specs in sync ### | ||
The build script can be used to update packages and specs files: | ||
node build pkg | ||
The packages/specs are automatically updated every time you run `npm test` as | ||
well. | ||
You can also add new modules with the command `node build add | ||
package/moduleName`, this will create a new module `src/package/moduleName.js` | ||
and also a failing spec `tests/spec/package/spec-moduleName.js`. | ||
### Tests & Code Coverage ### | ||
Tests can be found inside the `tests` folder, to execute them in the browser | ||
open the `tests/runner.html`. The same tests also work on node.js by running | ||
`npm test`. | ||
We should have tests for all methods and ensure we have a high code coverage | ||
through our continuous integration server | ||
([travis](https://travis-ci.org/mout/mout)). When you ask for | ||
a pull request Travis will automatically run the tests on node.js and check the | ||
code coverage as well. | ||
We run `node build pkg` automatically before any `npm test`, so specs and | ||
packages should always be in sync. (will avoid human mistakes) | ||
To check code coverage run `npm test --coverage`, it will generate the reports | ||
inside the `coverage` folder and also log the results. Please note that node.js | ||
doesn't execute all code branches since we have some conditionals that are only | ||
met on old JavaScript engines (eg. IE 7-8), so we will never have 100% code | ||
coverage (but should be close to it). | ||
### Building The Documentation ### | ||
The documentation is generated based on markdown files inside the | ||
`doc` folder using [mdoc](https://github.com/millermedeiros/mdoc). | ||
To compile the docs run: | ||
node build doc | ||
It will replace all the files inside the `doc_html` folder. | ||
Documentation files should be always up-to-date since modules are only | ||
committed to the `master` branch after they get proper tests and documentation. | ||
Online documentation can be found at http://mout.github.com/docs/ | ||
## Why AMD as the authoring format? ## | ||
**Because AMD is awesome!** | ||
By keeping each function in a separate package we can require just the | ||
methods/packages that are required by our app and let the RequireJS optimizer | ||
bundle only what is currently being used. We also have an extra benefit that we | ||
split the methods into separate packages so we reduce the chance of name | ||
collisions and the code is more organized. AMD is flexible and enables things | ||
that wouldn't be possible with a different module system or with a conventional | ||
namespace approach (remapping a module, conditionally loading, etc). | ||
Read these links if you still can't see why: | ||
- [Why AMD?](http://requirejs.org/docs/whyamd.html) | ||
- [AMD is better for the web than CJS modules](blog.millermedeiros.com/2011/09/amd-is-better-for-the-web-than-commonjs-modules/) | ||
- [AMD & CommonJS modules](http://briancavalier.com/presentations/pgh-js-amd-10-2011/) | ||
- [AMD vs. CJS](http://unscriptable.com/index.php/2011/09/30/amd-versus-cjs-whats-the-best-format/) | ||
- [Namespaces are Old School](http://blog.millermedeiros.com/namespaces-are-old-school/) | ||
Also since most node.js modules are installed through npm it's easier to write | ||
it using the AMD format and them convert into a node.js compatible format | ||
during `npm publish` or before each `npm test`. We use | ||
[nodefy](https://github.com/millermedeiros/nodefy) to convert the AMD modules | ||
into regular node.js modules so it won't add any extra overhead for you node.js | ||
apps. The opposite approach would be harder to automate. | ||
PS: Your mileage may vary... | ||
## Documentation ## | ||
Online documentation can be found at http://mout.github.com/docs or inside the | ||
`doc` folder. | ||
## License ## | ||
@@ -207,0 +62,0 @@ |
@@ -6,3 +6,2 @@ define(function () { | ||
* The first array will be modified. | ||
* @version 0.1.1 (2012/06/10) | ||
*/ | ||
@@ -9,0 +8,0 @@ function append(arr1, arr2) { |
@@ -6,3 +6,2 @@ define(['./indexOf'], function (indexOf) { | ||
* Does not allow duplicates and is case and type sensitive. | ||
* @version 0.1.0 (2012/01/28) | ||
*/ | ||
@@ -9,0 +8,0 @@ function combine(arr1, arr2) { |
@@ -5,3 +5,2 @@ define(['./filter'], function (filter) { | ||
* Remove all null/undefined items from array. | ||
* @version 0.1.0 (2011/11/15) | ||
*/ | ||
@@ -8,0 +7,0 @@ function compact(arr) { |
@@ -5,3 +5,2 @@ define(['./indexOf'], function (indexOf) { | ||
* If array contains values. | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -8,0 +7,0 @@ function contains(arr, val) { |
@@ -6,3 +6,2 @@ define(['./unique', './filter', './some', './contains'], function (unique, filter, some, contains) { | ||
* Return a new Array with elements that aren't present in the other Arrays. | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -9,0 +8,0 @@ function difference(arr) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Array every | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function every(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(['./forEach'], function (forEach) { | ||
* Array filter | ||
* @version 0.4.0 (2012/07/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function filter(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(['./some'], function (some) { | ||
* Returns first item that matches criteria | ||
* @version 0.3.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function find(arr, iterator, thisObj){ |
@@ -30,3 +30,2 @@ define(['../lang/isArray'], function (isArray) { | ||
* If `shallow` is true, it will only flatten one level. | ||
* @version 0.1.0 (2012/08/02) | ||
*/ | ||
@@ -33,0 +32,0 @@ function flatten(arr, shallow) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Array forEach | ||
* @version 0.8.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function forEach(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Array.indexOf | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function indexOf(arr, item, fromIndex) { |
@@ -5,3 +5,2 @@ define(['./difference', '../lang/toArray'], function (difference, toArray) { | ||
* Insert item into array if not already present. | ||
* @version 0.2.0 (2012/01/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function insert(arr, rest_items) { |
@@ -7,3 +7,2 @@ define(['./unique', './filter', './every', './contains'], function (unique, filter, every, contains) { | ||
* - based on underscore.js implementation | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -10,0 +9,0 @@ function intersection(arr) { |
@@ -6,3 +6,2 @@ define(['./forEach'], function (forEach) { | ||
* needed. | ||
* @version 0.1.0 (2012/10/02) | ||
*/ | ||
@@ -9,0 +8,0 @@ function invoke(arr, methodName, var_args){ |
@@ -10,3 +10,2 @@ define(['./filter'], function(filter) { | ||
* Null values and empty strings will be excluded. | ||
* @version 0.1.0 (2012/08/24) | ||
*/ | ||
@@ -13,0 +12,0 @@ function join(items, separator) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Array lastIndexOf | ||
* @version 0.4.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function lastIndexOf(arr, item, fromIndex) { |
@@ -5,3 +5,2 @@ define(['./forEach'], function (forEach) { | ||
* Array map | ||
* @version 0.5.0 (2012/11/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function map(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(['./forEach'], function (forEach) { | ||
* Return maximum value inside array | ||
* @version 0.1.0 (2012/01/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function max(arr, iterator){ |
@@ -5,3 +5,2 @@ define(['./forEach'], function (forEach) { | ||
* Return minimum value inside array | ||
* @version 0.1.0 (2012/01/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function min(arr, iterator){ |
@@ -5,3 +5,2 @@ define(['../random/randInt'], function (randInt) { | ||
* Remove a random item from the Array and return it | ||
* @version 0.1.0 (2012/04/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pick(arr){ |
@@ -5,3 +5,2 @@ define(['./map', '../function/prop'], function (map, prop) { | ||
* Extract a list of property values. | ||
* @version 0.1.0 (2012/06/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pluck(arr, propName){ |
@@ -5,3 +5,2 @@ define(['../math/countSteps'], function (countSteps) { | ||
* Returns an Array of numbers inside range. | ||
* @version 0.1.0 (2011/11/15) | ||
*/ | ||
@@ -8,0 +7,0 @@ function range(start, stop, step) { |
@@ -5,3 +5,2 @@ define(['./forEach'], function (forEach) { | ||
* Array reduce | ||
* @version 0.3.0 (2012/07/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reduce(arr, fn, initVal) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Array reduceRight | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reduceRight(arr, fn, initVal) { |
@@ -5,3 +5,2 @@ define(['./forEach'], function(forEach) { | ||
* Array reject | ||
* @version 0.1.0 (2012/09/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reject(arr, callback, thisObj) { |
@@ -6,3 +6,2 @@ define(['./indexOf'], function(indexOf){ | ||
* (it won't remove duplicates, just a single item) | ||
* @version 0.1.1 (2012/03/13) | ||
*/ | ||
@@ -9,0 +8,0 @@ function remove(arr, item){ |
@@ -5,3 +5,2 @@ define(['./indexOf'], function(indexOf){ | ||
* Remove all instances of an item from array. | ||
* @version 0.1.1 (2012/01/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function removeAll(arr, item){ |
@@ -5,3 +5,2 @@ define(['../random/randInt', './forEach'], function (randInt, forEach) { | ||
* Shuffle array items. | ||
* @version 0.2.0 (2011/11/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ function shuffle(arr) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Array some | ||
* @version 0.5.0 (2012/12/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function some(arr, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Merge sort (http://en.wikipedia.org/wiki/Merge_sort) | ||
* @version 0.1.0 (2012/05/23) | ||
*/ | ||
@@ -8,0 +7,0 @@ function mergeSort(arr, compareFn) { |
@@ -5,3 +5,2 @@ define(function() { | ||
* Split array into a fixed number of segments. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -8,0 +7,0 @@ function split(array, segments) { |
@@ -10,3 +10,2 @@ define(['../lang/isFunction'], function (isFunction) { | ||
* value. | ||
* @version 0.1.0 (2012/08/02) | ||
*/ | ||
@@ -13,0 +12,0 @@ function toLookup(arr, key) { |
@@ -5,3 +5,2 @@ define(['./unique'], function (unique) { | ||
* Concat multiple arrays and remove duplicates | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -8,0 +7,0 @@ function union(arrs) { |
@@ -5,3 +5,2 @@ define(['./indexOf', './filter'], function(indexOf, filter){ | ||
* @return {array} Array of unique items | ||
* @version 0.1.0 (2011/10/18) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unique(arr){ |
@@ -7,3 +7,2 @@ define(['./unique', './filter', './contains'], function (unique, filter, contains) { | ||
* - like ptyhon's `symmetric_difference` | ||
* @version 0.1.0 (2011/01/12) | ||
*/ | ||
@@ -10,0 +9,0 @@ function xor(arr1, arr2) { |
@@ -6,3 +6,2 @@ define(['./max', './pluck'], function (max, pluck) { | ||
* corresponding position. | ||
* @version 0.1.0 (2012/10/30) | ||
*/ | ||
@@ -9,0 +8,0 @@ function zip(arr){ |
define(['./make_', '../array/contains', '../object/contains'], function (make, arrContains, objContains) { | ||
/** | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -6,0 +5,0 @@ return make(arrContains, objContains); |
define(['./make_', '../array/every', '../object/every'], function (make, arrEvery, objEvery) { | ||
/** | ||
* @version 0.1.0 (2012/11/03) | ||
*/ | ||
@@ -6,0 +5,0 @@ return make(arrEvery, objEvery); |
@@ -5,3 +5,2 @@ define(['./forEach'], function (forEach) { | ||
* filter collection values, returns array. | ||
* @version 0.3.0 (2012/11/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function filter(list, iterator, context) { |
@@ -5,3 +5,2 @@ define(['./make_', '../array/find', '../object/find'], function(make, arrFind, objFind) { | ||
* Find value that returns true on iterator check. | ||
* @version 0.2.0 (2012/11/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ return make(arrFind, objFind); |
define(['./make_', '../array/forEach', '../object/forOwn'], function (make, arrForEach, objForEach) { | ||
/** | ||
* @version 0.1.1 (2012/10/30) | ||
*/ | ||
@@ -6,0 +5,0 @@ return make(arrForEach, objForEach); |
@@ -5,3 +5,2 @@ define(function(){ | ||
* internal method used to create other collection modules. | ||
* @version 0.2.0 (2012/10/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function makeCollectionMethod(arrMethod, objMethod, defaultReturn) { |
@@ -5,3 +5,2 @@ define(['../lang/isObject', '../object/values', '../array/map'], function (isObject, values, arrMap) { | ||
* Map collection values, returns Array. | ||
* @version 0.2.0 (2012/11/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function map(list, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(['./make_', '../array/max', '../object/max'], function (make, arrMax, objMax) { | ||
* Get maximum value inside collection | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -8,0 +7,0 @@ return make(arrMax, objMax); |
@@ -5,3 +5,2 @@ define(['./make_', '../array/min', '../object/min'], function (make, arrMin, objMin) { | ||
* Get minimum value inside collection. | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -8,0 +7,0 @@ return make(arrMin, objMin); |
@@ -5,3 +5,2 @@ define(['./map'], function (map) { | ||
* Extract a list of property values. | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pluck(list, key) { |
define(['./make_', '../array/reduce', '../object/reduce'], function (make, arrReduce, objReduce) { | ||
/** | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -6,0 +5,0 @@ return make(arrReduce, objReduce); |
@@ -5,3 +5,2 @@ define(['./filter'], function (filter) { | ||
* Inverse or collection/filter | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -8,0 +7,0 @@ function reject(list, iterator, context) { |
@@ -5,3 +5,2 @@ define(['../lang/isArray', '../object/size'], function (isArray, objSize) { | ||
* Get collection size | ||
* @version 0.2.0 (2012/11/16) | ||
*/ | ||
@@ -8,0 +7,0 @@ function size(list) { |
define(['./make_', '../array/some', '../object/some'], function (make, arrSome, objSome) { | ||
/** | ||
* @version 0.1.0 (2012/11/13) | ||
*/ | ||
@@ -6,0 +5,0 @@ return make(arrSome, objSome); |
@@ -13,3 +13,2 @@ define(function(){ | ||
* @return {Function} Wrapped Function. | ||
* @version 0.1.0 (2011/02/18) | ||
*/ | ||
@@ -16,0 +15,0 @@ function bind(fn, context, args){ |
@@ -6,3 +6,2 @@ define(function () { | ||
* each other. | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -9,0 +8,0 @@ function compose() { |
@@ -9,3 +9,2 @@ define(function () { | ||
* Creates a partially applied function. | ||
* @version 0.1.0 (2012/11/16) | ||
*/ | ||
@@ -12,0 +11,0 @@ function curry(fn, var_args){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Debounce callback execution | ||
* @version 0.1.0 (2012/11/27) | ||
*/ | ||
@@ -8,0 +7,0 @@ function debounce(fn, threshold, isAsap){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Returns a function that call a method on the passed object | ||
* @version 0.1.0 (2012/06/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function func(name){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Returns a function that gets a property of the passed object | ||
* @version 0.1.0 (2012/06/04) | ||
*/ | ||
@@ -8,0 +7,0 @@ function prop(name){ |
@@ -7,3 +7,2 @@ define(function () { | ||
* items during a forEach loop) | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -10,0 +9,0 @@ function series(){ |
define(['../time/now'], function (now) { | ||
/** | ||
* @version 0.1.0 (2012/11/27) | ||
*/ | ||
@@ -6,0 +5,0 @@ function throttle(fn, delay){ |
@@ -6,2 +6,3 @@ define(function(require){ | ||
return { | ||
'VERSION' : '0.2.0', | ||
'array' : require('./array'), | ||
@@ -8,0 +9,0 @@ 'collection' : require('./collection'), |
@@ -6,5 +6,5 @@ define(function(require){ | ||
return { | ||
'clone' : require('./lang/clone'), | ||
'createObject' : require('./lang/createObject'), | ||
'ctorApply' : require('./lang/ctorApply'), | ||
'deepClone' : require('./lang/deepClone'), | ||
'defaults' : require('./lang/defaults'), | ||
@@ -24,2 +24,3 @@ 'inheritPrototype' : require('./lang/inheritPrototype'), | ||
'isObject' : require('./lang/isObject'), | ||
'isPlainObject' : require('./lang/isPlainObject'), | ||
'isRegExp' : require('./lang/isRegExp'), | ||
@@ -26,0 +27,0 @@ 'isString' : require('./lang/isString'), |
@@ -9,3 +9,2 @@ define(['../object/mixIn'], function(mixIn){ | ||
* @return {object} Created object. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -12,0 +11,0 @@ function createObject(parent, props){ |
@@ -7,3 +7,2 @@ define(function () { | ||
* Do fn.apply on a constructor. | ||
* @version 0.1.0 (2011/11/24) | ||
*/ | ||
@@ -10,0 +9,0 @@ function ctorApply(ctor, args) { |
@@ -5,3 +5,2 @@ define(['./toArray', '../array/find'], function (toArray, find) { | ||
* Return first non void argument | ||
* @version 0.1.0 (2012/02/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function defaults(var_args){ |
@@ -8,3 +8,2 @@ define(['./createObject'], function(createObject){ | ||
* @param {object} parent Parent Object | ||
* @version 0.1.0 (2011/02/18) | ||
*/ | ||
@@ -11,0 +10,0 @@ function inheritPrototype(child, parent){ |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.2.0 (2011/12/05) | ||
*/ | ||
@@ -6,0 +5,0 @@ var isArgs = isKind(arguments, 'Arguments')? |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.2.0 (2011/12/06) | ||
*/ | ||
@@ -5,0 +4,0 @@ var isArray = Array.isArray || function (val) { |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isBoolean(val) { |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isDate(val) { |
@@ -7,3 +7,2 @@ define(['./isNumber'], function (isNumber) { | ||
* Check if value is finite | ||
* @version 0.1.2 (2012/12/09) | ||
*/ | ||
@@ -10,0 +9,0 @@ function isFinite(val){ |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isFunction(val) { |
define(['./kindOf'], function (kindOf) { | ||
/** | ||
* Check if value is from a specific "kind". | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -6,0 +5,0 @@ function isKind(val, kind){ |
@@ -5,3 +5,2 @@ define(['./isNumber'], function (isNumber) { | ||
* Check if value is NaN for realz | ||
* @version 0.1.2 (2012/11/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function isNaN(val){ |
define(function () { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isNull(val){ |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isNumber(val) { |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isObject(val) { |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isRegExp(val) { |
define(['./isKind'], function (isKind) { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -5,0 +4,0 @@ function isString(val) { |
@@ -5,3 +5,2 @@ define(function () { | ||
/** | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -8,0 +7,0 @@ function isUndef(val){ |
@@ -9,3 +9,2 @@ define(function () { | ||
* Gets the "kind" of value. (e.g. "String", "Number", etc) | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -12,0 +11,0 @@ function kindOf(val) { |
@@ -7,3 +7,2 @@ define(['./kindOf'], function (kindOf) { | ||
* Convert array-like object into array | ||
* @version 0.3.1 (2012/08/30) | ||
*/ | ||
@@ -10,0 +9,0 @@ function toArray(val){ |
@@ -1,14 +0,11 @@ | ||
define(['./floor'], function(floor){ | ||
define(function(){ | ||
/** | ||
* Round value up with a custom radix. | ||
* @version 0.1.0 (2012/11/30) | ||
*/ | ||
function ceil(val, step){ | ||
step = step || 1; | ||
return val % step? floor(val + Math.abs(step), step) : val; | ||
step = Math.abs(step || 1); | ||
return Math.ceil(val / step) * step; | ||
} | ||
return ceil; | ||
}); |
define(function(){ | ||
/** | ||
* Clamps value inside range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function clamp(val, min, max){ |
define(function(){ | ||
/** | ||
* Count number of full steps. | ||
* @version 0.2.0 (2011/10/21) | ||
*/ | ||
function countSteps(val, step, overflow){ | ||
//if (val/step == 0) mod oveflow will return NaN, so ~~ converts it to 0 | ||
return overflow? ~~(Math.floor(val / step) % overflow) : Math.floor(val / step); | ||
val = Math.floor(val / step); | ||
if (overflow) { | ||
return val % overflow; | ||
} | ||
return val; | ||
} | ||
return countSteps; | ||
}); |
@@ -1,11 +0,10 @@ | ||
define(['./countSteps'], function(countSteps){ | ||
define(function(){ | ||
/** | ||
* Floor value to full steps. | ||
* @version 0.2.0 (2012/11/30) | ||
*/ | ||
function floor(val, step){ | ||
step = step || 1; | ||
return countSteps(val, step) * step; | ||
step = Math.abs(step || 1); | ||
return Math.floor(val / step) * step; | ||
} | ||
return floor; | ||
}); |
define(function(){ | ||
/** | ||
* Checks if value is inside the range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function inRange(val, min, max, threshold){ |
define(function(){ | ||
/** | ||
* Check if value is close to target. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function isNear(val, target, threshold){ |
@@ -5,3 +5,2 @@ define(function(){ | ||
* IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -8,0 +7,0 @@ function lerp(ratio, start, end){ |
define(function(){ | ||
/** | ||
* Loops value inside range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function loop(val, min, max){ |
@@ -5,3 +5,2 @@ define(['./lerp', './norm'], function(lerp, norm){ | ||
* @example map(3, 0, 4, -1, 1) -> 0.5 | ||
* @version 0.1.1 (2011/10/21) | ||
*/ | ||
@@ -8,0 +7,0 @@ function map(val, min1, max1, min2, max2){ |
define(function(){ | ||
/** | ||
* Gets normalized ratio of value inside range. | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -6,0 +5,0 @@ function norm(val, min, max){ |
@@ -1,10 +0,8 @@ | ||
define(['./floor'], function (floor) { | ||
define(function () { | ||
/** | ||
* Round number to a specific radix | ||
* @version 0.1.0 (2012/11/27) | ||
*/ | ||
function round(value, radix){ | ||
radix = radix || 1; // default round 1 | ||
return floor(value + radix / 2, radix); | ||
return Math.round(value / radix) * radix; | ||
} | ||
@@ -11,0 +9,0 @@ |
@@ -11,3 +11,2 @@ define(['./enforcePrecision'], function (enforcePrecision) { | ||
* Abbreviate number if bigger than 1000. (eg: 2.5K, 17.5M, 3.4B, ...) | ||
* @version 0.2.0 (2012/11/30) | ||
*/ | ||
@@ -14,0 +13,0 @@ function abbreviateNumber(val, nDecimals, dict){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Converts number into currency format | ||
* @version 0.4.0 (2012/01/09) | ||
*/ | ||
@@ -8,0 +7,0 @@ var currencyFormatter = { |
@@ -7,3 +7,2 @@ define(function(){ | ||
* 0.61` | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -10,0 +9,0 @@ function enforcePrecision(val, nDecimalDigits){ |
/** | ||
* @constant Maximum 32-bit signed integer value. (2^31 - 1) | ||
* @version 0.1.1 (2012/02/17) | ||
*/ | ||
@@ -5,0 +4,0 @@ define(function(){ |
/** | ||
* @constant Maximum 32-bit unsigned integet value (2^32 - 1) | ||
* @version 0.1.1 (2012/02/17) | ||
*/ | ||
@@ -5,0 +4,0 @@ define(function(){ |
/** | ||
* @constant Minimum 32-bit signed integer value (-2^31). | ||
* @version 0.1.1 (2012/02/17) | ||
*/ | ||
@@ -5,0 +4,0 @@ define(function(){ |
@@ -5,3 +5,2 @@ define(['../string/lpad'], function(lpad){ | ||
* Add padding zeros if n.length < minLength. | ||
* @version 0.2.0 (2011/11/1) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pad(n, minLength){ |
@@ -5,3 +5,2 @@ define(function(){ | ||
* http://en.wikipedia.org/wiki/Circular_shift | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -8,0 +7,0 @@ function rol(val, shift){ |
@@ -5,3 +5,2 @@ define(function(){ | ||
* http://en.wikipedia.org/wiki/Circular_shift | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -8,0 +7,0 @@ function ror(val, shift){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Get sign of the value. | ||
* @version 0.1.0 (2011/11/25) | ||
*/ | ||
@@ -8,0 +7,0 @@ function sign(val) { |
@@ -8,3 +8,2 @@ define(function(){ | ||
* Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7 | ||
* @version 0.1.0 (2011/10/21) | ||
*/ | ||
@@ -11,0 +10,0 @@ function toInt(val){ |
@@ -6,3 +6,2 @@ define(function () { | ||
* IMPORTANT: Value will wrap at 2^32. | ||
* @version 0.2.0 (2011/11/25) | ||
*/ | ||
@@ -9,0 +8,0 @@ function toUInt(val){ |
@@ -6,3 +6,2 @@ define(['./MAX_INT'], function(MAX_INT){ | ||
* IMPORTANT: value wil wrap at 2^31, if negative will return 0. | ||
* @version 0.3.0 (2011/11/25) | ||
*/ | ||
@@ -9,0 +8,0 @@ function toUInt31(val){ |
@@ -1,19 +0,27 @@ | ||
define(['../array/forEach', './forOwn'], function (forEach, forOwn) { | ||
define(['./forOwn', '../lang/isPlainObject'], function (forOwn, isPlainObject) { | ||
/** | ||
* Deeply copy missing properties in the obj from the defaults. | ||
* @version 0.1.0 (2012/12/19) | ||
* Deeply copy missing properties in the target from the defaults. | ||
*/ | ||
function deepFillIn(obj, var_defaults){ | ||
forEach(Array.prototype.slice.call(arguments, 1), function(base){ | ||
forOwn(base, function(val, key){ | ||
var curVal = obj[key]; | ||
if (curVal == null) { | ||
obj[key] = val; | ||
} else if (typeof curVal === 'object' && typeof val === 'object') { | ||
deepFillIn(curVal, val); | ||
} | ||
}); | ||
}); | ||
return obj; | ||
function deepFillIn(target, defaults){ | ||
var i = 0, | ||
n = arguments.length, | ||
obj; | ||
while(++i < n) { | ||
obj = arguments[i]; | ||
if (obj) { | ||
forOwn(obj, function(newValue, key) { | ||
var curValue = target[key]; | ||
if (curValue == null) { | ||
target[key] = newValue; | ||
} else if (isPlainObject(curValue) | ||
&& isPlainObject(newValue)) { | ||
deepFillIn(curValue, newValue); | ||
} | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
@@ -20,0 +28,0 @@ |
@@ -1,8 +0,6 @@ | ||
// use collection/forEach since we also deep merge arrays during the process | ||
define(['../collection/forEach'], function (forEach) { | ||
define(['./forOwn', '../lang/isPlainObject'], function (forOwn, isPlainObject) { | ||
/** | ||
* Mixes objects into the target object, recursively mixing existing child | ||
* objects and arrays. | ||
* @version 0.1.1 (2012/11/08) | ||
* objects. | ||
*/ | ||
@@ -17,3 +15,3 @@ function deepMixIn(target, objects) { | ||
if (obj) { | ||
forEach(obj, copyProp, target); | ||
forOwn(obj, copyProp, target); | ||
} | ||
@@ -27,6 +25,3 @@ } | ||
var existing = this[key]; | ||
// WTFJS: `typeof null === 'object'` so we check if val is truthy. | ||
// need to use `typeof` check instead of lang/isObject since we also | ||
// need to deep merge arrays | ||
if (val && typeof val === 'object' && typeof existing === 'object') { | ||
if (isPlainObject(val) && isPlainObject(existing)) { | ||
deepMixIn(existing, val); | ||
@@ -33,0 +28,0 @@ } else { |
@@ -5,3 +5,2 @@ define(['../array/forEach', './forOwn'], function (forEach, forOwn) { | ||
* Copy missing properties in the obj from the defaults. | ||
* @version 0.1.0 (2012/02/25) | ||
*/ | ||
@@ -8,0 +7,0 @@ function fillIn(obj, var_defaults){ |
@@ -6,3 +6,2 @@ define(['./forOwn'], function(forOwn) { | ||
* true. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -9,0 +8,0 @@ function filterValues(obj, callback, thisObj) { |
@@ -28,3 +28,2 @@ define(function () { | ||
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation | ||
* @version 0.2.0 (2012/10/30) | ||
*/ | ||
@@ -31,0 +30,0 @@ function forIn(obj, fn, thisObj){ |
@@ -7,3 +7,2 @@ define(['./hasOwn', './forIn'], function (hasOwn, forIn) { | ||
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation | ||
* @version 0.4.0 (2012/10/30) | ||
*/ | ||
@@ -10,0 +9,0 @@ function forOwn(obj, fn, thisObj){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* get "nested" object property | ||
* @version 0.1.0 (2012/01/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function get(obj, prop){ |
@@ -7,3 +7,2 @@ define(['./get'], function (get) { | ||
* Check if object has nested property. | ||
* @version 0.2.0 (2012/03/14) | ||
*/ | ||
@@ -10,0 +9,0 @@ function has(obj, prop){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Safer Object.hasOwnProperty | ||
* @version 0.1.0 (2012/01/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function hasOwn(obj, prop){ |
@@ -5,3 +5,2 @@ define(['./forOwn'], function (forOwn) { | ||
* Get object keys | ||
* @version 0.3.0 (2011/12/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ var keys = Object.keys || function (obj) { |
@@ -6,3 +6,2 @@ define(['./forOwn'], function(forOwn) { | ||
* `callback`. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -9,0 +8,0 @@ function mapValues(obj, callback, thisObj) { |
@@ -1,6 +0,5 @@ | ||
define(['./hasOwn', '../lang/clone', '../lang/isObject'], function (hasOwn, clone, isObject) { | ||
define(['./hasOwn', '../lang/deepClone', '../lang/isObject'], function (hasOwn, deepClone, isObject) { | ||
/** | ||
* Deep merge objects. | ||
* @version 0.2.0 (2012/07/13) | ||
*/ | ||
@@ -13,3 +12,3 @@ function merge() { | ||
// objects are passed by reference | ||
target = clone( arguments[0] ); | ||
target = deepClone( arguments[0] ); | ||
@@ -29,3 +28,3 @@ while (obj = arguments[i++]) { | ||
// make sure arrays, regexp, date, objects are cloned | ||
target[key] = clone(val); | ||
target[key] = deepClone(val); | ||
} | ||
@@ -32,0 +31,0 @@ |
@@ -9,3 +9,2 @@ define(['./forOwn'], function(forOwn){ | ||
* @return {object} Target Object. | ||
* @version 0.1.4 (2012/10/29) | ||
*/ | ||
@@ -12,0 +11,0 @@ function mixIn(target, objects){ |
@@ -5,3 +5,2 @@ define(['../array/forEach'], function (forEach) { | ||
* Create nested object if non-existent | ||
* @version 0.1.0 (2012/01/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function namespace(obj, path){ |
@@ -5,3 +5,2 @@ define(function(){ | ||
* Return a copy of the object, filtered to only have values for the whitelisted keys. | ||
* @version 0.1.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pick(obj, var_keys){ |
@@ -5,3 +5,2 @@ define(['./namespace'], function (namespace) { | ||
* set "nested" object property | ||
* @version 0.1.0 (2012/01/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function set(obj, prop, val){ |
@@ -5,3 +5,2 @@ define(['./forOwn'], function (forOwn) { | ||
* Get object size | ||
* @version 0.1.1 (2012/01/28) | ||
*/ | ||
@@ -8,0 +7,0 @@ function size(obj) { |
@@ -5,3 +5,2 @@ define(['./forOwn'], function(forOwn) { | ||
* Object some | ||
* @version 0.2.0 (2012/11/16) | ||
*/ | ||
@@ -8,0 +7,0 @@ function some(obj, callback, thisObj) { |
@@ -5,3 +5,2 @@ define(['./has'], function (has) { | ||
* Unset object property. | ||
* @version 0.2.0 (2012/01/31) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unset(obj, prop){ |
@@ -5,3 +5,2 @@ define(['./forOwn'], function (forOwn) { | ||
* Get object values | ||
* @version 0.2.0 (2011/12/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ function values(obj) { |
@@ -5,3 +5,2 @@ define(['./getQuery'], function (getQuery) { | ||
* Checks if query string contains parameter. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function contains(url, paramName) { |
@@ -5,3 +5,2 @@ define(['../string/typecast', '../lang/isString'], function (typecast, isString) { | ||
* Decode query string into an object of keys => vals. | ||
* @version 0.3.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function decode(queryStr, shouldTypecast) { |
@@ -5,3 +5,2 @@ define(['../object/forOwn'], function (forOwn) { | ||
* Encode object into a query string. | ||
* @version 0.3.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function encode(obj){ |
@@ -5,3 +5,2 @@ define(['../string/typecast', './getQuery'], function (typecast, getQuery) { | ||
* Get query parameter value. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function getParam(url, param, shouldTypecast){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Gets full query as string with all special chars decoded. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function getQuery(url) { |
@@ -5,3 +5,2 @@ define(['./decode', './getQuery'], function (decode, getQuery) { | ||
* Get query string, parses and decodes it. | ||
* @version 0.2.0 (2012/09/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function parse(url, shouldTypecast) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Set query string parameter value | ||
* @version 0.1.0 (2012/10/11) | ||
*/ | ||
@@ -8,0 +7,0 @@ function setParam(url, paramName, value){ |
@@ -6,3 +6,2 @@ define(['./randInt', '../lang/isArray'], function (randInt, isArray) { | ||
* or from the array (if single argument is an array). | ||
* @version 0.1.1 (2011/12/08) | ||
*/ | ||
@@ -9,0 +8,0 @@ function choice(items) { |
@@ -9,3 +9,2 @@ define(['./randHex', './choice'], function (randHex, choice) { | ||
* the default PRNG. | ||
* @version 0.1.1 (2012/11/29) | ||
*/ | ||
@@ -12,0 +11,0 @@ function guid() { |
@@ -5,3 +5,2 @@ define(['./random', '../number/MIN_INT', '../number/MAX_INT'], function(random, MIN_INT, MAX_INT){ | ||
* Returns random number inside range | ||
* @version 0.4.0 (2012/04/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function rand(min, max){ |
@@ -5,3 +5,2 @@ define(['./random'], function (random) { | ||
* Returns random bit (0 or 1) | ||
* @version 0.2.0 (2012/11/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function randomBit() { |
@@ -5,3 +5,2 @@ define(['../number/MIN_INT', '../number/MAX_INT', './rand'], function(MIN_INT, MAX_INT, rand){ | ||
* Gets random integer inside range or snap to min/max values. | ||
* @version 0.6.0 (2012/04/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function randInt(min, max){ |
define(function () { | ||
/** | ||
* Just a wrapper to Math.random. No methods inside amd-utils should call | ||
* Just a wrapper to Math.random. No methods inside mout/random should call | ||
* Math.random() directly so we can inject the pseudo-random number | ||
* generator if needed (ie. in case we need a seeded random or a better | ||
* algorithm than the native one) | ||
* @version 0.1.0 (2012/11/29) | ||
*/ | ||
@@ -10,0 +9,0 @@ function random(){ |
@@ -5,3 +5,2 @@ define(['./random'], function (random) { | ||
* Returns random sign (-1 or 1) | ||
* @version 0.2.0 (2012/11/29) | ||
*/ | ||
@@ -8,0 +7,0 @@ function randomSign() { |
@@ -8,3 +8,2 @@ define(['./replaceAccents', './removeNonWord', './upperCase', './lowerCase'], function(replaceAccents, removeNonWord, upperCase, lowerCase){ | ||
* @return {string} | ||
* @version 0.2.0 (2011/08/09) | ||
*/ | ||
@@ -11,0 +10,0 @@ function camelCase(str){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* searches for a given substring | ||
* @version 0.1.0 (2012/08/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function contains(str, substring){ |
define(['./truncate'], function (truncate) { | ||
/** | ||
* Truncate string at full words. | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -6,0 +5,0 @@ function crop(str, maxChars, append) { |
@@ -9,3 +9,2 @@ define(function () { | ||
* @return {bool} | ||
* @version 0.1.0 (2012/03/01) | ||
*/ | ||
@@ -12,0 +11,0 @@ function endsWith(str, suffix) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Escapes a string for insertion into HTML. | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function escapeHtml(str){ |
@@ -7,3 +7,2 @@ define(function () { | ||
* Escape RegExp string chars. | ||
* @version 0.1.0 (2011/12/17) | ||
*/ | ||
@@ -10,0 +9,0 @@ function escapeRegExp(str) { |
@@ -5,3 +5,2 @@ define(function () { | ||
* Escape string into unicode sequences | ||
* @version 0.1.0 (2012/12/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function escapeUnicode(str, shouldEscapePrintable){ |
@@ -5,3 +5,2 @@ define(['./slugify', './unCamelCase'], function(slugify, unCamelCase){ | ||
* @example hyphenate('loremIpsum dolor spéçïãl chârs') -> 'lorem-ipsum-dolor-special-chars' | ||
* @version 0.2.0 (2012/08/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ function hyphenate(str){ |
@@ -7,3 +7,2 @@ define(function () { | ||
* String interpolation | ||
* @version 0.1.0 (2012/03/05) | ||
*/ | ||
@@ -10,0 +9,0 @@ function interpolate(template, replacements, syntax){ |
define(function(){ | ||
/** | ||
* "Safer" String.toLowerCase() | ||
* @version 0.1.0 (2011/10/19) | ||
*/ | ||
@@ -6,0 +5,0 @@ function upperCase(str){ |
@@ -5,3 +5,2 @@ define(['./repeat'], function (repeat) { | ||
* Pad string with `char` if its' length is smaller than `minLen` | ||
* @version 0.1.1 (2012/05/03) | ||
*/ | ||
@@ -8,0 +7,0 @@ function lpad(str, minLen, ch) { |
@@ -7,3 +7,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function ltrim(str){ |
@@ -6,3 +6,2 @@ define(['../array/join'], function(join){ | ||
* empty string it will be ignored from resulting path. | ||
* @version 0.3.0 (2012/08/24) | ||
*/ | ||
@@ -9,0 +8,0 @@ function makePath(var_args){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Convert line-breaks from DOS/MAC to a single standard (UNIX by default) | ||
* @version 0.1.0 (2011/12/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ function normalizeLineBreaks(str, lineEnd) { |
define(['./camelCase', './upperCase'], function(camelCase, upperCase){ | ||
/** | ||
* camelCase + uppercase first char | ||
* @version 0.1.0 (2011/10/26) | ||
*/ | ||
@@ -6,0 +5,0 @@ function pascalCase(str){ |
@@ -8,3 +8,2 @@ define(['./lowerCase', './upperCase'], function(lowerCase, upperCase){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -11,0 +10,0 @@ function properCase(str){ |
@@ -6,3 +6,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.1 (2011/08/09) | ||
*/ | ||
@@ -9,0 +8,0 @@ function removeNonASCII(str){ |
@@ -7,3 +7,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function removeNonWord(str){ |
@@ -5,3 +5,2 @@ define(function(){ | ||
* Repeat string n times | ||
* @version 0.1.0 (2011/12/07) | ||
*/ | ||
@@ -8,0 +7,0 @@ function repeat(str, n){ |
@@ -9,3 +9,2 @@ define(function(){ | ||
* @return {string} formated string | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -12,0 +11,0 @@ function replaceAccents(str){ |
@@ -5,3 +5,2 @@ define(['./repeat'], function (repeat) { | ||
* Pad string with `char` if its' length is smaller than `minLen` | ||
* @version 0.1.1 (2012/05/03) | ||
*/ | ||
@@ -8,0 +7,0 @@ function rpad(str, minLen, ch) { |
@@ -7,3 +7,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function rtrim(str){ |
@@ -8,3 +8,2 @@ define(['./lowerCase', './upperCase'], function(lowerCase, upperCase){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -11,0 +10,0 @@ function sentenceCase(str){ |
@@ -11,3 +11,2 @@ define(['./replaceAccents', './removeNonWord', './trim'], function(replaceAccents, removeNonWord, trim){ | ||
* @return {string} | ||
* @version 0.2.0 (2012/08/17) | ||
*/ | ||
@@ -14,0 +13,0 @@ function slugify(str, delimeter){ |
@@ -9,3 +9,2 @@ define(function () { | ||
* @return {bool} | ||
* @version 0.1.0 (2012/03/01) | ||
*/ | ||
@@ -12,0 +11,0 @@ function startsWith(str, prefix) { |
@@ -7,3 +7,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function stripHtmlTags(str){ |
@@ -7,3 +7,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function trim(str){ |
define(['./trim'], function(trim){ | ||
/** | ||
* Limit number of chars. | ||
* @version 0.3.0 (2011/10/31) | ||
*/ | ||
@@ -6,0 +5,0 @@ function truncate(str, maxChars, append, onlyFullWords){ |
@@ -7,3 +7,2 @@ define(function () { | ||
* Parses string and convert it into a native value. | ||
* @version 0.2.0 (2011/10/30) | ||
*/ | ||
@@ -10,0 +9,0 @@ function typecast(val) { |
@@ -7,3 +7,2 @@ define(function(){ | ||
* @return {string} | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -10,0 +9,0 @@ function unCamelCase(str){ |
define(['./slugify', './unCamelCase'], function(slugify, unCamelCase){ | ||
/** | ||
* Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -6,0 +5,0 @@ function underscore(str){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Unescapes HTML special chars | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unescapeHtml(str){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Unescape unicode char sequences | ||
* @version 0.1.0 (2012/12/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unescapeUnicode(str){ |
@@ -5,3 +5,2 @@ define(function(){ | ||
* @example unhyphenate('lorem-ipsum-dolor') -> 'lorem ipsum dolor' | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unhyphenate(str){ |
define(function(){ | ||
/** | ||
* "Safer" String.toUpperCase() | ||
* @version 0.1.0 (2011/10/19) | ||
*/ | ||
@@ -6,0 +5,0 @@ function upperCase(str){ |
@@ -5,3 +5,2 @@ define(function () { | ||
* Get current time in miliseconds | ||
* @version 0.1.0 (2012/04/11) | ||
*/ | ||
@@ -8,0 +7,0 @@ var now = (typeof Date.now === 'function')? Date.now : function(){ |
@@ -5,3 +5,2 @@ define(['../math/countSteps'], function(countSteps){ | ||
* Parse timestamp into an object. | ||
* @version 0.1.0 (2011/12/08) | ||
*/ | ||
@@ -8,0 +7,0 @@ function parseMs(ms){ |
@@ -9,3 +9,2 @@ define(['../math/countSteps', '../number/pad'], function(countSteps, pad){ | ||
* Format timestamp into a time string. | ||
* @version 0.3.0 (2012/08/08) | ||
*/ | ||
@@ -12,0 +11,0 @@ function toTimeString(ms){ |
@@ -11,3 +11,2 @@ var replaceAccents = require('./replaceAccents'); | ||
* @return {string} | ||
* @version 0.2.0 (2011/08/09) | ||
*/ | ||
@@ -14,0 +13,0 @@ function camelCase(str){ |
@@ -5,3 +5,2 @@ | ||
* searches for a given substring | ||
* @version 0.1.0 (2012/08/30) | ||
*/ | ||
@@ -8,0 +7,0 @@ function contains(str, substring){ |
var truncate = require('./truncate'); | ||
/** | ||
* Truncate string at full words. | ||
* @version 0.1.0 (2011/10/31) | ||
*/ | ||
@@ -6,0 +5,0 @@ function crop(str, maxChars, append) { |
@@ -9,3 +9,2 @@ | ||
* @return {bool} | ||
* @version 0.1.0 (2012/03/01) | ||
*/ | ||
@@ -12,0 +11,0 @@ function endsWith(str, suffix) { |
@@ -5,3 +5,2 @@ | ||
* Escapes a string for insertion into HTML. | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function escapeHtml(str){ |
@@ -7,3 +7,2 @@ | ||
* Escape RegExp string chars. | ||
* @version 0.1.0 (2011/12/17) | ||
*/ | ||
@@ -10,0 +9,0 @@ function escapeRegExp(str) { |
@@ -5,3 +5,2 @@ | ||
* Escape string into unicode sequences | ||
* @version 0.1.0 (2012/12/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function escapeUnicode(str, shouldEscapePrintable){ |
@@ -6,3 +6,2 @@ var slugify = require('./slugify'); | ||
* @example hyphenate('loremIpsum dolor spéçïãl chârs') -> 'lorem-ipsum-dolor-special-chars' | ||
* @version 0.2.0 (2012/08/17) | ||
*/ | ||
@@ -9,0 +8,0 @@ function hyphenate(str){ |
@@ -7,3 +7,2 @@ | ||
* String interpolation | ||
* @version 0.1.0 (2012/03/05) | ||
*/ | ||
@@ -10,0 +9,0 @@ function interpolate(template, replacements, syntax){ |
/** | ||
* "Safer" String.toLowerCase() | ||
* @version 0.1.0 (2011/10/19) | ||
*/ | ||
@@ -6,0 +5,0 @@ function upperCase(str){ |
@@ -5,3 +5,2 @@ var repeat = require('./repeat'); | ||
* Pad string with `char` if its' length is smaller than `minLen` | ||
* @version 0.1.1 (2012/05/03) | ||
*/ | ||
@@ -8,0 +7,0 @@ function lpad(str, minLen, ch) { |
@@ -7,3 +7,2 @@ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function ltrim(str){ |
@@ -6,3 +6,2 @@ var join = require('../array/join'); | ||
* empty string it will be ignored from resulting path. | ||
* @version 0.3.0 (2012/08/24) | ||
*/ | ||
@@ -9,0 +8,0 @@ function makePath(var_args){ |
@@ -5,3 +5,2 @@ | ||
* Convert line-breaks from DOS/MAC to a single standard (UNIX by default) | ||
* @version 0.1.0 (2011/12/17) | ||
*/ | ||
@@ -8,0 +7,0 @@ function normalizeLineBreaks(str, lineEnd) { |
@@ -5,3 +5,2 @@ var camelCase = require('./camelCase'); | ||
* camelCase + uppercase first char | ||
* @version 0.1.0 (2011/10/26) | ||
*/ | ||
@@ -8,0 +7,0 @@ function pascalCase(str){ |
@@ -9,3 +9,2 @@ var lowerCase = require('./lowerCase'); | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -12,0 +11,0 @@ function properCase(str){ |
@@ -6,3 +6,2 @@ | ||
* @return {string} | ||
* @version 0.1.1 (2011/08/09) | ||
*/ | ||
@@ -9,0 +8,0 @@ function removeNonASCII(str){ |
@@ -7,3 +7,2 @@ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function removeNonWord(str){ |
@@ -5,3 +5,2 @@ | ||
* Repeat string n times | ||
* @version 0.1.0 (2011/12/07) | ||
*/ | ||
@@ -8,0 +7,0 @@ function repeat(str, n){ |
@@ -9,3 +9,2 @@ | ||
* @return {string} formated string | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -12,0 +11,0 @@ function replaceAccents(str){ |
@@ -5,3 +5,2 @@ var repeat = require('./repeat'); | ||
* Pad string with `char` if its' length is smaller than `minLen` | ||
* @version 0.1.1 (2012/05/03) | ||
*/ | ||
@@ -8,0 +7,0 @@ function rpad(str, minLen, ch) { |
@@ -7,3 +7,2 @@ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function rtrim(str){ |
@@ -9,3 +9,2 @@ var lowerCase = require('./lowerCase'); | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -12,0 +11,0 @@ function sentenceCase(str){ |
@@ -13,3 +13,2 @@ var replaceAccents = require('./replaceAccents'); | ||
* @return {string} | ||
* @version 0.2.0 (2012/08/17) | ||
*/ | ||
@@ -16,0 +15,0 @@ function slugify(str, delimeter){ |
@@ -9,3 +9,2 @@ | ||
* @return {bool} | ||
* @version 0.1.0 (2012/03/01) | ||
*/ | ||
@@ -12,0 +11,0 @@ function startsWith(str, prefix) { |
@@ -7,3 +7,2 @@ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function stripHtmlTags(str){ |
@@ -7,3 +7,2 @@ | ||
* @return {string} | ||
* @version 0.1.0 (2011/07/20) | ||
*/ | ||
@@ -10,0 +9,0 @@ function trim(str){ |
var trim = require('./trim'); | ||
/** | ||
* Limit number of chars. | ||
* @version 0.3.0 (2011/10/31) | ||
*/ | ||
@@ -6,0 +5,0 @@ function truncate(str, maxChars, append, onlyFullWords){ |
@@ -7,3 +7,2 @@ | ||
* Parses string and convert it into a native value. | ||
* @version 0.2.0 (2011/10/30) | ||
*/ | ||
@@ -10,0 +9,0 @@ function typecast(val) { |
@@ -7,3 +7,2 @@ | ||
* @return {string} | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -10,0 +9,0 @@ function unCamelCase(str){ |
@@ -5,3 +5,2 @@ var slugify = require('./slugify'); | ||
* Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case. | ||
* @version 0.1.0 | ||
*/ | ||
@@ -8,0 +7,0 @@ function underscore(str){ |
@@ -5,3 +5,2 @@ | ||
* Unescapes HTML special chars | ||
* @version 0.1.0 (2012/05/24) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unescapeHtml(str){ |
@@ -5,3 +5,2 @@ | ||
* Unescape unicode char sequences | ||
* @version 0.1.0 (2012/12/19) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unescapeUnicode(str){ |
@@ -5,3 +5,2 @@ | ||
* @example unhyphenate('lorem-ipsum-dolor') -> 'lorem ipsum dolor' | ||
* @version 0.1.0 (2011/08/09) | ||
*/ | ||
@@ -8,0 +7,0 @@ function unhyphenate(str){ |
/** | ||
* "Safer" String.toUpperCase() | ||
* @version 0.1.0 (2011/10/19) | ||
*/ | ||
@@ -6,0 +5,0 @@ function upperCase(str){ |
@@ -5,3 +5,2 @@ | ||
* Get current time in miliseconds | ||
* @version 0.1.0 (2012/04/11) | ||
*/ | ||
@@ -8,0 +7,0 @@ var now = (typeof Date.now === 'function')? Date.now : function(){ |
@@ -5,3 +5,2 @@ var countSteps = require('../math/countSteps'); | ||
* Parse timestamp into an object. | ||
* @version 0.1.0 (2011/12/08) | ||
*/ | ||
@@ -8,0 +7,0 @@ function parseMs(ms){ |
@@ -10,3 +10,2 @@ var countSteps = require('../math/countSteps'); | ||
* Format timestamp into a time string. | ||
* @version 0.3.0 (2012/08/08) | ||
*/ | ||
@@ -13,0 +12,0 @@ function toTimeString(ms){ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
413
1
257979
5774
64