Monthly Archives: August 2012

underscore.js Object functions (replacement 2)

_.isArray(object) === if(object instanceof Array) _.isObject(value) === if(object instanceof Object) _.isFunction(object) === if(object instanceof Function) _.isString(object) === if(object instanceof String) _.isNumber(object) === if(object instanceof Number) _.isBoolean(object) === if(object instanceof Boolean) _.isDate(object) === if(object instanceof Date) _.isRegExp(object) === if(object instanceof RegExp)

Posted in Uncategorized | Leave a comment

underscore.js Array functions (replacements 1)

_.first === array[0] _.initial === array.slice(0, array.length-1) _.last === array[array.length-1] _.rest === array.slice(x,¬†array.length-1) n.b. where x = start position in array  

Posted in Uncategorized | Leave a comment