update js libraries.

This commit is contained in:
Keivan Beigi 2013-07-03 18:02:17 -07:00 committed by kay.one
parent 1c5a74df98
commit 38c3faf53c
4 changed files with 100 additions and 45 deletions

View file

@ -322,7 +322,7 @@
function escapeRegExp(str) {
if(!isString(str)) str = string(str);
return str.replace(/([\\/'*+?|()\[\]{}.^$])/g,'\\$1');
return str.replace(/([\\/\'*+?|()\[\]{}.^$])/g,'\\$1');
}
@ -4876,7 +4876,7 @@
*
***/
number.extend({
extend(number, true, false, {
/***
* @method upto(<num>, [fn], [step] = 1)
@ -4897,7 +4897,7 @@
},
/***
* @method clamp([start], [end])
* @method clamp([start] = Infinity, [end] = Infinity)
* @returns Number
* @short Constrains the number so that it is between [start] and [end].
* @extra This alias will build a range object that can be accessed directly using %Number.range% and has an equivalent %clamp% method.
@ -4905,6 +4905,17 @@
***/
'clamp': function(start, end) {
return new Range(start, end).clamp(this);
},
/***
* @method cap([max] = Infinity)
* @returns Number
* @short Constrains the number so that it is between [start] and [end].
* @extra This alias will build a range object that can be accessed directly using %Number.range% and has an equivalent %clamp% method.
*
***/
'cap': function(max) {
return this.clamp(Undefined, max);
}
});
@ -5638,7 +5649,7 @@
}
function selectFromObject(obj, args, select) {
var result = {}, match;
var match, result = obj instanceof Hash ? new Hash : {};
iterateOverObject(obj, function(key, value) {
match = false;
flattenedArgs(args, function(arg) {
@ -5816,17 +5827,18 @@
*
***/
'merge': function(target, source, deep, resolve) {
var key, val;
var key, val, goDeep;
// Strings cannot be reliably merged thanks to
// their properties not being enumerable in < IE8.
if(target && typeof source != 'string') {
if(target && typeof source !== 'string') {
for(key in source) {
if(!hasOwnProperty(source, key) || !target) continue;
val = source[key];
val = source[key];
goDeep = deep && isObjectPrimitive(val);
// Conflict!
if(isDefined(target[key])) {
// Do not merge.
if(resolve === false) {
if(resolve === false && !goDeep) {
continue;
}
// Use the result of the callback as the result.
@ -5835,7 +5847,7 @@
}
}
// Deep merging.
if(deep === true && val && isObjectPrimitive(val)) {
if(goDeep) {
if(isDate(val)) {
val = new date(val.getTime());
} else if(isRegExp(val)) {
@ -6032,7 +6044,6 @@
buildObjectExtend();
buildObjectInstanceMethods(ObjectHashMethods, Hash);
/***
* @package RegExp
* @dependency core
@ -6979,7 +6990,7 @@
***/
'capitalize': function(all) {
var lastResponded;
return this.toLowerCase().replace(all ? /[\s\S]/g : /^\S/, function(lower) {
return this.toLowerCase().replace(all ? /[^']/g : /^\S/, function(lower) {
var upper = lower.toUpperCase(), result;
result = lastResponded ? lower : upper;
lastResponded = upper !== lower;
@ -6990,8 +7001,8 @@
/***
* @method assign(<obj1>, <obj2>, ...)
* @returns String
* @short Assigns variables to tokens in a string.
* @extra If an object is passed, it's properties can be assigned using the object's keys. If a non-object (string, number, etc.) is passed it can be accessed by the argument number beginning with 1 (as with regex tokens). Multiple objects can be passed and will be merged together (original objects are unaffected).
* @short Assigns variables to tokens in a string, demarcated with `{}`.
* @extra If an object is passed, it's properties can be assigned using the object's keys (i.e. {name}). If a non-object (string, number, etc.) is passed it can be accessed by the argument number beginning with {1} (as with regex tokens). Multiple objects can be passed and will be merged together (original objects are unaffected).
* @example
*
* 'Welcome, Mr. {name}.'.assign({ name: 'Franklin' }) -> 'Welcome, Mr. Franklin.'