Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jahcode

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jahcode - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

98

jahcode.js

@@ -1,2 +0,2 @@

/*! Jahcode v1.0.1 | jahcode.com | Copyright 2011-2013 by Florian Buecklers | MIT license */
/*! Jahcode v1.1.0 | jahcode.com | Copyright 2011-2013 by Florian Buecklers | MIT license */

@@ -30,5 +30,7 @@ (function(global) {

if (!(this instanceof klass)) {
return toCast && toCast.isInstanceOf && toCast.isInstanceOf(klass) ? toCast : klass.conv(toCast);
return klass.asInstance(toCast);
}
arguments.length ? this.initialize.apply(this, arguments) : this.initialize.call(this);
if (this.initialize)
arguments.length ? this.initialize.apply(this, arguments) : this.initialize.call(this);
};

@@ -56,3 +58,3 @@

if (!d || !(d.hasOwnProperty('get') || d.hasOwnProperty('set'))) {
if (!d || !(d.hasOwnProperty('get') || d.hasOwnProperty('value'))) {
proto[name] = d;

@@ -71,2 +73,15 @@ } else {

},
isInstance : function(obj) {
if (obj === null || obj === undefined)
return false;
return Object(obj) instanceof this || classOf(obj).linearizedTypes.lastIndexOf(this) != -1;
},
asInstance : function(obj) {
if (this.isInstance(obj)) {
return obj;
} else {
return this.conv(obj);
}
},
conv : function() {

@@ -79,6 +94,2 @@ return null;

properties : {},
baseDescriptors : {},
initialize : function() {
Object.defineProperties(Object.prototype, Object.baseDescriptors);
},
cloneOwnProperties : function(target, src) {

@@ -95,22 +106,4 @@ var names = Object.getOwnPropertyNames(src);

},
getBasePrototype : function(cls) {
if (cls.prototype.isInstanceOf) {
return cls.prototype;
}
if (!cls.basePrototype) {
cls.basePrototype = Object.create(cls.prototype);
Object.defineProperties(cls.basePrototype, Object.baseDescriptors);
if (!cls.prototype.initialize) {
cls.basePrototype.initialize = function() {
arguments.length ? cls.apply(this, arguments) : cls.call(this);
};
}
}
return cls.basePrototype;
},
createPrototypeChain : function(cls, parentClass, traits) {
var proto = Object.getBasePrototype(parentClass);
var proto = parentClass.prototype;
var linearizedTypes = parentClass.linearizedTypes.slice();

@@ -166,3 +159,4 @@ var prototypeChain = parentClass.prototypeChain ? parentClass.prototypeChain.slice() : [proto];

return arguments.length ? proto[methodName].apply(this, arguments) : proto[methodName].call(this);
if (methodName != 'initialize' || proto[methodName])
return arguments.length ? proto[methodName].apply(this, arguments) : proto[methodName].call(this);
};

@@ -176,3 +170,8 @@

this.superCall = current;
if (current) {
this.superCall = current;
} else {
// made the property invisible again
delete this.superCall;
}

@@ -210,21 +209,2 @@ return result;

Object.extend(Object.baseDescriptors, {
isInstanceOf : {
value : function(klass) {
return this instanceof klass || classOf(this).linearizedTypes.lastIndexOf(klass) != -1;
},
enumarable : false
},
asInstanceOf : {
value : function(klass) {
if (this.isInstanceOf(klass)) {
return this;
} else {
throw new TypeError();
}
},
enumerable : false
}
});
var classOf = function(object) {

@@ -235,2 +215,3 @@ return Object.getPrototypeOf(Object(object)).constructor;

var Trait = Object.inherit({});
var Bind = Trait.inherit({

@@ -314,11 +295,4 @@ extend : {

var nativeClasses = [Boolean, Number, String, Array, Function, Date, RegExp, Error];
var nativeClasses = [Boolean, Number, String, Function, RegExp, Error];
for ( var i = 0, cls; cls = nativeClasses[i]; ++i) {
Object.extend(cls.prototype, {
isInstanceOf : function(klass) {
return this instanceof klass;
},
asInstanceOf : Object.basePrototype.asInstanceOf
});
cls.conv = cls;

@@ -331,2 +305,6 @@ }

Array.conv = function(object) {
return Array.prototype.slice.call(object);
};
Array.prototype.initialize = function() {

@@ -341,5 +319,13 @@ for ( var i = 0; i < arguments.length; ++i) {

Error.prototype.initialize = function(message) {
Object.extend(this, new Error());
this.message = message;
};
if (TypeError instanceof Error) { // ie8 uses error instances for subtype constructors
Error.prototype.isInstance = Error.isInstance;
Error.prototype.asInstance = Error.asInstance;
Error.prototype.conv = Error.conv;
}
Object.extend(global, {

@@ -346,0 +332,0 @@ classOf : classOf,

@@ -1,5 +0,5 @@

/*! Jahcode v1.0.1 | jahcode.com | Copyright 2011-2013 by Florian Buecklers | MIT license */
!function(t){var e=Object.getPrototypeOf({constructor:String})==String.prototype;Function.prototype.extend||(Function.prototype.extend=function(t,e){e||(e=t,t=this);for(name in e)e.hasOwnProperty(name)&&(t[name]=e[name]);return t}),Object.extend(Function.prototype,{linearizedTypes:[Object],inherit:function(){for(var t=function(e){return this instanceof t?(arguments.length?this.initialize.apply(this,arguments):this.initialize.call(this),void 0):e&&e.isInstanceOf&&e.isInstanceOf(t)?e:t.conv(e)},e=arguments[arguments.length-1],n=Object.createPrototypeChain(t,this,Array.prototype.slice.call(arguments,0,arguments.length-1)),r=Object.getOwnPropertyNames(e),i=0;i<r.length;++i){var o=r[i],a=!1;if(Object.properties.hasOwnProperty(o)&&(a=Object.properties[o](n,e,o)),!a){var s=e[o];s instanceof Function&&/this\.superCall/.test(s.toString())&&(s=Object.createSuperCallWrapper(t,o,s)),s&&(s.hasOwnProperty("get")||s.hasOwnProperty("set"))?Object.defineProperty(n,o,s):n[o]=s}}return t.initialize&&t.initialize(),t},conv:function(){return null}}),Object.extend({properties:{},baseDescriptors:{},initialize:function(){Object.defineProperties(Object.prototype,Object.baseDescriptors)},cloneOwnProperties:function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;++r){var i=n[r];if("__proto__"!=i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,o)}}},getBasePrototype:function(t){return t.prototype.isInstanceOf?t.prototype:(t.basePrototype||(t.basePrototype=Object.create(t.prototype),Object.defineProperties(t.basePrototype,Object.baseDescriptors),t.prototype.initialize||(t.basePrototype.initialize=function(){arguments.length?t.apply(this,arguments):t.call(this)})),t.basePrototype)},createPrototypeChain:function(t,n,r){for(var o,a=Object.getBasePrototype(n),s=n.linearizedTypes.slice(),c=n.prototypeChain?n.prototypeChain.slice():[a],p=0;o=r[p];++p){if(!(o.prototype instanceof i))throw new TypeError("Only traits can be mixed in.");for(var u,l=o.linearizedTypes,h=0;u=l[h];++h)-1==s.indexOf(u)&&u!=i&&(a=Object.create(a),Object.cloneOwnProperties(a,u.wrappedPrototype?u.wrappedPrototype:u.prototype),a.constructor=u,s.push(u),c.push(a))}return a=Object.create(a),a.constructor=t,s.push(t),c.push(a),e?(t.wrappedPrototype=a,t.prototype=Object.create(a)):t.prototype=a,t.linearizedTypes=s,t.prototypeChain=c,a},createSuperCallWrapper:function(t,e,n){var i=function(){var n=r(this),i=n.linearizedTypes.lastIndexOf(t);if(-1==i)throw new ReferenceError("superCall can't determine any super method");var o=n.prototypeChain[i-1];return arguments.length?o[e].apply(this,arguments):o[e].call(this)};return function(){var t=this.superCall;this.superCall=i;var e=arguments.length?n.apply(this,arguments):n.call(this);return this.superCall=t,e}}}),Object.extend(Object.properties,{initialize:function(t,e){var n=e.initialize,o=/this\.superCall/.test(n.toString());if(t instanceof i){if(o)throw new TypeError("Trait constructors can not call super constructors directly.");e.initialize=function(){arguments.length?this.superCall.apply(this,arguments):this.superCall.call(this),n.call(this)}}else o||r(t)==Object||(e.initialize=function(){this.superCall.call(this),arguments.length?n.apply(this,arguments):n.call(this)})},extend:function(t,e){return Object.extend(t.constructor,e.extend),!0}}),Object.extend(Object.baseDescriptors,{isInstanceOf:{value:function(t){return this instanceof t||-1!=r(this).linearizedTypes.lastIndexOf(t)},enumarable:!1},asInstanceOf:{value:function(t){if(this.isInstanceOf(t))return this;throw new TypeError},enumerable:!1}});for(var n,r=function(t){return Object.getPrototypeOf(Object(t)).constructor},i=Object.inherit({}),o=(i.inherit({extend:{initialize:function(){try{Object.defineProperty(this.prototype,"bind",{get:function(){return this.bind=o.create(this)},set:function(t){Object.defineProperty(this,"bind",{value:t})},configurable:!0}),this.Object=Object.inherit({initialize:function(t){this.self=t}})}catch(t){this.Object=Object.inherit({initialize:function(t){this.self=t;var e=this;o.each(t,function(t,n){e[t]=n.bind(e.self)})}})}},create:function(t){if(!t.constructor.Bind)try{var e={};o.each(t,function(t,n){e[t]={get:function(){return this[t]=n.bind(this.self)},set:function(e){Object.defineProperty(this,t,{value:e})},configurable:!0}}),t.constructor.Bind=o.Object.inherit(e)}catch(n){t.constructor.Bind=o.Object.inherit({})}return new t.constructor.Bind(t)},each:function(t,e){var n=Object.getPrototypeOf(t);for(var r in n){var i=n[r];"initialize"!=r&&i instanceof Function&&e(r,i)}}},initialize:function(){"bind"in this||(this.bind=o.create(this))}})),a=[Boolean,Number,String,Array,Function,Date,RegExp,Error],s=0;n=a[s];++s)Object.extend(n.prototype,{isInstanceOf:function(t){return this instanceof t},asInstanceOf:Object.basePrototype.asInstanceOf}),n.conv=n;Date.conv=function(t){return new Date(t)},Array.prototype.initialize=function(){for(var t=0;t<arguments.length;++t)this[t]=arguments[t];this.length=arguments.length},Error.prototype.initialize=function(t){this.message=t},Object.extend(t,{classOf:r,Trait:i,Bind:o})}("undefined"!=typeof window?window:global);
/*! Jahcode v1.1.0 | jahcode.com | Copyright 2011-2013 by Florian Buecklers | MIT license */
!function(t){var e=Object.getPrototypeOf({constructor:String})==String.prototype;Function.prototype.extend||(Function.prototype.extend=function(t,e){e||(e=t,t=this);for(name in e)e.hasOwnProperty(name)&&(t[name]=e[name]);return t}),Object.extend(Function.prototype,{linearizedTypes:[Object],inherit:function(){for(var t=function(e){return this instanceof t?(this.initialize&&(arguments.length?this.initialize.apply(this,arguments):this.initialize.call(this)),void 0):t.asInstance(e)},e=arguments[arguments.length-1],n=Object.createPrototypeChain(t,this,Array.prototype.slice.call(arguments,0,arguments.length-1)),r=Object.getOwnPropertyNames(e),i=0;i<r.length;++i){var o=r[i],a=!1;if(Object.properties.hasOwnProperty(o)&&(a=Object.properties[o](n,e,o)),!a){var c=e[o];c instanceof Function&&/this\.superCall/.test(c.toString())&&(c=Object.createSuperCallWrapper(t,o,c)),c&&(c.hasOwnProperty("get")||c.hasOwnProperty("value"))?Object.defineProperty(n,o,c):n[o]=c}}return t.initialize&&t.initialize(),t},isInstance:function(t){return null===t||void 0===t?!1:Object(t)instanceof this||-1!=r(t).linearizedTypes.lastIndexOf(this)},asInstance:function(t){return this.isInstance(t)?t:this.conv(t)},conv:function(){return null}}),Object.extend({properties:{},cloneOwnProperties:function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r<n.length;++r){var i=n[r];if("__proto__"!=i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,o)}}},createPrototypeChain:function(t,n,r){for(var o,a=n.prototype,c=n.linearizedTypes.slice(),s=n.prototypeChain?n.prototypeChain.slice():[a],p=0;o=r[p];++p){if(!(o.prototype instanceof i))throw new TypeError("Only traits can be mixed in.");for(var l,u=o.linearizedTypes,h=0;l=u[h];++h)-1==c.indexOf(l)&&l!=i&&(a=Object.create(a),Object.cloneOwnProperties(a,l.wrappedPrototype?l.wrappedPrototype:l.prototype),a.constructor=l,c.push(l),s.push(a))}return a=Object.create(a),a.constructor=t,c.push(t),s.push(a),e?(t.wrappedPrototype=a,t.prototype=Object.create(a)):t.prototype=a,t.linearizedTypes=c,t.prototypeChain=s,a},createSuperCallWrapper:function(t,e,n){var i=function(){var n=r(this),i=n.linearizedTypes.lastIndexOf(t);if(-1==i)throw new ReferenceError("superCall can't determine any super method");var o=n.prototypeChain[i-1];return"initialize"!=e||o[e]?arguments.length?o[e].apply(this,arguments):o[e].call(this):void 0};return function(){var t=this.superCall;this.superCall=i;var e=arguments.length?n.apply(this,arguments):n.call(this);return t?this.superCall=t:delete this.superCall,e}}}),Object.extend(Object.properties,{initialize:function(t,e){var n=e.initialize,o=/this\.superCall/.test(n.toString());if(t instanceof i){if(o)throw new TypeError("Trait constructors can not call super constructors directly.");e.initialize=function(){arguments.length?this.superCall.apply(this,arguments):this.superCall.call(this),n.call(this)}}else o||r(t)==Object||(e.initialize=function(){this.superCall.call(this),arguments.length?n.apply(this,arguments):n.call(this)})},extend:function(t,e){return Object.extend(t.constructor,e.extend),!0}});for(var n,r=function(t){return Object.getPrototypeOf(Object(t)).constructor},i=Object.inherit({}),o=(i.inherit({extend:{initialize:function(){try{Object.defineProperty(this.prototype,"bind",{get:function(){return this.bind=o.create(this)},set:function(t){Object.defineProperty(this,"bind",{value:t})},configurable:!0}),this.Object=Object.inherit({initialize:function(t){this.self=t}})}catch(t){this.Object=Object.inherit({initialize:function(t){this.self=t;var e=this;o.each(t,function(t,n){e[t]=n.bind(e.self)})}})}},create:function(t){if(!t.constructor.Bind)try{var e={};o.each(t,function(t,n){e[t]={get:function(){return this[t]=n.bind(this.self)},set:function(e){Object.defineProperty(this,t,{value:e})},configurable:!0}}),t.constructor.Bind=o.Object.inherit(e)}catch(n){t.constructor.Bind=o.Object.inherit({})}return new t.constructor.Bind(t)},each:function(t,e){var n=Object.getPrototypeOf(t);for(var r in n){var i=n[r];"initialize"!=r&&i instanceof Function&&e(r,i)}}},initialize:function(){"bind"in this||(this.bind=o.create(this))}})),a=[Boolean,Number,String,Function,RegExp,Error],c=0;n=a[c];++c)n.conv=n;Date.conv=function(t){return new Date(t)},Array.conv=function(t){return Array.prototype.slice.call(t)},Array.prototype.initialize=function(){for(var t=0;t<arguments.length;++t)this[t]=arguments[t];this.length=arguments.length},Error.prototype.initialize=function(t){Object.extend(this,new Error),this.message=t},TypeError instanceof Error&&(Error.prototype.isInstance=Error.isInstance,Error.prototype.asInstance=Error.asInstance,Error.prototype.conv=Error.conv),Object.extend(t,{classOf:r,Trait:i,Bind:o})}("undefined"!=typeof window?window:global);
/*
//@ sourceMappingURL=jahcode.map
*/

@@ -25,2 +25,2 @@

Copyright (C) 2009 MIT License
- Steven Levithan Copyright (C) 2012 MIT License

@@ -114,3 +114,3 @@ // Copyright 2009-2012 by contributors, MIT License

};
if(target.prototype) {
if (target.prototype) {
Empty.prototype = target.prototype;

@@ -194,3 +194,3 @@ bound.prototype = new Empty();

if(function() { // test IE < 9 to splice bug - see issue #138
if (function() { // test IE < 9 to splice bug - see issue #138
function makeArray(l) {

@@ -214,3 +214,3 @@ var a = [];

if(lengthBefore + 1 == array.length) {
if (lengthBefore + 1 == array.length) {
return true;// has right splice implementation without bugs

@@ -240,16 +240,16 @@ }

if(!arguments.length) {
if (!arguments.length) {
return [];
}
if(start === void 0) { // default
if (start === void 0) { // default
start = 0;
}
if(deleteCount === void 0) { // default
if (deleteCount === void 0) { // default
deleteCount = this.length - start;
}
if(addElementsCount > 0) {
if(deleteCount <= 0) {
if(start == this.length) { // tiny optimisation #1
if (addElementsCount > 0) {
if (deleteCount <= 0) {
if (start == this.length) { // tiny optimisation #1
this.push.apply(this, args);

@@ -259,3 +259,3 @@ return [];

if(start == 0) { // tiny optimisation #2
if (start == 0) { // tiny optimisation #2
this.unshift.apply(this, args);

@@ -550,2 +550,6 @@ return [];

if (i < 0) {
return result;
}
do {

@@ -858,2 +862,6 @@ if (i in this) {

function toUTC(t) {
return Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
}
// Copy any custom methods a 3rd party library may have added

@@ -887,4 +895,3 @@ for (var key in NativeDate) {

// see https://bugs.ecmascript.org/show_bug.cgi?id=112
offset = !match[4] || match[8] ?
0 : Number(new NativeDate(1970, 0)),
isLocalTime = Boolean(match[4] && !match[8]),
signOffset = match[9] === "-" ? 1 : -1,

@@ -916,3 +923,6 @@ hourOffset = Number(match[10] || 0),

second
) * 1000 + millisecond + offset;
) * 1000 + millisecond;
if (isLocalTime) {
result = toUTC(result);
}
if (-8.64e15 <= result && result <= 8.64e15) {

@@ -1103,2 +1113,100 @@ return result;

// http://es5.github.com/#x15.5.4.14
// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
// Many browsers do not split properly with regular expressions or they
// do not perform the split correctly under obscure conditions.
// See http://blog.stevenlevithan.com/archives/cross-browser-split
// I've tested in many browsers and this seems to cover the deviant ones:
// 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
// '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
// 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
// [undefined, "t", undefined, "e", ...]
// ''.split(/.?/) should be [], not [""]
// '.'.split(/()()/) should be ["."], not ["", "", "."]
var string_split = String.prototype.split;
if (
'ab'.split(/(?:ab)*/).length !== 2 ||
'.'.split(/(.?)(.?)/).length !== 4 ||
'tesst'.split(/(s)*/)[1] === "t" ||
''.split(/.?/).length ||
'.'.split(/()()/).length > 1
) {
(function () {
var compliantExecNpcg = /()??/.exec("")[1] === void 0; // NPCG: nonparticipating capturing group
String.prototype.split = function (separator, limit) {
var string = this;
if (separator === void 0 && limit === 0)
return [];
// If `separator` is not a regex, use native split
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
return string_split.apply(this, arguments);
}
var output = [],
flags = (separator.ignoreCase ? "i" : "") +
(separator.multiline ? "m" : "") +
(separator.extended ? "x" : "") + // Proposed for ES6
(separator.sticky ? "y" : ""), // Firefox 3+
lastLastIndex = 0,
// Make `global` and avoid `lastIndex` issues by working with a copy
separator = new RegExp(separator.source, flags + "g"),
separator2, match, lastIndex, lastLength;
string += ""; // Type-convert
if (!compliantExecNpcg) {
// Doesn't need flags gy, but they don't hurt
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
}
/* Values for `limit`, per the spec:
* If undefined: 4294967295 // Math.pow(2, 32) - 1
* If 0, Infinity, or NaN: 0
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
* If negative number: 4294967296 - Math.floor(Math.abs(limit))
* If other: Type-convert, then use the above rules
*/
limit = limit === void 0 ?
-1 >>> 0 : // Math.pow(2, 32) - 1
limit >>> 0; // ToUint32(limit)
while (match = separator.exec(string)) {
// `separator.lastIndex` is not reliable cross-browser
lastIndex = match.index + match[0].length;
if (lastIndex > lastLastIndex) {
output.push(string.slice(lastLastIndex, match.index));
// Fix browsers whose `exec` methods don't consistently return `undefined` for
// nonparticipating capturing groups
if (!compliantExecNpcg && match.length > 1) {
match[0].replace(separator2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === void 0) {
match[i] = void 0;
}
}
});
}
if (match.length > 1 && match.index < string.length) {
Array.prototype.push.apply(output, match.slice(1));
}
lastLength = match[0].length;
lastLastIndex = lastIndex;
if (output.length >= limit) {
break;
}
}
if (separator.lastIndex === match.index) {
separator.lastIndex++; // Avoid an infinite loop
}
}
if (lastLastIndex === string.length) {
if (lastLength || !separator.test("")) {
output.push("");
}
} else {
output.push(string.slice(lastLastIndex));
}
return output.length > limit ? output.slice(0, limit) : output;
};
}());
// [bugfix, chrome]

@@ -1110,6 +1218,5 @@ // If separator is undefined, then the result array contains just one String,

// "0".split(undefined, 0) -> []
if("0".split(void 0, 0).length) {
var string_split = String.prototype.split;
} else if ("0".split(void 0, 0).length) {
String.prototype.split = function(separator, limit) {
if(separator === void 0 && limit === 0)return [];
if (separator === void 0 && limit === 0) return [];
return string_split.apply(this, arguments);

@@ -1119,2 +1226,3 @@ }

// ECMA-262, 3rd B.2.3

@@ -1125,3 +1233,3 @@ // Note an ECMAScript standart, although ECMAScript 3rd Edition has a

// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
if("".substr && "0b".substr(-1) !== "b") {
if ("".substr && "0b".substr(-1) !== "b") {
var string_substr = String.prototype.substr;

@@ -1155,3 +1263,3 @@ /**

String.prototype.trim = function trim() {
if (this === undefined || this === null) {
if (this === void 0 || this === null) {
throw new TypeError("can't convert "+this+" to object");

@@ -1158,0 +1266,0 @@ }

@@ -1,4 +0,4 @@

(function(definition){if(typeof define=="function"){define(definition)}else if(typeof YUI=="function"){YUI.add("es5",definition)}else{definition()}})(function(){function Empty(){}if(!Function.prototype.bind){Function.prototype.bind=function bind(that){var target=this;if(typeof target!="function"){throw new TypeError("Function.prototype.bind called on incompatible "+target)}var args=_Array_slice_.call(arguments,1);var bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(_Array_slice_.call(arguments)));if(Object(result)===result){return result}return this}else{return target.apply(that,args.concat(_Array_slice_.call(arguments)))}};if(target.prototype){Empty.prototype=target.prototype;bound.prototype=new Empty;Empty.prototype=null}return bound}}var call=Function.prototype.call;var prototypeOfArray=Array.prototype;var prototypeOfObject=Object.prototype;var _Array_slice_=prototypeOfArray.slice;var _toString=call.bind(prototypeOfObject.toString);var owns=call.bind(prototypeOfObject.hasOwnProperty);var defineGetter;var defineSetter;var lookupGetter;var lookupSetter;var supportsAccessors;if(supportsAccessors=owns(prototypeOfObject,"__defineGetter__")){defineGetter=call.bind(prototypeOfObject.__defineGetter__);defineSetter=call.bind(prototypeOfObject.__defineSetter__);lookupGetter=call.bind(prototypeOfObject.__lookupGetter__);lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)}if([1,2].splice(0).length!=2){var array_splice=Array.prototype.splice;if(function(){function makeArray(l){var a=[];while(l--){a.unshift(l)}return a}var array=[],lengthBefore;array.splice.bind(array,0,0).apply(null,makeArray(20));array.splice.bind(array,0,0).apply(null,makeArray(26));lengthBefore=array.length;array.splice(5,0,"XXX");if(lengthBefore+1==array.length){return true}}()){Array.prototype.splice=function(start,deleteCount){if(!arguments.length){return[]}else{return array_splice.apply(this,[start===void 0?0:start,deleteCount===void 0?this.length-start:deleteCount].concat(_Array_slice_.call(arguments,2)))}}}else{Array.prototype.splice=function(start,deleteCount){var result,args=_Array_slice_.call(arguments,2),addElementsCount=args.length;if(!arguments.length){return[]}if(start===void 0){start=0}if(deleteCount===void 0){deleteCount=this.length-start}if(addElementsCount>0){if(deleteCount<=0){if(start==this.length){this.push.apply(this,args);return[]}if(start==0){this.unshift.apply(this,args);return[]}}result=_Array_slice_.call(this,start,start+deleteCount);args.push.apply(args,_Array_slice_.call(this,start+deleteCount,this.length));args.unshift.apply(args,_Array_slice_.call(this,0,start));args.unshift(0,this.length);array_splice.apply(this,args);return result}return array_splice.call(this,start,deleteCount)}}}if([].unshift(0)!=1){var array_unshift=Array.prototype.unshift;Array.prototype.unshift=function(){array_unshift.apply(this,arguments);return this.length}}if(!Array.isArray){Array.isArray=function isArray(obj){return _toString(obj)=="[object Array]"}}var boxedString=Object("a"),splitString=boxedString[0]!="a"||!(0 in boxedString);if(!Array.prototype.forEach){Array.prototype.forEach=function forEach(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError}while(++i<length){if(i in self){fun.call(thisp,self[i],i,object)}}}}if(!Array.prototype.map){Array.prototype.map=function map(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self)result[i]=fun.call(thisp,self[i],i,object)}return result}}if(!Array.prototype.filter){Array.prototype.filter=function filter(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,result=[],value,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self){value=self[i];if(fun.call(thisp,value,i,object)){result.push(value)}}}return result}}if(!Array.prototype.every){Array.prototype.every=function every(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self&&!fun.call(thisp,self[i],i,object)){return false}}return true}}if(!Array.prototype.some){Array.prototype.some=function some(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self&&fun.call(thisp,self[i],i,object)){return true}}return false}}if(!Array.prototype.reduce){Array.prototype.reduce=function reduce(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}if(!length&&arguments.length==1){throw new TypeError("reduce of empty array with no initial value")}var i=0;var result;if(arguments.length>=2){result=arguments[1]}else{do{if(i in self){result=self[i++];break}if(++i>=length){throw new TypeError("reduce of empty array with no initial value")}}while(true)}for(;i<length;i++){if(i in self){result=fun.call(void 0,result,self[i],i,object)}}return result}}if(!Array.prototype.reduceRight){Array.prototype.reduceRight=function reduceRight(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}if(!length&&arguments.length==1){throw new TypeError("reduceRight of empty array with no initial value")}var result,i=length-1;if(arguments.length>=2){result=arguments[1]}else{do{if(i in self){result=self[i--];break}if(--i<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}do{if(i in this){result=fun.call(void 0,result,self[i],i,object)}}while(i--);return result}}if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1){Array.prototype.indexOf=function indexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length){return-1}var i=0;if(arguments.length>1){i=toInteger(arguments[1])}i=i>=0?i:Math.max(0,length+i);for(;i<length;i++){if(i in self&&self[i]===sought){return i}}return-1}}if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1){Array.prototype.lastIndexOf=function lastIndexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length){return-1}var i=length-1;if(arguments.length>1){i=Math.min(i,toInteger(arguments[1]))}i=i>=0?i:length-Math.abs(i);for(;i>=0;i--){if(i in self&&sought===self[i]){return i}}return-1}}if(!Object.keys){var hasDontEnumBug=true,dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;for(var key in{toString:null}){hasDontEnumBug=false}Object.keys=function keys(object){if(typeof object!="object"&&typeof object!="function"||object===null){throw new TypeError("Object.keys called on a non-object")}var keys=[];for(var name in object){if(owns(object,name)){keys.push(name)}}if(hasDontEnumBug){for(var i=0,ii=dontEnumsLength;i<ii;i++){var dontEnum=dontEnums[i];if(owns(object,dontEnum)){keys.push(dontEnum)}}}return keys}}var negativeDate=-621987552e5,negativeYearString="-000001";if(!Date.prototype.toISOString||new Date(negativeDate).toISOString().indexOf(negativeYearString)===-1){Date.prototype.toISOString=function toISOString(){var result,length,value,year,month;if(!isFinite(this)){throw new RangeError("Date.prototype.toISOString called on non-finite value.")}year=this.getUTCFullYear();month=this.getUTCMonth();year+=Math.floor(month/12);month=(month%12+12)%12;result=[month+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];year=(year<0?"-":year>9999?"+":"")+("00000"+Math.abs(year)).slice(0<=year&&year<=9999?-4:-6);length=result.length;while(length--){value=result[length];if(value<10){result[length]="0"+value}}return year+"-"+result.slice(0,2).join("-")+"T"+result.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}}var dateToJSONIsSupported=false;try{dateToJSONIsSupported=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(negativeDate).toJSON().indexOf(negativeYearString)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(e){}if(!dateToJSONIsSupported){Date.prototype.toJSON=function toJSON(key){var o=Object(this),tv=toPrimitive(o),toISO;if(typeof tv==="number"&&!isFinite(tv)){return null}toISO=o.toISOString;if(typeof toISO!="function"){throw new TypeError("toISOString property is not callable")}return toISO.call(o)}}if(!Date.parse||"Date.parse is buggy"){Date=function(NativeDate){function Date(Y,M,D,h,m,s,ms){var length=arguments.length;if(this instanceof NativeDate){var date=length==1&&String(Y)===Y?new NativeDate(Date.parse(Y)):length>=7?new NativeDate(Y,M,D,h,m,s,ms):length>=6?new NativeDate(Y,M,D,h,m,s):length>=5?new NativeDate(Y,M,D,h,m):length>=4?new NativeDate(Y,M,D,h):length>=3?new NativeDate(Y,M,D):length>=2?new NativeDate(Y,M):length>=1?new NativeDate(Y):new NativeDate;date.constructor=Date;return date}return NativeDate.apply(this,arguments)}var isoDateExpression=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:(\\.\\d{1,}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+"$");var months=[0,31,59,90,120,151,181,212,243,273,304,334,365];function dayFromMonth(year,month){var t=month>1?1:0;return months[month]+Math.floor((year-1969+t)/4)-Math.floor((year-1901+t)/100)+Math.floor((year-1601+t)/400)+365*(year-1970)}for(var key in NativeDate){Date[key]=NativeDate[key]}Date.now=NativeDate.now;Date.UTC=NativeDate.UTC;Date.prototype=NativeDate.prototype;Date.prototype.constructor=Date;Date.parse=function parse(string){var match=isoDateExpression.exec(string);if(match){var year=Number(match[1]),month=Number(match[2]||1)-1,day=Number(match[3]||1)-1,hour=Number(match[4]||0),minute=Number(match[5]||0),second=Number(match[6]||0),millisecond=Math.floor(Number(match[7]||0)*1e3),offset=!match[4]||match[8]?0:Number(new NativeDate(1970,0)),signOffset=match[9]==="-"?1:-1,hourOffset=Number(match[10]||0),minuteOffset=Number(match[11]||0),result;if(hour<(minute>0||second>0||millisecond>0?24:25)&&minute<60&&second<60&&millisecond<1e3&&month>-1&&month<12&&hourOffset<24&&minuteOffset<60&&day>-1&&day<dayFromMonth(year,month+1)-dayFromMonth(year,month)){result=((dayFromMonth(year,month)+day)*24+hour+hourOffset*signOffset)*60;result=((result+minute+minuteOffset*signOffset)*60+second)*1e3+millisecond+offset;if(-864e13<=result&&result<=864e13){return result}}return NaN}return NativeDate.parse.apply(this,arguments)};return Date}(Date)}if(!Date.now){Date.now=function now(){return(new Date).getTime()}}if(!Number.prototype.toFixed||8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)==="0"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128"){(function(){var base,size,data,i;base=1e7;size=6;data=[0,0,0,0,0,0];function multiply(n,c){var i=-1;while(++i<size){c+=n*data[i];data[i]=c%base;c=Math.floor(c/base)}}function divide(n){var i=size,c=0;while(--i>=0){c+=data[i];data[i]=Math.floor(c/n);c=c%n*base}}function toString(){var i=size;var s="";while(--i>=0){if(s!==""||i===0||data[i]!==0){var t=String(data[i]);if(s===""){s=t}else{s+="0000000".slice(0,7-t.length)+t}}}return s}function pow(x,n,acc){return n===0?acc:n%2===1?pow(x,n-1,acc*x):pow(x*x,n/2,acc)}function log(x){var n=0;while(x>=4096){n+=12;x/=4096}while(x>=2){n+=1;x/=2}return n}Number.prototype.toFixed=function(fractionDigits){var f,x,s,m,e,z,j,k;f=Number(fractionDigits);f=f!==f?0:Math.floor(f);if(f<0||f>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}x=Number(this);if(x!==x){return"NaN"}if(x<=-1e21||x>=1e21){return String(x)}s="";if(x<0){s="-";x=-x}m="0";if(x>1e-21){e=log(x*pow(2,69,1))-69;z=e<0?x*pow(2,-e,1):x/pow(2,e,1);z*=4503599627370496;e=52-e;if(e>0){multiply(0,z);j=f;while(j>=7){multiply(1e7,0);j-=7}multiply(pow(10,j,1),0);j=e-1;while(j>=23){divide(1<<23);j-=23}divide(1<<j);multiply(1,1);divide(2);m=toString()}else{multiply(0,z);multiply(1<<-e,0);m=toString()+"0.00000000000000000000".slice(2,2+f)}}if(f>0){k=m.length;if(k<=f){m=s+"0.0000000000000000000".slice(0,f-k+2)+m}else{m=s+m.slice(0,k-f)+"."+m.slice(k-f)}}else{m=s+m}return m}})()}if("0".split(void 0,0).length){var string_split=String.prototype.split;String.prototype.split=function(separator,limit){if(separator===void 0&&limit===0)return[];return string_split.apply(this,arguments)}}if("".substr&&"0b".substr(-1)!=="b"){var string_substr=String.prototype.substr;String.prototype.substr=function(start,length){return string_substr.call(this,start<0?(start=this.length+start)<0?0:start:start,length)}}var ws=" \n \f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";if(!String.prototype.trim||ws.trim()){ws="["+ws+"]";var trimBeginRegexp=new RegExp("^"+ws+ws+"*"),trimEndRegexp=new RegExp(ws+ws+"*$");String.prototype.trim=function trim(){if(this===undefined||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}}function toInteger(n){n=+n;if(n!==n){n=0}else if(n!==0&&n!==1/0&&n!==-(1/0)){n=(n>0||-1)*Math.floor(Math.abs(n))}return n}function isPrimitive(input){var type=typeof input;return input===null||type==="undefined"||type==="boolean"||type==="number"||type==="string"}function toPrimitive(input){var val,valueOf,toString;if(isPrimitive(input)){return input}valueOf=input.valueOf;if(typeof valueOf==="function"){val=valueOf.call(input);if(isPrimitive(val)){return val}}toString=input.toString;if(typeof toString==="function"){val=toString.call(input);if(isPrimitive(val)){return val}}throw new TypeError}var toObject=function(o){if(o==null){throw new TypeError("can't convert "+o+" to object")}return Object(o)}});
(function(definition){if(typeof define=="function"){define(definition)}else if(typeof YUI=="function"){YUI.add("es5",definition)}else{definition()}})(function(){function Empty(){}if(!Function.prototype.bind){Function.prototype.bind=function bind(that){var target=this;if(typeof target!="function"){throw new TypeError("Function.prototype.bind called on incompatible "+target)}var args=_Array_slice_.call(arguments,1);var bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(_Array_slice_.call(arguments)));if(Object(result)===result){return result}return this}else{return target.apply(that,args.concat(_Array_slice_.call(arguments)))}};if(target.prototype){Empty.prototype=target.prototype;bound.prototype=new Empty;Empty.prototype=null}return bound}}var call=Function.prototype.call;var prototypeOfArray=Array.prototype;var prototypeOfObject=Object.prototype;var _Array_slice_=prototypeOfArray.slice;var _toString=call.bind(prototypeOfObject.toString);var owns=call.bind(prototypeOfObject.hasOwnProperty);var defineGetter;var defineSetter;var lookupGetter;var lookupSetter;var supportsAccessors;if(supportsAccessors=owns(prototypeOfObject,"__defineGetter__")){defineGetter=call.bind(prototypeOfObject.__defineGetter__);defineSetter=call.bind(prototypeOfObject.__defineSetter__);lookupGetter=call.bind(prototypeOfObject.__lookupGetter__);lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)}if([1,2].splice(0).length!=2){var array_splice=Array.prototype.splice;if(function(){function makeArray(l){var a=[];while(l--){a.unshift(l)}return a}var array=[],lengthBefore;array.splice.bind(array,0,0).apply(null,makeArray(20));array.splice.bind(array,0,0).apply(null,makeArray(26));lengthBefore=array.length;array.splice(5,0,"XXX");if(lengthBefore+1==array.length){return true}}()){Array.prototype.splice=function(start,deleteCount){if(!arguments.length){return[]}else{return array_splice.apply(this,[start===void 0?0:start,deleteCount===void 0?this.length-start:deleteCount].concat(_Array_slice_.call(arguments,2)))}}}else{Array.prototype.splice=function(start,deleteCount){var result,args=_Array_slice_.call(arguments,2),addElementsCount=args.length;if(!arguments.length){return[]}if(start===void 0){start=0}if(deleteCount===void 0){deleteCount=this.length-start}if(addElementsCount>0){if(deleteCount<=0){if(start==this.length){this.push.apply(this,args);return[]}if(start==0){this.unshift.apply(this,args);return[]}}result=_Array_slice_.call(this,start,start+deleteCount);args.push.apply(args,_Array_slice_.call(this,start+deleteCount,this.length));args.unshift.apply(args,_Array_slice_.call(this,0,start));args.unshift(0,this.length);array_splice.apply(this,args);return result}return array_splice.call(this,start,deleteCount)}}}if([].unshift(0)!=1){var array_unshift=Array.prototype.unshift;Array.prototype.unshift=function(){array_unshift.apply(this,arguments);return this.length}}if(!Array.isArray){Array.isArray=function isArray(obj){return _toString(obj)=="[object Array]"}}var boxedString=Object("a"),splitString=boxedString[0]!="a"||!(0 in boxedString);if(!Array.prototype.forEach){Array.prototype.forEach=function forEach(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError}while(++i<length){if(i in self){fun.call(thisp,self[i],i,object)}}}}if(!Array.prototype.map){Array.prototype.map=function map(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self)result[i]=fun.call(thisp,self[i],i,object)}return result}}if(!Array.prototype.filter){Array.prototype.filter=function filter(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,result=[],value,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self){value=self[i];if(fun.call(thisp,value,i,object)){result.push(value)}}}return result}}if(!Array.prototype.every){Array.prototype.every=function every(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self&&!fun.call(thisp,self[i],i,object)){return false}}return true}}if(!Array.prototype.some){Array.prototype.some=function some(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self&&fun.call(thisp,self[i],i,object)){return true}}return false}}if(!Array.prototype.reduce){Array.prototype.reduce=function reduce(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}if(!length&&arguments.length==1){throw new TypeError("reduce of empty array with no initial value")}var i=0;var result;if(arguments.length>=2){result=arguments[1]}else{do{if(i in self){result=self[i++];break}if(++i>=length){throw new TypeError("reduce of empty array with no initial value")}}while(true)}for(;i<length;i++){if(i in self){result=fun.call(void 0,result,self[i],i,object)}}return result}}if(!Array.prototype.reduceRight){Array.prototype.reduceRight=function reduceRight(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}if(!length&&arguments.length==1){throw new TypeError("reduceRight of empty array with no initial value")}var result,i=length-1;if(arguments.length>=2){result=arguments[1]}else{do{if(i in self){result=self[i--];break}if(--i<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(i<0){return result}do{if(i in this){result=fun.call(void 0,result,self[i],i,object)}}while(i--);return result}}if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1){Array.prototype.indexOf=function indexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length){return-1}var i=0;if(arguments.length>1){i=toInteger(arguments[1])}i=i>=0?i:Math.max(0,length+i);for(;i<length;i++){if(i in self&&self[i]===sought){return i}}return-1}}if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1){Array.prototype.lastIndexOf=function lastIndexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length){return-1}var i=length-1;if(arguments.length>1){i=Math.min(i,toInteger(arguments[1]))}i=i>=0?i:length-Math.abs(i);for(;i>=0;i--){if(i in self&&sought===self[i]){return i}}return-1}}if(!Object.keys){var hasDontEnumBug=true,dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;for(var key in{toString:null}){hasDontEnumBug=false}Object.keys=function keys(object){if(typeof object!="object"&&typeof object!="function"||object===null){throw new TypeError("Object.keys called on a non-object")}var keys=[];for(var name in object){if(owns(object,name)){keys.push(name)}}if(hasDontEnumBug){for(var i=0,ii=dontEnumsLength;i<ii;i++){var dontEnum=dontEnums[i];if(owns(object,dontEnum)){keys.push(dontEnum)}}}return keys}}var negativeDate=-621987552e5,negativeYearString="-000001";if(!Date.prototype.toISOString||new Date(negativeDate).toISOString().indexOf(negativeYearString)===-1){Date.prototype.toISOString=function toISOString(){var result,length,value,year,month;if(!isFinite(this)){throw new RangeError("Date.prototype.toISOString called on non-finite value.")}year=this.getUTCFullYear();month=this.getUTCMonth();year+=Math.floor(month/12);month=(month%12+12)%12;result=[month+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];year=(year<0?"-":year>9999?"+":"")+("00000"+Math.abs(year)).slice(0<=year&&year<=9999?-4:-6);length=result.length;while(length--){value=result[length];if(value<10){result[length]="0"+value}}return year+"-"+result.slice(0,2).join("-")+"T"+result.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}}var dateToJSONIsSupported=false;try{dateToJSONIsSupported=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(negativeDate).toJSON().indexOf(negativeYearString)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(e){}if(!dateToJSONIsSupported){Date.prototype.toJSON=function toJSON(key){var o=Object(this),tv=toPrimitive(o),toISO;if(typeof tv==="number"&&!isFinite(tv)){return null}toISO=o.toISOString;if(typeof toISO!="function"){throw new TypeError("toISOString property is not callable")}return toISO.call(o)}}if(!Date.parse||"Date.parse is buggy"){Date=function(NativeDate){function Date(Y,M,D,h,m,s,ms){var length=arguments.length;if(this instanceof NativeDate){var date=length==1&&String(Y)===Y?new NativeDate(Date.parse(Y)):length>=7?new NativeDate(Y,M,D,h,m,s,ms):length>=6?new NativeDate(Y,M,D,h,m,s):length>=5?new NativeDate(Y,M,D,h,m):length>=4?new NativeDate(Y,M,D,h):length>=3?new NativeDate(Y,M,D):length>=2?new NativeDate(Y,M):length>=1?new NativeDate(Y):new NativeDate;date.constructor=Date;return date}return NativeDate.apply(this,arguments)}var isoDateExpression=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:(\\.\\d{1,}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+"$");var months=[0,31,59,90,120,151,181,212,243,273,304,334,365];function dayFromMonth(year,month){var t=month>1?1:0;return months[month]+Math.floor((year-1969+t)/4)-Math.floor((year-1901+t)/100)+Math.floor((year-1601+t)/400)+365*(year-1970)}for(var key in NativeDate){Date[key]=NativeDate[key]}Date.now=NativeDate.now;Date.UTC=NativeDate.UTC;Date.prototype=NativeDate.prototype;Date.prototype.constructor=Date;Date.parse=function parse(string){var match=isoDateExpression.exec(string);if(match){var year=Number(match[1]),month=Number(match[2]||1)-1,day=Number(match[3]||1)-1,hour=Number(match[4]||0),minute=Number(match[5]||0),second=Number(match[6]||0),millisecond=Math.floor(Number(match[7]||0)*1e3),offset=!match[4]||match[8]?0:Number(new NativeDate(1970,0)),signOffset=match[9]==="-"?1:-1,hourOffset=Number(match[10]||0),minuteOffset=Number(match[11]||0),result;if(hour<(minute>0||second>0||millisecond>0?24:25)&&minute<60&&second<60&&millisecond<1e3&&month>-1&&month<12&&hourOffset<24&&minuteOffset<60&&day>-1&&day<dayFromMonth(year,month+1)-dayFromMonth(year,month)){result=((dayFromMonth(year,month)+day)*24+hour+hourOffset*signOffset)*60;result=((result+minute+minuteOffset*signOffset)*60+second)*1e3+millisecond+offset;if(-864e13<=result&&result<=864e13){return result}}return NaN}return NativeDate.parse.apply(this,arguments)};return Date}(Date)}if(!Date.now){Date.now=function now(){return(new Date).getTime()}}if(!Number.prototype.toFixed||8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)==="0"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128"){(function(){var base,size,data,i;base=1e7;size=6;data=[0,0,0,0,0,0];function multiply(n,c){var i=-1;while(++i<size){c+=n*data[i];data[i]=c%base;c=Math.floor(c/base)}}function divide(n){var i=size,c=0;while(--i>=0){c+=data[i];data[i]=Math.floor(c/n);c=c%n*base}}function toString(){var i=size;var s="";while(--i>=0){if(s!==""||i===0||data[i]!==0){var t=String(data[i]);if(s===""){s=t}else{s+="0000000".slice(0,7-t.length)+t}}}return s}function pow(x,n,acc){return n===0?acc:n%2===1?pow(x,n-1,acc*x):pow(x*x,n/2,acc)}function log(x){var n=0;while(x>=4096){n+=12;x/=4096}while(x>=2){n+=1;x/=2}return n}Number.prototype.toFixed=function(fractionDigits){var f,x,s,m,e,z,j,k;f=Number(fractionDigits);f=f!==f?0:Math.floor(f);if(f<0||f>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}x=Number(this);if(x!==x){return"NaN"}if(x<=-1e21||x>=1e21){return String(x)}s="";if(x<0){s="-";x=-x}m="0";if(x>1e-21){e=log(x*pow(2,69,1))-69;z=e<0?x*pow(2,-e,1):x/pow(2,e,1);z*=4503599627370496;e=52-e;if(e>0){multiply(0,z);j=f;while(j>=7){multiply(1e7,0);j-=7}multiply(pow(10,j,1),0);j=e-1;while(j>=23){divide(1<<23);j-=23}divide(1<<j);multiply(1,1);divide(2);m=toString()}else{multiply(0,z);multiply(1<<-e,0);m=toString()+"0.00000000000000000000".slice(2,2+f)}}if(f>0){k=m.length;if(k<=f){m=s+"0.0000000000000000000".slice(0,f-k+2)+m}else{m=s+m.slice(0,k-f)+"."+m.slice(k-f)}}else{m=s+m}return m}})()}var string_split=String.prototype.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"".split(/.?/).length===0||".".split(/()()/).length>1){(function(){var compliantExecNpcg=/()??/.exec("")[1]===void 0;String.prototype.split=function(separator,limit){var string=this;if(separator===void 0&&limit===0)return[];if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return string_split.apply(this,arguments)}var output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0,separator=new RegExp(separator.source,flags+"g"),separator2,match,lastIndex,lastLength;string+="";if(!compliantExecNpcg){separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)}limit=limit===void 0?-1>>>0:limit>>>0;while(match=separator.exec(string)){lastIndex=match.index+match[0].length;if(lastIndex>lastLastIndex){output.push(string.slice(lastLastIndex,match.index));if(!compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===void 0){match[i]=void 0}}})}if(match.length>1&&match.index<string.length){Array.prototype.push.apply(output,match.slice(1))}lastLength=match[0].length;lastLastIndex=lastIndex;if(output.length>=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===string.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(string.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output}})()}else if("0".split(void 0,0).length){String.prototype.split=function(separator,limit){if(separator===void 0&&limit===0)return[];return string_split.apply(this,arguments)}}if("".substr&&"0b".substr(-1)!=="b"){var string_substr=String.prototype.substr;String.prototype.substr=function(start,length){return string_substr.call(this,start<0?(start=this.length+start)<0?0:start:start,length)}}var ws=" \n \f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";if(!String.prototype.trim||ws.trim()){ws="["+ws+"]";var trimBeginRegexp=new RegExp("^"+ws+ws+"*"),trimEndRegexp=new RegExp(ws+ws+"*$");String.prototype.trim=function trim(){if(this===void 0||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}}function toInteger(n){n=+n;if(n!==n){n=0}else if(n!==0&&n!==1/0&&n!==-(1/0)){n=(n>0||-1)*Math.floor(Math.abs(n))}return n}function isPrimitive(input){var type=typeof input;return input===null||type==="undefined"||type==="boolean"||type==="number"||type==="string"}function toPrimitive(input){var val,valueOf,toString;if(isPrimitive(input)){return input}valueOf=input.valueOf;if(typeof valueOf==="function"){val=valueOf.call(input);if(isPrimitive(val)){return val}}toString=input.toString;if(typeof toString==="function"){val=toString.call(input);if(isPrimitive(val)){return val}}throw new TypeError}var toObject=function(o){if(o==null){throw new TypeError("can't convert "+o+" to object")}return Object(o)}});
/*
//@ sourceMappingURL=es5-shim.map
*/
{
"name": "es5-shim",
"version": "2.0.11",
"version": "2.1.0",
"description": "ES5 as implementable on previous engines",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/kriskowal/es5-shim/",

@@ -1,2 +0,1 @@

`es5-shim.js` and `es5-shim.min.js` monkey-patch a JavaScript context to

@@ -41,13 +40,12 @@ contain all EcmaScript 5 methods that can be faithfully emulated with a

* Function.prototype.bind
* /!\ Caveat: the bound function's length is always 0.
* /!\ Caveat: the bound function has a prototype property.
* /!\ Caveat: bound functions do not try too hard to keep you
* :warning: Caveat: the bound function's length is always 0.
* :warning: Caveat: the bound function has a prototype property.
* :warning: Caveat: bound functions do not try too hard to keep you
from manipulating their ``arguments`` and ``caller`` properties.
* /!\ Caveat: bound functions don't have checks in ``call`` and
* :warning: Caveat: bound functions don't have checks in ``call`` and
``apply`` to avoid executing as a constructor.
* Number.prototype.toFixed
* Object.keys
* String.prototype.split
* String.prototype.trim
### Untested ###
* Date.parse (for ISO parsing)

@@ -58,25 +56,23 @@ * Date.prototype.toISOString

* /?\ Object.create
* :warning: Object.create
For the case of simply "begetting" an object that
inherits prototypically from another, this should work
fine across legacy engines.
For the case of simply "begetting" an object that inherits
prototypically from another, this should work fine across legacy
engines.
/!\ Object.create(null) will work only in browsers that
support prototype assignment. This creates an object
that does not have any properties inherited from
Object.prototype. It will silently fail otherwise.
:warning: Object.create(null) will work only in browsers that
support prototype assignment. This creates an object that does not
have any properties inherited from Object.prototype. It will
silently fail otherwise.
/!\ The second argument is passed to
Object.defineProperties which will probably fail
silently.
:warning: The second argument is passed to Object.defineProperties
which will probably fail either silently or with extreme predudice.
* /?\ Object.getPrototypeOf
* :warning: Object.getPrototypeOf
This will return "undefined" in some cases. It uses
__proto__ if it's available. Failing that, it uses
constructor.prototype, which depends on the constructor
property of the object's prototype having not been
replaced. If your object was created like this, it
won't work:
This will return "undefined" in some cases. It uses `__proto__` if
it's available. Failing that, it uses constructor.prototype, which
depends on the constructor property of the object's prototype having
not been replaced. If your object was created like this, it won't
work:

@@ -87,4 +83,4 @@ function Foo() {

Because the prototype reassignment destroys the
constructor property.
Because the prototype reassignment destroys the constructor
property.

@@ -94,49 +90,47 @@ This will work for all objects that were created using

* /!\ Object.getOwnPropertyNames
* :warning: Object.getOwnPropertyNames
This method uses Object.keys, so it will not be accurate
on legacy engines.
This method uses Object.keys, so it will not be accurate on legacy
engines.
* Object.isSealed
Returns "false" in all legacy engines for all objects,
which is conveniently guaranteed to be accurate.
Returns "false" in all legacy engines for all objects, which is
conveniently guaranteed to be accurate.
* Object.isFrozen
Returns "false" in all legacy engines for all objects,
which is conveniently guaranteed to be accurate.
Returns "false" in all legacy engines for all objects, which is
conveniently guaranteed to be accurate.
* Object.isExtensible
Works like a charm, by trying very hard to extend the
object then redacting the extension.
Works like a charm, by trying very hard to extend the object then
redacting the extension.
### Fail silently
### May fail
* /!\ Object.getOwnPropertyDescriptor
* :warning: Object.getOwnPropertyDescriptor
The behavior of this shim does not conform to ES5. It
should probably not be used at this time, until its
behavior has been reviewed and been confirmed to be
useful in legacy engines.
The behavior of this shim does not conform to ES5. It should
probably not be used at this time, until its behavior has been
reviewed and been confirmed to be useful in legacy engines.
* /!\ Object.defineProperty
* :warning: Object.defineProperty
This method will silently fail to set "writable",
"enumerable", and "configurable" properties.
In the worst of circumstances, IE 8 provides a version of this
method that only works on DOM objects. This sham will not be
installed. The given version of `defineProperty` will throw an
exception if used on non-DOM objects.
In slightly better circumstances, this method will silently fail to
set "writable", "enumerable", and "configurable" properties.
Providing a getter or setter with "get" or "set" on a
descriptor will silently fail on engines that lack
"__defineGetter__" and "__defineSetter__", which include
all versions of IE up to version 8 so far.
Providing a getter or setter with "get" or "set" on a descriptor
will silently fail on engines that lack "__defineGetter__" and
"__defineSetter__", which include all versions of IE.
IE 8 provides a version of this method but it only works
on DOM objects. Thus, the shim will not get installed
and attempts to set "value" properties will fail
silently on non-DOM objects.
https://github.com/kriskowal/es5-shim/issues#issue/5
* /!\ Object.defineProperties
* :warning: Object.defineProperties

@@ -143,0 +137,0 @@ This uses the Object.defineProperty shim

@@ -6,3 +6,3 @@ // This methods allows the killing of built-in functions,

var kill;
kill = function(_class, methods) {

@@ -60,6 +60,7 @@ /*if(!Array.isArray(methods))

HLP.kill(Array.prototype, [
'forEach', 'some', 'every',
'indexOf', 'lastIndexOf',
'map', 'filter',
'forEach', 'some', 'every',
'indexOf', 'lastIndexOf',
'map', 'filter',
'reduce', 'reduceRight'
]);

@@ -15,7 +15,7 @@ describe('Array', function() {

};
describe('forEach', function() {
"use strict";
var expected, actual;
beforeEach(function() {

@@ -41,3 +41,3 @@ expected = {0:2, 2: undefined, 3:true, 4: 'hej', 5:null, 6:false, 7:0 };

});
it('should set the right context when given none', function() {

@@ -56,3 +56,3 @@ var context;

var o = { a: actual };
testSubject.forEach(function(obj, index) {

@@ -63,3 +63,3 @@ this.a[index] = obj;

});
it('should iterate all in an array-like object', function() {

@@ -75,3 +75,3 @@ var ts = createArrayLikeFromArray(testSubject);

o = { a: actual };
Array.prototype.forEach.call(ts, function(obj, index) {

@@ -112,3 +112,3 @@ this.a[index] = obj;

var actual, expected, numberOfRuns;
beforeEach(function() {

@@ -119,3 +119,3 @@ expected = {0:2, 2: undefined, 3:true };

});
it('should pass the correct values along to the callback', function() {

@@ -143,3 +143,3 @@ var callback = jasmine.createSpy('callback');

});
it('should return false if it runs to the end', function() {

@@ -157,3 +157,3 @@ actual = testSubject.some(function() {});

});
it('should stop after 3 elements', function() {

@@ -182,3 +182,3 @@ testSubject.some(function(obj, index) {

});
it('should stop after 3 elements in an array-like object', function() {

@@ -212,3 +212,3 @@ var ts = createArrayLikeFromArray(testSubject);

var actual, expected, numberOfRuns;
beforeEach(function() {

@@ -219,3 +219,3 @@ expected = {0:2, 2: undefined, 3:true };

});
it('should pass the correct values along to the callback', function() {

@@ -243,7 +243,7 @@ var callback = jasmine.createSpy('callback');

});
it('should return true if the array is empty', function() {
actual = [].every(function() { return true; });
expect(actual).toBeTruthy();
actual = [].every(function() { return false; });

@@ -260,3 +260,3 @@ expect(actual).toBeTruthy();

});
it('should return after 3 elements', function() {

@@ -285,3 +285,3 @@ testSubject.every(function(obj, index) {

});
it('should stop after 3 elements in an array-like object', function() {

@@ -313,13 +313,13 @@ var ts = createArrayLikeFromArray(testSubject);

});
describe('indexOf', function() {
"use strict";
var actual, expected, testSubject;
beforeEach(function() {
testSubject = [2, 3, undefined, true, 'hej', null, 2, false, 0];
delete testSubject[1];
});
it('should find the element', function() {

@@ -348,3 +348,3 @@ expected = 4;

expect(actual).toEqual(5);
actual = testSubject.indexOf('2');

@@ -368,3 +368,3 @@ expect(actual).toEqual(-1);

});
describe('Array-like', function ArrayLike() {

@@ -404,3 +404,3 @@ var indexOf = Array.prototype.indexOf,

expect(actual).toEqual(5);
actual = Array.prototype.indexOf.call(testAL, '2');

@@ -429,3 +429,3 @@ expect(actual).toEqual(-1);

var actual, expected, testSubject, testAL;
beforeEach(function() {

@@ -460,3 +460,3 @@ testSubject = [2, 3, undefined, true, 'hej', null, 2, 3, false, 0];

expect(actual).toEqual(5);
actual = testSubject.lastIndexOf('2');

@@ -481,3 +481,3 @@ expect(actual).toEqual(-1);

});
describe('Array like', function() {

@@ -516,3 +516,3 @@ var lastIndexOf = Array.prototype.lastIndexOf,

expect(actual).toEqual(5);
actual = lastIndexOf.call(testAL, '2');

@@ -538,3 +538,3 @@ expect(actual).toEqual(-1);

});
describe('filter', function() {

@@ -547,3 +547,3 @@ var filteredArray,

};
beforeEach(function() {

@@ -730,3 +730,3 @@ testSubject = [2, 3, undefined, true, 'hej', 3, null, false, 0];

it('should skip non-existing values', function() {
var array = [1,2,3,4],
var array = [1,2,3,4],
i = 0;

@@ -787,3 +787,3 @@ delete array[2];

it('should skip non-existing values', function() {
var array = createArrayLikeFromArray([1,2,3,4]),
var array = createArrayLikeFromArray([1,2,3,4]),
i = 0;

@@ -798,3 +798,3 @@ delete array[2];

});
describe('reduce', function() {

@@ -804,3 +804,3 @@ beforeEach(function() {

});
describe('Array', function() {

@@ -864,3 +864,3 @@ it('should pass the correct arguments to the callback', function() {

});
expect(visited).toEqual({ '1': true, '3': true });

@@ -942,3 +942,3 @@ });

});
expect(visited).toEqual({ '1': true, '3': true });

@@ -955,3 +955,3 @@ });

});
describe('Array', function() {

@@ -988,2 +988,10 @@ it('should pass the correct arguments to the callback', function() {

});
it('should work as expected for empty arrays with an initial value', function() {
var spy = jasmine.createSpy(),
result;
result = [].reduceRight(spy, '');
expect(spy).not.toHaveBeenCalled();
expect(result).toBe('');
});
it('should throw correctly if no callback is given', function() {

@@ -1016,3 +1024,3 @@ expect(function() {

});
expect(visited).toEqual({ '1': true, '3': true });

@@ -1094,3 +1102,3 @@ });

});
expect(visited).toEqual({ '1': true, '3': true });

@@ -1154,3 +1162,3 @@ });

});
it('basic implementation test 1', function () {

@@ -1224,4 +1232,4 @@ expect(test.splice(0)).toEqual(a);

});
it('should do nothing if method called with no arguments', function () {

@@ -1251,3 +1259,3 @@ expect(test.splice()).toEqual([]);

});

@@ -23,3 +23,183 @@ describe('String', function() {

});
describe('Tests from Steven Levithan', function () {
it("''.split() results in ['']", function () {
expect(''.split()).toEqual(['']);
});
it("''.split(/./) results in ['']", function () {
expect(''.split(/./)).toEqual(['']);
});
it("''.split(/.?/) results in []", function () {
expect(''.split(/.?/)).toEqual([]);
});
it("''.split(/.??/) results in []", function () {
expect(''.split(/.??/)).toEqual([]);
});
it("'ab'.split(/a*/) results in ['', 'b']", function () {
expect('ab'.split(/a*/)).toEqual(['', 'b']);
});
it("'ab'.split(/a*?/) results in ['a', 'b']", function () {
expect('ab'.split(/a*?/)).toEqual(['a', 'b']);
});
it("'ab'.split(/(?:ab)/) results in ['', '']", function () {
expect('ab'.split(/(?:ab)/)).toEqual(['', '']);
});
it("'ab'.split(/(?:ab)*/) results in ['', '']", function () {
expect('ab'.split(/(?:ab)*/)).toEqual(['', '']);
});
it("'ab'.split(/(?:ab)*?/) results in ['a', 'b']", function () {
expect('ab'.split(/(?:ab)*?/)).toEqual(['a', 'b']);
});
it("'test'.split('') results in ['t', 'e', 's', 't']", function () {
expect('test'.split('')).toEqual(['t', 'e', 's', 't']);
});
it("'test'.split() results in ['test']", function () {
expect('test'.split()).toEqual(['test']);
});
it("'111'.split(1) results in ['', '', '', '']", function () {
expect('111'.split(1)).toEqual(['', '', '', '']);
});
it("'test'.split(/(?:)/, 2) results in ['t', 'e']", function () {
expect('test'.split(/(?:)/, 2)).toEqual(['t', 'e']);
});
it("'test'.split(/(?:)/, -1) results in ['t', 'e', 's', 't']", function () {
expect('test'.split(/(?:)/, -1)).toEqual(['t', 'e', 's', 't']);
});
it("'test'.split(/(?:)/, undefined) results in ['t', 'e', 's', 't']", function () {
expect('test'.split(/(?:)/, undefined)).toEqual(['t', 'e', 's', 't']);
});
it("'test'.split(/(?:)/, null) results in []", function () {
expect('test'.split(/(?:)/, null)).toEqual([]);
});
it("'test'.split(/(?:)/, NaN) results in []", function () {
expect('test'.split(/(?:)/, NaN)).toEqual([]);
});
it("'test'.split(/(?:)/, true) results in ['t']", function () {
expect('test'.split(/(?:)/, true)).toEqual(['t']);
});
it("'test'.split(/(?:)/, '2') results in ['t', 'e']", function () {
expect('test'.split(/(?:)/, '2')).toEqual(['t', 'e']);
});
it("'test'.split(/(?:)/, 'two') results in []", function () {
expect('test'.split(/(?:)/, 'two')).toEqual([]);
});
it("'a'.split(/-/) results in ['a']", function () {
expect('a'.split(/-/)).toEqual(['a']);
});
it("'a'.split(/-?/) results in ['a']", function () {
expect('a'.split(/-?/)).toEqual(['a']);
});
it("'a'.split(/-??/) results in ['a']", function () {
expect('a'.split(/-??/)).toEqual(['a']);
});
it("'a'.split(/a/) results in ['', '']", function () {
expect('a'.split(/a/)).toEqual(['', '']);
});
it("'a'.split(/a?/) results in ['', '']", function () {
expect('a'.split(/a?/)).toEqual(['', '']);
});
it("'a'.split(/a??/) results in ['a']", function () {
expect('a'.split(/a??/)).toEqual(['a']);
});
it("'ab'.split(/-/) results in ['ab']", function () {
expect('ab'.split(/-/)).toEqual(['ab']);
});
it("'ab'.split(/-?/) results in ['a', 'b']", function () {
expect('ab'.split(/-?/)).toEqual(['a', 'b']);
});
it("'ab'.split(/-??/) results in ['a', 'b']", function () {
expect('ab'.split(/-??/)).toEqual(['a', 'b']);
});
it("'a-b'.split(/-/) results in ['a', 'b']", function () {
expect('a-b'.split(/-/)).toEqual(['a', 'b']);
});
it("'a-b'.split(/-?/) results in ['a', 'b']", function () {
expect('a-b'.split(/-?/)).toEqual(['a', 'b']);
});
it("'a-b'.split(/-??/) results in ['a', '-', 'b']", function () {
expect('a-b'.split(/-??/)).toEqual(['a', '-', 'b']);
});
it("'a--b'.split(/-/) results in ['a', '', 'b']", function () {
expect('a--b'.split(/-/)).toEqual(['a', '', 'b']);
});
it("'a--b'.split(/-?/) results in ['a', '', 'b']", function () {
expect('a--b'.split(/-?/)).toEqual(['a', '', 'b']);
});
it("'a--b'.split(/-??/) results in ['a', '-', '-', 'b']", function () {
expect('a--b'.split(/-??/)).toEqual(['a', '-', '-', 'b']);
});
it("''.split(/()()/) results in []", function () {
expect(''.split(/()()/)).toEqual([]);
});
it("'.'.split(/()()/) results in ['.']", function () {
expect('.'.split(/()()/)).toEqual(['.']);
});
it("'.'.split(/(.?)(.?)/) results in ['', '.', '', '']", function () {
expect('.'.split(/(.?)(.?)/)).toEqual(['', '.', '', '']);
});
it("'.'.split(/(.??)(.??)/) results in ['.']", function () {
expect('.'.split(/(.??)(.??)/)).toEqual(['.']);
});
it("'.'.split(/(.)?(.)?/) results in ['', '.', undefined, '']", function () {
expect('.'.split(/(.)?(.)?/)).toEqual(['', '.', undefined, '']);
});
it("'A<B>bold</B>and<CODE>coded</CODE>'.split(/<(\\/)?([^<>]+)>/) results in ['A', undefined, 'B', 'bold', '/', 'B', 'and', undefined, 'CODE', 'coded', '/', 'CODE', '']", function () {
expect('A<B>bold</B>and<CODE>coded</CODE>'.split(/<(\/)?([^<>]+)>/)).toEqual(['A', undefined, 'B', 'bold', '/', 'B', 'and', undefined, 'CODE', 'coded', '/', 'CODE', '']);
});
it("'tesst'.split(/(s)*/) results in ['t', undefined, 'e', 's', 't']", function () {
expect('tesst'.split(/(s)*/)).toEqual(['t', undefined, 'e', 's', 't']);
});
it("'tesst'.split(/(s)*?/) results in ['t', undefined, 'e', undefined, 's', undefined, 's', undefined, 't']", function () {
expect('tesst'.split(/(s)*?/)).toEqual(['t', undefined, 'e', undefined, 's', undefined, 's', undefined, 't']);
});
it("'tesst'.split(/(s*)/) results in ['t', '', 'e', 'ss', 't']", function () {
expect('tesst'.split(/(s*)/)).toEqual(['t', '', 'e', 'ss', 't']);
});
it("'tesst'.split(/(s*?)/) results in ['t', '', 'e', '', 's', '', 's', '', 't']", function () {
expect('tesst'.split(/(s*?)/)).toEqual(['t', '', 'e', '', 's', '', 's', '', 't']);
});
it("'tesst'.split(/(?:s)*/) results in ['t', 'e', 't']", function () {
expect('tesst'.split(/(?:s)*/)).toEqual(['t', 'e', 't']);
});
it("'tesst'.split(/(?=s+)/) results in ['te', 's', 'st']", function () {
expect('tesst'.split(/(?=s+)/)).toEqual(['te', 's', 'st']);
});
it("'test'.split('t') results in ['', 'es', '']", function () {
expect('test'.split('t')).toEqual(['', 'es', '']);
});
it("'test'.split('es') results in ['t', 't']", function () {
expect('test'.split('es')).toEqual(['t', 't']);
});
it("'test'.split(/t/) results in ['', 'es', '']", function () {
expect('test'.split(/t/)).toEqual(['', 'es', '']);
});
it("'test'.split(/es/) results in ['t', 't']", function () {
expect('test'.split(/es/)).toEqual(['t', 't']);
});
it("'test'.split(/(t)/) results in ['', 't', 'es', 't', '']", function () {
expect('test'.split(/(t)/)).toEqual(['', 't', 'es', 't', '']);
});
it("'test'.split(/(es)/) results in ['t', 'es', 't']", function () {
expect('test'.split(/(es)/)).toEqual(['t', 'es', 't']);
});
it("'test'.split(/(t)(e)(s)(t)/) results in ['', 't', 'e', 's', 't', '']", function () {
expect('test'.split(/(t)(e)(s)(t)/)).toEqual(['', 't', 'e', 's', 't', '']);
});
it("'.'.split(/(((.((.??)))))/) results in ['', '.', '.', '.', '', '', '']", function () {
expect('.'.split(/(((.((.??)))))/)).toEqual(['', '.', '.', '.', '', '', '']);
});
it("'.'.split(/(((((.??)))))/) results in ['.']", function () {
expect('.'.split(/(((((.??)))))/)).toEqual(['.']);
});
it("'a b c d'.split(/ /, -(Math.pow(2, 32) - 1)) results in ['a']", function () {
expect('a b c d'.split(/ /, -(Math.pow(2, 32) - 1))).toEqual(['a']);
});
it("'a b c d'.split(/ /, Math.pow(2, 32) + 1) results in ['a']", function () {
expect('a b c d'.split(/ /, Math.pow(2, 32) + 1)).toEqual(['a']);
});
it("'a b c d'.split(/ /, Infinity) results in []", function () {
expect('a b c d'.split(/ /, Infinity)).toEqual([]);
});
});
});
});
{
"name": "jahcode",
"version": "1.0.1",
"version": "1.1.0",
"description": "Scala like Classes and Traits in JavaScript",

@@ -5,0 +5,0 @@ "author": {

@@ -100,1 +100,7 @@ require('../jahcode.js');

});
describe("asInstance", function() {
it('should return the instance if it is from the right type', function() {
})
});

@@ -137,3 +137,2 @@ require('../jahcode.js');

expect(t).not.isInstanceOf(otherTypes);
expect(t).not.asInstanceOf(otherTypes);
expect(t).not.toBeCastable(otherTypes);

@@ -169,3 +168,2 @@

expect(t).not.isInstanceOf(otherTypes);
expect(t).not.asInstanceOf(otherTypes);
expect(t).not.toBeCastable(otherTypes);

@@ -201,3 +199,2 @@

expect(t).not.isInstanceOf(otherTypes);
expect(t).not.asInstanceOf(otherTypes);
expect(t).not.toBeCastable(otherTypes);

@@ -235,3 +232,2 @@

expect(t).not.isInstanceOf(otherTypes);
expect(t).not.asInstanceOf(otherTypes);
expect(t).not.toBeCastable(otherTypes);

@@ -268,3 +264,2 @@

expect(t).not.isInstanceOf(otherTypes);
expect(t).not.asInstanceOf(otherTypes);
expect(t).not.toBeCastable(otherTypes);

@@ -304,3 +299,2 @@

expect(t).not.isInstanceOf(otherTypes);
expect(t).not.asInstanceOf(otherTypes);
expect(t).not.toBeCastable(otherTypes);

@@ -307,0 +301,0 @@

@@ -17,2 +17,18 @@ require('../jahcode.js');

});
it("should be converted to true", function() {
var truly = [true, "test", 2, 3.3, /test/, [], [1,2,3], function() {}, new Date(), new Error()];
for ( var i = 0; i < truly.length; ++i) {
expect(Boolean.asInstance(truly[i])).toBeTruthy();
}
});
it("should be converted to false", function() {
var falsely = [false, "", 0, 0.0, undefined, NaN];
for ( var i = 0; i < falsely.length; ++i) {
expect(Boolean.asInstance(falsely[i])).toBeFalsy();
}
});
});

@@ -34,2 +50,11 @@

});
it("should be converted to number", function() {
var val = [true, false, "123", "22.45", 2, 3.3];
var num = [1, 0, 123, 22.45, 2, 3.3];
for ( var i = 0; i < val.length; ++i) {
expect(Number.asInstance(val[i])).toBe(num[i]);
}
});
});

@@ -51,2 +76,11 @@

});
it("should be converted to String", function() {
var val = [true, false, 123, 22.45, "test"];
var num = ["true", "false", "123", "22.45", "test"];
for ( var i = 0; i < vals.length; ++i) {
expect(String.asInstance(val[i])).toBe(num[i]);
}
});
});

@@ -85,2 +119,10 @@

it("should be converted to Array", function() {
var val = [[1,2,3], (function() {return arguments})(1,2,3), {0:1,1:2,2:3,length:3}];
for ( var i = 0; i < val.length; ++i) {
expect(Array.asInstance(val[i])).toEqual([1,2,3]);
}
});
it("should be extendable", function() {

@@ -87,0 +129,0 @@ var myArray = Array.inherit({

beforeEach(function() {
this.addMatchers({
hasPrototypeChain : function(chain) {
var expected = chain.isInstanceOf(Array) ? chain : arguments;
var expected = Array.isInstance(chain) ? chain : arguments;

@@ -21,6 +21,6 @@ var proto = this.actual;

isInstanceOf : function(klasses) {
var expected = klasses.isInstanceOf(Array) ? klasses : arguments;
var expected = Array.isInstance(klasses) ? klasses : arguments;
for ( var i = 0, cls; cls = expected[i]; ++i) {
if (this.isNot === this.actual.isInstanceOf(cls)) {
if (this.isNot === cls.isInstance(this.actual)) {
return this.isNot;

@@ -34,15 +34,11 @@ }

asInstanceOf : function(klasses) {
var expected = klasses.isInstanceOf(Array) ? klasses : arguments;
var expected = Array.isInstance(klasses) ? klasses : arguments;
for ( var i = 0, cls; cls = expected[i]; ++i) {
try {
this.actual.asInstanceOf(cls);
if (this.isNot) {
return this.isNot;
}
} catch (e) {
if (!this.isNot) {
return this.isNot;
}
if (!this.isNot) {
if (cls.asInstance(this.actual) !== this.actual)
return false;
} else {
if (cls.asInstance(this.actual) === this.actual);
return true;
}

@@ -55,3 +51,3 @@ }

toBeCastable : function(to) {
var expected = to.isInstanceOf(Array) ? to : arguments;
var expected = Array.isInstance(to) ? to : arguments;

@@ -58,0 +54,0 @@ for ( var i = 0, cls; cls = expected[i]; ++i) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc