corrade-nucleus-nucleons
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/abs-ceil.js |
---|
@@ -0,0 +1,7 @@ |
export default function absCeil (number) { |
if (number < 0) { |
return Math.floor(number); |
} else { |
return Math.ceil(number); |
} |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/abs-floor.js |
---|
@@ -0,0 +1,8 @@ |
export default function absFloor (number) { |
if (number < 0) { |
// -0 -> 0 |
return Math.ceil(number) || 0; |
} else { |
return Math.floor(number); |
} |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/abs-round.js |
---|
@@ -0,0 +1,7 @@ |
export default function absRound (number) { |
if (number < 0) { |
return Math.round(-1 * number) * -1; |
} else { |
return Math.round(number); |
} |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/compare-arrays.js |
---|
@@ -0,0 +1,16 @@ |
import toInt from './to-int'; |
// compare two arrays, return the number of differences |
export default function compareArrays(array1, array2, dontConvert) { |
var len = Math.min(array1.length, array2.length), |
lengthDiff = Math.abs(array1.length - array2.length), |
diffs = 0, |
i; |
for (i = 0; i < len; i++) { |
if ((dontConvert && array1[i] !== array2[i]) || |
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { |
diffs++; |
} |
} |
return diffs + lengthDiff; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/defaults.js |
---|
@@ -0,0 +1,10 @@ |
// Pick the first defined of two or three arguments. |
export default function defaults(a, b, c) { |
if (a != null) { |
return a; |
} |
if (b != null) { |
return b; |
} |
return c; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/deprecate.js |
---|
@@ -0,0 +1,55 @@ |
import extend from './extend'; |
import { hooks } from './hooks'; |
import isUndefined from './is-undefined'; |
function warn(msg) { |
if (hooks.suppressDeprecationWarnings === false && |
(typeof console !== 'undefined') && console.warn) { |
console.warn('Deprecation warning: ' + msg); |
} |
} |
export function deprecate(msg, fn) { |
var firstTime = true; |
return extend(function () { |
if (hooks.deprecationHandler != null) { |
hooks.deprecationHandler(null, msg); |
} |
if (firstTime) { |
var args = []; |
var arg; |
for (var i = 0; i < arguments.length; i++) { |
arg = ''; |
if (typeof arguments[i] === 'object') { |
arg += '\n[' + i + '] '; |
for (var key in arguments[0]) { |
arg += key + ': ' + arguments[0][key] + ', '; |
} |
arg = arg.slice(0, -2); // Remove trailing comma and space |
} else { |
arg = arguments[i]; |
} |
args.push(arg); |
} |
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); |
firstTime = false; |
} |
return fn.apply(this, arguments); |
}, fn); |
} |
var deprecations = {}; |
export function deprecateSimple(name, msg) { |
if (hooks.deprecationHandler != null) { |
hooks.deprecationHandler(name, msg); |
} |
if (!deprecations[name]) { |
warn(msg); |
deprecations[name] = true; |
} |
} |
hooks.suppressDeprecationWarnings = false; |
hooks.deprecationHandler = null; |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/extend.js |
---|
@@ -0,0 +1,19 @@ |
import hasOwnProp from './has-own-prop'; |
export default function extend(a, b) { |
for (var i in b) { |
if (hasOwnProp(b, i)) { |
a[i] = b[i]; |
} |
} |
if (hasOwnProp(b, 'toString')) { |
a.toString = b.toString; |
} |
if (hasOwnProp(b, 'valueOf')) { |
a.valueOf = b.valueOf; |
} |
return a; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/has-own-prop.js |
---|
@@ -0,0 +1,3 @@ |
export default function hasOwnProp(a, b) { |
return Object.prototype.hasOwnProperty.call(a, b); |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/hooks.js |
---|
@@ -0,0 +1,13 @@ |
export { hooks, setHookCallback }; |
var hookCallback; |
function hooks () { |
return hookCallback.apply(null, arguments); |
} |
// This is done to register the method called with moment() |
// without creating circular dependencies. |
function setHookCallback (callback) { |
hookCallback = callback; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/index-of.js |
---|
@@ -0,0 +1,18 @@ |
var indexOf; |
if (Array.prototype.indexOf) { |
indexOf = Array.prototype.indexOf; |
} else { |
indexOf = function (o) { |
// I know |
var i; |
for (i = 0; i < this.length; ++i) { |
if (this[i] === o) { |
return i; |
} |
} |
return -1; |
}; |
} |
export { indexOf as default }; |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-array.js |
---|
@@ -0,0 +1,3 @@ |
export default function isArray(input) { |
return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-date.js |
---|
@@ -0,0 +1,3 @@ |
export default function isDate(input) { |
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-function.js |
---|
@@ -0,0 +1,3 @@ |
export default function isFunction(input) { |
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-number.js |
---|
@@ -0,0 +1,3 @@ |
export default function isNumber(input) { |
return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-object-empty.js |
---|
@@ -0,0 +1,8 @@ |
export default function isObjectEmpty(obj) { |
var k; |
for (k in obj) { |
// even if its not own property I'd still call it non-empty |
return false; |
} |
return true; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-object.js |
---|
@@ -0,0 +1,5 @@ |
export default function isObject(input) { |
// IE8 will treat undefined and null as object if it wasn't for |
// input != null |
return input != null && Object.prototype.toString.call(input) === '[object Object]'; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/is-undefined.js |
---|
@@ -0,0 +1,3 @@ |
export default function isUndefined(input) { |
return input === void 0; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/keys.js |
---|
@@ -0,0 +1,19 @@ |
import hasOwnProp from './has-own-prop'; |
var keys; |
if (Object.keys) { |
keys = Object.keys; |
} else { |
keys = function (obj) { |
var i, res = []; |
for (i in obj) { |
if (hasOwnProp(obj, i)) { |
res.push(i); |
} |
} |
return res; |
}; |
} |
export { keys as default }; |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/map.js |
---|
@@ -0,0 +1,7 @@ |
export default function map(arr, fn) { |
var res = [], i; |
for (i = 0; i < arr.length; ++i) { |
res.push(fn(arr[i], i)); |
} |
return res; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/some.js |
---|
@@ -0,0 +1,19 @@ |
var some; |
if (Array.prototype.some) { |
some = Array.prototype.some; |
} else { |
some = function (fun) { |
var t = Object(this); |
var len = t.length >>> 0; |
for (var i = 0; i < len; i++) { |
if (i in t && fun.call(this, t[i], i, t)) { |
return true; |
} |
} |
return false; |
}; |
} |
export { some as default }; |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/to-int.js |
---|
@@ -0,0 +1,12 @@ |
import absFloor from './abs-floor'; |
export default function toInt(argumentForCoercion) { |
var coercedNumber = +argumentForCoercion, |
value = 0; |
if (coercedNumber !== 0 && isFinite(coercedNumber)) { |
value = absFloor(coercedNumber); |
} |
return value; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/utils/zero-fill.js |
---|
@@ -0,0 +1,7 @@ |
export default function zeroFill(number, targetLength, forceSign) { |
var absNumber = '' + Math.abs(number), |
zerosToFill = targetLength - absNumber.length, |
sign = number >= 0; |
return (sign ? (forceSign ? '+' : '') : '-') + |
Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; |
} |