module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // object to store loaded chunks /******/ // "0" means "already loaded" /******/ var installedChunks = { /******/ 2: 0 /******/ }; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // This file contains only the entry chunk. /******/ // The chunk loading function for additional chunks /******/ __webpack_require__.e = function requireEnsure(chunkId) { /******/ var promises = []; /******/ /******/ /******/ // require() chunk loading for javascript /******/ /******/ // "0" is the signal for "already loaded" /******/ if(installedChunks[chunkId] !== 0) { /******/ var chunk = require("./" + chunkId + ".extension.js"); /******/ var moreModules = chunk.modules, chunkIds = chunk.ids; /******/ for(var moduleId in moreModules) { /******/ modules[moduleId] = moreModules[moduleId]; /******/ } /******/ for(var i = 0; i < chunkIds.length; i++) /******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ return Promise.all(promises); /******/ }; /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // uncaught error handler for webpack runtime /******/ __webpack_require__.oe = function(err) { /******/ process.nextTick(function() { /******/ throw err; // catch this error by using import().catch() /******/ }); /******/ }; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 29); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = require("vscode"); /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = require("fs"); /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; /*global extender is, dateExtended*/ function defineExtended(extender) { var merge = (function merger() { function _merge(target, source) { var name, s; for (name in source) { if (source.hasOwnProperty(name)) { s = source[name]; if (!(name in target) || (target[name] !== s)) { target[name] = s; } } } return target; } return function merge(obj) { if (!obj) { obj = {}; } for (var i = 1, l = arguments.length; i < l; i++) { _merge(obj, arguments[i]); } return obj; // Object }; }()); function getExtended() { var loaded = {}; //getInitial instance; var extended = extender.define(); extended.expose({ register: function register(alias, extendWith) { if (!extendWith) { extendWith = alias; alias = null; } var type = typeof extendWith; if (alias) { extended[alias] = extendWith; } else if (extendWith && type === "function") { extended.extend(extendWith); } else if (type === "object") { extended.expose(extendWith); } else { throw new TypeError("extended.register must be called with an extender function"); } return extended; }, define: function () { return extender.define.apply(extender, arguments); } }); return extended; } function extended() { return getExtended(); } extended.define = function define() { return extender.define.apply(extender, arguments); }; return extended; } if (true) { if ( true && module.exports) { module.exports = defineExtended(__webpack_require__(15)); } } else {} }).call(this); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { var is = __webpack_require__(4), hasOwn = Object.prototype.hasOwnProperty; module.exports = __webpack_require__(2)() .register(is) .register(__webpack_require__(19)) .register(__webpack_require__(21)) .register("LINE_BREAK", __webpack_require__(23).EOL) .register("asyncEach", function (arr, iter, cb) { (function asyncIterator(i, l, rows, cb) { if (++i < l) { iter(rows[i], function (err) { if (err) { cb(err); } else { if ((i % 100) === 0) { //dont overflow the stack setImmediate(function () { asyncIterator(i, l, rows, cb); }); } else { asyncIterator(i, l, rows, cb); } } }); } else { //get out of stack cb(null, arr); } }(-1, arr.length, arr, cb)); }) .register("spreadArgs", function spreadArgs(f, args, scope) { var ret; switch ((args || []).length) { case 0: ret = f.call(scope); break; case 1: ret = f.call(scope, args[0]); break; case 2: ret = f.call(scope, args[0], args[1]); break; case 3: ret = f.call(scope, args[0], args[1], args[2]); break; default: ret = f.apply(scope, args); } return ret; }) .register("keys", function (obj) { var ret = []; for (var i in obj) { if (hasOwn.call(obj, i)) { ret.push(i); } } return ret; }); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; function defineIsa(extended) { var pSlice = Array.prototype.slice; var hasOwn = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; function argsToArray(args, slice) { var i = -1, j = 0, l = args.length, ret = []; slice = slice || 0; i += slice; while (++i < l) { ret[j++] = args[i]; } return ret; } function keys(obj) { var ret = []; for (var i in obj) { if (hasOwn.call(obj, i)) { ret.push(i); } } return ret; } //taken from node js assert.js //https://github.com/joyent/node/blob/master/lib/assert.js function deepEqual(actual, expected) { // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; } else if (typeof Buffer !== "undefined" && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { if (actual.length !== expected.length) { return false; } for (var i = 0; i < actual.length; i++) { if (actual[i] !== expected[i]) { return false; } } return true; // 7.2. If the expected value is a Date object, the actual value is // equivalent if it is also a Date object that refers to the same time. } else if (isDate(actual) && isDate(expected)) { return actual.getTime() === expected.getTime(); // 7.3 If the expected value is a RegExp object, the actual value is // equivalent if it is also a RegExp object with the same source and // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). } else if (isRegExp(actual) && isRegExp(expected)) { return actual.source === expected.source && actual.global === expected.global && actual.multiline === expected.multiline && actual.lastIndex === expected.lastIndex && actual.ignoreCase === expected.ignoreCase; // 7.4. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. } else if (isString(actual) && isString(expected) && actual !== expected) { return false; } else if (typeof actual !== 'object' && typeof expected !== 'object') { return actual === expected; // 7.5 For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified // with Object.prototype.hasOwnProperty.call), the same set of keys // (although not necessarily the same order), equivalent values for every // corresponding key, and an identical 'prototype' property. Note: this // accounts for both named and indexed properties on Arrays. } else { return objEquiv(actual, expected); } } function objEquiv(a, b) { var key; if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; } // an identical 'prototype' property. if (a.prototype !== b.prototype) { return false; } //~~~I've managed to break Object.keys through screwy arguments passing. // Converting to array solves the problem. if (isArguments(a)) { if (!isArguments(b)) { return false; } a = pSlice.call(a); b = pSlice.call(b); return deepEqual(a, b); } try { var ka = keys(a), kb = keys(b), i; // having the same number of owned properties (keys incorporates // hasOwnProperty) if (ka.length !== kb.length) { return false; } //the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); //~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] !== kb[i]) { return false; } } //equivalent values for every corresponding key, and //~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!deepEqual(a[key], b[key])) { return false; } } } catch (e) {//happens when one is a string literal and the other isn't return false; } return true; } var isFunction = function (obj) { return toStr.call(obj) === '[object Function]'; }; //ie hack if ("undefined" !== typeof window && !isFunction(window.alert)) { (function (alert) { isFunction = function (obj) { return toStr.call(obj) === '[object Function]' || obj === alert; }; }(window.alert)); } function isObject(obj) { var undef; return obj !== null && typeof obj === "object"; } function isHash(obj) { var ret = isObject(obj); return ret && obj.constructor === Object && !obj.nodeType && !obj.setInterval; } function isEmpty(object) { if (isArguments(object)) { return object.length === 0; } else if (isObject(object)) { return keys(object).length === 0; } else if (isString(object) || isArray(object)) { return object.length === 0; } return true; } function isBoolean(obj) { return obj === true || obj === false || toStr.call(obj) === "[object Boolean]"; } function isUndefined(obj) { return typeof obj === 'undefined'; } function isDefined(obj) { return !isUndefined(obj); } function isUndefinedOrNull(obj) { return isUndefined(obj) || isNull(obj); } function isNull(obj) { return obj === null; } var isArguments = function _isArguments(object) { return toStr.call(object) === '[object Arguments]'; }; if (!isArguments(arguments)) { isArguments = function _isArguments(obj) { return !!(obj && hasOwn.call(obj, "callee")); }; } function isInstanceOf(obj, clazz) { if (isFunction(clazz)) { return obj instanceof clazz; } else { return false; } } function isRegExp(obj) { return toStr.call(obj) === '[object RegExp]'; } var isArray = Array.isArray || function isArray(obj) { return toStr.call(obj) === "[object Array]"; }; function isDate(obj) { return toStr.call(obj) === '[object Date]'; } function isString(obj) { return toStr.call(obj) === '[object String]'; } function isNumber(obj) { return toStr.call(obj) === '[object Number]'; } function isTrue(obj) { return obj === true; } function isFalse(obj) { return obj === false; } function isNotNull(obj) { return !isNull(obj); } function isEq(obj, obj2) { /*jshint eqeqeq:false*/ return obj == obj2; } function isNeq(obj, obj2) { /*jshint eqeqeq:false*/ return obj != obj2; } function isSeq(obj, obj2) { return obj === obj2; } function isSneq(obj, obj2) { return obj !== obj2; } function isIn(obj, arr) { if ((isArray(arr) && Array.prototype.indexOf) || isString(arr)) { return arr.indexOf(obj) > -1; } else if (isArray(arr)) { for (var i = 0, l = arr.length; i < l; i++) { if (isEq(obj, arr[i])) { return true; } } } return false; } function isNotIn(obj, arr) { return !isIn(obj, arr); } function isLt(obj, obj2) { return obj < obj2; } function isLte(obj, obj2) { return obj <= obj2; } function isGt(obj, obj2) { return obj > obj2; } function isGte(obj, obj2) { return obj >= obj2; } function isLike(obj, reg) { if (isString(reg)) { return ("" + obj).match(reg) !== null; } else if (isRegExp(reg)) { return reg.test(obj); } return false; } function isNotLike(obj, reg) { return !isLike(obj, reg); } function contains(arr, obj) { return isIn(obj, arr); } function notContains(arr, obj) { return !isIn(obj, arr); } function containsAt(arr, obj, index) { if (isArray(arr) && arr.length > index) { return isEq(arr[index], obj); } return false; } function notContainsAt(arr, obj, index) { if (isArray(arr)) { return !isEq(arr[index], obj); } return false; } function has(obj, prop) { return hasOwn.call(obj, prop); } function notHas(obj, prop) { return !has(obj, prop); } function length(obj, l) { if (has(obj, "length")) { return obj.length === l; } return false; } function notLength(obj, l) { if (has(obj, "length")) { return obj.length !== l; } return false; } var isa = { isFunction: isFunction, isObject: isObject, isEmpty: isEmpty, isHash: isHash, isNumber: isNumber, isString: isString, isDate: isDate, isArray: isArray, isBoolean: isBoolean, isUndefined: isUndefined, isDefined: isDefined, isUndefinedOrNull: isUndefinedOrNull, isNull: isNull, isArguments: isArguments, instanceOf: isInstanceOf, isRegExp: isRegExp, deepEqual: deepEqual, isTrue: isTrue, isFalse: isFalse, isNotNull: isNotNull, isEq: isEq, isNeq: isNeq, isSeq: isSeq, isSneq: isSneq, isIn: isIn, isNotIn: isNotIn, isLt: isLt, isLte: isLte, isGt: isGt, isGte: isGte, isLike: isLike, isNotLike: isNotLike, contains: contains, notContains: notContains, has: has, notHas: notHas, isLength: length, isNotLength: notLength, containsAt: containsAt, notContainsAt: notContainsAt }; var tester = { constructor: function () { this._testers = []; }, noWrap: { tester: function () { var testers = this._testers; return function tester(value) { var isa = false; for (var i = 0, l = testers.length; i < l && !isa; i++) { isa = testers[i](value); } return isa; }; } } }; var switcher = { constructor: function () { this._cases = []; this.__default = null; }, def: function (val, fn) { this.__default = fn; }, noWrap: { switcher: function () { var testers = this._cases, __default = this.__default; return function tester() { var handled = false, args = argsToArray(arguments), caseRet; for (var i = 0, l = testers.length; i < l && !handled; i++) { caseRet = testers[i](args); if (caseRet.length > 1) { if (caseRet[1] || caseRet[0]) { return caseRet[1]; } } } if (!handled && __default) { return __default.apply(this, args); } }; } } }; function addToTester(func) { tester[func] = function isaTester() { this._testers.push(isa[func]); }; } function addToSwitcher(func) { switcher[func] = function isaTester() { var args = argsToArray(arguments, 1), isFunc = isa[func], handler, doBreak = true; if (args.length <= isFunc.length - 1) { throw new TypeError("A handler must be defined when calling using switch"); } else { handler = args.pop(); if (isBoolean(handler)) { doBreak = handler; handler = args.pop(); } } if (!isFunction(handler)) { throw new TypeError("handler must be defined"); } this._cases.push(function (testArgs) { if (isFunc.apply(isa, testArgs.concat(args))) { return [doBreak, handler.apply(this, testArgs)]; } return [false]; }); }; } for (var i in isa) { if (hasOwn.call(isa, i)) { addToSwitcher(i); addToTester(i); } } var is = extended.define(isa).expose(isa); is.tester = extended.define(tester); is.switcher = extended.define(switcher); return is; } if (true) { if ( true && module.exports) { module.exports = defineIsa(__webpack_require__(2)); } } else {} }).call(this); /***/ }), /* 5 */ /***/ (function(module, exports) { module.exports = require("stream"); /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; /*global define*/ function defineArray(extended, is, args) { var isString = is.isString, isArray = Array.isArray || is.isArray, isDate = is.isDate, floor = Math.floor, abs = Math.abs, mathMax = Math.max, mathMin = Math.min, arrayProto = Array.prototype, arrayIndexOf = arrayProto.indexOf, arrayForEach = arrayProto.forEach, arrayMap = arrayProto.map, arrayReduce = arrayProto.reduce, arrayReduceRight = arrayProto.reduceRight, arrayFilter = arrayProto.filter, arrayEvery = arrayProto.every, arraySome = arrayProto.some, argsToArray = args.argsToArray; function cross(num, cros) { return reduceRight(cros, function (a, b) { if (!isArray(b)) { b = [b]; } b.unshift(num); a.unshift(b); return a; }, []); } function permute(num, cross, length) { var ret = []; for (var i = 0; i < cross.length; i++) { ret.push([num].concat(rotate(cross, i)).slice(0, length)); } return ret; } function intersection(a, b) { var ret = [], aOne, i = -1, l; l = a.length; while (++i < l) { aOne = a[i]; if (indexOf(b, aOne) !== -1) { ret.push(aOne); } } return ret; } var _sort = (function () { var isAll = function (arr, test) { return every(arr, test); }; var defaultCmp = function (a, b) { return a - b; }; var dateSort = function (a, b) { return a.getTime() - b.getTime(); }; return function _sort(arr, property) { var ret = []; if (isArray(arr)) { ret = arr.slice(); if (property) { if (typeof property === "function") { ret.sort(property); } else { ret.sort(function (a, b) { var aProp = a[property], bProp = b[property]; if (isString(aProp) && isString(bProp)) { return aProp > bProp ? 1 : aProp < bProp ? -1 : 0; } else if (isDate(aProp) && isDate(bProp)) { return aProp.getTime() - bProp.getTime(); } else { return aProp - bProp; } }); } } else { if (isAll(ret, isString)) { ret.sort(); } else if (isAll(ret, isDate)) { ret.sort(dateSort); } else { ret.sort(defaultCmp); } } } return ret; }; })(); function indexOf(arr, searchElement, from) { var index = (from || 0) - 1, length = arr.length; while (++index < length) { if (arr[index] === searchElement) { return index; } } return -1; } function lastIndexOf(arr, searchElement, from) { if (!isArray(arr)) { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; if (len === 0) { return -1; } var n = len; if (arguments.length > 2) { n = Number(arguments[2]); if (n !== n) { n = 0; } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { n = (n > 0 || -1) * floor(abs(n)); } } var k = n >= 0 ? mathMin(n, len - 1) : len - abs(n); for (; k >= 0; k--) { if (k in t && t[k] === searchElement) { return k; } } return -1; } function filter(arr, iterator, scope) { if (arr && arrayFilter && arrayFilter === arr.filter) { return arr.filter(iterator, scope); } if (!isArray(arr) || typeof iterator !== "function") { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; var res = []; for (var i = 0; i < len; i++) { if (i in t) { var val = t[i]; // in case fun mutates this if (iterator.call(scope, val, i, t)) { res.push(val); } } } return res; } function forEach(arr, iterator, scope) { if (!isArray(arr) || typeof iterator !== "function") { throw new TypeError(); } if (arr && arrayForEach && arrayForEach === arr.forEach) { arr.forEach(iterator, scope); return arr; } for (var i = 0, len = arr.length; i < len; ++i) { iterator.call(scope || arr, arr[i], i, arr); } return arr; } function every(arr, iterator, scope) { if (arr && arrayEvery && arrayEvery === arr.every) { return arr.every(iterator, scope); } if (!isArray(arr) || typeof iterator !== "function") { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && !iterator.call(scope, t[i], i, t)) { return false; } } return true; } function some(arr, iterator, scope) { if (arr && arraySome && arraySome === arr.some) { return arr.some(iterator, scope); } if (!isArray(arr) || typeof iterator !== "function") { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && iterator.call(scope, t[i], i, t)) { return true; } } return false; } function map(arr, iterator, scope) { if (arr && arrayMap && arrayMap === arr.map) { return arr.map(iterator, scope); } if (!isArray(arr) || typeof iterator !== "function") { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; var res = []; for (var i = 0; i < len; i++) { if (i in t) { res.push(iterator.call(scope, t[i], i, t)); } } return res; } function reduce(arr, accumulator, curr) { var initial = arguments.length > 2; if (arr && arrayReduce && arrayReduce === arr.reduce) { return initial ? arr.reduce(accumulator, curr) : arr.reduce(accumulator); } if (!isArray(arr) || typeof accumulator !== "function") { throw new TypeError(); } var i = 0, l = arr.length >> 0; if (arguments.length < 3) { if (l === 0) { throw new TypeError("Array length is 0 and no second argument"); } curr = arr[0]; i = 1; // start accumulating at the second element } else { curr = arguments[2]; } while (i < l) { if (i in arr) { curr = accumulator.call(undefined, curr, arr[i], i, arr); } ++i; } return curr; } function reduceRight(arr, accumulator, curr) { var initial = arguments.length > 2; if (arr && arrayReduceRight && arrayReduceRight === arr.reduceRight) { return initial ? arr.reduceRight(accumulator, curr) : arr.reduceRight(accumulator); } if (!isArray(arr) || typeof accumulator !== "function") { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; // no value to return if no initial value, empty array if (len === 0 && arguments.length === 2) { throw new TypeError(); } var k = len - 1; if (arguments.length >= 3) { curr = arguments[2]; } else { do { if (k in arr) { curr = arr[k--]; break; } } while (true); } while (k >= 0) { if (k in t) { curr = accumulator.call(undefined, curr, t[k], k, t); } k--; } return curr; } function toArray(o) { var ret = []; if (o !== null) { var args = argsToArray(arguments); if (args.length === 1) { if (isArray(o)) { ret = o; } else if (is.isHash(o)) { for (var i in o) { if (o.hasOwnProperty(i)) { ret.push([i, o[i]]); } } } else { ret.push(o); } } else { forEach(args, function (a) { ret = ret.concat(toArray(a)); }); } } return ret; } function sum(array) { array = array || []; if (array.length) { return reduce(array, function (a, b) { return a + b; }); } else { return 0; } } function avg(arr) { arr = arr || []; if (arr.length) { var total = sum(arr); if (is.isNumber(total)) { return total / arr.length; } else { throw new Error("Cannot average an array of non numbers."); } } else { return 0; } } function sort(arr, cmp) { return _sort(arr, cmp); } function min(arr, cmp) { return _sort(arr, cmp)[0]; } function max(arr, cmp) { return _sort(arr, cmp)[arr.length - 1]; } function difference(arr1) { var ret = arr1, args = flatten(argsToArray(arguments, 1)); if (isArray(arr1)) { ret = filter(arr1, function (a) { return indexOf(args, a) === -1; }); } return ret; } function removeDuplicates(arr) { var ret = [], i = -1, l, retLength = 0; if (arr) { l = arr.length; while (++i < l) { var item = arr[i]; if (indexOf(ret, item) === -1) { ret[retLength++] = item; } } } return ret; } function unique(arr) { return removeDuplicates(arr); } function rotate(arr, numberOfTimes) { var ret = arr.slice(); if (typeof numberOfTimes !== "number") { numberOfTimes = 1; } if (numberOfTimes && isArray(arr)) { if (numberOfTimes > 0) { ret.push(ret.shift()); numberOfTimes--; } else { ret.unshift(ret.pop()); numberOfTimes++; } return rotate(ret, numberOfTimes); } else { return ret; } } function permutations(arr, length) { var ret = []; if (isArray(arr)) { var copy = arr.slice(0); if (typeof length !== "number") { length = arr.length; } if (!length) { ret = [ [] ]; } else if (length <= arr.length) { ret = reduce(arr, function (a, b, i) { var ret; if (length > 1) { ret = permute(b, rotate(copy, i).slice(1), length); } else { ret = [ [b] ]; } return a.concat(ret); }, []); } } return ret; } function zip() { var ret = []; var arrs = argsToArray(arguments); if (arrs.length > 1) { var arr1 = arrs.shift(); if (isArray(arr1)) { ret = reduce(arr1, function (a, b, i) { var curr = [b]; for (var j = 0; j < arrs.length; j++) { var currArr = arrs[j]; if (isArray(currArr) && !is.isUndefined(currArr[i])) { curr.push(currArr[i]); } else { curr.push(null); } } a.push(curr); return a; }, []); } } return ret; } function transpose(arr) { var ret = []; if (isArray(arr) && arr.length) { var last; forEach(arr, function (a) { if (isArray(a) && (!last || a.length === last.length)) { forEach(a, function (b, i) { if (!ret[i]) { ret[i] = []; } ret[i].push(b); }); last = a; } }); } return ret; } function valuesAt(arr, indexes) { var ret = []; indexes = argsToArray(arguments); arr = indexes.shift(); if (isArray(arr) && indexes.length) { for (var i = 0, l = indexes.length; i < l; i++) { ret.push(arr[indexes[i]] || null); } } return ret; } function union() { var ret = []; var arrs = argsToArray(arguments); if (arrs.length > 1) { for (var i = 0, l = arrs.length; i < l; i++) { ret = ret.concat(arrs[i]); } ret = removeDuplicates(ret); } return ret; } function intersect() { var collect = [], sets, i = -1 , l; if (arguments.length > 1) { //assume we are intersections all the lists in the array sets = argsToArray(arguments); } else { sets = arguments[0]; } if (isArray(sets)) { collect = sets[0]; i = 0; l = sets.length; while (++i < l) { collect = intersection(collect, sets[i]); } } return removeDuplicates(collect); } function powerSet(arr) { var ret = []; if (isArray(arr) && arr.length) { ret = reduce(arr, function (a, b) { var ret = map(a, function (c) { return c.concat(b); }); return a.concat(ret); }, [ [] ]); } return ret; } function cartesian(a, b) { var ret = []; if (isArray(a) && isArray(b) && a.length && b.length) { ret = cross(a[0], b).concat(cartesian(a.slice(1), b)); } return ret; } function compact(arr) { var ret = []; if (isArray(arr) && arr.length) { ret = filter(arr, function (item) { return !is.isUndefinedOrNull(item); }); } return ret; } function multiply(arr, times) { times = is.isNumber(times) ? times : 1; if (!times) { //make sure times is greater than zero if it is zero then dont multiply it times = 1; } arr = toArray(arr || []); var ret = [], i = 0; while (++i <= times) { ret = ret.concat(arr); } return ret; } function flatten(arr) { var set; var args = argsToArray(arguments); if (args.length > 1) { //assume we are intersections all the lists in the array set = args; } else { set = toArray(arr); } return reduce(set, function (a, b) { return a.concat(b); }, []); } function pluck(arr, prop) { prop = prop.split("."); var result = arr.slice(0); forEach(prop, function (prop) { var exec = prop.match(/(\w+)\(\)$/); result = map(result, function (item) { return exec ? item[exec[1]]() : item[prop]; }); }); return result; } function invoke(arr, func, args) { args = argsToArray(arguments, 2); return map(arr, function (item) { var exec = isString(func) ? item[func] : func; return exec.apply(item, args); }); } var array = { toArray: toArray, sum: sum, avg: avg, sort: sort, min: min, max: max, difference: difference, removeDuplicates: removeDuplicates, unique: unique, rotate: rotate, permutations: permutations, zip: zip, transpose: transpose, valuesAt: valuesAt, union: union, intersect: intersect, powerSet: powerSet, cartesian: cartesian, compact: compact, multiply: multiply, flatten: flatten, pluck: pluck, invoke: invoke, forEach: forEach, map: map, filter: filter, reduce: reduce, reduceRight: reduceRight, some: some, every: every, indexOf: indexOf, lastIndexOf: lastIndexOf }; return extended.define(isArray, array).expose(array); } if (true) { if ( true && module.exports) { module.exports = defineArray(__webpack_require__(2), __webpack_require__(4), __webpack_require__(20)); } } else {} }).call(this); /***/ }), /* 7 */ /***/ (function(module, exports) { module.exports = require("util"); /***/ }), /* 8 */ /***/ (function(module, exports) { module.exports = require("path"); /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable node/no-deprecated-api */ var buffer = __webpack_require__(12) var Buffer = buffer.Buffer var safer = {} var key for (key in buffer) { if (!buffer.hasOwnProperty(key)) continue if (key === 'SlowBuffer' || key === 'Buffer') continue safer[key] = buffer[key] } var Safer = safer.Buffer = {} for (key in Buffer) { if (!Buffer.hasOwnProperty(key)) continue if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue Safer[key] = Buffer[key] } safer.Buffer.prototype = Buffer.prototype if (!Safer.from || Safer.from === Uint8Array.from) { Safer.from = function (value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) } if (value && typeof value.length === 'undefined') { throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) } return Buffer(value, encodingOrOffset, length) } } if (!Safer.alloc) { Safer.alloc = function (size, fill, encoding) { if (typeof size !== 'number') { throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) } if (size < 0 || size >= 2 * (1 << 30)) { throw new RangeError('The value "' + size + '" is invalid for option "size"') } var buf = Buffer(size) if (!fill || fill.length === 0) { buf.fill(0) } else if (typeof encoding === 'string') { buf.fill(fill, encoding) } else { buf.fill(fill) } return buf } } if (!safer.kStringMaxLength) { try { safer.kStringMaxLength = process.binding('buffer').kStringMaxLength } catch (e) { // we can't determine kStringMaxLength in environments where process.binding // is unsupported, so let's not set it } } if (!safer.constants) { safer.constants = { MAX_LENGTH: safer.kMaxLength } if (safer.kStringMaxLength) { safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength } } module.exports = safer /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(13); /***/ }), /* 11 */ /***/ (function(module, exports) { module.exports = require("string_decoder"); /***/ }), /* 12 */ /***/ (function(module, exports) { module.exports = require("buffer"); /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { /** * @projectName fast-csv * @github https://github.com/C2FO/fast-csv * @includeDoc [Change Log] ../History.md * @header [../README.md] */ var fs = __webpack_require__(1), parser = __webpack_require__(14), formatter = __webpack_require__(26); function csv() { return parser.apply(void 0, arguments); } csv.parse = csv; csv.fromString = parser.fromString; csv.fromPath = parser.fromPath; csv.fromStream = parser.fromStream; csv.format = formatter; csv.write = formatter.write; csv.writeToStream = formatter.writeToStream; csv.writeToString = formatter.writeToString; csv.writeToBuffer = formatter.writeToBuffer; csv.writeToPath = formatter.writeToPath; csv.createWriteStream = formatter.createWriteStream; csv.createReadStream = formatter.createWriteStream; module.exports = csv; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { var extended = __webpack_require__(3), out = process.stdout, stream = __webpack_require__(5), fs = __webpack_require__(1), ParserStream = __webpack_require__(24); function parse(options) { return new ParserStream(options); } function fromStream(stream, options) { return stream.pipe(new ParserStream(options)); } function fromPath(location, options) { return fs.createReadStream(location).pipe(new ParserStream(options)); } function fromString(string, options) { var rs = new stream.Readable(); rs.push(string); rs.push(null); return rs.pipe(new ParserStream(options)); } parse.fromStream = fromStream; parse.fromPath = fromPath; parse.fromString = fromString; module.exports = parse; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(16); /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { (function () { /*jshint strict:false*/ /** * * @projectName extender * @github http://github.com/doug-martin/extender * @header * [![build status](https://secure.travis-ci.org/doug-martin/extender.png)](http://travis-ci.org/doug-martin/extender) * # Extender * * `extender` is a library that helps in making chainable APIs, by creating a function that accepts different values and returns an object decorated with functions based on the type. * * ## Why Is Extender Different? * * Extender is different than normal chaining because is does more than return `this`. It decorates your values in a type safe manner. * * For example if you return an array from a string based method then the returned value will be decorated with array methods and not the string methods. This allow you as the developer to focus on your API and not worrying about how to properly build and connect your API. * * * ## Installation * * ``` * npm install extender * ``` * * Or [download the source](https://raw.github.com/doug-martin/extender/master/extender.js) ([minified](https://raw.github.com/doug-martin/extender/master/extender-min.js)) * * **Note** `extender` depends on [`declare.js`](http://doug-martin.github.com/declare.js/). * * ### Requirejs * * To use with requirejs place the `extend` source in the root scripts directory * * ```javascript * * define(["extender"], function(extender){ * }); * * ``` * * * ## Usage * * **`extender.define(tester, decorations)`** * * To create your own extender call the `extender.define` function. * * This function accepts an optional tester which is used to determine a value should be decorated with the specified `decorations` * * ```javascript * function isString(obj) { * return !isUndefinedOrNull(obj) && (typeof obj === "string" || obj instanceof String); * } * * * var myExtender = extender.define(isString, { * multiply: function (str, times) { * var ret = str; * for (var i = 1; i < times; i++) { * ret += str; * } * return ret; * }, * toArray: function (str, delim) { * delim = delim || ""; * return str.split(delim); * } * }); * * myExtender("hello").multiply(2).value(); //hellohello * * ``` * * If you do not specify a tester function and just pass in an object of `functions` then all values passed in will be decorated with methods. * * ```javascript * * function isUndefined(obj) { * var undef; * return obj === undef; * } * * function isUndefinedOrNull(obj) { * var undef; * return obj === undef || obj === null; * } * * function isArray(obj) { * return Object.prototype.toString.call(obj) === "[object Array]"; * } * * function isBoolean(obj) { * var undef, type = typeof obj; * return !isUndefinedOrNull(obj) && type === "boolean" || type === "Boolean"; * } * * function isString(obj) { * return !isUndefinedOrNull(obj) && (typeof obj === "string" || obj instanceof String); * } * * var myExtender = extender.define({ * isUndefined : isUndefined, * isUndefinedOrNull : isUndefinedOrNull, * isArray : isArray, * isBoolean : isBoolean, * isString : isString * }); * * ``` * * To use * * ``` * var undef; * myExtender("hello").isUndefined().value(); //false * myExtender(undef).isUndefined().value(); //true * ``` * * You can also chain extenders so that they accept multiple types and decorates accordingly. * * ```javascript * myExtender * .define(isArray, { * pluck: function (arr, m) { * var ret = []; * for (var i = 0, l = arr.length; i < l; i++) { * ret.push(arr[i][m]); * } * return ret; * } * }) * .define(isBoolean, { * invert: function (val) { * return !val; * } * }); * * myExtender([{a: "a"},{a: "b"},{a: "c"}]).pluck("a").value(); //["a", "b", "c"] * myExtender("I love javascript!").toArray(/\s+/).pluck("0"); //["I", "l", "j"] * * ``` * * Notice that we reuse the same extender as defined above. * * **Return Values** * * When creating an extender if you return a value from one of the decoration functions then that value will also be decorated. If you do not return any values then the extender will be returned. * * **Default decoration methods** * * By default every value passed into an extender is decorated with the following methods. * * * `value` : The value this extender represents. * * `eq(otherValue)` : Tests strict equality of the currently represented value to the `otherValue` * * `neq(oterValue)` : Tests strict inequality of the currently represented value. * * `print` : logs the current value to the console. * * **Extender initialization** * * When creating an extender you can also specify a constructor which will be invoked with the current value. * * ```javascript * myExtender.define(isString, { * constructor : function(val){ * //set our value to the string trimmed * this._value = val.trimRight().trimLeft(); * } * }); * ``` * * **`noWrap`** * * `extender` also allows you to specify methods that should not have the value wrapped providing a cleaner exit function other than `value()`. * * For example suppose you have an API that allows you to build a validator, rather than forcing the user to invoke the `value` method you could add a method called `validator` which makes more syntactic sense. * * ``` * * var myValidator = extender.define({ * //chainable validation methods * //... * //end chainable validation methods * * noWrap : { * validator : function(){ * //return your validator * } * } * }); * * myValidator().isNotNull().isEmailAddress().validator(); //now you dont need to call .value() * * * ``` * **`extender.extend(extendr)`** * * You may also compose extenders through the use of `extender.extend(extender)`, which will return an entirely new extender that is the composition of extenders. * * Suppose you have the following two extenders. * * ```javascript * var myExtender = extender * .define({ * isFunction: is.function, * isNumber: is.number, * isString: is.string, * isDate: is.date, * isArray: is.array, * isBoolean: is.boolean, * isUndefined: is.undefined, * isDefined: is.defined, * isUndefinedOrNull: is.undefinedOrNull, * isNull: is.null, * isArguments: is.arguments, * isInstanceOf: is.instanceOf, * isRegExp: is.regExp * }); * var myExtender2 = extender.define(is.array, { * pluck: function (arr, m) { * var ret = []; * for (var i = 0, l = arr.length; i < l; i++) { * ret.push(arr[i][m]); * } * return ret; * }, * * noWrap: { * pluckPlain: function (arr, m) { * var ret = []; * for (var i = 0, l = arr.length; i < l; i++) { * ret.push(arr[i][m]); * } * return ret; * } * } * }); * * * ``` * * And you do not want to alter either of them but instead what to create a third that is the union of the two. * * * ```javascript * var composed = extender.extend(myExtender).extend(myExtender2); * ``` * So now you can use the new extender with the joined functionality if `myExtender` and `myExtender2`. * * ```javascript * var extended = composed([ * {a: "a"}, * {a: "b"}, * {a: "c"} * ]); * extended.isArray().value(); //true * extended.pluck("a").value(); // ["a", "b", "c"]); * * ``` * * **Note** `myExtender` and `myExtender2` will **NOT** be altered. * * **`extender.expose(methods)`** * * The `expose` method allows you to add methods to your extender that are not wrapped or automatically chained by exposing them on the extender directly. * * ``` * var isMethods = { * isFunction: is.function, * isNumber: is.number, * isString: is.string, * isDate: is.date, * isArray: is.array, * isBoolean: is.boolean, * isUndefined: is.undefined, * isDefined: is.defined, * isUndefinedOrNull: is.undefinedOrNull, * isNull: is.null, * isArguments: is.arguments, * isInstanceOf: is.instanceOf, * isRegExp: is.regExp * }; * * var myExtender = extender.define(isMethods).expose(isMethods); * * myExtender.isArray([]); //true * myExtender([]).isArray([]).value(); //true * * ``` * * * **Using `instanceof`** * * When using extenders you can test if a value is an `instanceof` of an extender by using the instanceof operator. * * ```javascript * var str = myExtender("hello"); * * str instanceof myExtender; //true * ``` * * ## Examples * * To see more examples click [here](https://github.com/doug-martin/extender/tree/master/examples) */ function defineExtender(declare) { var slice = Array.prototype.slice, undef; function indexOf(arr, item) { if (arr && arr.length) { for (var i = 0, l = arr.length; i < l; i++) { if (arr[i] === item) { return i; } } } return -1; } function isArray(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; } var merge = (function merger() { function _merge(target, source, exclude) { var name, s; for (name in source) { if (source.hasOwnProperty(name) && indexOf(exclude, name) === -1) { s = source[name]; if (!(name in target) || (target[name] !== s)) { target[name] = s; } } } return target; } return function merge(obj) { if (!obj) { obj = {}; } var l = arguments.length; var exclude = arguments[arguments.length - 1]; if (isArray(exclude)) { l--; } else { exclude = []; } for (var i = 1; i < l; i++) { _merge(obj, arguments[i], exclude); } return obj; // Object }; }()); function extender(supers) { supers = supers || []; var Base = declare({ instance: { constructor: function (value) { this._value = value; }, value: function () { return this._value; }, eq: function eq(val) { return this["__extender__"](this._value === val); }, neq: function neq(other) { return this["__extender__"](this._value !== other); }, print: function () { console.log(this._value); return this; } } }), defined = []; function addMethod(proto, name, func) { if ("function" !== typeof func) { throw new TypeError("when extending type you must provide a function"); } var extendedMethod; if (name === "constructor") { extendedMethod = function () { this._super(arguments); func.apply(this, arguments); }; } else { extendedMethod = function extendedMethod() { var args = slice.call(arguments); args.unshift(this._value); var ret = func.apply(this, args); return ret !== undef ? this["__extender__"](ret) : this; }; } proto[name] = extendedMethod; } function addNoWrapMethod(proto, name, func) { if ("function" !== typeof func) { throw new TypeError("when extending type you must provide a function"); } var extendedMethod; if (name === "constructor") { extendedMethod = function () { this._super(arguments); func.apply(this, arguments); }; } else { extendedMethod = function extendedMethod() { var args = slice.call(arguments); args.unshift(this._value); return func.apply(this, args); }; } proto[name] = extendedMethod; } function decorateProto(proto, decoration, nowrap) { for (var i in decoration) { if (decoration.hasOwnProperty(i)) { if (i !== "getters" && i !== "setters") { if (i === "noWrap") { decorateProto(proto, decoration[i], true); } else if (nowrap) { addNoWrapMethod(proto, i, decoration[i]); } else { addMethod(proto, i, decoration[i]); } } else { proto[i] = decoration[i]; } } } } function _extender(obj) { var ret = obj, i, l; if (!(obj instanceof Base)) { var OurBase = Base; for (i = 0, l = defined.length; i < l; i++) { var definer = defined[i]; if (definer[0](obj)) { OurBase = OurBase.extend({instance: definer[1]}); } } ret = new OurBase(obj); ret["__extender__"] = _extender; } return ret; } function always() { return true; } function define(tester, decorate) { if (arguments.length) { if (typeof tester === "object") { decorate = tester; tester = always; } decorate = decorate || {}; var proto = {}; decorateProto(proto, decorate); //handle browsers like which skip over the constructor while looping if (!proto.hasOwnProperty("constructor")) { if (decorate.hasOwnProperty("constructor")) { addMethod(proto, "constructor", decorate.constructor); } else { proto.constructor = function () { this._super(arguments); }; } } defined.push([tester, proto]); } return _extender; } function extend(supr) { if (supr && supr.hasOwnProperty("__defined__")) { _extender["__defined__"] = defined = defined.concat(supr["__defined__"]); } merge(_extender, supr, ["define", "extend", "expose", "__defined__"]); return _extender; } _extender.define = define; _extender.extend = extend; _extender.expose = function expose() { var methods; for (var i = 0, l = arguments.length; i < l; i++) { methods = arguments[i]; if (typeof methods === "object") { merge(_extender, methods, ["define", "extend", "expose", "__defined__"]); } } return _extender; }; _extender["__defined__"] = defined; return _extender; } return { define: function () { return extender().define.apply(extender, arguments); }, extend: function (supr) { return extender().define().extend(supr); } }; } if (true) { if ( true && module.exports) { module.exports = defineExtender(__webpack_require__(17)); } } else {} }).call(this); /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(18); /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { (function () { /** * @projectName declare * @github http://github.com/doug-martin/declare.js * @header * * Declare is a library designed to allow writing object oriented code the same way in both the browser and node.js. * * ##Installation * * `npm install declare.js` * * Or [download the source](https://raw.github.com/doug-martin/declare.js/master/declare.js) ([minified](https://raw.github.com/doug-martin/declare.js/master/declare-min.js)) * * ###Requirejs * * To use with requirejs place the `declare` source in the root scripts directory * * ``` * * define(["declare"], function(declare){ * return declare({ * instance : { * hello : function(){ * return "world"; * } * } * }); * }); * * ``` * * * ##Usage * * declare.js provides * * Class methods * * * `as(module | object, name)` : exports the object to module or the object with the name * * `mixin(mixin)` : mixes in an object but does not inherit directly from the object. **Note** this does not return a new class but changes the original class. * * `extend(proto)` : extend a class with the given properties. A shortcut to `declare(Super, {})`; * * Instance methods * * * `_super(arguments)`: calls the super of the current method, you can pass in either the argments object or an array with arguments you want passed to super * * `_getSuper()`: returns a this methods direct super. * * `_static` : use to reference class properties and methods. * * `get(prop)` : gets a property invoking the getter if it exists otherwise it just returns the named property on the object. * * `set(prop, val)` : sets a property invoking the setter if it exists otherwise it just sets the named property on the object. * * * ###Declaring a new Class * * Creating a new class with declare is easy! * * ``` * * var Mammal = declare({ * //define your instance methods and properties * instance : { * * //will be called whenever a new instance is created * constructor: function(options) { * options = options || {}; * this._super(arguments); * this._type = options.type || "mammal"; * }, * * speak : function() { * return "A mammal of type " + this._type + " sounds like"; * }, * * //Define your getters * getters : { * * //can be accessed by using the get method. (mammal.get("type")) * type : function() { * return this._type; * } * }, * * //Define your setters * setters : { * * //can be accessed by using the set method. (mammal.set("type", "mammalType")) * type : function(t) { * this._type = t; * } * } * }, * * //Define your static methods * static : { * * //Mammal.soundOff(); //"Im a mammal!!" * soundOff : function() { * return "Im a mammal!!"; * } * } * }); * * * ``` * * You can use Mammal just like you would any other class. * * ``` * Mammal.soundOff("Im a mammal!!"); * * var myMammal = new Mammal({type : "mymammal"}); * myMammal.speak(); // "A mammal of type mymammal sounds like" * myMammal.get("type"); //"mymammal" * myMammal.set("type", "mammal"); * myMammal.get("type"); //"mammal" * * * ``` * * ###Extending a class * * If you want to just extend a single class use the .extend method. * * ``` * * var Wolf = Mammal.extend({ * * //define your instance method * instance: { * * //You can override super constructors just be sure to call `_super` * constructor: function(options) { * options = options || {}; * this._super(arguments); //call our super constructor. * this._sound = "growl"; * this._color = options.color || "grey"; * }, * * //override Mammals `speak` method by appending our own data to it. * speak : function() { * return this._super(arguments) + " a " + this._sound; * }, * * //add new getters for sound and color * getters : { * * //new Wolf().get("type") * //notice color is read only as we did not define a setter * color : function() { * return this._color; * }, * * //new Wolf().get("sound") * sound : function() { * return this._sound; * } * }, * * setters : { * * //new Wolf().set("sound", "howl") * sound : function(s) { * this._sound = s; * } * } * * }, * * static : { * * //You can override super static methods also! And you can still use _super * soundOff : function() { * //You can even call super in your statics!!! * //should return "I'm a mammal!! that growls" * return this._super(arguments) + " that growls"; * } * } * }); * * Wolf.soundOff(); //Im a mammal!! that growls * * var myWolf = new Wolf(); * myWolf instanceof Mammal //true * myWolf instanceof Wolf //true * * ``` * * You can also extend a class by using the declare method and just pass in the super class. * * ``` * //Typical hierarchical inheritance * // Mammal->Wolf->Dog * var Dog = declare(Wolf, { * instance: { * constructor: function(options) { * options = options || {}; * this._super(arguments); * //override Wolfs initialization of sound to woof. * this._sound = "woof"; * * }, * * speak : function() { * //Should return "A mammal of type mammal sounds like a growl thats domesticated" * return this._super(arguments) + " thats domesticated"; * } * }, * * static : { * soundOff : function() { * //should return "I'm a mammal!! that growls but now barks" * return this._super(arguments) + " but now barks"; * } * } * }); * * Dog.soundOff(); //Im a mammal!! that growls but now barks * * var myDog = new Dog(); * myDog instanceof Mammal //true * myDog instanceof Wolf //true * myDog instanceof Dog //true * * * //Notice you still get the extend method. * * // Mammal->Wolf->Dog->Breed * var Breed = Dog.extend({ * instance: { * * //initialize outside of constructor * _pitch : "high", * * constructor: function(options) { * options = options || {}; * this._super(arguments); * this.breed = options.breed || "lab"; * }, * * speak : function() { * //Should return "A mammal of type mammal sounds like a * //growl thats domesticated with a high pitch!" * return this._super(arguments) + " with a " + this._pitch + " pitch!"; * }, * * getters : { * pitch : function() { * return this._pitch; * } * } * }, * * static : { * soundOff : function() { * //should return "I'M A MAMMAL!! THAT GROWLS BUT NOW BARKS!" * return this._super(arguments).toUpperCase() + "!"; * } * } * }); * * * Breed.soundOff()//"IM A MAMMAL!! THAT GROWLS BUT NOW BARKS!" * * var myBreed = new Breed({color : "gold", type : "lab"}), * myBreed instanceof Dog //true * myBreed instanceof Wolf //true * myBreed instanceof Mammal //true * myBreed.speak() //"A mammal of type lab sounds like a woof thats domesticated with a high pitch!" * myBreed.get("type") //"lab" * myBreed.get("color") //"gold" * myBreed.get("sound")" //"woof" * ``` * * ###Multiple Inheritance / Mixins * * declare also allows the use of multiple super classes. * This is useful if you have generic classes that provide functionality but shouldnt be used on their own. * * Lets declare a mixin that allows us to watch for property changes. * * ``` * //Notice that we set up the functions outside of declare because we can reuse them * * function _set(prop, val) { * //get the old value * var oldVal = this.get(prop); * //call super to actually set the property * var ret = this._super(arguments); * //call our handlers * this.__callHandlers(prop, oldVal, val); * return ret; * } * * function _callHandlers(prop, oldVal, newVal) { * //get our handlers for the property * var handlers = this.__watchers[prop], l; * //if the handlers exist and their length does not equal 0 then we call loop through them * if (handlers && (l = handlers.length) !== 0) { * for (var i = 0; i < l; i++) { * //call the handler * handlers[i].call(null, prop, oldVal, newVal); * } * } * } * * * //the watch function * function _watch(prop, handler) { * if ("function" !== typeof handler) { * //if its not a function then its an invalid handler * throw new TypeError("Invalid handler."); * } * if (!this.__watchers[prop]) { * //create the watchers if it doesnt exist * this.__watchers[prop] = [handler]; * } else { * //otherwise just add it to the handlers array * this.__watchers[prop].push(handler); * } * } * * function _unwatch(prop, handler) { * if ("function" !== typeof handler) { * throw new TypeError("Invalid handler."); * } * var handlers = this.__watchers[prop], index; * if (handlers && (index = handlers.indexOf(handler)) !== -1) { * //remove the handler if it is found * handlers.splice(index, 1); * } * } * * declare({ * instance:{ * constructor:function () { * this._super(arguments); * //set up our watchers * this.__watchers = {}; * }, * * //override the default set function so we can watch values * "set":_set, * //set up our callhandlers function * __callHandlers:_callHandlers, * //add the watch function * watch:_watch, * //add the unwatch function * unwatch:_unwatch * }, * * "static":{ * * init:function () { * this._super(arguments); * this.__watchers = {}; * }, * //override the default set function so we can watch values * "set":_set, * //set our callHandlers function * __callHandlers:_callHandlers, * //add the watch * watch:_watch, * //add the unwatch function * unwatch:_unwatch * } * }) * * ``` * * Now lets use the mixin * * ``` * var WatchDog = declare([Dog, WatchMixin]); * * var watchDog = new WatchDog(); * //create our handler * function watch(id, oldVal, newVal) { * console.log("watchdog's %s was %s, now %s", id, oldVal, newVal); * } * * //watch for property changes * watchDog.watch("type", watch); * watchDog.watch("color", watch); * watchDog.watch("sound", watch); * * //now set the properties each handler will be called * watchDog.set("type", "newDog"); * watchDog.set("color", "newColor"); * watchDog.set("sound", "newSound"); * * * //unwatch the property changes * watchDog.unwatch("type", watch); * watchDog.unwatch("color", watch); * watchDog.unwatch("sound", watch); * * //no handlers will be called this time * watchDog.set("type", "newDog"); * watchDog.set("color", "newColor"); * watchDog.set("sound", "newSound"); * * * ``` * * ###Accessing static methods and properties witin an instance. * * To access static properties on an instance use the `_static` property which is a reference to your constructor. * * For example if your in your constructor and you want to have configurable default values. * * ``` * consturctor : function constructor(opts){ * this.opts = opts || {}; * this._type = opts.type || this._static.DEFAULT_TYPE; * } * ``` * * * * ###Creating a new instance of within an instance. * * Often times you want to create a new instance of an object within an instance. If your subclassed however you cannot return a new instance of the parent class as it will not be the right sub class. `declare` provides a way around this by setting the `_static` property on each isntance of the class. * * Lets add a reproduce method `Mammal` * * ``` * reproduce : function(options){ * return new this._static(options); * } * ``` * * Now in each subclass you can call reproduce and get the proper type. * * ``` * var myDog = new Dog(); * var myDogsChild = myDog.reproduce(); * * myDogsChild instanceof Dog; //true * ``` * * ###Using the `as` * * `declare` also provides an `as` method which allows you to add your class to an object or if your using node.js you can pass in `module` and the class will be exported as the module. * * ``` * var animals = {}; * * Mammal.as(animals, "Dog"); * Wolf.as(animals, "Wolf"); * Dog.as(animals, "Dog"); * Breed.as(animals, "Breed"); * * var myDog = new animals.Dog(); * * ``` * * Or in node * * ``` * Mammal.as(exports, "Dog"); * Wolf.as(exports, "Wolf"); * Dog.as(exports, "Dog"); * Breed.as(exports, "Breed"); * * ``` * * To export a class as the `module` in node * * ``` * Mammal.as(module); * ``` * * */ function createDeclared() { var arraySlice = Array.prototype.slice, classCounter = 0, Base, forceNew = new Function(); var SUPER_REGEXP = /(super)/g; function argsToArray(args, slice) { slice = slice || 0; return arraySlice.call(args, slice); } function isArray(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; } function isObject(obj) { var undef; return obj !== null && obj !== undef && typeof obj === "object"; } function isHash(obj) { var ret = isObject(obj); return ret && obj.constructor === Object; } var isArguments = function _isArguments(object) { return Object.prototype.toString.call(object) === '[object Arguments]'; }; if (!isArguments(arguments)) { isArguments = function _isArguments(obj) { return !!(obj && obj.hasOwnProperty("callee")); }; } function indexOf(arr, item) { if (arr && arr.length) { for (var i = 0, l = arr.length; i < l; i++) { if (arr[i] === item) { return i; } } } return -1; } function merge(target, source, exclude) { var name, s; for (name in source) { if (source.hasOwnProperty(name) && indexOf(exclude, name) === -1) { s = source[name]; if (!(name in target) || (target[name] !== s)) { target[name] = s; } } } return target; } function callSuper(args, a) { var meta = this.__meta, supers = meta.supers, l = supers.length, superMeta = meta.superMeta, pos = superMeta.pos; if (l > pos) { args = !args ? [] : (!isArguments(args) && !isArray(args)) ? [args] : args; var name = superMeta.name, f = superMeta.f, m; do { m = supers[pos][name]; if ("function" === typeof m && (m = m._f || m) !== f) { superMeta.pos = 1 + pos; return m.apply(this, args); } } while (l > ++pos); } return null; } function getSuper() { var meta = this.__meta, supers = meta.supers, l = supers.length, superMeta = meta.superMeta, pos = superMeta.pos; if (l > pos) { var name = superMeta.name, f = superMeta.f, m; do { m = supers[pos][name]; if ("function" === typeof m && (m = m._f || m) !== f) { superMeta.pos = 1 + pos; return m.bind(this); } } while (l > ++pos); } return null; } function getter(name) { var getters = this.__getters__; if (getters.hasOwnProperty(name)) { return getters[name].apply(this); } else { return this[name]; } } function setter(name, val) { var setters = this.__setters__; if (isHash(name)) { for (var i in name) { var prop = name[i]; if (setters.hasOwnProperty(i)) { setters[name].call(this, prop); } else { this[i] = prop; } } } else { if (setters.hasOwnProperty(name)) { return setters[name].apply(this, argsToArray(arguments, 1)); } else { return this[name] = val; } } } function defaultFunction() { var meta = this.__meta || {}, supers = meta.supers, l = supers.length, superMeta = meta.superMeta, pos = superMeta.pos; if (l > pos) { var name = superMeta.name, f = superMeta.f, m; do { m = supers[pos][name]; if ("function" === typeof m && (m = m._f || m) !== f) { superMeta.pos = 1 + pos; return m.apply(this, arguments); } } while (l > ++pos); } return null; } function functionWrapper(f, name) { if (f.toString().match(SUPER_REGEXP)) { var wrapper = function wrapper() { var ret, meta = this.__meta || {}; var orig = meta.superMeta; meta.superMeta = {f: f, pos: 0, name: name}; switch (arguments.length) { case 0: ret = f.call(this); break; case 1: ret = f.call(this, arguments[0]); break; case 2: ret = f.call(this, arguments[0], arguments[1]); break; case 3: ret = f.call(this, arguments[0], arguments[1], arguments[2]); break; default: ret = f.apply(this, arguments); } meta.superMeta = orig; return ret; }; wrapper._f = f; return wrapper; } else { f._f = f; return f; } } function defineMixinProps(child, proto) { var operations = proto.setters || {}, __setters = child.__setters__, __getters = child.__getters__; for (var i in operations) { if (!__setters.hasOwnProperty(i)) { //make sure that the setter isnt already there __setters[i] = operations[i]; } } operations = proto.getters || {}; for (i in operations) { if (!__getters.hasOwnProperty(i)) { //make sure that the setter isnt already there __getters[i] = operations[i]; } } for (var j in proto) { if (j !== "getters" && j !== "setters") { var p = proto[j]; if ("function" === typeof p) { if (!child.hasOwnProperty(j)) { child[j] = functionWrapper(defaultFunction, j); } } else { child[j] = p; } } } } function mixin() { var args = argsToArray(arguments), l = args.length; var child = this.prototype; var childMeta = child.__meta, thisMeta = this.__meta, bases = child.__meta.bases, staticBases = bases.slice(), staticSupers = thisMeta.supers || [], supers = childMeta.supers || []; for (var i = 0; i < l; i++) { var m = args[i], mProto = m.prototype; var protoMeta = mProto.__meta, meta = m.__meta; !protoMeta && (protoMeta = (mProto.__meta = {proto: mProto || {}})); !meta && (meta = (m.__meta = {proto: m.__proto__ || {}})); defineMixinProps(child, protoMeta.proto || {}); defineMixinProps(this, meta.proto || {}); //copy the bases for static, mixinSupers(m.prototype, supers, bases); mixinSupers(m, staticSupers, staticBases); } return this; } function mixinSupers(sup, arr, bases) { var meta = sup.__meta; !meta && (meta = (sup.__meta = {})); var unique = sup.__meta.unique; !unique && (meta.unique = "declare" + ++classCounter); //check it we already have this super mixed into our prototype chain //if true then we have already looped their supers! if (indexOf(bases, unique) === -1) { //add their id to our bases bases.push(unique); var supers = sup.__meta.supers || [], i = supers.length - 1 || 0; while (i >= 0) { mixinSupers(supers[i--], arr, bases); } arr.unshift(sup); } } function defineProps(child, proto) { var operations = proto.setters, __setters = child.__setters__, __getters = child.__getters__; if (operations) { for (var i in operations) { __setters[i] = operations[i]; } } operations = proto.getters || {}; if (operations) { for (i in operations) { __getters[i] = operations[i]; } } for (i in proto) { if (i != "getters" && i != "setters") { var f = proto[i]; if ("function" === typeof f) { var meta = f.__meta || {}; if (!meta.isConstructor) { child[i] = functionWrapper(f, i); } else { child[i] = f; } } else { child[i] = f; } } } } function _export(obj, name) { if (obj && name) { obj[name] = this; } else { obj.exports = obj = this; } return this; } function extend(proto) { return declare(this, proto); } function getNew(ctor) { // create object with correct prototype using a do-nothing // constructor forceNew.prototype = ctor.prototype; var t = new forceNew(); forceNew.prototype = null; // clean up return t; } function __declare(child, sup, proto) { var childProto = {}, supers = []; var unique = "declare" + ++classCounter, bases = [], staticBases = []; var instanceSupers = [], staticSupers = []; var meta = { supers: instanceSupers, unique: unique, bases: bases, superMeta: { f: null, pos: 0, name: null } }; var childMeta = { supers: staticSupers, unique: unique, bases: staticBases, isConstructor: true, superMeta: { f: null, pos: 0, name: null } }; if (isHash(sup) && !proto) { proto = sup; sup = Base; } if ("function" === typeof sup || isArray(sup)) { supers = isArray(sup) ? sup : [sup]; sup = supers.shift(); child.__meta = childMeta; childProto = getNew(sup); childProto.__meta = meta; childProto.__getters__ = merge({}, childProto.__getters__ || {}); childProto.__setters__ = merge({}, childProto.__setters__ || {}); child.__getters__ = merge({}, child.__getters__ || {}); child.__setters__ = merge({}, child.__setters__ || {}); mixinSupers(sup.prototype, instanceSupers, bases); mixinSupers(sup, staticSupers, staticBases); } else { child.__meta = childMeta; childProto.__meta = meta; childProto.__getters__ = childProto.__getters__ || {}; childProto.__setters__ = childProto.__setters__ || {}; child.__getters__ = child.__getters__ || {}; child.__setters__ = child.__setters__ || {}; } child.prototype = childProto; if (proto) { var instance = meta.proto = proto.instance || {}; var stat = childMeta.proto = proto.static || {}; stat.init = stat.init || defaultFunction; defineProps(childProto, instance); defineProps(child, stat); if (!instance.hasOwnProperty("constructor")) { childProto.constructor = instance.constructor = functionWrapper(defaultFunction, "constructor"); } else { childProto.constructor = functionWrapper(instance.constructor, "constructor"); } } else { meta.proto = {}; childMeta.proto = {}; child.init = functionWrapper(defaultFunction, "init"); childProto.constructor = functionWrapper(defaultFunction, "constructor"); } if (supers.length) { mixin.apply(child, supers); } if (sup) { //do this so we mixin our super methods directly but do not ov merge(child, merge(merge({}, sup), child)); } childProto._super = child._super = callSuper; childProto._getSuper = child._getSuper = getSuper; childProto._static = child; } function declare(sup, proto) { function declared() { switch (arguments.length) { case 0: this.constructor.call(this); break; case 1: this.constructor.call(this, arguments[0]); break; case 2: this.constructor.call(this, arguments[0], arguments[1]); break; case 3: this.constructor.call(this, arguments[0], arguments[1], arguments[2]); break; default: this.constructor.apply(this, arguments); } } __declare(declared, sup, proto); return declared.init() || declared; } function singleton(sup, proto) { var retInstance; function declaredSingleton() { if (!retInstance) { this.constructor.apply(this, arguments); retInstance = this; } return retInstance; } __declare(declaredSingleton, sup, proto); return declaredSingleton.init() || declaredSingleton; } Base = declare({ instance: { "get": getter, "set": setter }, "static": { "get": getter, "set": setter, mixin: mixin, extend: extend, as: _export } }); declare.singleton = singleton; return declare; } if (true) { if ( true && module.exports) { module.exports = createDeclared(); } } else {} }()); /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; /*global extended isExtended*/ function defineObject(extended, is, arr) { var deepEqual = is.deepEqual, isString = is.isString, isHash = is.isHash, difference = arr.difference, hasOwn = Object.prototype.hasOwnProperty, isFunction = is.isFunction; function _merge(target, source) { var name, s; for (name in source) { if (hasOwn.call(source, name)) { s = source[name]; if (!(name in target) || (target[name] !== s)) { target[name] = s; } } } return target; } function _deepMerge(target, source) { var name, s, t; for (name in source) { if (hasOwn.call(source, name)) { s = source[name]; t = target[name]; if (!deepEqual(t, s)) { if (isHash(t) && isHash(s)) { target[name] = _deepMerge(t, s); } else if (isHash(s)) { target[name] = _deepMerge({}, s); } else { target[name] = s; } } } } return target; } function merge(obj) { if (!obj) { obj = {}; } for (var i = 1, l = arguments.length; i < l; i++) { _merge(obj, arguments[i]); } return obj; // Object } function deepMerge(obj) { if (!obj) { obj = {}; } for (var i = 1, l = arguments.length; i < l; i++) { _deepMerge(obj, arguments[i]); } return obj; // Object } function extend(parent, child) { var proto = parent.prototype || parent; merge(proto, child); return parent; } function forEach(hash, iterator, scope) { if (!isHash(hash) || !isFunction(iterator)) { throw new TypeError(); } var objKeys = keys(hash), key; for (var i = 0, len = objKeys.length; i < len; ++i) { key = objKeys[i]; iterator.call(scope || hash, hash[key], key, hash); } return hash; } function filter(hash, iterator, scope) { if (!isHash(hash) || !isFunction(iterator)) { throw new TypeError(); } var objKeys = keys(hash), key, value, ret = {}; for (var i = 0, len = objKeys.length; i < len; ++i) { key = objKeys[i]; value = hash[key]; if (iterator.call(scope || hash, value, key, hash)) { ret[key] = value; } } return ret; } function values(hash) { if (!isHash(hash)) { throw new TypeError(); } var objKeys = keys(hash), ret = []; for (var i = 0, len = objKeys.length; i < len; ++i) { ret.push(hash[objKeys[i]]); } return ret; } function keys(hash) { if (!isHash(hash)) { throw new TypeError(); } var ret = []; for (var i in hash) { if (hasOwn.call(hash, i)) { ret.push(i); } } return ret; } function invert(hash) { if (!isHash(hash)) { throw new TypeError(); } var objKeys = keys(hash), key, ret = {}; for (var i = 0, len = objKeys.length; i < len; ++i) { key = objKeys[i]; ret[hash[key]] = key; } return ret; } function toArray(hash) { if (!isHash(hash)) { throw new TypeError(); } var objKeys = keys(hash), key, ret = []; for (var i = 0, len = objKeys.length; i < len; ++i) { key = objKeys[i]; ret.push([key, hash[key]]); } return ret; } function omit(hash, omitted) { if (!isHash(hash)) { throw new TypeError(); } if (isString(omitted)) { omitted = [omitted]; } var objKeys = difference(keys(hash), omitted), key, ret = {}; for (var i = 0, len = objKeys.length; i < len; ++i) { key = objKeys[i]; ret[key] = hash[key]; } return ret; } var hash = { forEach: forEach, filter: filter, invert: invert, values: values, toArray: toArray, keys: keys, omit: omit }; var obj = { extend: extend, merge: merge, deepMerge: deepMerge, omit: omit }; var ret = extended.define(is.isObject, obj).define(isHash, hash).define(is.isFunction, {extend: extend}).expose({hash: hash}).expose(obj); var orig = ret.extend; ret.extend = function __extend() { if (arguments.length === 1) { return orig.extend.apply(ret, arguments); } else { extend.apply(null, arguments); } }; return ret; } if (true) { if ( true && module.exports) { module.exports = defineObject(__webpack_require__(2), __webpack_require__(4), __webpack_require__(6)); } } else {} }).call(this); /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; function defineArgumentsExtended(extended, is) { var pSlice = Array.prototype.slice, isArguments = is.isArguments; function argsToArray(args, slice) { var i = -1, j = 0, l = args.length, ret = []; slice = slice || 0; i += slice; while (++i < l) { ret[j++] = args[i]; } return ret; } return extended .define(isArguments, { toArray: argsToArray }) .expose({ argsToArray: argsToArray }); } if (true) { if ( true && module.exports) { module.exports = defineArgumentsExtended(__webpack_require__(2), __webpack_require__(4)); } } else {} }).call(this); /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; function defineString(extended, is, date, arr) { var stringify; if (typeof JSON === "undefined") { /* json2.js 2012-10-08 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. */ (function () { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } var isPrimitive = is.tester().isString().isNumber().isBoolean().tester(); function toJSON(obj) { if (is.isDate(obj)) { return isFinite(obj.valueOf()) ? obj.getUTCFullYear() + '-' + f(obj.getUTCMonth() + 1) + '-' + f(obj.getUTCDate()) + 'T' + f(obj.getUTCHours()) + ':' + f(obj.getUTCMinutes()) + ':' + f(obj.getUTCSeconds()) + 'Z' : null; } else if (isPrimitive(obj)) { return obj.valueOf(); } return obj; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }, rep; function quote(string) { escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { var i, k, v, length, mind = gap, partial, value = holder[key]; if (value) { value = toJSON(value); } if (typeof rep === 'function') { value = rep.call(holder, key, value); } switch (typeof value) { case 'string': return quote(value); case 'number': return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': return String(value); case 'object': if (!value) { return 'null'; } gap += indent; partial = []; if (Object.prototype.toString.apply(value) === '[object Array]') { length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } stringify = function (value, replacer, space) { var i; gap = ''; indent = ''; if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } } else if (typeof space === 'string') { indent = space; } rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } return str('', {'': value}); }; }()); } else { stringify = JSON.stringify; } var isHash = is.isHash, aSlice = Array.prototype.slice; var FORMAT_REGEX = /%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g; var INTERP_REGEX = /\{(?:\[([^\[|\]]*)\])?(\w+)\}/g; var STR_FORMAT = /(-?)(\+?)([A-Z|a-z|\W]?)([1-9][0-9]*)?$/; var OBJECT_FORMAT = /([1-9][0-9]*)$/g; function formatString(string, format) { var ret = string; if (STR_FORMAT.test(format)) { var match = format.match(STR_FORMAT); var isLeftJustified = match[1], padChar = match[3], width = match[4]; if (width) { width = parseInt(width, 10); if (ret.length < width) { ret = pad(ret, width, padChar, isLeftJustified); } else { ret = truncate(ret, width); } } } return ret; } function formatNumber(number, format) { var ret; if (is.isNumber(number)) { ret = "" + number; if (STR_FORMAT.test(format)) { var match = format.match(STR_FORMAT); var isLeftJustified = match[1], signed = match[2], padChar = match[3], width = match[4]; if (signed) { ret = (number > 0 ? "+" : "") + ret; } if (width) { width = parseInt(width, 10); if (ret.length < width) { ret = pad(ret, width, padChar || "0", isLeftJustified); } else { ret = truncate(ret, width); } } } } else { throw new Error("stringExtended.format : when using %d the parameter must be a number!"); } return ret; } function formatObject(object, format) { var ret, match = format.match(OBJECT_FORMAT), spacing = 0; if (match) { spacing = parseInt(match[0], 10); if (isNaN(spacing)) { spacing = 0; } } try { ret = stringify(object, null, spacing); } catch (e) { throw new Error("stringExtended.format : Unable to parse json from ", object); } return ret; } var styles = { //styles bold: 1, bright: 1, italic: 3, underline: 4, blink: 5, inverse: 7, crossedOut: 9, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37, redBackground: 41, greenBackground: 42, yellowBackground: 43, blueBackground: 44, magentaBackground: 45, cyanBackground: 46, whiteBackground: 47, encircled: 52, overlined: 53, grey: 90, black: 90 }; var characters = { SMILEY: "☺", SOLID_SMILEY: "☻", HEART: "♥", DIAMOND: "♦", CLOVE: "♣", SPADE: "♠", DOT: "•", SQUARE_CIRCLE: "◘", CIRCLE: "○", FILLED_SQUARE_CIRCLE: "◙", MALE: "♂", FEMALE: "♀", EIGHT_NOTE: "♪", DOUBLE_EIGHTH_NOTE: "♫", SUN: "☼", PLAY: "►", REWIND: "◄", UP_DOWN: "↕", PILCROW: "¶", SECTION: "§", THICK_MINUS: "▬", SMALL_UP_DOWN: "↨", UP_ARROW: "↑", DOWN_ARROW: "↓", RIGHT_ARROW: "→", LEFT_ARROW: "←", RIGHT_ANGLE: "∟", LEFT_RIGHT_ARROW: "↔", TRIANGLE: "▲", DOWN_TRIANGLE: "▼", HOUSE: "⌂", C_CEDILLA: "Ç", U_UMLAUT: "ü", E_ACCENT: "é", A_LOWER_CIRCUMFLEX: "â", A_LOWER_UMLAUT: "ä", A_LOWER_GRAVE_ACCENT: "à", A_LOWER_CIRCLE_OVER: "å", C_LOWER_CIRCUMFLEX: "ç", E_LOWER_CIRCUMFLEX: "ê", E_LOWER_UMLAUT: "ë", E_LOWER_GRAVE_ACCENT: "è", I_LOWER_UMLAUT: "ï", I_LOWER_CIRCUMFLEX: "î", I_LOWER_GRAVE_ACCENT: "ì", A_UPPER_UMLAUT: "Ä", A_UPPER_CIRCLE: "Å", E_UPPER_ACCENT: "É", A_E_LOWER: "æ", A_E_UPPER: "Æ", O_LOWER_CIRCUMFLEX: "ô", O_LOWER_UMLAUT: "ö", O_LOWER_GRAVE_ACCENT: "ò", U_LOWER_CIRCUMFLEX: "û", U_LOWER_GRAVE_ACCENT: "ù", Y_LOWER_UMLAUT: "ÿ", O_UPPER_UMLAUT: "Ö", U_UPPER_UMLAUT: "Ü", CENTS: "¢", POUND: "£", YEN: "¥", CURRENCY: "¤", PTS: "₧", FUNCTION: "ƒ", A_LOWER_ACCENT: "á", I_LOWER_ACCENT: "í", O_LOWER_ACCENT: "ó", U_LOWER_ACCENT: "ú", N_LOWER_TILDE: "ñ", N_UPPER_TILDE: "Ñ", A_SUPER: "ª", O_SUPER: "º", UPSIDEDOWN_QUESTION: "¿", SIDEWAYS_L: "⌐", NEGATION: "¬", ONE_HALF: "½", ONE_FOURTH: "¼", UPSIDEDOWN_EXCLAMATION: "¡", DOUBLE_LEFT: "«", DOUBLE_RIGHT: "»", LIGHT_SHADED_BOX: "░", MEDIUM_SHADED_BOX: "▒", DARK_SHADED_BOX: "▓", VERTICAL_LINE: "│", MAZE__SINGLE_RIGHT_T: "┤", MAZE_SINGLE_RIGHT_TOP: "┐", MAZE_SINGLE_RIGHT_BOTTOM_SMALL: "┘", MAZE_SINGLE_LEFT_TOP_SMALL: "┌", MAZE_SINGLE_LEFT_BOTTOM_SMALL: "└", MAZE_SINGLE_LEFT_T: "├", MAZE_SINGLE_BOTTOM_T: "┴", MAZE_SINGLE_TOP_T: "┬", MAZE_SINGLE_CENTER: "┼", MAZE_SINGLE_HORIZONTAL_LINE: "─", MAZE_SINGLE_RIGHT_DOUBLECENTER_T: "╡", MAZE_SINGLE_RIGHT_DOUBLE_BL: "╛", MAZE_SINGLE_RIGHT_DOUBLE_T: "╢", MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP: "╖", MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP: "╕", MAZE_SINGLE_LEFT_DOUBLE_T: "╞", MAZE_SINGLE_BOTTOM_DOUBLE_T: "╧", MAZE_SINGLE_TOP_DOUBLE_T: "╤", MAZE_SINGLE_TOP_DOUBLECENTER_T: "╥", MAZE_SINGLE_BOTTOM_DOUBLECENTER_T: "╨", MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM: "╘", MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP: "╒", MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP: "╓", MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM: "╙", MAZE_SINGLE_LEFT_TOP: "Γ", MAZE_SINGLE_RIGHT_BOTTOM: "╜", MAZE_SINGLE_LEFT_CENTER: "╟", MAZE_SINGLE_DOUBLECENTER_CENTER: "╫", MAZE_SINGLE_DOUBLECROSS_CENTER: "╪", MAZE_DOUBLE_LEFT_CENTER: "╣", MAZE_DOUBLE_VERTICAL: "║", MAZE_DOUBLE_RIGHT_TOP: "╗", MAZE_DOUBLE_RIGHT_BOTTOM: "╝", MAZE_DOUBLE_LEFT_BOTTOM: "╚", MAZE_DOUBLE_LEFT_TOP: "╔", MAZE_DOUBLE_BOTTOM_T: "╩", MAZE_DOUBLE_TOP_T: "╦", MAZE_DOUBLE_LEFT_T: "╠", MAZE_DOUBLE_HORIZONTAL: "═", MAZE_DOUBLE_CROSS: "╬", SOLID_RECTANGLE: "█", THICK_LEFT_VERTICAL: "▌", THICK_RIGHT_VERTICAL: "▐", SOLID_SMALL_RECTANGLE_BOTTOM: "▄", SOLID_SMALL_RECTANGLE_TOP: "▀", PHI_UPPER: "Φ", INFINITY: "∞", INTERSECTION: "∩", DEFINITION: "≡", PLUS_MINUS: "±", GT_EQ: "≥", LT_EQ: "≤", THEREFORE: "⌠", SINCE: "∵", DOESNOT_EXIST: "∄", EXISTS: "∃", FOR_ALL: "∀", EXCLUSIVE_OR: "⊕", BECAUSE: "⌡", DIVIDE: "÷", APPROX: "≈", DEGREE: "°", BOLD_DOT: "∙", DOT_SMALL: "·", CHECK: "√", ITALIC_X: "✗", SUPER_N: "ⁿ", SQUARED: "²", CUBED: "³", SOLID_BOX: "■", PERMILE: "‰", REGISTERED_TM: "®", COPYRIGHT: "©", TRADEMARK: "™", BETA: "β", GAMMA: "γ", ZETA: "ζ", ETA: "η", IOTA: "ι", KAPPA: "κ", LAMBDA: "λ", NU: "ν", XI: "ξ", OMICRON: "ο", RHO: "ρ", UPSILON: "υ", CHI_LOWER: "φ", CHI_UPPER: "χ", PSI: "ψ", ALPHA: "α", ESZETT: "ß", PI: "π", SIGMA_UPPER: "Σ", SIGMA_LOWER: "σ", MU: "µ", TAU: "τ", THETA: "Θ", OMEGA: "Ω", DELTA: "δ", PHI_LOWER: "φ", EPSILON: "ε" }; function pad(string, length, ch, end) { string = "" + string; //check for numbers ch = ch || " "; var strLen = string.length; while (strLen < length) { if (end) { string += ch; } else { string = ch + string; } strLen++; } return string; } function truncate(string, length, end) { var ret = string; if (is.isString(ret)) { if (string.length > length) { if (end) { var l = string.length; ret = string.substring(l - length, l); } else { ret = string.substring(0, length); } } } else { ret = truncate("" + ret, length); } return ret; } function format(str, obj) { if (obj instanceof Array) { var i = 0, len = obj.length; //find the matches return str.replace(FORMAT_REGEX, function (m, format, type) { var replacer, ret; if (i < len) { replacer = obj[i++]; } else { //we are out of things to replace with so //just return the match? return m; } if (m === "%s" || m === "%d" || m === "%D") { //fast path! ret = replacer + ""; } else if (m === "%Z") { ret = replacer.toUTCString(); } else if (m === "%j") { try { ret = stringify(replacer); } catch (e) { throw new Error("stringExtended.format : Unable to parse json from ", replacer); } } else { format = format.replace(/^\[|\]$/g, ""); switch (type) { case "s": ret = formatString(replacer, format); break; case "d": ret = formatNumber(replacer, format); break; case "j": ret = formatObject(replacer, format); break; case "D": ret = date.format(replacer, format); break; case "Z": ret = date.format(replacer, format, true); break; } } return ret; }); } else if (isHash(obj)) { return str.replace(INTERP_REGEX, function (m, format, value) { value = obj[value]; if (!is.isUndefined(value)) { if (format) { if (is.isString(value)) { return formatString(value, format); } else if (is.isNumber(value)) { return formatNumber(value, format); } else if (is.isDate(value)) { return date.format(value, format); } else if (is.isObject(value)) { return formatObject(value, format); } } else { return "" + value; } } return m; }); } else { var args = aSlice.call(arguments).slice(1); return format(str, args); } } function toArray(testStr, delim) { var ret = []; if (testStr) { if (testStr.indexOf(delim) > 0) { ret = testStr.replace(/\s+/g, "").split(delim); } else { ret.push(testStr); } } return ret; } function multiply(str, times) { var ret = []; if (times) { for (var i = 0; i < times; i++) { ret.push(str); } } return ret.join(""); } function style(str, options) { var ret, i, l; if (options) { if (is.isArray(str)) { ret = []; for (i = 0, l = str.length; i < l; i++) { ret.push(style(str[i], options)); } } else if (options instanceof Array) { ret = str; for (i = 0, l = options.length; i < l; i++) { ret = style(ret, options[i]); } } else if (options in styles) { ret = '\x1B[' + styles[options] + 'm' + str + '\x1B[0m'; } } return ret; } function escape(str, except) { return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function (ch) { if (except && arr.indexOf(except, ch) !== -1) { return ch; } return "\\" + ch; }); } function trim(str) { return str.replace(/^\s*|\s*$/g, ""); } function trimLeft(str) { return str.replace(/^\s*/, ""); } function trimRight(str) { return str.replace(/\s*$/, ""); } function isEmpty(str) { return str.length === 0; } var string = { toArray: toArray, pad: pad, truncate: truncate, multiply: multiply, format: format, style: style, escape: escape, trim: trim, trimLeft: trimLeft, trimRight: trimRight, isEmpty: isEmpty }; return extended.define(is.isString, string).define(is.isArray, {style: style}).expose(string).expose({characters: characters}); } if (true) { if ( true && module.exports) { module.exports = defineString(__webpack_require__(2), __webpack_require__(4), __webpack_require__(22), __webpack_require__(6)); } } else {} }).call(this); /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { (function () { "use strict"; function defineDate(extended, is, array) { function _pad(string, length, ch, end) { string = "" + string; //check for numbers ch = ch || " "; var strLen = string.length; while (strLen < length) { if (end) { string += ch; } else { string = ch + string; } strLen++; } return string; } function _truncate(string, length, end) { var ret = string; if (is.isString(ret)) { if (string.length > length) { if (end) { var l = string.length; ret = string.substring(l - length, l); } else { ret = string.substring(0, length); } } } else { ret = _truncate("" + ret, length); } return ret; } function every(arr, iterator, scope) { if (!is.isArray(arr) || typeof iterator !== "function") { throw new TypeError(); } var t = Object(arr); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && !iterator.call(scope, t[i], i, t)) { return false; } } return true; } var transforms = (function () { var floor = Math.floor, round = Math.round; var addMap = { day: function addDay(date, amount) { return [amount, "Date", false]; }, weekday: function addWeekday(date, amount) { // Divide the increment time span into weekspans plus leftover days // e.g., 8 days is one 5-day weekspan / and two leftover days // Can't have zero leftover days, so numbers divisible by 5 get // a days value of 5, and the remaining days make up the number of weeks var days, weeks, mod = amount % 5, strt = date.getDay(), adj = 0; if (!mod) { days = (amount > 0) ? 5 : -5; weeks = (amount > 0) ? ((amount - 5) / 5) : ((amount + 5) / 5); } else { days = mod; weeks = parseInt(amount / 5, 10); } if (strt === 6 && amount > 0) { adj = 1; } else if (strt === 0 && amount < 0) { // Orig date is Sun / negative increment // Jump back over Sat adj = -1; } // Get weekday val for the new date var trgt = strt + days; // New date is on Sat or Sun if (trgt === 0 || trgt === 6) { adj = (amount > 0) ? 2 : -2; } // Increment by number of weeks plus leftover days plus // weekend adjustments return [(7 * weeks) + days + adj, "Date", false]; }, year: function addYear(date, amount) { return [amount, "FullYear", true]; }, week: function addWeek(date, amount) { return [amount * 7, "Date", false]; }, quarter: function addYear(date, amount) { return [amount * 3, "Month", true]; }, month: function addYear(date, amount) { return [amount, "Month", true]; } }; function addTransform(interval, date, amount) { interval = interval.replace(/s$/, ""); if (addMap.hasOwnProperty(interval)) { return addMap[interval](date, amount); } return [amount, "UTC" + interval.charAt(0).toUpperCase() + interval.substring(1) + "s", false]; } var differenceMap = { "quarter": function quarterDifference(date1, date2, utc) { var yearDiff = date2.getFullYear() - date1.getFullYear(); var m1 = date1[utc ? "getUTCMonth" : "getMonth"](); var m2 = date2[utc ? "getUTCMonth" : "getMonth"](); // Figure out which quarter the months are in var q1 = floor(m1 / 3) + 1; var q2 = floor(m2 / 3) + 1; // Add quarters for any year difference between the dates q2 += (yearDiff * 4); return q2 - q1; }, "weekday": function weekdayDifference(date1, date2, utc) { var days = differenceTransform("day", date1, date2, utc), weeks; var mod = days % 7; // Even number of weeks if (mod === 0) { days = differenceTransform("week", date1, date2, utc) * 5; } else { // Weeks plus spare change (< 7 days) var adj = 0, aDay = date1[utc ? "getUTCDay" : "getDay"](), bDay = date2[utc ? "getUTCDay" : "getDay"](); weeks = parseInt(days / 7, 10); // Mark the date advanced by the number of // round weeks (may be zero) var dtMark = new Date(+date1); dtMark.setDate(dtMark[utc ? "getUTCDate" : "getDate"]() + (weeks * 7)); var dayMark = dtMark[utc ? "getUTCDay" : "getDay"](); // Spare change days -- 6 or less if (days > 0) { if (aDay === 6 || bDay === 6) { adj = -1; } else if (aDay === 0) { adj = 0; } else if (bDay === 0 || (dayMark + mod) > 5) { adj = -2; } } else if (days < 0) { if (aDay === 6) { adj = 0; } else if (aDay === 0 || bDay === 0) { adj = 1; } else if (bDay === 6 || (dayMark + mod) < 0) { adj = 2; } } days += adj; days -= (weeks * 2); } return days; }, year: function (date1, date2) { return date2.getFullYear() - date1.getFullYear(); }, month: function (date1, date2, utc) { var m1 = date1[utc ? "getUTCMonth" : "getMonth"](); var m2 = date2[utc ? "getUTCMonth" : "getMonth"](); return (m2 - m1) + ((date2.getFullYear() - date1.getFullYear()) * 12); }, week: function (date1, date2, utc) { return round(differenceTransform("day", date1, date2, utc) / 7); }, day: function (date1, date2) { return 1.1574074074074074e-8 * (date2.getTime() - date1.getTime()); }, hour: function (date1, date2) { return 2.7777777777777776e-7 * (date2.getTime() - date1.getTime()); }, minute: function (date1, date2) { return 0.000016666666666666667 * (date2.getTime() - date1.getTime()); }, second: function (date1, date2) { return 0.001 * (date2.getTime() - date1.getTime()); }, millisecond: function (date1, date2) { return date2.getTime() - date1.getTime(); } }; function differenceTransform(interval, date1, date2, utc) { interval = interval.replace(/s$/, ""); return round(differenceMap[interval](date1, date2, utc)); } return { addTransform: addTransform, differenceTransform: differenceTransform }; }()), addTransform = transforms.addTransform, differenceTransform = transforms.differenceTransform; /** * @ignore * Based on DOJO Date Implementation * * Dojo is available under *either* the terms of the modified BSD license *or* the * Academic Free License version 2.1. As a recipient of Dojo, you may choose which * license to receive this code under (except as noted in per-module LICENSE * files). Some modules may not be the copyright of the Dojo Foundation. These * modules contain explicit declarations of copyright in both the LICENSE files in * the directories in which they reside and in the code itself. No external * contributions are allowed under licenses which are fundamentally incompatible * with the AFL or BSD licenses that Dojo is distributed under. * */ var floor = Math.floor, round = Math.round, min = Math.min, pow = Math.pow, ceil = Math.ceil, abs = Math.abs; var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var monthAbbr = ["Jan.", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."]; var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var dayAbbr = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var eraNames = ["Before Christ", "Anno Domini"]; var eraAbbr = ["BC", "AD"]; function getDayOfYear(/*Date*/dateObject, utc) { // summary: gets the day of the year as represented by dateObject return date.difference(new Date(dateObject.getFullYear(), 0, 1, dateObject.getHours()), dateObject, null, utc) + 1; // Number } function getWeekOfYear(/*Date*/dateObject, /*Number*/firstDayOfWeek, utc) { firstDayOfWeek = firstDayOfWeek || 0; var fullYear = dateObject[utc ? "getUTCFullYear" : "getFullYear"](); var firstDayOfYear = new Date(fullYear, 0, 1).getDay(), adj = (firstDayOfYear - firstDayOfWeek + 7) % 7, week = floor((getDayOfYear(dateObject) + adj - 1) / 7); // if year starts on the specified day, start counting weeks at 1 if (firstDayOfYear === firstDayOfWeek) { week++; } return week; // Number } function getTimezoneName(/*Date*/dateObject) { var str = dateObject.toString(); var tz = ''; var pos = str.indexOf('('); if (pos > -1) { tz = str.substring(++pos, str.indexOf(')')); } return tz; // String } function buildDateEXP(pattern, tokens) { return pattern.replace(/([a-z])\1*/ig,function (match) { // Build a simple regexp. Avoid captures, which would ruin the tokens list var s, c = match.charAt(0), l = match.length, p2 = '0?', p3 = '0{0,2}'; if (c === 'y') { s = '\\d{2,4}'; } else if (c === "M") { s = (l > 2) ? '\\S+?' : '1[0-2]|' + p2 + '[1-9]'; } else if (c === "D") { s = '[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|' + p3 + '[1-9][0-9]|' + p2 + '[1-9]'; } else if (c === "d") { s = '3[01]|[12]\\d|' + p2 + '[1-9]'; } else if (c === "w") { s = '[1-4][0-9]|5[0-3]|' + p2 + '[1-9]'; } else if (c === "E") { s = '\\S+'; } else if (c === "h") { s = '1[0-2]|' + p2 + '[1-9]'; } else if (c === "K") { s = '1[01]|' + p2 + '\\d'; } else if (c === "H") { s = '1\\d|2[0-3]|' + p2 + '\\d'; } else if (c === "k") { s = '1\\d|2[0-4]|' + p2 + '[1-9]'; } else if (c === "m" || c === "s") { s = '[0-5]\\d'; } else if (c === "S") { s = '\\d{' + l + '}'; } else if (c === "a") { var am = 'AM', pm = 'PM'; s = am + '|' + pm; if (am !== am.toLowerCase()) { s += '|' + am.toLowerCase(); } if (pm !== pm.toLowerCase()) { s += '|' + pm.toLowerCase(); } s = s.replace(/\./g, "\\."); } else if (c === 'v' || c === 'z' || c === 'Z' || c === 'G' || c === 'q' || c === 'Q') { s = ".*"; } else { s = c === " " ? "\\s*" : c + "*"; } if (tokens) { tokens.push(match); } return "(" + s + ")"; // add capture }).replace(/[\xa0 ]/g, "[\\s\\xa0]"); // normalize whitespace. Need explicit handling of \xa0 for IE. } /** * @namespace Utilities for Dates */ var date = { /**@lends date*/ /** * Returns the number of days in the month of a date * * @example * * dateExtender.getDaysInMonth(new Date(2006, 1, 1)); //28 * dateExtender.getDaysInMonth(new Date(2004, 1, 1)); //29 * dateExtender.getDaysInMonth(new Date(2006, 2, 1)); //31 * dateExtender.getDaysInMonth(new Date(2006, 3, 1)); //30 * dateExtender.getDaysInMonth(new Date(2006, 4, 1)); //31 * dateExtender.getDaysInMonth(new Date(2006, 5, 1)); //30 * dateExtender.getDaysInMonth(new Date(2006, 6, 1)); //31 * @param {Date} dateObject the date containing the month * @return {Number} the number of days in the month */ getDaysInMonth: function (/*Date*/dateObject) { // summary: // Returns the number of days in the month used by dateObject var month = dateObject.getMonth(); var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (month === 1 && date.isLeapYear(dateObject)) { return 29; } // Number return days[month]; // Number }, /** * Determines if a date is a leap year * * @example * * dateExtender.isLeapYear(new Date(1600, 0, 1)); //true * dateExtender.isLeapYear(new Date(2004, 0, 1)); //true * dateExtender.isLeapYear(new Date(2000, 0, 1)); //true * dateExtender.isLeapYear(new Date(2006, 0, 1)); //false * dateExtender.isLeapYear(new Date(1900, 0, 1)); //false * dateExtender.isLeapYear(new Date(1800, 0, 1)); //false * dateExtender.isLeapYear(new Date(1700, 0, 1)); //false * * @param {Date} dateObject * @returns {Boolean} true if it is a leap year false otherwise */ isLeapYear: function (/*Date*/dateObject, utc) { var year = dateObject[utc ? "getUTCFullYear" : "getFullYear"](); return (year % 400 === 0) || (year % 4 === 0 && year % 100 !== 0); }, /** * Determines if a date is on a weekend * * @example * * var thursday = new Date(2006, 8, 21); * var saturday = new Date(2006, 8, 23); * var sunday = new Date(2006, 8, 24); * var monday = new Date(2006, 8, 25); * dateExtender.isWeekend(thursday)); //false * dateExtender.isWeekend(saturday); //true * dateExtender.isWeekend(sunday); //true * dateExtender.isWeekend(monday)); //false * * @param {Date} dateObject the date to test * * @returns {Boolean} true if the date is a weekend */ isWeekend: function (/*Date?*/dateObject, utc) { // summary: // Determines if the date falls on a weekend, according to local custom. var day = (dateObject || new Date())[utc ? "getUTCDay" : "getDay"](); return day === 0 || day === 6; }, /** * Get the timezone of a date * * @example * //just setting the strLocal to simulate the toString() of a date * dt.str = 'Sun Sep 17 2006 22:25:51 GMT-0500 (CDT)'; * //just setting the strLocal to simulate the locale * dt.strLocale = 'Sun 17 Sep 2006 10:25:51 PM CDT'; * dateExtender.getTimezoneName(dt); //'CDT' * dt.str = 'Sun Sep 17 2006 22:57:18 GMT-0500 (CDT)'; * dt.strLocale = 'Sun Sep 17 22:57:18 2006'; * dateExtender.getTimezoneName(dt); //'CDT' * @param dateObject the date to get the timezone from * * @returns {String} the timezone of the date */ getTimezoneName: getTimezoneName, /** * Compares two dates * * @example * * var d1 = new Date(); * d1.setHours(0); * dateExtender.compare(d1, d1); // 0 * * var d1 = new Date(); * d1.setHours(0); * var d2 = new Date(); * d2.setFullYear(2005); * d2.setHours(12); * dateExtender.compare(d1, d2, "date"); // 1 * dateExtender.compare(d1, d2, "datetime"); // 1 * * var d1 = new Date(); * d1.setHours(0); * var d2 = new Date(); * d2.setFullYear(2005); * d2.setHours(12); * dateExtender.compare(d2, d1, "date"); // -1 * dateExtender.compare(d1, d2, "time"); //-1 * * @param {Date|String} date1 the date to comapare * @param {Date|String} [date2=new Date()] the date to compare date1 againse * @param {"date"|"time"|"datetime"} portion compares the portion specified * * @returns -1 if date1 is < date2 0 if date1 === date2 1 if date1 > date2 */ compare: function (/*Date*/date1, /*Date*/date2, /*String*/portion) { date1 = new Date(+date1); date2 = new Date(+(date2 || new Date())); if (portion === "date") { // Ignore times and compare dates. date1.setHours(0, 0, 0, 0); date2.setHours(0, 0, 0, 0); } else if (portion === "time") { // Ignore dates and compare times. date1.setFullYear(0, 0, 0); date2.setFullYear(0, 0, 0); } return date1 > date2 ? 1 : date1 < date2 ? -1 : 0; }, /** * Adds a specified interval and amount to a date * * @example * var dtA = new Date(2005, 11, 27); * dateExtender.add(dtA, "year", 1); //new Date(2006, 11, 27); * dateExtender.add(dtA, "years", 1); //new Date(2006, 11, 27); * * dtA = new Date(2000, 0, 1); * dateExtender.add(dtA, "quarter", 1); //new Date(2000, 3, 1); * dateExtender.add(dtA, "quarters", 1); //new Date(2000, 3, 1); * * dtA = new Date(2000, 0, 1); * dateExtender.add(dtA, "month", 1); //new Date(2000, 1, 1); * dateExtender.add(dtA, "months", 1); //new Date(2000, 1, 1); * * dtA = new Date(2000, 0, 31); * dateExtender.add(dtA, "month", 1); //new Date(2000, 1, 29); * dateExtender.add(dtA, "months", 1); //new Date(2000, 1, 29); * * dtA = new Date(2000, 0, 1); * dateExtender.add(dtA, "week", 1); //new Date(2000, 0, 8); * dateExtender.add(dtA, "weeks", 1); //new Date(2000, 0, 8); * * dtA = new Date(2000, 0, 1); * dateExtender.add(dtA, "day", 1); //new Date(2000, 0, 2); * * dtA = new Date(2000, 0, 1); * dateExtender.add(dtA, "weekday", 1); //new Date(2000, 0, 3); * * dtA = new Date(2000, 0, 1, 11); * dateExtender.add(dtA, "hour", 1); //new Date(2000, 0, 1, 12); * * dtA = new Date(2000, 11, 31, 23, 59); * dateExtender.add(dtA, "minute", 1); //new Date(2001, 0, 1, 0, 0); * * dtA = new Date(2000, 11, 31, 23, 59, 59); * dateExtender.add(dtA, "second", 1); //new Date(2001, 0, 1, 0, 0, 0); * * dtA = new Date(2000, 11, 31, 23, 59, 59, 999); * dateExtender.add(dtA, "millisecond", 1); //new Date(2001, 0, 1, 0, 0, 0, 0); * * @param {Date} date * @param {String} interval the interval to add *