Comparing version 0.6.3 to 0.6.4
971
onix-core.js
@@ -1,970 +0,1 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["onix"] = factory(); | ||
else | ||
root["onix"] = factory(); | ||
})(this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // 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; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // 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 = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 24); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pad = function (str, len, chr, leftJustify) { | ||
var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr); | ||
return leftJustify ? str + padding : padding + str; | ||
}; | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// ===================== Types ======================= | ||
/** @returns object string name (using Object.prototype.toString.call) */ | ||
exports.getType = function (x) { | ||
return Object.prototype.toString.call(x); | ||
}; | ||
/** @returns true if object is number */ | ||
exports.isNumber = function (x) { | ||
return exports.getType(x) === "[object Number]"; | ||
}; | ||
/** @returns true if object is string */ | ||
exports.isString = function (x) { | ||
return exports.getType(x) === "[object String]"; | ||
}; | ||
/** @returns true if object is Date */ | ||
exports.isDate = function (x) { | ||
return exports.getType(x) === "[object Date]"; | ||
}; | ||
/** @returns true if object is function */ | ||
exports.isFunction = function (x) { | ||
return exports.getType(x) === "[object Function]"; | ||
}; | ||
/** @returns true if object is array */ | ||
exports.isArray = function (x) { | ||
return exports.getType(x) === "[object Array]"; | ||
}; | ||
/** @return true if object is empty object */ | ||
exports.isEmptyObject = function (obj) { | ||
var name; | ||
for (name in obj) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.average = function (arr) { | ||
var sum = 0; | ||
for (var i = 0; i < arr.length; i++) { | ||
sum += arr[i]; | ||
} | ||
return sum / arr.length; | ||
}; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.intVal = function (mixed_var, base) { | ||
base = base || 10; | ||
if (typeof mixed_var === "string") { | ||
var tmp = parseInt(mixed_var, base); | ||
if (isNaN(tmp)) { | ||
return 0; | ||
} | ||
else { | ||
return tmp; | ||
} | ||
} | ||
else if (typeof mixed_var === "number") { | ||
return Math.floor(mixed_var); | ||
} | ||
else { | ||
return 0; | ||
} | ||
}; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Pad_1 = __webpack_require__(0); | ||
exports.justify = function (value, prefix, leftJustify, minWidth, zeroPad) { | ||
var diff = minWidth - value.length; | ||
if (diff > 0) { | ||
if (leftJustify || !zeroPad) { | ||
value = Pad_1.pad(value, minWidth, ' ', leftJustify); | ||
} | ||
else { | ||
value = value.slice(0, prefix.length) + Pad_1.pad('', diff, '0', true) + value.slice(prefix.length); | ||
} | ||
} | ||
return value; | ||
}; | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(__webpack_require__(1)); | ||
__export(__webpack_require__(12)); | ||
__export(__webpack_require__(22)); | ||
__export(__webpack_require__(16)); | ||
var Logger_1 = __webpack_require__(7); | ||
exports.Logger = Logger_1.Logger; | ||
var Intl_1 = __webpack_require__(6); | ||
exports.Intl = Intl_1.Intl; | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var defaultLocale = 'ru-ru'; | ||
var currentLocale = defaultLocale; | ||
var categories = {}; | ||
var locale = function (value) { | ||
if (value == "en" || value == "en-us" || value == "en-uk") { | ||
currentLocale = 'en-us'; | ||
} | ||
currentLocale = 'ru-ru'; | ||
return currentLocale; | ||
}; | ||
var register = function (category, strings) { | ||
if (!categories[category]) { | ||
categories[category] = strings; | ||
} | ||
else { | ||
for (var lang in strings) { | ||
categories[category][lang] = strings[lang]; | ||
} | ||
} | ||
}; | ||
var t = function (category, key) { | ||
var result = categories[category][currentLocale][key]; | ||
if (!result) { | ||
result = categories[category][defaultLocale][key]; | ||
} | ||
return result; | ||
}; | ||
var ts = function (category, key) { | ||
var result = categories[category][currentLocale][key]; | ||
if (!result) { | ||
result = categories[category][defaultLocale][key]; | ||
} | ||
return result; | ||
}; | ||
var Intl = (function () { | ||
function Intl() { | ||
} | ||
return Intl; | ||
}()); | ||
Intl.setLocale = locale; | ||
Intl.t = t; | ||
Intl.ts = ts; | ||
Intl.registerStrings = register; | ||
exports.Intl = Intl; | ||
Intl.setLocale(window.navigator.language); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/* WEBPACK VAR INJECTION */(function(process) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var wnd = window; | ||
var FALSE = false; | ||
// some convenient shortcuts. | ||
var aps = Array.prototype.slice; | ||
var con = wnd.console; | ||
var callback_func = null; | ||
var callback_force = FALSE; | ||
// default logging level, none. | ||
var log_level = 9; | ||
if (process.env.NODE_ENV !== 'production') { | ||
log_level = 9; | ||
} | ||
// logging methods, in "priority order". Not all console implementations | ||
// will utilize these, but they will be used in the callback passed to | ||
// setCallback. | ||
var log_methods = ["error", "warn", "info", "debug", "log"]; | ||
// pass these methods through to the console if they exist, otherwise just | ||
// fail gracefully. These methods are provided for convenience. | ||
var pass_methods = "assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" "); | ||
// logs are stored here so that they can be recalled as necessary. | ||
var logs = []; | ||
// determine if the level is visible given the current log_level. | ||
function is_level(level) { | ||
return log_level > 0 | ||
? log_level > level | ||
: log_methods.length + log_level <= level; | ||
} | ||
// execute the callback function if set. | ||
function exec_callback(args) { | ||
if (callback_func && (callback_force || !con || !con.log)) { | ||
callback_func.apply(wnd, args); | ||
} | ||
} | ||
var LoggerClass = (function () { | ||
function LoggerClass() { | ||
var idx = pass_methods.length; | ||
while (--idx >= 0) { | ||
this.callPassThroughMethod(pass_methods[idx]); | ||
} | ||
idx = log_methods.length; | ||
while (--idx >= 0) { | ||
this.setLevelFunctions(idx, log_methods[idx]); | ||
} | ||
} | ||
LoggerClass.prototype.error = function (message) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
}; | ||
LoggerClass.prototype.warn = function (message) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
}; | ||
LoggerClass.prototype.info = function (message) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
}; | ||
LoggerClass.prototype.debug = function (message) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
}; | ||
LoggerClass.prototype.log = function (message) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
}; | ||
LoggerClass.prototype.callPassThroughMethod = function (method) { | ||
// generate pass-through methods. These methods will be called, if they | ||
// exist, as long as the logging level is non-zero. | ||
this[method] = function () { | ||
if (log_level !== 0 && con && con[method]) { | ||
con[method].apply(con, arguments); | ||
} | ||
}; | ||
}; | ||
LoggerClass.prototype.setLevelFunctions = function (idx, level) { | ||
this[level] = function () { | ||
var args = aps.call(arguments); | ||
var log_arr = [level].concat(args); | ||
logs.push(log_arr); | ||
exec_callback(log_arr); | ||
if (!con || !is_level(idx)) { | ||
return; | ||
} | ||
var arg_norm = (args.length === 1) ? args[0] : args; | ||
con.firebug ? con[level].apply(wnd, arg_norm) | ||
: con[level] ? con[level](arg_norm) | ||
: con.log(arg_norm); | ||
}; | ||
}; | ||
LoggerClass.prototype.setCallback = function () { | ||
var args = aps.call(arguments), max = logs.length, i = max; | ||
callback_func = args.shift() || null; | ||
callback_force = typeof args[0] === "boolean" ? args.shift() : FALSE; | ||
i -= typeof args[0] === "number" ? args.shift() : max; | ||
while (i < max) { | ||
exec_callback(logs[i++]); | ||
} | ||
}; | ||
; | ||
// priority levels: | ||
// log (1) < debug (2) < info (3) < warn (4) < error (5) | ||
LoggerClass.prototype.setLevel = function (level) { | ||
log_level = level; | ||
}; | ||
return LoggerClass; | ||
}()); | ||
exports.LoggerClass = LoggerClass; | ||
exports.Logger = new LoggerClass(); | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(23))) | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.grep = function (elems, callback, invert) { | ||
var callbackInverse, matches = []; | ||
var i = 0; | ||
var length = elems.length; | ||
var callbackExpect = !invert; | ||
// Go through the array, only saving the items | ||
// that pass the validator function | ||
for (; i < length; i++) { | ||
callbackInverse = !callback(elems[i], i); | ||
if (callbackInverse !== callbackExpect) { | ||
matches.push(elems[i]); | ||
} | ||
} | ||
return matches; | ||
}; | ||
/***/ }), | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.inArray = function (needle, haystack, strict) { | ||
var found = false; | ||
var key; | ||
var strct = !!strict; | ||
for (key in haystack) { | ||
if ((strct && haystack[key] === needle) || (!strct && haystack[key] == needle)) { | ||
found = true; | ||
break; | ||
} | ||
} | ||
return found; | ||
}; | ||
/***/ }), | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Types_1 = __webpack_require__(1); | ||
exports.indexOf = function (searchElement, arr, fromIndex) { | ||
return ((!Types_1.isArray(arr)) || (arr == null)) ? -1 : arr.indexOf(searchElement, fromIndex); | ||
}; | ||
/***/ }), | ||
/* 11 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pushif = function (a, cond, val) { | ||
if (cond) { | ||
a.push(val); | ||
} | ||
}; | ||
/***/ }), | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var InArray_1 = __webpack_require__(9); | ||
exports.inArray = InArray_1.inArray; | ||
var IndexOf_1 = __webpack_require__(10); | ||
exports.indexOf = IndexOf_1.indexOf; | ||
var Grep_1 = __webpack_require__(8); | ||
exports.grep = Grep_1.grep; | ||
var Pushif_1 = __webpack_require__(11); | ||
exports.pushif = Pushif_1.pushif; | ||
/***/ }), | ||
/* 13 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isValueOutOfRange = function (value, min, max) { | ||
return value < min || value > max; | ||
}; | ||
/***/ }), | ||
/* 14 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Average_1 = __webpack_require__(2); | ||
exports.stdDeviation = function (arr) { | ||
var avg = Average_1.average(arr), sum = 0; | ||
for (var i = 0; i < arr.length; i++) { | ||
sum += Math.pow(arr[i] - avg, 2); | ||
} | ||
return Math.sqrt(sum / (arr.length - 1)); | ||
}; | ||
/***/ }), | ||
/* 15 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensureValueInRange = function (val, min, max) { | ||
if (val <= min) { | ||
return min; | ||
} | ||
if (val >= max) { | ||
return max; | ||
} | ||
return val; | ||
}; | ||
/***/ }), | ||
/* 16 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var IntVal_1 = __webpack_require__(3); | ||
exports.intVal = IntVal_1.intVal; | ||
var IsValueOutOfRange_1 = __webpack_require__(13); | ||
exports.isValueOutOfRange = IsValueOutOfRange_1.isValueOutOfRange; | ||
var ensureValueInRange_1 = __webpack_require__(15); | ||
exports.ensureValueInRange = ensureValueInRange_1.ensureValueInRange; | ||
var Average_1 = __webpack_require__(2); | ||
exports.average = Average_1.average; | ||
var StdDeviation_1 = __webpack_require__(14); | ||
exports.stdDeviation = StdDeviation_1.stdDeviation; | ||
/***/ }), | ||
/* 17 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.capitalize = function (str) { | ||
return "" + str.charAt(0).toUpperCase() + str.slice(1); | ||
}; | ||
/***/ }), | ||
/* 18 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pluralize = function (num, strOne, strTwo, strFive) { | ||
strFive = strFive || strTwo; | ||
if ((strTwo === strFive) && (num > 1)) { | ||
return strTwo; | ||
} | ||
if ((num > 10) && (num < 20)) { | ||
return strFive; | ||
} | ||
var d = num % 10; | ||
if (d === 1) { | ||
return strOne; | ||
} | ||
else if ((d < 5) && (d !== 0)) { | ||
return strTwo; | ||
} | ||
else { | ||
return strFive; | ||
} | ||
}; | ||
/***/ }), | ||
/* 19 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Pad_1 = __webpack_require__(0); | ||
var Justify_1 = __webpack_require__(4); | ||
var IntVal_1 = __webpack_require__(3); | ||
// formatBaseX() | ||
var formatBaseX = function (value, base, prefixBaseX, leftJustify, minWidth, precision, zeroPad) { | ||
// Note: casts negative numbers to positive ones | ||
var number = value >>> 0; | ||
var prefix = prefixBaseX && number && { '2': '0b', '8': '0', '10': '', '16': '0x' }[base] || ''; | ||
var result = prefix + Pad_1.pad(number.toString(base), precision || 0, '0', false); | ||
return Justify_1.justify(result, prefix, leftJustify, minWidth, zeroPad); | ||
}; | ||
// formatString() | ||
var formatString = function (value, leftJustify, minWidth, precision, zeroPad) { | ||
if (precision != null) { | ||
value = value.slice(0, precision); | ||
} | ||
return Justify_1.justify(value, '', leftJustify, minWidth, zeroPad); | ||
}; | ||
exports.sprintf = function (format) { | ||
var a = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
a[_i - 1] = arguments[_i]; | ||
} | ||
var regex = /%%|%(\d+\$)?([-+#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g; | ||
var i = 0; | ||
// finalFormat() | ||
var doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) { | ||
if (substring == '%%') | ||
return '%'; | ||
// parse flags | ||
var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false; | ||
for (var j = 0; flags && j < flags.length; j++) | ||
switch (flags.charAt(j)) { | ||
case ' ': | ||
positivePrefix = ' '; | ||
break; | ||
case '+': | ||
positivePrefix = '+'; | ||
break; | ||
case '-': | ||
leftJustify = true; | ||
break; | ||
case '0': | ||
zeroPad = true; | ||
break; | ||
case '#': | ||
prefixBaseX = true; | ||
break; | ||
} | ||
// parameters may be null, undefined, empty-string or real valued | ||
// we want to ignore null, undefined and empty-string values | ||
if (!minWidth) { | ||
minWidth = 0; | ||
} | ||
else if (minWidth == '*') { | ||
minWidth = +a[i++]; | ||
} | ||
else if (minWidth.charAt(0) == '*') { | ||
minWidth = +a[minWidth.slice(1, -1)]; | ||
} | ||
else { | ||
minWidth = +minWidth; | ||
} | ||
// Note: undocumented perl feature: | ||
if (minWidth < 0) { | ||
minWidth = -minWidth; | ||
leftJustify = true; | ||
} | ||
if (!isFinite(minWidth)) { | ||
throw new Error('sprintf: (minimum-)width must be finite'); | ||
} | ||
if (!precision) { | ||
precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : void (0); | ||
} | ||
else if (precision == '*') { | ||
precision = +a[i++]; | ||
} | ||
else if (precision.charAt(0) == '*') { | ||
precision = +a[precision.slice(1, -1)]; | ||
} | ||
else { | ||
precision = +precision; | ||
} | ||
// grab value using valueIndex if required? | ||
var value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++]; | ||
switch (type) { | ||
case 's': return formatString(String(value), leftJustify, minWidth, precision, zeroPad); | ||
case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad); | ||
case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad); | ||
case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad); | ||
case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad); | ||
case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad).toUpperCase(); | ||
case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad); | ||
case 'i': | ||
case 'd': { | ||
var number = IntVal_1.intVal(+value); | ||
var prefix = number < 0 ? '-' : positivePrefix; | ||
value = prefix + Pad_1.pad(String(Math.abs(number)), precision, '0', false); | ||
return Justify_1.justify(value, prefix, leftJustify, minWidth, zeroPad); | ||
} | ||
case 'e': | ||
case 'E': | ||
case 'f': | ||
case 'F': | ||
case 'g': | ||
case 'G': | ||
{ | ||
var number = +value; | ||
var prefix = number < 0 ? '-' : positivePrefix; | ||
var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())]; | ||
var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2]; | ||
value = prefix + Math.abs(number)[method](precision); | ||
return Justify_1.justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform](); | ||
} | ||
default: return substring; | ||
} | ||
}; | ||
return format.replace(regex, doFormat); | ||
}; | ||
/***/ }), | ||
/* 20 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.strRepeat = function (str, n) { | ||
var result = "", t = str.toString(); | ||
while (--n >= 0) { | ||
result += t; | ||
} | ||
return result; | ||
}; | ||
/***/ }), | ||
/* 21 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.trim = function (value) { | ||
return value.replace(/^\s*/, "").replace(/\s*$/, ""); | ||
}; | ||
/***/ }), | ||
/* 22 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var StrRepeat_1 = __webpack_require__(20); | ||
exports.strRepeat = StrRepeat_1.strRepeat; | ||
var Trim_1 = __webpack_require__(21); | ||
exports.trim = Trim_1.trim; | ||
var Pad_1 = __webpack_require__(0); | ||
exports.pad = Pad_1.pad; | ||
var Justify_1 = __webpack_require__(4); | ||
exports.justify = Justify_1.justify; | ||
var Capitalize_1 = __webpack_require__(17); | ||
exports.capitalize = Capitalize_1.capitalize; | ||
var Pluralize_1 = __webpack_require__(18); | ||
exports.pluralize = Pluralize_1.pluralize; | ||
var Sprintf_1 = __webpack_require__(19); | ||
exports.sprintf = Sprintf_1.sprintf; | ||
/***/ }), | ||
/* 23 */ | ||
/***/ (function(module, exports) { | ||
// shim for using process in browser | ||
var process = module.exports = {}; | ||
// cached from whatever global is present so that test runners that stub it | ||
// don't break things. But we need to wrap it in a try catch in case it is | ||
// wrapped in strict mode code which doesn't define any globals. It's inside a | ||
// function because try/catches deoptimize in certain engines. | ||
var cachedSetTimeout; | ||
var cachedClearTimeout; | ||
function defaultSetTimout() { | ||
throw new Error('setTimeout has not been defined'); | ||
} | ||
function defaultClearTimeout () { | ||
throw new Error('clearTimeout has not been defined'); | ||
} | ||
(function () { | ||
try { | ||
if (typeof setTimeout === 'function') { | ||
cachedSetTimeout = setTimeout; | ||
} else { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
} catch (e) { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
try { | ||
if (typeof clearTimeout === 'function') { | ||
cachedClearTimeout = clearTimeout; | ||
} else { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} catch (e) { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} ()) | ||
function runTimeout(fun) { | ||
if (cachedSetTimeout === setTimeout) { | ||
//normal enviroments in sane situations | ||
return setTimeout(fun, 0); | ||
} | ||
// if setTimeout wasn't available but was latter defined | ||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
cachedSetTimeout = setTimeout; | ||
return setTimeout(fun, 0); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedSetTimeout(fun, 0); | ||
} catch(e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedSetTimeout.call(null, fun, 0); | ||
} catch(e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
return cachedSetTimeout.call(this, fun, 0); | ||
} | ||
} | ||
} | ||
function runClearTimeout(marker) { | ||
if (cachedClearTimeout === clearTimeout) { | ||
//normal enviroments in sane situations | ||
return clearTimeout(marker); | ||
} | ||
// if clearTimeout wasn't available but was latter defined | ||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
cachedClearTimeout = clearTimeout; | ||
return clearTimeout(marker); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedClearTimeout(marker); | ||
} catch (e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedClearTimeout.call(null, marker); | ||
} catch (e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
return cachedClearTimeout.call(this, marker); | ||
} | ||
} | ||
} | ||
var queue = []; | ||
var draining = false; | ||
var currentQueue; | ||
var queueIndex = -1; | ||
function cleanUpNextTick() { | ||
if (!draining || !currentQueue) { | ||
return; | ||
} | ||
draining = false; | ||
if (currentQueue.length) { | ||
queue = currentQueue.concat(queue); | ||
} else { | ||
queueIndex = -1; | ||
} | ||
if (queue.length) { | ||
drainQueue(); | ||
} | ||
} | ||
function drainQueue() { | ||
if (draining) { | ||
return; | ||
} | ||
var timeout = runTimeout(cleanUpNextTick); | ||
draining = true; | ||
var len = queue.length; | ||
while(len) { | ||
currentQueue = queue; | ||
queue = []; | ||
while (++queueIndex < len) { | ||
if (currentQueue) { | ||
currentQueue[queueIndex].run(); | ||
} | ||
} | ||
queueIndex = -1; | ||
len = queue.length; | ||
} | ||
currentQueue = null; | ||
draining = false; | ||
runClearTimeout(timeout); | ||
} | ||
process.nextTick = function (fun) { | ||
var args = new Array(arguments.length - 1); | ||
if (arguments.length > 1) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
args[i - 1] = arguments[i]; | ||
} | ||
} | ||
queue.push(new Item(fun, args)); | ||
if (queue.length === 1 && !draining) { | ||
runTimeout(drainQueue); | ||
} | ||
}; | ||
// v8 likes predictible objects | ||
function Item(fun, array) { | ||
this.fun = fun; | ||
this.array = array; | ||
} | ||
Item.prototype.run = function () { | ||
this.fun.apply(null, this.array); | ||
}; | ||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
function noop() {} | ||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
process.umask = function() { return 0; }; | ||
/***/ }), | ||
/* 24 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(5); | ||
/***/ }) | ||
/******/ ]); | ||
}); | ||
//# sourceMappingURL=onix-core.js.map | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.onix=r():e.onix=r()}(this,function(){return function(e){function __webpack_require__(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,__webpack_require__),n.l=!0,n.exports}var r={};return __webpack_require__.m=e,__webpack_require__.c=r,__webpack_require__.i=function(e){return e},__webpack_require__.d=function(e,r,t){__webpack_require__.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},__webpack_require__.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=23)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pad=function(e,r,t,n){var u=e.length>=r?"":Array(1+r-e.length>>>0).join(t);return n?e+u:u+e}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getType=function(e){return Object.prototype.toString.call(e)},r.isNumber=function(e){return"[object Number]"===r.getType(e)},r.isString=function(e){return"[object String]"===r.getType(e)},r.isDate=function(e){return"[object Date]"===r.getType(e)},r.isFunction=function(e){return"[object Function]"===r.getType(e)},r.isArray=function(e){return"[object Array]"===r.getType(e)},r.isEmptyObject=function(e){var r;for(r in e)return!1;return!0}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.average=function(e){for(var r=0,t=0;t<e.length;t++)r+=e[t];return r/e.length}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.intVal=function(e,r){if(r=r||10,"string"==typeof e){var t=parseInt(e,r);return isNaN(t)?0:t}return"number"==typeof e?Math.floor(e):0}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(0);r.justify=function(e,r,t,u,o){var i=u-e.length;return i>0&&(e=t||!o?n.pad(e,u," ",t):e.slice(0,r.length)+n.pad("",i,"0",!0)+e.slice(r.length)),e}},function(e,r,t){"use strict";function __export(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}Object.defineProperty(r,"__esModule",{value:!0}),__export(t(1)),__export(t(12)),__export(t(22)),__export(t(16));var n=t(7);r.Logger=n.Logger;var u=t(6);r.Intl=u.Intl},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="ru-ru",u={},o=function(e){return"en"!=e&&"en-us"!=e&&"en-uk"!=e||(n="en-us"),n="ru-ru"},i=function(e,r){if(u[e])for(var t in r)u[e][t]=r[t];else u[e]=r},a=function(e,r){var t=u[e][n][r];return t||(t=u[e]["ru-ru"][r]),t},c=function(e,r){var t=u[e][n][r];return t||(t=u[e]["ru-ru"][r]),t},s=function(){function Intl(){}return Intl}();s.setLocale=o,s.t=a,s.ts=c,s.registerStrings=i,r.Intl=s,s.setLocale(window.navigator.language)},function(e,r,t){"use strict";function is_level(e){return c>0?c>e:s.length+c<=e}function exec_callback(e){!i||!a&&o&&o.log||i.apply(n,e)}Object.defineProperty(r,"__esModule",{value:!0});var n=window,u=Array.prototype.slice,o=n.console,i=null,a=!1,c=9,s=["error","warn","info","debug","log"],f="assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" "),l=[],p=function(){function LoggerClass(){for(var e=f.length;--e>=0;)this.callPassThroughMethod(f[e]);for(e=s.length;--e>=0;)this.setLevelFunctions(e,s[e])}return LoggerClass.prototype.error=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t]},LoggerClass.prototype.warn=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t]},LoggerClass.prototype.info=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t]},LoggerClass.prototype.debug=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t]},LoggerClass.prototype.log=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t]},LoggerClass.prototype.callPassThroughMethod=function(e){this[e]=function(){0!==c&&o&&o[e]&&o[e].apply(o,arguments)}},LoggerClass.prototype.setLevelFunctions=function(e,r){this[r]=function(){var t=u.call(arguments),i=[r].concat(t);if(l.push(i),exec_callback(i),o&&is_level(e)){var a=1===t.length?t[0]:t;o.firebug?o[r].apply(n,a):o[r]?o[r](a):o.log(a)}}},LoggerClass.prototype.setCallback=function(){var e=u.call(arguments),r=l.length,t=r;for(i=e.shift()||null,a="boolean"==typeof e[0]&&e.shift(),t-="number"==typeof e[0]?e.shift():r;t<r;)exec_callback(l[t++])},LoggerClass.prototype.setLevel=function(e){c=e},LoggerClass}();r.LoggerClass=p,r.Logger=new p},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.grep=function(e,r,t){for(var n=[],u=0,o=e.length,i=!t;u<o;u++)!r(e[u],u)!==i&&n.push(e[u]);return n}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.inArray=function(e,r,t){var n,u=!1,o=!!t;for(n in r)if(o&&r[n]===e||!o&&r[n]==e){u=!0;break}return u}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(1);r.indexOf=function(e,r,t){return n.isArray(r)&&null!=r?r.indexOf(e,t):-1}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pushif=function(e,r,t){r&&e.push(t)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(9);r.inArray=n.inArray;var u=t(10);r.indexOf=u.indexOf;var o=t(8);r.grep=o.grep;var i=t(11);r.pushif=i.pushif},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isValueOutOfRange=function(e,r,t){return e<r||e>t}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(2);r.stdDeviation=function(e){for(var r=n.average(e),t=0,u=0;u<e.length;u++)t+=Math.pow(e[u]-r,2);return Math.sqrt(t/(e.length-1))}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ensureValueInRange=function(e,r,t){return e<=r?r:e>=t?t:e}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(3);r.intVal=n.intVal;var u=t(13);r.isValueOutOfRange=u.isValueOutOfRange;var o=t(15);r.ensureValueInRange=o.ensureValueInRange;var i=t(2);r.average=i.average;var a=t(14);r.stdDeviation=a.stdDeviation},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.capitalize=function(e){return""+e.charAt(0).toUpperCase()+e.slice(1)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pluralize=function(e,r,t,n){if(n=n||t,t===n&&e>1)return t;if(e>10&&e<20)return n;var u=e%10;return 1===u?r:u<5&&0!==u?t:n}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(0),u=t(4),o=t(3),i=function(e,r,t,o,i,a,c){var s=e>>>0,f=t&&s&&{2:"0b",8:"0",10:"",16:"0x"}[r]||"",l=f+n.pad(s.toString(r),a||0,"0",!1);return u.justify(l,f,o,i,c)},a=function(e,r,t,n,o){return null!=n&&(e=e.slice(0,n)),u.justify(e,"",r,t,o)};r.sprintf=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];var c=0,s=function(e,t,s,f,l,p,_){if("%%"==e)return"%";for(var g=!1,d="",v=!1,b=!1,y=0;s&&y<s.length;y++)switch(s.charAt(y)){case" ":d=" ";break;case"+":d="+";break;case"-":g=!0;break;case"0":v=!0;break;case"#":b=!0}if(f=f?"*"==f?+r[c++]:"*"==f.charAt(0)?+r[f.slice(1,-1)]:+f:0,f<0&&(f=-f,g=!0),!isFinite(f))throw new Error("sprintf: (minimum-)width must be finite");p=p?"*"==p?+r[c++]:"*"==p.charAt(0)?+r[p.slice(1,-1)]:+p:"fFeE".indexOf(_)>-1?6:"d"==_?0:void 0;var h=t?r[t.slice(0,-1)]:r[c++];switch(_){case"s":return a(String(h),g,f,p,v);case"c":return a(String.fromCharCode(+h),g,f,p,v);case"b":return i(h,2,b,g,f,p,v);case"o":return i(h,8,b,g,f,p,v);case"x":return i(h,16,b,g,f,p,v);case"X":return i(h,16,b,g,f,p,v).toUpperCase();case"u":return i(h,10,b,g,f,p,v);case"i":case"d":var j=o.intVal(+h),O=j<0?"-":d;return h=O+n.pad(String(Math.abs(j)),p,"0",!1),u.justify(h,O,g,f,v);case"e":case"E":case"f":case"F":case"g":case"G":var j=+h,O=j<0?"-":d,x=["toExponential","toFixed","toPrecision"]["efg".indexOf(_.toLowerCase())],M=["toString","toUpperCase"]["eEfFgG".indexOf(_)%2];return h=O+Math.abs(j)[x](p),u.justify(h,O,g,f,v)[M]();default:return e}};return e.replace(/%%|%(\d+\$)?([-+#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g,s)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.strRepeat=function(e,r){for(var t="",n=e.toString();--r>=0;)t+=n;return t}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.trim=function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(20);r.strRepeat=n.strRepeat;var u=t(21);r.trim=u.trim;var o=t(0);r.pad=o.pad;var i=t(4);r.justify=i.justify;var a=t(17);r.capitalize=a.capitalize;var c=t(18);r.pluralize=c.pluralize;var s=t(19);r.sprintf=s.sprintf},function(e,r,t){e.exports=t(5)}])}); |
{ | ||
"name": "onix-core", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "Onix library core", | ||
@@ -5,0 +5,0 @@ "main": "built/index.js", |
70933
1040