function(url, prev, done) {
        if (url.indexOf('bootstrap/') === 0) {
          var component = url.substr('bootstrap/'.length+1);
          var file = cmsDir+'/src/scss/bootstrap/_'+component+'.scss';
          try {
            var stats = fs.lstatSync(file);

            if (stats.isFile()) {
              return { file: file };
            }
          } catch (ex) {
            // file does not exist
          }
        }

        return sass.compiler.NULL; // do nothing
      }

function
(
url
,
prev
,
done
)
{
if
(
url
.
indexOf
(
'bootstrap/'
)
===
0
)
{
var
component
=
url
.
substr
(
'bootstrap/'
.
length
+
1
)
;
var
file
=
cmsDir
+
'/src/scss/bootstrap/_'
+
component
+
'.scss'
;
try
{
var
stats
=
fs
.
lstatSync
(
file
)
;
if
(
stats
.
isFile
(
)
)
{
return
{
file
:
file
}
;
}
}
catch
(
ex
)
{
// file does not exist
}
}
return
sass
.
compiler
.
;
// do nothing
}

this is a hack to have some selective components from bootstrap overriden without copying the whole bootstrap.scss with all its @imports

this is a hack to have some selective components from bootstrap overriden without copying the whole bootstrap . scss with all its


function streamToBuffer(stream, cb){ // cb(err, buffer);
    var bufs = [];
    stream.on('data', function(d){
        bufs.push(d);
    })
    .on('end', function(){
        cb(null, Buffer.concat(bufs));
    })
    .on('error', function(err){
        cb(err);
    });
}

function
streamToBuffer
(
stream
,
cb
)
{
// cb(err, buffer);
var
bufs
=
[
]
;
stream
.
on
(
'data'
,
function
(
d
)
{
bufs
.
push
(
d
)
;
}
)
.
on
(
'end'
,
function
(
)
{
cb
(
,
Buffer
.
concat
(
bufs
)
)
;
}
)
.
on
(
'error'
,
function
(
err
)
{
cb
(
err
)
;
}
)
;
}

turn stream into buffer
@param {Object} stream
@param {Function} cb cb(err, buffer)


function Bucks(params) {
        this._tasks = [];
        this._taskcount = 0;
        this._results = [];
        this.callback = none;
        this.failure  = none;
        this._alive = true;
        this._interrupt = false;
        this.__id = uid();
        Bucks.living[this.__id] = this;
        this.initialize(params);
    }

function Bucks ( params ) { this . _tasks = [ ] ; this . _taskcount = 0 ; this . _results = [ ] ; this . callback = none ; this . failure = none ; this . _alive = true ; this . _interrupt = false ; this . __id = uid ( ) ; Bucks . living [ this . __id ] = this ; this . initialize ( params ) ; }

Bucks chain constructor.
@name Bucks
@constructor


function cached(opt) {
  if (typeof opt == 'undefined' || opt === null) opt = {};
  if (typeof opt == 'string') opt = {type:opt};
  if (typeof opt.id != 'string') opt.id = _random_string(8);
  opt = Object.assign({}, getSettings(), opt);
  for (var i in opt) checkSetting(i, opt[i]);

  return function (func, key, descriptor) {
    if (key) func = func[key]; //for ES6 notation

    const f = function (...rest) {
      const _key = _hash(rest, opt.id);
      return cacheObj.get(opt, _key)
              .then(res => {
                if (typeof res == 'undefined' || res === null) {
                  res = _update.bind(this)(opt, func, rest);
                }
                return res;
              });
    }
    f.forceUpdate = function(...rest){
      _update.bind(this, opt, func)(rest)
    }

    if (key) {
      //ES6 notation
      descriptor.value = f;
    } else {
      //vanilla js notation
      return f;
    }
  }
}

function
cached
(
opt
)
{
if
(
typeof
opt
==
'undefined'
||
opt
===
)
opt
=
{
}
;
if
(
typeof
opt
==
'string'
)
opt
=
{
type
:
opt
}
;
if
(
typeof
opt
.
id
!=
'string'
)
opt
.
id
=
_random_string
(
8
)
;
opt
=
Object
.
assign
(
{
}
,
getSettings
(
)
,
opt
)
;
for
(
var
i
in
opt
)
checkSetting
(
i
,
opt
[
i
]
)
;
return
function
(
func
,
key
,
descriptor
)
{
if
(
key
)
func
=
func
[
key
]
;
//for ES6 notation
const
f
=
function
(
...
rest
)
{
const
_key
=
_hash
(
rest
,
opt
.
id
)
;
return
cacheObj
.
get
(
opt
,
_key
)
.
then
(
res
=>
{
if
(
typeof
res
==
'undefined'
||
res
===
)
{
res
=
_update
.
bind
(
this
)
(
opt
,
func
,
rest
)
;
}
return
res
;
}
)
;
}
f
.
forceUpdate
=
function
(
...
rest
)
{
_update
.
bind
(
this
,
opt
,
func
)
(
rest
)
}
if
(
key
)
{
//ES6 notation
descriptor
.
value
=
f
;
}
else
{
//vanilla js notation
return
f
;
}
}
}

opt.type opt.id opt.tardy opt.tardy_timeout

opt . type opt . id opt . tardy opt . tardy_timeout


function (...rest) {
      const _key = _hash(rest, opt.id);
      return cacheObj.get(opt, _key)
              .then(res => {
                if (typeof res == 'undefined' || res === null) {
                  res = _update.bind(this)(opt, func, rest);
                }
                return res;
              });
    }

function ( ... rest ) { const _key = _hash ( rest , opt . id ) ; return cacheObj . get ( opt , _key ) . then ( res => { if ( typeof res == 'undefined' || res === null ) { res = _update . bind ( this ) ( opt , func , rest ) ; } return res ; } ) ; }


function getChain(storage, name) {
    if (storage[GET_CHAIN_METHOD]) {
        return storage[GET_CHAIN_METHOD](name);
    }
    var chain = Object.assign({}, storage[name]);
    chain['$chainId'] = (0, _Util.generateUUID)();
    return Object.assign({}, chain);
}

function getChain ( storage , name ) { if ( storage [ GET_CHAIN_METHOD ] ) { return storage [ GET_CHAIN_METHOD ] ( name ) ; } var chain = Object . assign ( { } , storage [ name ] ) ; chain [ '$chainId' ] = ( 0 , _Util . generateUUID ) ( ) ; return Object . assign ( { } , chain ) ; }

Gets the chain instance from storage
@param storage
@param name


function getChainDataById(storage, chainId) {
    if (storage[GET_CHAIN_METHOD]) {
        return storage[GET_CHAIN_METHOD](chainId);
    }
    return storage[chainId];
}

function getChainDataById ( storage , chainId ) { if ( storage [ GET_CHAIN_METHOD ] ) { return storage [ GET_CHAIN_METHOD ] ( chainId ) ; } return storage [ chainId ] ; }

Gets the chain data from storage by chain id
@param storage
@param chainId


function getChainContext(storage, chainId, field) {
    if (storage[GET_CHAIN_CONTEXT_METHOD]) {
        return storage[GET_CHAIN_CONTEXT_METHOD](chainId, field);
    }
    if (storage[chainId]) {
        return storage[chainId][field];
    }
}

function getChainContext ( storage , chainId , field ) { if ( storage [ GET_CHAIN_CONTEXT_METHOD ] ) { return storage [ GET_CHAIN_CONTEXT_METHOD ] ( chainId , field ) ; } if ( storage [ chainId ] ) { return storage [ chainId ] [ field ] ; } }

Gets the chain context value from storage
@param storage
@param chainId
@param field
@returns {*}


function create(props) {
    var multiButton = Object.create(this);

    _canvasWidget2.default.create.call(multiButton);

    Object.assign(multiButton, MultiButton.defaults, props);

    if (props.value) {
      multiButton.__value = props.value;
    } else {
      multiButton.__value = [];
      for (var i = 0; i < multiButton.count; i++) {
        multiButton.__value[i] = 0;
      }multiButton.value = [];
    }

    multiButton.active = {};
    multiButton.__prevValue = [];

    multiButton.init();

    return multiButton;
  }

function create ( props ) { var multiButton = Object . create ( this ) ; _canvasWidget2 . default . create . call ( multiButton ) ; Object . assign ( multiButton , MultiButton . defaults , props ) ; if ( props . value ) { multiButton . __value = props . value ; } else { multiButton . __value = [ ] ; for ( var i = 0 ; i < multiButton . count ; i ++ ) { multiButton . __value [ i ] = 0 ; } multiButton . value = [ ] ; } multiButton . active = { } ; multiButton . __prevValue = [ ] ; multiButton . init ( ) ; return multiButton ; }

Create a new MultiButton instance.
@memberof MultiButton
@constructs
@param {Object} [props] - A dictionary of properties to initialize a MultiButton instance with.
@static


function mkSprite(srcFiles, destImage, options, callback) {

		options.src = srcFiles,

		grunt.verbose.writeln('Options passed to Spritesmth:', JSON.stringify(options));

		spritesmith(options, function(err, result) {
			// If an error occurred, callback with it
			if (err) {
				grunt.fatal(err);
				return;
			}

			// Otherwise, write out the result to destImg
			var destDir = path.dirname(destImage);
			grunt.file.mkdir(destDir);
			fs.writeFileSync(destImage, result.image, 'binary');

			grunt.log.writeln(destImage, 'created.');

			callback(result.coordinates);
		});
	}

Create an image from `srcFiles`, with name `destImage`, and pass coordinates to callback.

Create an image from srcFiles with name destImage and pass coordinates to callback .


function hasPath(object, path, hasFunc) {
	  path = isKey$1(path, object) ? [path] : castPath$1(path);

	  var result,
	      index = -1,
	      length = path.length;

	  while (++index < length) {
	    var key = toKey$1(path[index]);
	    if (!(result = object != null && hasFunc(object, key))) {
	      break;
	    }
	    object = object[key];
	  }
	  if (result) {
	    return result;
	  }
	  var length = object ? object.length : 0;
	  return !!length && isLength(length) && isIndex(key, length) &&
	    (isArray$1(object) || isArguments(object));
	}

function hasPath ( object , path , hasFunc ) { path = isKey$1 ( path , object ) ? [ path ] : castPath$1 ( path ) ; var result , index = - 1 , length = path . length ; while ( ++ index < length ) { var key = toKey$1 ( path [ index ] ) ; if ( ! ( result = object != null && hasFunc ( object , key ) ) ) { break ; } object = object [ key ] ; } if ( result ) { return result ; } var length = object ? object . length : 0 ; return ! ! length && isLength ( length ) && isIndex ( key , length ) && ( isArray$1 ( object ) || isArguments ( object ) ) ; }

Checks if `path` exists on `object`.

@private
@param {Object} object The object to query.
@param {Array|string} path The path to check.
@param {Function} hasFunc The function to check properties.
@returns {boolean} Returns `true` if `path` exists, else `false`.


function baseSet(object, path, value, customizer) {
	  if (!isObject$2(object)) {
	    return object;
	  }
	  path = isKey$2(path, object) ? [path] : castPath$2(path);

	  var index = -1,
	      length = path.length,
	      lastIndex = length - 1,
	      nested = object;

	  while (nested != null && ++index < length) {
	    var key = toKey$2(path[index]),
	        newValue = value;

	    if (index != lastIndex) {
	      var objValue = nested[key];
	      newValue = customizer ? customizer(objValue, key, nested) : undefined;
	      if (newValue === undefined) {
	        newValue = isObject$2(objValue)
	          ? objValue
	          : (isIndex$1(path[index + 1]) ? [] : {});
	      }
	    }
	    assignValue(nested, key, newValue);
	    nested = nested[key];
	  }
	  return object;
	}

function baseSet ( object , path , value , customizer ) { if ( ! isObject$2 ( object ) ) { return object ; } path = isKey$2 ( path , object ) ? [ path ] : castPath$2 ( path ) ; var index = - 1 , length = path . length , lastIndex = length - 1 , nested = object ; while ( nested != null && ++ index < length ) { var key = toKey$2 ( path [ index ] ) , newValue = value ; if ( index != lastIndex ) { var objValue = nested [ key ] ; newValue = customizer ? customizer ( objValue , key , nested ) : undefined ; if ( newValue === undefined ) { newValue = isObject$2 ( objValue ) ? objValue : ( isIndex$1 ( path [ index + 1 ] ) ? [ ] : { } ) ; } } assignValue ( nested , key , newValue ) ; nested = nested [ key ] ; } return object ; }

The base implementation of `_.set`.

@private
@param {Object} object The object to modify.
@param {Array|string} path The path of the property to set.
@param {*} value The value to set.
@param {Function} [customizer] The function to customize path creation.
@returns {Object} Returns `object`.


function mixin(ctor, methods) {
	    var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };
	    Object.keys(methods).forEach(keyCopier);
	    Object.getOwnPropertySymbols &&
	      Object.getOwnPropertySymbols(methods).forEach(keyCopier);
	    return ctor;
	  }

function mixin ( ctor , methods ) { var keyCopier = function ( key ) { ctor . prototype [ key ] = methods [ key ] ; } ; Object . keys ( methods ) . forEach ( keyCopier ) ; Object . getOwnPropertySymbols && Object . getOwnPropertySymbols ( methods ) . forEach ( keyCopier ) ; return ctor ; }

Contributes additional methods to a constructor


function isString(value) {
	  return typeof value == 'string' ||
	    (!isArray$3(value) && isObjectLike$4(value) && objectToString$4.call(value) == stringTag);
	}

function isString ( value ) { return typeof value == 'string' || ( ! isArray$3 ( value ) && isObjectLike$4 ( value ) && objectToString$4 . call ( value ) == stringTag ) ; }

Checks if `value` is classified as a `String` primitive or object.

@static
@memberOf _
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
@example

_.isString('abc');
// => true

_.isString(1);
// => false

Checks if value is classified as a String primitive or object .


function arrayIncludes(array, value) {
	  var length = array ? array.length : 0;
	  return !!length && baseIndexOf(array, value, 0) > -1;
	}

function arrayIncludes ( array , value ) { var length = array ? array . length : 0 ; return ! ! length && baseIndexOf ( array , value , 0 ) > - 1 ; }

A specialized version of `_.includes` for arrays without support for
specifying an index to search from.

@private
@param {Array} [array] The array to inspect.
@param {*} target The value to search for.
@returns {boolean} Returns `true` if `target` is found, else `false`.

A specialized version of _ . includes for arrays without support for specifying an index to search from .


function baseIndexOf(array, value, fromIndex) {
	  if (value !== value) {
	    return baseFindIndex(array, baseIsNaN, fromIndex);
	  }
	  var index = fromIndex - 1,
	      length = array.length;

	  while (++index < length) {
	    if (array[index] === value) {
	      return index;
	    }
	  }
	  return -1;
	}

function baseIndexOf ( array , value , fromIndex ) { if ( value !== value ) { return baseFindIndex ( array , baseIsNaN , fromIndex ) ; } var index = fromIndex - 1 , length = array . length ; while ( ++ index < length ) { if ( array [ index ] === value ) { return index ; } } return - 1 ; }

The base implementation of `_.indexOf` without `fromIndex` bounds checks.

@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@returns {number} Returns the index of the matched value, else `-1`.

The base implementation of _ . indexOf without fromIndex bounds checks .


function countHolders(array, placeholder) {
	  var length = array.length,
	      result = 0;

	  while (length--) {
	    if (array[length] === placeholder) {
	      result++;
	    }
	  }
	  return result;
	}

function countHolders ( array , placeholder ) { var length = array . length , result = 0 ; while ( length -- ) { if ( array [ length ] === placeholder ) { result ++ ; } } return result ; }

Gets the number of `placeholder` occurrences in `array`.

@private
@param {Array} array The array to inspect.
@param {*} placeholder The placeholder to search for.
@returns {number} Returns the placeholder count.

Gets the number of placeholder occurrences in array .


function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
	  var isCurry = bitmask & CURRY_FLAG,
	      newHolders = isCurry ? holders : undefined,
	      newHoldersRight = isCurry ? undefined : holders,
	      newPartials = isCurry ? partials : undefined,
	      newPartialsRight = isCurry ? undefined : partials;

	  bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
	  bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);

	  if (!(bitmask & CURRY_BOUND_FLAG)) {
	    bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
	  }

	  var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity);
	  result.placeholder = placeholder;
	  return setWrapToString(result, func, bitmask);
	}

function createRecurry ( func , bitmask , wrapFunc , placeholder , thisArg , partials , holders , argPos , ary , arity ) { var isCurry = bitmask & CURRY_FLAG , newHolders = isCurry ? holders : undefined , newHoldersRight = isCurry ? undefined : holders , newPartials = isCurry ? partials : undefined , newPartialsRight = isCurry ? undefined : partials ; bitmask |= ( isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG ) ; bitmask &= ~ ( isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG ) ; if ( ! ( bitmask & CURRY_BOUND_FLAG ) ) { bitmask &= ~ ( BIND_FLAG | BIND_KEY_FLAG ) ; } var result = wrapFunc ( func , bitmask , thisArg , newPartials , newHolders , newPartialsRight , newHoldersRight , argPos , ary , arity ) ; result . placeholder = placeholder ; return setWrapToString ( result , func , bitmask ) ; }

Creates a function that wraps `func` to continue currying.

@private
@param {Function} func The function to wrap.
@param {number} bitmask The bitmask flags. See `createWrap` for more details.
@param {Function} wrapFunc The function to create the `func` wrapper.
@param {*} placeholder The placeholder value.
@param {*} [thisArg] The `this` binding of `func`.
@param {Array} [partials] The arguments to prepend to those provided to
the new function.
@param {Array} [holders] The `partials` placeholder indexes.
@param {Array} [argPos] The argument positions of the new function.
@param {number} [ary] The arity cap of `func`.
@param {number} [arity] The arity of `func`.
@returns {Function} Returns the new wrapped function.

Creates a function that wraps func to continue currying .


function insertWrapDetails(source, details) {
	  var length = details.length,
	      lastIndex = length - 1;

	  details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
	  details = details.join(length > 2 ? ', ' : ' ');
	  return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
	}

function
insertWrapDetails
(
source
,
details
)
{
var
length
=
details
.
length
,
lastIndex
=
length
1
;
details
[
lastIndex
]
=
(
length
>
1
'& '
:
''
)
+
details
[
lastIndex
]
;
details
=
details
.
join
(
length
>
2
', '
:
' '
)
;
return
source
.
replace
(
reWrapComment
,
'{\n/* [wrapped with '
+
details
+
'] */\n'
)
;
}

Inserts wrapper `details` in a comment at the top of the `source` body.

@private
@param {string} source The source to modify.
@returns {Array} details The details to insert.
@returns {string} Returns the modified source.

Inserts wrapper details in a comment at the top of the source body .


function toFinite(value) {
	  if (!value) {
	    return value === 0 ? value : 0;
	  }
	  value = toNumber(value);
	  if (value === INFINITY$3 || value === -INFINITY$3) {
	    var sign = (value < 0 ? -1 : 1);
	    return sign * MAX_INTEGER;
	  }
	  return value === value ? value : 0;
	}

function toFinite ( value ) { if ( ! value ) { return value === 0 ? value : 0 ; } value = toNumber ( value ) ; if ( value === INFINITY$3 || value === - INFINITY$3 ) { var sign = ( value < 0 ? - 1 : 1 ) ; return sign * MAX_INTEGER ; } return value === value ? value : 0 ; }

Converts `value` to a finite number.

@static
@memberOf _
@since 4.12.0
@category Lang
@param {*} value The value to convert.
@returns {number} Returns the converted number.
@example

_.toFinite(3.2);
// => 3.2

_.toFinite(Number.MIN_VALUE);
// => 5e-324

_.toFinite(Infinity);
// => 1.7976931348623157e+308

_.toFinite('3.2');
// => 3.2


function toNumber(value) {
	  if (typeof value == 'number') {
	    return value;
	  }
	  if (isSymbol$3(value)) {
	    return NAN;
	  }
	  if (isObject$4(value)) {
	    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
	    value = isObject$4(other) ? (other + '') : other;
	  }
	  if (typeof value != 'string') {
	    return value === 0 ? value : +value;
	  }
	  value = value.replace(reTrim, '');
	  var isBinary = reIsBinary.test(value);
	  return (isBinary || reIsOctal.test(value))
	    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
	    : (reIsBadHex.test(value) ? NAN : +value);
	}

function toNumber ( value ) { if ( typeof value == 'number' ) { return value ; } if ( isSymbol$3 ( value ) ) { return NAN ; } if ( isObject$4 ( value ) ) { var other = typeof value . valueOf == 'function' ? value . valueOf ( ) : value ; value = isObject$4 ( other ) ? ( other + '' ) : other ; } if ( typeof value != 'string' ) { return value === 0 ? value : + value ; } value = value . replace ( reTrim , '' ) ; var isBinary = reIsBinary . test ( value ) ; return ( isBinary || reIsOctal . test ( value ) ) ? freeParseInt ( value . slice ( 2 ) , isBinary ? 2 : 8 ) : ( reIsBadHex . test ( value ) ? NAN : + value ) ; }

Converts `value` to a number.

@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to process.
@returns {number} Returns the number.
@example

_.toNumber(3.2);
// => 3.2

_.toNumber(Number.MIN_VALUE);
// => 5e-324

_.toNumber(Infinity);
// => Infinity

_.toNumber('3.2');
// => 3.2


function arrayLikeKeys(value, inherited) {
	  // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
	  // Safari 9 makes `arguments.length` enumerable in strict mode.
	  var result = (isArray$4(value) || isArguments$1(value))
	    ? baseTimes(value.length, String)
	    : [];

	  var length = result.length,
	      skipIndexes = !!length;

	  for (var key in value) {
	    if ((inherited || hasOwnProperty$6.call(value, key)) &&
	        !(skipIndexes && (key == 'length' || isIndex$3(key, length)))) {
	      result.push(key);
	    }
	  }
	  return result;
	}

Creates an array of the enumerable property names of the array-like `value`.

@private
@param {*} value The value to query.
@param {boolean} inherited Specify returning inherited property names.
@returns {Array} Returns the array of property names.

Creates an array of the enumerable property names of the array - like value .


function assignInDefaults(objValue, srcValue, key, object) {
	  if (objValue === undefined ||
	      (eq$3(objValue, objectProto$7[key]) && !hasOwnProperty$6.call(object, key))) {
	    return srcValue;
	  }
	  return objValue;
	}

function assignInDefaults ( objValue , srcValue , key , object ) { if ( objValue === undefined || ( eq$3 ( objValue , objectProto$7 [ key ] ) && ! hasOwnProperty$6 . call ( object , key ) ) ) { return srcValue ; } return objValue ; }

Used by `_.defaults` to customize its `_.assignIn` use.

@private
@param {*} objValue The destination value.
@param {*} srcValue The source value.
@param {string} key The key of the property to assign.
@param {Object} object The parent object of `objValue`.
@returns {*} Returns the value to assign.

Used by _ . defaults to customize its _ . assignIn use .


function baseRest(func, start) {
	  start = nativeMax$1(start === undefined ? (func.length - 1) : start, 0);
	  return function() {
	    var args = arguments,
	        index = -1,
	        length = nativeMax$1(args.length - start, 0),
	        array = Array(length);

	    while (++index < length) {
	      array[index] = args[start + index];
	    }
	    index = -1;
	    var otherArgs = Array(start + 1);
	    while (++index < start) {
	      otherArgs[index] = args[index];
	    }
	    otherArgs[start] = array;
	    return apply$1(func, this, otherArgs);
	  };
	}

function baseRest ( func , start ) { start = nativeMax$1 ( start === undefined ? ( func . length - 1 ) : start , 0 ) ; return function ( ) { var args = arguments , index = - 1 , length = nativeMax$1 ( args . length - start , 0 ) , array = Array ( length ) ; while ( ++ index < length ) { array [ index ] = args [ start + index ] ; } index = - 1 ; var otherArgs = Array ( start + 1 ) ; while ( ++ index < start ) { otherArgs [ index ] = args [ index ] ; } otherArgs [ start ] = array ; return apply$1 ( func , this , otherArgs ) ; } ; }

The base implementation of `_.rest` which doesn't validate or coerce arguments.

@private
@param {Function} func The function to apply a rest parameter to.
@param {number} [start=func.length-1] The start position of the rest parameter.
@returns {Function} Returns the new function.

The base implementation of _ . rest which doesn t validate or coerce arguments .


function isIndex$3(value, length) {
	  length = length == null ? MAX_SAFE_INTEGER$3 : length;
	  return !!length &&
	    (typeof value == 'number' || reIsUint$3.test(value)) &&
	    (value > -1 && value % 1 == 0 && value < length);
	}

function isIndex$3 ( value , length ) { length = length == null ? MAX_SAFE_INTEGER$3 : length ; return ! ! length && ( typeof value == 'number' || reIsUint$3 . test ( value ) ) && ( value > - 1 && value % 1 == 0 && value < length ) ; }

Checks if `value` is a valid array-like index.

@private
@param {*} value The value to check.
@param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
@returns {boolean} Returns `true` if `value` is a valid index, else `false`.

Checks if value is a valid array - like index .


function isIterateeCall(value, index, object) {
	  if (!isObject$5(object)) {
	    return false;
	  }
	  var type = typeof index;
	  if (type == 'number'
	        ? (isArrayLike$1(object) && isIndex$3(index, object.length))
	        : (type == 'string' && index in object)
	      ) {
	    return eq$3(object[index], value);
	  }
	  return false;
	}

function isIterateeCall ( value , index , object ) { if ( ! isObject$5 ( object ) ) { return false ; } var type = typeof index ; if ( type == 'number' ? ( isArrayLike$1 ( object ) && isIndex$3 ( index , object . length ) ) : ( type == 'string' && index in object ) ) { return eq$3 ( object [ index ] , value ) ; } return false ; }

Checks if the given arguments are from an iteratee call.

@private
@param {*} value The potential iteratee value argument.
@param {*} index The potential iteratee index or key argument.
@param {*} object The potential iteratee object argument.
@returns {boolean} Returns `true` if the arguments are from an iteratee call,
else `false`.

Checks if the given arguments are from an iteratee call .


function getRawTag$1(value) {
	  var isOwn = hasOwnProperty$7.call(value, symToStringTag$1),
	      tag = value[symToStringTag$1];

	  try {
	    value[symToStringTag$1] = undefined;
	  } catch (e) {}

	  var result = nativeObjectToString$1.call(value);
	  {
	    if (isOwn) {
	      value[symToStringTag$1] = tag;
	    } else {
	      delete value[symToStringTag$1];
	    }
	  }
	  return result;
	}

function getRawTag$1 ( value ) { var isOwn = hasOwnProperty$7 . call ( value , symToStringTag$1 ) , tag = value [ symToStringTag$1 ] ; try { value [ symToStringTag$1 ] = undefined ; } catch ( e ) { } var result = nativeObjectToString$1 . call ( value ) ; { if ( isOwn ) { value [ symToStringTag$1 ] = tag ; } else { delete value [ symToStringTag$1 ] ; } } return result ; }

A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.

@private
@param {*} value The value to query.
@returns {string} Returns the raw `toStringTag`.

A specialized version of baseGetTag which ignores Symbol . toStringTag values .


function baseGetTag$1(value) {
	  if (value == null) {
	    return value === undefined ? undefinedTag$1 : nullTag$1;
	  }
	  return (symToStringTag$2 && symToStringTag$2 in Object(value))
	    ? _getRawTag(value)
	    : _objectToString(value);
	}

function baseGetTag$1 ( value ) { if ( value == null ) { return value === undefined ? undefinedTag$1 : nullTag$1 ; } return ( symToStringTag$2 && symToStringTag$2 in Object ( value ) ) ? _getRawTag ( value ) : _objectToString ( value ) ; }

The base implementation of `getTag` without fallbacks for buggy environments.

@private
@param {*} value The value to query.
@returns {string} Returns the `toStringTag`.

The base implementation of getTag without fallbacks for buggy environments .


function hashDelete$3(key) {
	  var result = this.has(key) && delete this.__data__[key];
	  this.size -= result ? 1 : 0;
	  return result;
	}

function hashDelete$3 ( key ) { var result = this . has ( key ) && delete this . __data__ [ key ] ; this . size -= result ? 1 : 0 ; return result ; }

Removes `key` and its value from the hash.

@private
@name delete
@memberOf Hash
@param {Object} hash The hash to modify.
@param {string} key The key of the value to remove.
@returns {boolean} Returns `true` if the entry was removed, else `false`.

Removes key and its value from the hash .


function mapCacheSet$3(key, value) {
	  var data = _getMapData(this, key),
	      size = data.size;

	  data.set(key, value);
	  this.size += data.size == size ? 0 : 1;
	  return this;
	}

function mapCacheSet$3 ( key , value ) { var data = _getMapData ( this , key ) , size = data . size ; data . set ( key , value ) ; this . size += data . size == size ? 0 : 1 ; return this ; }

Sets the map `key` to `value`.

@private
@name set
@memberOf MapCache
@param {string} key The key of the value to set.
@param {*} value The value to set.
@returns {Object} Returns the map cache instance.


function castPath$3(value, object) {
	  if (isArray_1(value)) {
	    return value;
	  }
	  return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
	}

function castPath$3 ( value , object ) { if ( isArray_1 ( value ) ) { return value ; } return _isKey ( value , object ) ? [ value ] : _stringToPath ( toString_1 ( value ) ) ; }

Casts `value` to a path array if it's not one.

@private
@param {*} value The value to inspect.
@param {Object} [object] The object to query keys on.
@returns {Array} Returns the cast property path array.

Casts value to a path array if it s not one .


function get$2(object, path, defaultValue) {
	  var result = object == null ? undefined : _baseGet(object, path);
	  return result === undefined ? defaultValue : result;
	}

function get$2 ( object , path , defaultValue ) { var result = object == null ? undefined : _baseGet ( object , path ) ; return result === undefined ? defaultValue : result ; }

Gets the value at `path` of `object`. If the resolved value is
`undefined`, the `defaultValue` is returned in its place.

@static
@memberOf _
@since 3.7.0
@category Object
@param {Object} object The object to query.
@param {Array|string} path The path of the property to get.
@param {*} [defaultValue] The value returned for `undefined` resolved values.
@returns {*} Returns the resolved value.
@example

var object = { 'a': [{ 'b': { 'c': 3 } }] };

_.get(object, 'a[0].b.c');
// => 3

_.get(object, ['a', '0', 'b', 'c']);
// => 3

_.get(object, 'a.b.c', 'default');
// => 'default'

Gets the value at path of object . If the resolved value is undefined the defaultValue is returned in its place .


function(savePath, consolidate, useDotNotation, filePrefix, consolidateAll) {
        this.savePath = savePath || '';
        this.consolidate = consolidate === jasmine.undefined ? true : consolidate;
        this.consolidateAll = consolidateAll === jasmine.undefined ? false : consolidateAll;
        this.useDotNotation = useDotNotation === jasmine.undefined ? true : useDotNotation;
        this.filePrefix = filePrefix || (this.consolidateAll ? 'junitresults' : 'TEST-');
    }

function ( savePath , consolidate , useDotNotation , filePrefix , consolidateAll ) { this . savePath = savePath || '' ; this . consolidate = consolidate === jasmine . undefined ? true : consolidate ; this . consolidateAll = consolidateAll === jasmine . undefined ? false : consolidateAll ; this . useDotNotation = useDotNotation === jasmine . undefined ? true : useDotNotation ; this . filePrefix = filePrefix || ( this . consolidateAll ? 'junitresults' : 'TEST-' ) ; }

Generates JUnit XML for the given spec run.
Allows the test results to be used in java based CI
systems like CruiseControl and Hudson.

@param {string} [savePath] where to save the files
@param {boolean} [consolidate] whether to save nested describes within the
same file as their parent; default: true
@param {boolean} [useDotNotation] whether to separate suite names with
dots rather than spaces (ie "Class.init" not
"Class init"); default: true
@param {string} [filePrefix] is the string value that is prepended to the
xml output file; default: 'TEST-'
@param {boolean} [consolidateAll] whether to save test results from different
specs all in a single file; filePrefix is then the whole file
name without extension; default: false

Generates JUnit XML for the given spec run . Allows the test results to be used in java based CI systems like CruiseControl and Hudson .


function attachLibraryToSelf () {
            for(var i in libs)
                if(libs.hasOwnProperty(i) && !self[i]) self[i] = libs[i];
            return self;
        }

function attachLibraryToSelf ( ) { for ( var i in libs ) if ( libs . hasOwnProperty ( i ) && ! self [ i ] ) self [ i ] = libs [ i ] ; return self ; }

Appends all the library functions to this instance for static use.
@return {ProtoLib} The current ProtoLib instance

Appends all the library functions to this instance for static use .


function applyLibraryToPrototypes () {
            if(!attached) {
                Object.defineProperty(Object.prototype, handle, {
                    configurable : true,
                    enumerable   : false,
                    // Allow users to overwrite the handle on a per instance basis...
                    set: function (v) {
                        if(this[handle] !== v) {
                            Object.defineProperty(this, handle, {
                                configurable : true,
                                enumerable   : true,
                                writable     : true,
                                value        : v
                            });
                        }
                    },
                    // Returns the libp library...
                    get: function () {
                        var ccId,
                            proto = getProto(this),
                            cId   = proto.constructor.__get_protolib_id__,
                            lib   = {},
                            i     = 0,
                            last  = null,
                            m;

                        currentThis = this;

                        do {
                            ccId = proto.constructor.__get_protolib_id__;
                            if(cached[ccId] && i === 0) {
                                return cached[ccId];
                            }
                            else if(cached[ccId]) {
                                for(m in cached[ccId])
                                    if(cached[ccId].hasOwnProperty(m)) lib[m] = cached[ccId][m];

                                if(!inheritanceChain[cId]) inheritanceChain[cId] = [];
                                inheritanceChain[cId] = inheritanceChain[ccId].concat(inheritanceChain[cId]);
                                cached[cId] = lib;
                                return lib;
                            }
                            else {
                                if(!libp[ccId]) libp[ccId] = {};
                                for(m in libp[ccId])
                                    if(libp[ccId].hasOwnProperty(m)) lib[m] = libp[ccId][m];

                                    if(!inheritanceChain[ccId]) inheritanceChain[ccId] = [];
                                    inheritanceChain[cId].unshift(ccId);

                                cached[cId] = lib;
                                last = ccId;
                            }

                            ++i;
                        }
                        while (proto = getProto(proto)); // jshint ignore:line

                        lib.__protolib_cId__ = cId;
                        return lib;
                    }
                });
                attached = true;
            }
            return self;
        }

Adds the library methods from the primitive object prototypes.
@return {ProtoLib} The current ProtoLib instance

Adds the library methods from the primitive object prototypes .


function (v) {
                        if(this[handle] !== v) {
                            Object.defineProperty(this, handle, {
                                configurable : true,
                                enumerable   : true,
                                writable     : true,
                                value        : v
                            });
                        }
                    }

function ( v ) { if ( this [ handle ] !== v ) { Object . defineProperty ( this , handle , { configurable : true , enumerable : true , writable : true , value : v } ) ; } }

Allow users to overwrite the handle on a per instance basis...

Allow users to overwrite the handle on a per instance basis ...


function () {
                        var ccId,
                            proto = getProto(this),
                            cId   = proto.constructor.__get_protolib_id__,
                            lib   = {},
                            i     = 0,
                            last  = null,
                            m;

                        currentThis = this;

                        do {
                            ccId = proto.constructor.__get_protolib_id__;
                            if(cached[ccId] && i === 0) {
                                return cached[ccId];
                            }
                            else if(cached[ccId]) {
                                for(m in cached[ccId])
                                    if(cached[ccId].hasOwnProperty(m)) lib[m] = cached[ccId][m];

                                if(!inheritanceChain[cId]) inheritanceChain[cId] = [];
                                inheritanceChain[cId] = inheritanceChain[ccId].concat(inheritanceChain[cId]);
                                cached[cId] = lib;
                                return lib;
                            }
                            else {
                                if(!libp[ccId]) libp[ccId] = {};
                                for(m in libp[ccId])
                                    if(libp[ccId].hasOwnProperty(m)) lib[m] = libp[ccId][m];

                                    if(!inheritanceChain[ccId]) inheritanceChain[ccId] = [];
                                    inheritanceChain[cId].unshift(ccId);

                                cached[cId] = lib;
                                last = ccId;
                            }

                            ++i;
                        }
                        while (proto = getProto(proto)); // jshint ignore:line

                        lib.__protolib_cId__ = cId;
                        return lib;
                    }

function
(
)
{
var
ccId
,
proto
=
getProto
(
this
)
,
cId
=
proto
.
constructor
.
__get_protolib_id__
,
lib
=
{
}
,
i
=
0
,
last
=
,
m
;
currentThis
=
this
;
do
{
ccId
=
proto
.
constructor
.
__get_protolib_id__
;
if
(
cached
[
ccId
]
&&
i
===
0
)
{
return
cached
[
ccId
]
;
}
else
if
(
cached
[
ccId
]
)
{
for
(
m
in
cached
[
ccId
]
)
if
(
cached
[
ccId
]
.
hasOwnProperty
(
m
)
)
lib
[
m
]
=
cached
[
ccId
]
[
m
]
;
if
(
!
inheritanceChain
[
cId
]
)
inheritanceChain
[
cId
]
=
[
]
;
inheritanceChain
[
cId
]
=
inheritanceChain
[
ccId
]
.
concat
(
inheritanceChain
[
cId
]
)
;
cached
[
cId
]
=
lib
;
return
lib
;
}
else
{
if
(
!
libp
[
ccId
]
)
libp
[
ccId
]
=
{
}
;
for
(
m
in
libp
[
ccId
]
)
if
(
libp
[
ccId
]
.
hasOwnProperty
(
m
)
)
lib
[
m
]
=
libp
[
ccId
]
[
m
]
;
if
(
!
inheritanceChain
[
ccId
]
)
inheritanceChain
[
ccId
]
=
[
]
;
inheritanceChain
[
cId
]
.
unshift
(
ccId
)
;
cached
[
cId
]
=
lib
;
last
=
ccId
;
}
++
i
;
}
while
(
proto
=
getProto
(
proto
)
)
;
// jshint ignore:line
lib
.
__protolib_cId__
=
cId
;
return
lib
;
}


function removeLibraryFromPrototypes () {
            Object.defineProperty(Object.prototype, handle, { value: undefined });
            delete Object.prototype[handle];
            attached = false;
            return self;
        }

function removeLibraryFromPrototypes ( ) { Object . defineProperty ( Object . prototype , handle , { value : undefined } ) ; delete Object . prototype [ handle ] ; attached = false ; return self ; }

Removes the library methods from the primitive object prototypes.
@return {ProtoLib} The current ProtoLib instance

Removes the library methods from the primitive object prototypes .


function getThisValueAndInvoke (callback) {
            return callback(currentThis !== undefined && currentThis !== null ?
                (typeof currentThis === 'object' ? currentThis : currentThis.valueOf()) : currentThis
            );
        }

function getThisValueAndInvoke ( callback ) { return callback ( currentThis !== undefined && currentThis !== null ? ( typeof currentThis === 'object' ? currentThis : currentThis . valueOf ( ) ) : currentThis ) ; }

Retrieves the last item from the 'thisPointerStack' and invokes the provided callback with it.
@param {Function} callback The callback to be invoked with the current 'this' value.
@return The result of the invocation of the callback.

Retrieves the last item from the thisPointerStack and invokes the provided callback with it .


function create(props) {
    var button = Object.create(this);

    _canvasWidget2.default.create.call(button);

    Object.assign(button, Button.defaults, props);

    if (props.value) button.__value = props.value;

    button.init();

    return button;
  }

function create ( props ) { var button = Object . create ( this ) ; _canvasWidget2 . default . create . call ( button ) ; Object . assign ( button , Button . defaults , props ) ; if ( props . value ) button . __value = props . value ; button . init ( ) ; return button ; }

Create a new Button instance.
@memberof Button
@constructs
@param {Object} [props] - A dictionary of properties to initialize a Button instance with.
@static


function bindProperty(o, parent, prop) {
            Object.defineProperty(o, prop, {
                get: function () {
                    try { return parent[prop]; } catch (e) {}
                },
                set: function (val) {
                    try { parent[prop] = val; } catch(e) {}
                },
                configurable: true
            });
        }

function bindProperty ( o , parent , prop ) { Object . defineProperty ( o , prop , { get : function ( ) { try { return parent [ prop ] ; } catch ( e ) { } } , set : function ( val ) { try { parent [ prop ] = val ; } catch ( e ) { } } , configurable : true } ) ; }

Used in Object.setPrototypeOf polyfill only

Used in Object . setPrototypeOf polyfill only


function getKeys (o) {
            switch(typeof o) {
                case 'object':
                    return o ? Object.keys(o) : [];

                case 'string':
                    var keys = [];
                    for(var i = 0; i < o.length; i++) keys.push(i.toString());
                    return keys;

                default:
                    return [];
            }
        }

function getKeys ( o ) { switch ( typeof o ) { case 'object' : return o ? Object . keys ( o ) : [ ] ; case 'string' : var keys = [ ] ; for ( var i = 0 ; i < o . length ; i ++ ) keys . push ( i . toString ( ) ) ; return keys ; default : return [ ] ; } }

IE doesn't allow Object.keys on primitive types...
@return {Array<String|Number>}

IE doesn t allow Object . keys on primitive types ...


function camelize () {
                    var ret = [];
                    libs.object.every(arguments, function (s) {
                        if(s) {
                            if(typeof s === 'function') s = fixFirefoxFunctionString(s.toString());
                            s = s.toString().replace(/[^a-z0-9$]/gi, '_').replace(/\$(\w)/g, '$_$1').split(/[\s_]+/g);
                            libs.object.each(s, 1, s.length, function (i, k) {
                                this[k] = libs.string.ucFirst(i);
                            });
                            s = libs.string.lcFirst(s.join(''));
                        }
                        ret.push(s);
                    });
                    return ret.length === 1 ? ret[0] : ret;
                }

function camelize ( ) { var ret = [ ] ; libs . object . every ( arguments , function ( s ) { if ( s ) { if ( typeof s === 'function' ) s = fixFirefoxFunctionString ( s . toString ( ) ) ; s = s . toString ( ) . replace ( / [^a-z0-9$] / gi , '_' ) . replace ( / \$(\w) / g , '$_$1' ) . split ( / [\s_]+ / g ) ; libs . object . each ( s , 1 , s . length , function ( i , k ) { this [ k ] = libs . string . ucFirst ( i ) ; } ) ; s = libs . string . lcFirst ( s . join ( '' ) ) ; } ret . push ( s ) ; } ) ; return ret . length === 1 ? ret [ 0 ] : ret ; }

Camelizes all of the provided string arguments.
@param {...String} string A list of strings to camelize.
@return {Array<String>} An array of the provided arguments, with all strings camelized.

Camelizes all of the provided string arguments .


function decamelize () {
                    var ret = [];
                    libs.object.every(arguments, function (s) {
                        if(s) {
                            if(typeof s === 'function') s = fixFirefoxFunctionString(s.toString());
                            s = s.toString().replace(/([A-Z$])/g, function ($) {
                                return ' ' + (typeof $ === 'string' ? $.toLowerCase() : '');
                            }).replace(/function \(\)/g, 'function()');
                        }
                        ret.push(typeof s === 'string' ? s.trim() : s);
                    });
                    return ret.length === 1 ? ret[0] : ret;
                }

function
decamelize
(
)
{
var
ret
=
[
]
;
libs
.
object
.
every
(
arguments
,
function
(
s
)
{
if
(
s
)
{
if
(
typeof
s
===
'function'
)
s
=
fixFirefoxFunctionString
(
s
.
toString
(
)
)
;
s
=
s
.
toString
(
)
.
replace
(
/
([A-Z$])
/
g
,
function
(
$
)
{
return
' '
+
(
typeof
$
===
'string'
$
.
toLowerCase
(
)
:
''
)
;
}
)
.
replace
(
/
function \(\)
/
g
,
'function()'
)
;
}
ret
.
push
(
typeof
s
===
'string'
s
.
trim
(
)
:
s
)
;
}
)
;
return
ret
.
length
===
1
ret
[
0
]
:
ret
;
}

Decamelizes all of the provided string arguments.
@param {...String} string A list of strings to decamelize.
@return {Array<String>} An array of the provided arguments, with all strings decamelized.

Decamelizes all of the provided string arguments .


function differenceFromString (s, other) {
                    if(typeof other !== 'string' || typeof s !== 'string') return s;
                    var sarr = s.split(''), oarr = other.split('');
                    return libs.array.difference(sarr, oarr).join('');
                }

function differenceFromString ( s , other ) { if ( typeof other !== 'string' || typeof s !== 'string' ) return s ; var sarr = s . split ( '' ) , oarr = other . split ( '' ) ; return libs . array . difference ( sarr , oarr ) . join ( '' ) ; }

Returns all the characters found in one string but not the other.
@param {String} s The string to operate on.
@param {String} other The string to compute the difference against.
@return {String} A difference string.

Returns all the characters found in one string but not the other .


function intersectString (s, other) {
                    if(typeof other !== 'string' || typeof s !== 'string') return s;
                    var sarr = s.split(''), oarr = other.split('');
                    return libs.array.intersect(sarr, oarr).join('');
                }

function intersectString ( s , other ) { if ( typeof other !== 'string' || typeof s !== 'string' ) return s ; var sarr = s . split ( '' ) , oarr = other . split ( '' ) ; return libs . array . intersect ( sarr , oarr ) . join ( '' ) ; }

Returns only the characters common to both strings
@param {String} s The string to operate on.
@param {String} other The string to compute the intersection against.
@return {String} The intersection between the two strings.


function repeat (s, times) {
                    times = parseInt(times, 10);
                    times = isNaN(times) || !isFinite(times) || times <= 0 ? 1 : times;

                    var os = s;
                    for(var i = 1; i < times; i++) s += os;
                    return s;
                }

function repeat ( s , times ) { times = parseInt ( times , 10 ) ; times = isNaN ( times ) || ! isFinite ( times ) || times <= 0 ? 1 : times ; var os = s ; for ( var i = 1 ; i < times ; i ++ ) s += os ; return s ; }

Repeat a string 'times' times.
@param {String} s The string to operate on.
@param {Number} times The number of times to repeat the string
@return {String} The repeated string.


function rtrim (s, what) {
                    what = typeof what === 'string' ? what : '\\s+';
                    return s.replace(new RegExp(what + '$'), '');
                }

function rtrim ( s , what ) { what = typeof what === 'string' ? what : '\\s+' ; return s . replace ( new RegExp ( what + '$' ) , '' ) ; }

Right trims a string. Same as String.trim, but only for the end of a string.
@param {String} s The string to operate on.
@param {String} [what='\\s+'] What to trim.
@return {String} The right trimmed string

Right trims a string . Same as String . trim but only for the end of a string .


function ltrim (s, what) {
                    what = typeof what === 'string' ? what : '\\s+';
                    return s.replace(new RegExp('^' + what), '');
                }

function ltrim ( s , what ) { what = typeof what === 'string' ? what : '\\s+' ; return s . replace ( new RegExp ( '^' + what ) , '' ) ; }

Left trims a string. Same as String.trim, but only for the beginning of a string.
@param {String} s The string to operate on.
@param {String} [what='\\s+'] What to trim.
@return {String} The left trimmed string

Left trims a string . Same as String . trim but only for the beginning of a string .


function titleCase (s) {
                    var arr = [];
                    libs.object.each(s.split(' '), function (t) { arr.push(libs.string.ucFirst(t)); });
                    return arr.join(' ');
                }

function
titleCase
(
s
)
{
var
arr
=
[
]
;
libs
.
object
.
each
(
s
.
split
(
' '
)
,
function
(
t
)
{
arr
.
push
(
libs
.
string
.
ucFirst
(
t
)
)
;
}
)
;
return
arr
.
join
(
' '
)
;
}

Returns a string in Title Case.
@param {String} s The string to operate on.
@return {String} The title cased string.
@function


function splice (s, index, count, add) {
                    return s.slice(0, index) + (add || '') + s.slice(index + count);
                }

function splice ( s , index , count , add ) { return s . slice ( 0 , index ) + ( add || '' ) + s . slice ( index + count ) ; }

Splices a string, much like an array.
@param {String} s The string to operate on.
@param {Number} index The index to begin splicing the string at
@param {Number} count The number of characters to delete
@param {String} add The string to append at the spliced section
@return {String} The spliced string.
@function


function ellipses_ (s, length, place, ellipses) {
                    if(isNaN(parseInt(length, 10))) length = s.length;
                    if(length < 0 || !isFinite(length)) length = 0;

                    ellipses = typeof ellipses === 'string' ? ellipses : '...';
                    if(s.length <= length) return s;

                    if(length <= ellipses.length) {
                        return ellipses.substring(0, length);
                    }
                    else if(!place || place !== 'front') {
                        return s.substr(0, length - ellipses.length) + ellipses;
                    }
                    else {
                        return ellipses + s.substr(0, length - ellipses.length);
                    }
                }

function ellipses_ ( s , length , place , ellipses ) { if ( isNaN ( parseInt ( length , 10 ) ) ) length = s . length ; if ( length < 0 || ! isFinite ( length ) ) length = 0 ; ellipses = typeof ellipses === 'string' ? ellipses : '...' ; if ( s . length <= length ) return s ; if ( length <= ellipses . length ) { return ellipses . substring ( 0 , length ) ; } else if ( ! place || place !== 'front' ) { return s . substr ( 0 , length - ellipses . length ) + ellipses ; } else { return ellipses + s . substr ( 0 , length - ellipses . length ) ; } }

Return a truncated string with ellipses.
@param {String} s The string to operate on.
@param {Number=} length The length of the desired string. If ommited, the strings original length will be used.
@param {String=} [place='back'] Possible values are 'front' and 'back'. Specifying 'front' will truncate the
string and add ellipses to the front, 'back' (or any other value) will add the ellipses to the back.
@param {String=} [ellipses='...'] The string value of the ellipses. Use this to add anything other than '...'
@returns {String} A truncated string with ellipses (if its length is greater than 'length')
@function

Return a truncated string with ellipses .


function shuffle (s, splitter) {
                    var a = s.split(typeof splitter === 'string' ? splitter : ''), n = a.length,
                    replaceSplits = n - 1;

                    for(var i = n - 1; i > 0; i--) {
                        var j = Math.floor(Math.random() * (i + 1)),
                            tmp = a[i];

                        a[i] = a[j];
                        a[j] = tmp;
                    }

                    for(var k = 0; k < replaceSplits; k++) a.splice(libs.number.randomIntInRange(0, a.length), 0, splitter);
                    return a.join('');
                }

function shuffle ( s , splitter ) { var a = s . split ( typeof splitter === 'string' ? splitter : '' ) , n = a . length , replaceSplits = n - 1 ; for ( var i = n - 1 ; i > 0 ; i -- ) { var j = Math . floor ( Math . random ( ) * ( i + 1 ) ) , tmp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = tmp ; } for ( var k = 0 ; k < replaceSplits ; k ++ ) a . splice ( libs . number . randomIntInRange ( 0 , a . length ) , 0 , splitter ) ; return a . join ( '' ) ; }

Shuffles a string
@param {String} s The string to operate on.
@param {String} splitter A string used to split the string, to tokenize it before shuffling.
@return {String} The mixed up string.


function reverse (s) {
                    if(s.length < 64) {
                        var str = '';
                        for(var i = s.length; i >= 0; i--) str += s.charAt(i);
                        return str;
                    }
                    else {
                        return s.split('').reverse().join('');
                    }
                }

function reverse ( s ) { if ( s . length < 64 ) { var str = '' ; for ( var i = s . length ; i >= 0 ; i -- ) str += s . charAt ( i ) ; return str ; } else { return s . split ( '' ) . reverse ( ) . join ( '' ) ; } }

Reverses a string.
@param {String} s The string to operate on.
@return {String} The reversed string.


function withoutTrailingSlash (s) {
                    if(!IS_BROWSER && HAS_OS && require('os').platform === 'win32') return s.replace(/\\+$/, '');
                    return s.replace(/\/+$/, '');
                }

function withoutTrailingSlash ( s ) { if ( ! IS_BROWSER && HAS_OS && require ( 'os' ) . platform === 'win32' ) return s . replace ( / \\+$ / , '' ) ; return s . replace ( / \/+$ / , '' ) ; }

Strips the trailing slashes from a string.
@param {String} s The string to operate on.
If using Node.js, it will replace the trailing slash based on the value of os.platform
(i.e. if windows, '\\' will be replaced, '/' otherwise).
@returns {String} The string without a trailing slash.
@function

Strips the trailing slashes from a string .


function pad (s, length, delim, pre) {
                    var i, thisLength = s.length;

                    if(!delim) delim = ' ';
                    if(length === 0) return ''; else if(isNaN(parseInt(length, 10))) return s;

                    length = parseInt(length, 10);
                    if(length < thisLength) return !pre ? s.slice(0, length) : s.slice(-length);

                    if(pre) {
                        for(i = 0; i < length - thisLength; i++) s = delim + s;
                    }
                    else {
                        for(i = 0; i < length - thisLength; i++) s += delim;
                    }
                    return s;
                }

function
pad
(
s
,
length
,
delim
,
pre
)
{
var
i
,
thisLength
=
s
.
length
;
if
(
!
delim
)
delim
=
' '
;
if
(
length
===
0
)
return
''
;
else
if
(
isNaN
(
parseInt
(
length
,
10
)
)
)
return
s
;
length
=
parseInt
(
length
,
10
)
;
if
(
length
<
thisLength
)
return
!
pre
s
.
slice
(
0
,
length
)
:
s
.
slice
(
length
)
;
if
(
pre
)
{
for
(
i
=
0
;
i
<
length
thisLength
;
i
++
)
s
=
delim
+
s
;
}
else
{
for
(
i
=
0
;
i
<
length
thisLength
;
i
++
)
s
+=
delim
;
}
return
s
;
}

Pads a string with 'delim' characters to the specified length. If the length is less than the string length,
the string will be truncated.
@param {String} s The string to operate on.
@param {Number} length The length to pad the string to. If less that the length of the string, the string will
be returned. If less than the length of the string, the string will be sliced.
@param {String=} [delim=' '] The character to pad the string with.
@param {Boolean=} [pre=false] If true, the padding will be added to the beginning of the string, otherwise the padding
will be added to the end.
@returns {String} The padded string
@function

Pads a string with delim characters to the specified length . If the length is less than the string length the string will be truncated .


function wordWrapToLength (s, width, padleft, padright, omitFirst) {
                    if(padright === undefined && padleft) padright = padleft;

                    padleft  = !isNaN(parseInt(padleft,  10)) ? parseInt(padleft, 10)  : 0;
                    padright = !isNaN(parseInt(padright, 10)) ? parseInt(padright, 10) : 0;

                    var paddingLeft = '';
                    for(var n = 0; n < padleft;  n++) paddingLeft  += ' ';

                    var cols   = !isNaN(parseInt(width, 10)) ? length : 120,
                        arr    = s.split(' '),
                        item   = null,
                        len    = !omitFirst ? cols - padright - padleft : cols - padright,
                        str    = !omitFirst ? paddingLeft : '',
                        olen   = cols - padright - padleft;

                    while((item = arr.shift()) !== undefined) {
                        if(item.length < len) {
                            str += item + ' ';
                            len -= item.length + 1;
                        }
                        else if(item.length > olen) {
                            str += item.substring(0, len - 1) + '-\n' + paddingLeft;
                            arr.unshift(item.substring(len, item.length - 1));
                            len = cols - padright - padleft;
                        }
                        else {
                            str += '\n' + paddingLeft + item + ' ';
                            len = cols - padright - 1 - padleft - item.length;
                        }
                    }
                    return str;
                }

function
wordWrapToLength
(
s
,
width
,
padleft
,
padright
,
omitFirst
)
{
if
(
padright
===
undefined
&&
padleft
)
padright
=
padleft
;
padleft
=
!
isNaN
(
parseInt
(
padleft
,
10
)
)
parseInt
(
padleft
,
10
)
:
0
;
padright
=
!
isNaN
(
parseInt
(
padright
,
10
)
)
parseInt
(
padright
,
10
)
:
0
;
var
paddingLeft
=
''
;
for
(
var
n
=
0
;
n
<
padleft
;
n
++
)
paddingLeft
+=
' '
;
var
cols
=
!
isNaN
(
parseInt
(
width
,
10
)
)
length
:
120
,
arr
=
s
.
split
(
' '
)
,
item
=
,
len
=
!
omitFirst
cols
padright
padleft
:
cols
padright
,
str
=
!
omitFirst
paddingLeft
:
''
,
olen
=
cols
padright
padleft
;
while
(
(
item
=
arr
.
shift
(
)
)
!==
undefined
)
{
if
(
item
.
length
<
len
)
{
str
+=
item
+
' '
;
len
-=
item
.
length
+
1
;
}
else
if
(
item
.
length
>
olen
)
{
str
+=
item
.
substring
(
0
,
len
1
)
+
'-\n'
+
paddingLeft
;
arr
.
unshift
(
item
.
substring
(
len
,
item
.
length
1
)
)
;
len
=
cols
padright
padleft
;
}
else
{
str
+=
'\n'
+
paddingLeft
+
item
+
' '
;
len
=
cols
padright
1
padleft
item
.
length
;
}
}
return
str
;
}

Adjusts a string to fit within the confines of 'width', without breaking words.
@param {String} s The string to operate on.
@param {Number=} [length=120] The length to word wrap the string to.
@param {Number=} [padleft=0] The number of columns to pad the string on the left
@param {Number=} [padright=0] The number of columns to pad the string on the right
@param {Boolean=} omitFirst If true, the first line will not be padded left
@return {String} The string adjusted and padded for the stdout.
@function

Adjusts a string to fit within the confines of width without breaking words .


function advanceDays (d, daysInTheFuture, adjustForWeekend) {
                    if(!(d instanceof Date)) return d;
                    daysInTheFuture = daysInTheFuture && libs.generic.isNumeric(daysInTheFuture) ? daysInTheFuture : 1;
                    d.setTime(d.getTime() + (daysInTheFuture * 86400000));

                    if(adjustForWeekend && (d.getDay() === 0 || d.getDay() === 6)) {
                        while(d.getDay() === 0 || d.getDay() === 6) d.setTime(d.getTime() + 86400000);
                    }
                    return d;
                }

function advanceDays ( d , daysInTheFuture , adjustForWeekend ) { if ( ! ( d instanceof Date ) ) return d ; daysInTheFuture = daysInTheFuture && libs . generic . isNumeric ( daysInTheFuture ) ? daysInTheFuture : 1 ; d . setTime ( d . getTime ( ) + ( daysInTheFuture * 86400000 ) ) ; if ( adjustForWeekend && ( d . getDay ( ) === 0 || d . getDay ( ) === 6 ) ) { while ( d . getDay ( ) === 0 || d . getDay ( ) === 6 ) d . setTime ( d . getTime ( ) + 86400000 ) ; } return d ; }

Moves a date forward 'daysInTheFuture' days.
@param {Date} The date object to operate on.
@param {Number} daysInTheFuture The number of days in the future to advance the date
@param {Boolean=} [adjustForWeekend=false] Whether or not the date should fall on a weekend day
@returns {Date} The date, adjusted the number of specified days.
@function

Moves a date forward daysInTheFuture days .


function advanceMonths (d, monthsInTheFuture, adjustForWeekend) {
                    if(!(d instanceof Date)) return d;
                    monthsInTheFuture = monthsInTheFuture && libs.generic.isNumeric(monthsInTheFuture) ? monthsInTheFuture : 1;
                    d.setTime(d.getTime() + (monthsInTheFuture * 2629746000));

                    if(adjustForWeekend && (d.getDay() === 0 || d.getDay() === 6)) {
                        while(d.getDay() === 0 || d.getDay() === 6) d.setTime(d.getTime() + 86400000);
                    }
                    return d;
                }

function advanceMonths ( d , monthsInTheFuture , adjustForWeekend ) { if ( ! ( d instanceof Date ) ) return d ; monthsInTheFuture = monthsInTheFuture && libs . generic . isNumeric ( monthsInTheFuture ) ? monthsInTheFuture : 1 ; d . setTime ( d . getTime ( ) + ( monthsInTheFuture * 2629746000 ) ) ; if ( adjustForWeekend && ( d . getDay ( ) === 0 || d . getDay ( ) === 6 ) ) { while ( d . getDay ( ) === 0 || d . getDay ( ) === 6 ) d . setTime ( d . getTime ( ) + 86400000 ) ; } return d ; }

Moves a date forward 'monthsInTheFuture' months.
@param {Date} The date object to operate on.
@param {Number} monthsInTheFuture The number of months in the future to advance the date
@param {Boolean=} [adjustForWeekend=false] Whether or not the date should fall on a weekend day
@returns {Date} The date, adjusted the number of specified months.
@function

Moves a date forward monthsInTheFuture months .


function advanceYears (d, yearsInTheFuture, adjustForWeekend) {
                    if(!(d instanceof Date)) return d;
                    yearsInTheFuture = yearsInTheFuture && libs.generic.isNumeric(yearsInTheFuture) ? yearsInTheFuture : 1;
                    d.setTime(d.getTime() + (yearsInTheFuture * 31536000000));

                    if(adjustForWeekend && (d.getDay() === 0 || d.getDay() === 6)) {
                        while(d.getDay() === 0 || d.getDay() === 6) d.setTime(d.getTime() + 86400000);
                    }
                    return d;
                }

function advanceYears ( d , yearsInTheFuture , adjustForWeekend ) { if ( ! ( d instanceof Date ) ) return d ; yearsInTheFuture = yearsInTheFuture && libs . generic . isNumeric ( yearsInTheFuture ) ? yearsInTheFuture : 1 ; d . setTime ( d . getTime ( ) + ( yearsInTheFuture * 31536000000 ) ) ; if ( adjustForWeekend && ( d . getDay ( ) === 0 || d . getDay ( ) === 6 ) ) { while ( d . getDay ( ) === 0 || d . getDay ( ) === 6 ) d . setTime ( d . getTime ( ) + 86400000 ) ; } return d ; }

Moves a date forward 'yearsInTheFuture' years.
@param {Date} The date object to operate on.
@param {Number} yearsInTheFuture The number of years in the future to advance the date
@param {Boolean=} [adjustForWeekend=false] Whether or not the date should fall on a weekend day
@returns {Date} The date, adjusted the number of specified years.
@function

Moves a date forward yearsInTheFuture years .


function yyyymmdd (d, delim) {
                    if(!(d instanceof Date)) return d;
                    delim = typeof delim !== 'string' ? '-' : delim ;

                    var dd   = d.getDate(),
                        mm   = d.getMonth() + 1,
                        yyyy = d.getFullYear();

                    if(dd < 10) dd = '0' + dd;
                    if(mm < 10) mm = '0' + mm;
                    return yyyy + delim + mm + delim + dd;
                }

function yyyymmdd ( d , delim ) { if ( ! ( d instanceof Date ) ) return d ; delim = typeof delim !== 'string' ? '-' : delim ; var dd = d . getDate ( ) , mm = d . getMonth ( ) + 1 , yyyy = d . getFullYear ( ) ; if ( dd < 10 ) dd = '0' + dd ; if ( mm < 10 ) mm = '0' + mm ; return yyyy + delim + mm + delim + dd ; }

Returns the date in the yyyy-mm-dd format.
@param {Date} The date object to operate on.
@param {String} [delim='-'] The delimiter to used the separate the date components (e.g. '-' or '.')
@returns {String} The date in the yyyy-mm-dd format.
@function

Returns the date in the yyyy - mm - dd format .


function (n, placeholder) {
                    if(n === undefined || n === null || !libs.object.isNumeric(n)) return n;
                    placeholder = typeof placeholder === 'string' ? placeholder : '.';
                    var rest, idx, int, ns = n.toString(), neg = n < 0;

                    idx  = ns.indexOf('.');
                    int  = parseInt(Math.abs(n), 10).toString();

                    if(idx > -1) rest = '.' + ns.substring(idx + 1, ns.length);
                    return (neg ? '-' : '') + libs.string.reverse(libs.string.reverse(int).replace(/(\d{3})(?!$)/g, '$1,')) + (rest || '');
                }

function ( n , placeholder ) { if ( n === undefined || n === null || ! libs . object . isNumeric ( n ) ) return n ; placeholder = typeof placeholder === 'string' ? placeholder : '.' ; var rest , idx , int , ns = n . toString ( ) , neg = n < 0 ; idx = ns . indexOf ( '.' ) ; int = parseInt ( Math . abs ( n ) , 10 ) . toString ( ) ; if ( idx > - 1 ) rest = '.' + ns . substring ( idx + 1 , ns . length ) ; return ( neg ? '-' : '' ) + libs . string . reverse ( libs . string . reverse ( int ) . replace ( / (\d{3})(?!$) / g , '$1,' ) ) + ( rest || '' ) ; }

Returns the string representation of a number, with placeholders added.
@param {Number} n The number to add the placeholders to.
@param {String=} [placeholder=','] Typically the comma (,). The string that seperates the thousanths place.
@return {String} The number formatted with placeholders.

Returns the string representation of a number with placeholders added .


function (n, symbol) {
                    if(n === undefined || n === null || !libs.object.isNumeric(n)) return n;
                    n = libs.object.getNumeric(n).toFixed(2);
                    symbol = typeof symbol === 'string' ? symbol : '$';

                    return n.replace(/^(-)?(\d+)\.(\d+)$/, function ($0, $1, $2, $3) {
                        $1 = $2 === '0' && $3 === '00' ? null : $1;
                        return ($1 || '') + symbol + libs.number.withPlaceholders($2) + '.' + $3;
                    });
                }

function ( n , symbol ) { if ( n === undefined || n === null || ! libs . object . isNumeric ( n ) ) return n ; n = libs . object . getNumeric ( n ) . toFixed ( 2 ) ; symbol = typeof symbol === 'string' ? symbol : '$' ; return n . replace ( / ^(-)?(\d+)\.(\d+)$ / , function ( $0 , $1 , $2 , $3 ) { $1 = $2 === '0' && $3 === '00' ? null : $1 ; return ( $1 || '' ) + symbol + libs . number . withPlaceholders ( $2 ) + '.' + $3 ; } ) ; }

Formats a number in money notation.
@param {Number} n The number to format.
@param {String=} [symbol='$'] The currency type symbol.
@return {String} The number in USD format.


function factorial (n) {
                    if(typeof n !== 'number' || n < 0) return NaN;
                    if(n > 170) return Infinity;
                    if(n === 0 || n === 1) return 1;
                    return n * factorial(n - 1);
                }

function factorial ( n ) { if ( typeof n !== 'number' || n < 0 ) return NaN ; if ( n > 170 ) return Infinity ; if ( n === 0 || n === 1 ) return 1 ; return n * factorial ( n - 1 ) ; }

Recursively computes the factorial of the number n.
@param {Number} n A number.
@return {Number|Infinity} n!

Recursively computes the factorial of the number n .


function isInt () {
                    return libs.object.every(arguments, function (n) {
                        return typeof n === 'number' && n % 1 === 0 && n.toString().indexOf('.') === -1;
                    });
                }

function isInt ( ) { return libs . object . every ( arguments , function ( n ) { return typeof n === 'number' && n % 1 === 0 && n . toString ( ) . indexOf ( '.' ) === - 1 ; } ) ; }

Determines is the given numbers are integers
@param {...Number} n Numbers.
@return {Boolean} True if all arguments are integers, false otherwise.


function choose (n, k) {
                    if(typeof n !== 'number' || typeof k !== 'number') return NaN;
                    if(k === 0) return 1;
                    return (n * choose(n - 1, k - 1)) / k;
                }

function choose ( n , k ) { if ( typeof n !== 'number' || typeof k !== 'number' ) return NaN ; if ( k === 0 ) return 1 ; return ( n * choose ( n - 1 , k - 1 ) ) / k ; }

Recursively computes n choose k.
@param {Number} n A number.
@param {Number} k A number.
@return {Number|Infinity} n choose k.


function pad (n, length) {
                    return libs.string.pad(n.toString(), length, '0', true);
                }

function pad ( n , length ) { return libs . string . pad ( n . toString ( ) , length , '0' , true ) ; }

Pads a number with preceeding zeros.
@param {Number} n The number object to operate on.
@param {Number} length The final length of the string
@returns {String} The padded number, now a string.
@function


function inherits (constructor, superConstructor) {
                    if (constructor === undefined || constructor === null)
                        throw new TypeError('The constructor to "inherits" must not be ' + 'null or undefined');

                    if (superConstructor === undefined || superConstructor === null)
                        throw new TypeError('The super constructor to "inherits" must not ' + 'be null or undefined');

                    if (superConstructor.prototype === undefined)
                        throw new TypeError('The super constructor to "inherits" must ' + 'have a prototype');

                    constructor.super_ = superConstructor;
                    Object.setPrototypeOf(constructor.prototype, superConstructor.prototype);

                    // Kill al the ProtoLib cache, for all instances...
                    ProtoLib.killCacheForConstructor(constructor);
                    return constructor;
                }

Inherit the prototype methods from one constructor into another.
Mostly borrowed directly from Node.js
@param {Function} constructor The inheriting constructor
@param {Function} superConstructor The parent constructor
@return {Function} The inheriting constructor

Inherit the prototype methods from one constructor into another . Mostly borrowed directly from Node . js


function union (a) {
                    var args = libs.object.only(libs.object.toArray(arguments), 'array');

                    var union = [];
                    args.unshift(a);
                    libs.object.each(args, function (array) {
                        libs.object.each(array, function (item) {
                            if(union.indexOf(item) === -1) union.push(item);
                        });
                    });
                    return union;
                }

function union ( a ) { var args = libs . object . only ( libs . object . toArray ( arguments ) , 'array' ) ; var union = [ ] ; args . unshift ( a ) ; libs . object . each ( args , function ( array ) { libs . object . each ( array , function ( item ) { if ( union . indexOf ( item ) === - 1 ) union . push ( item ) ; } ) ; } ) ; return union ; }

Computes the union between the current array, and all the array objects passed in. That is,
the set of unique objects present in all of the arrays.
@param {Array} a The Array object to operate on.
@param {...Array} arr A list of array objects
@return {Array<*>} The union set of the provided arrays.

Computes the union between the current array and all the array objects passed in . That is the set of unique objects present in all of the arrays .


function intersect () {
                    var arrays = libs.object.only(libs.object.toArray(arguments), 'array');

                    if(arrays.length === 0) return [];
                    if(arrays.length === 1) return libs.object.copy(arrays[0]);

                    var intersection = arrays[0], intermediate = [];
                    for(var i = 1; i < arrays.length; i++) {
                        var arr = libs.object.copy(arrays[i]); // Don't want to modify the original array!
                        for(var n = 0; n < intersection.length; n++) {
                            if(arr.indexOf(intersection[n]) > -1) {
                                intermediate.push(intersection[n]);
                                var idx = arr.indexOf(intersection[n]);
                                arr.splice(idx, 1);
                            }
                        }
                        intersection = intermediate;
                        intermediate = [];
                    }

                    return intersection;
                }

Returns the items common to all arrays.
@param {...Array} items The arrays from which to compute the intersection.
@return {Array} A new array with items common to both arrays.

Returns the items common to all arrays .


function rotateLeft (a, amount) {
                    if(!(a instanceof Array)) return a;
                    return libs.array.rotate(a, 'left', amount);
                }

function rotateLeft ( a , amount ) { if ( ! ( a instanceof Array ) ) return a ; return libs . array . rotate ( a , 'left' , amount ) ; }

Rotates the array left the specified number of times.
This is useful if trying to create a circular queue.
@param {Array} a The Array object to operate on.
@param {Number=} [amount=1] The number of times to rotate the array left.
@return {Array<*>} The current array, rotated left.
@function

Rotates the array left the specified number of times . This is useful if trying to create a circular queue .


function makeUnique (a) {
                    if(!(a instanceof Array)) return a;

                    var visited = [];
                    for(var i = 0; i < a.length; i++) {
                        if(visited.indexOf(a[i]) === -1) {
                            visited.push(a[i]);
                        }
                        else {
                            a.splice(i, 1);
                            i--; // Splice will affect the internal array pointer, so fix it...
                        }
                    }
                    return a;
                }

Removes duplicates from the current array.
This is a destructive action, and will modify the array in place.
@param {Array} a The Array object to operate on.
@returns {Array<*>} The current array, with duplicates removed.
@function

Removes duplicates from the current array . This is a destructive action and will modify the array in place .


function unique (a) {
                    if(!(a instanceof Array)) return a;

                    var visited = [],
                        unique  = [];

                    libs.object.each(a, function (item) {
                        if(visited.indexOf(item) === -1) {
                            unique.push(item);
                            visited.push(item);
                        }
                    });
                    return unique;
                }

function unique ( a ) { if ( ! ( a instanceof Array ) ) return a ; var visited = [ ] , unique = [ ] ; libs . object . each ( a , function ( item ) { if ( visited . indexOf ( item ) === - 1 ) { unique . push ( item ) ; visited . push ( item ) ; } } ) ; return unique ; }

Gets an array of unique items from the current array.
@param {Array} a The Array object to operate on.
@returns {Array} A new array with no duplicate values.
@function

Gets an array of unique items from the current array .


function ascending (a) {
                    if(!(a instanceof Array)) return a;
                    return a.sort(function (a, b) {
                        if(a !== undefined && a !== null) a = a.toString();
                        if(b !== undefined && b !== null) b = b.toString();
                        return a < b ? -1 : a > b ? 1 : 0;
                    });
                }

function ascending ( a ) { if ( ! ( a instanceof Array ) ) return a ; return a . sort ( function ( a , b ) { if ( a !== undefined && a !== null ) a = a . toString ( ) ; if ( b !== undefined && b !== null ) b = b . toString ( ) ; return a < b ? - 1 : a > b ? 1 : 0 ; } ) ; }

Sorts the array in ascending order.
This is a destructive action, and will modify the array in place.
@param {Array} a The Array object to operate on.
@returns {Array} The array sorted in ascending order.
@function

Sorts the array in ascending order . This is a destructive action and will modify the array in place .


function descending (a) {
                    if(!(a instanceof Array)) return a;
                    return a.sort(function (a, b) {
                        if(a !== undefined && a !== null) a = a.toString();
                        if(b !== undefined && b !== null) b = b.toString();
                        return a > b ? -1 : a < b ? 1 : 0;
                    });
                }

function descending ( a ) { if ( ! ( a instanceof Array ) ) return a ; return a . sort ( function ( a , b ) { if ( a !== undefined && a !== null ) a = a . toString ( ) ; if ( b !== undefined && b !== null ) b = b . toString ( ) ; return a > b ? - 1 : a < b ? 1 : 0 ; } ) ; }

Sorts the array in descending order.
This is a destructive action, and will modify the array in place.
@param {Array} a The Array object to operate on.
@returns {Array} The array sorted in descending order.
@function

Sorts the array in descending order . This is a destructive action and will modify the array in place .


function histogram () {
                    var histogram = {};
                    libs.object.every(arguments, function (o) {
                        if(typeof o === 'boolean') {
                            if(!histogram[o]) histogram[o] = 1; else histogram[o]++;
                        }
                        else if(typeof o === 'function') {
                            if(!histogram['function']) histogram['function'] = 1; else histogram[o]++;
                        }
                        else {
                            libs.object.every(o, function (val) {
                                switch(true) {
                                    case typeof val === 'function':
                                    case typeof val === 'undefined':
                                        val = typeof val;
                                        break;
                                    case typeof val === 'object' && val === null:
                                        val = 'null';
                                        break;
                                    case typeof val === 'object' && val instanceof Array:
                                        val = 'array';
                                        break;
                                    case typeof val === 'object':
                                        val = 'object';
                                        break;
                                    default:
                                        val = val.toString();
                                }

                                if(typeof histogram[val] !== 'number') histogram[val] = 0;
                                histogram[val]++;
                            });
                        }
                    });
                    return histogram;
                }

function histogram ( ) { var histogram = { } ; libs . object . every ( arguments , function ( o ) { if ( typeof o === 'boolean' ) { if ( ! histogram [ o ] ) histogram [ o ] = 1 ; else histogram [ o ] ++ ; } else if ( typeof o === 'function' ) { if ( ! histogram [ 'function' ] ) histogram [ 'function' ] = 1 ; else histogram [ o ] ++ ; } else { libs . object . every ( o , function ( val ) { switch ( true ) { case typeof val === 'function' : case typeof val === 'undefined' : val = typeof val ; break ; case typeof val === 'object' && val === null : val = 'null' ; break ; case typeof val === 'object' && val instanceof Array : val = 'array' ; break ; case typeof val === 'object' : val = 'object' ; break ; default : val = val . toString ( ) ; } if ( typeof histogram [ val ] !== 'number' ) histogram [ val ] = 0 ; histogram [ val ] ++ ; } ) ; } } ) ; return histogram ; }

Computes the frequencies for each item in all of arguments.
@param {...*} objs The objects to compute the histogram from.
@return {Object<Number>} An object that has the items from all of the arguments as its keys and their frequencies as it's values.

Computes the frequencies for each item in all of arguments .


function copy (item) {
                    var copy;
                    if(!item) return item;

                    switch (typeof item) {
                        case 'string':
                        case 'number':
                        case 'function':
                        case 'boolean':
                            return item;

                        default:
                            if(item instanceof Array) {
                                return item.slice(0);
                            }
                            else {
                                copy = {};
                            }
                    }

                    libs.object.every(item, function (o, k) { copy[k] = o; });
                    return copy;
                }

function copy ( item ) { var copy ; if ( ! item ) return item ; switch ( typeof item ) { case 'string' : case 'number' : case 'function' : case 'boolean' : return item ; default : if ( item instanceof Array ) { return item . slice ( 0 ) ; } else { copy = { } ; } } libs . object . every ( item , function ( o , k ) { copy [ k ] = o ; } ) ; return copy ; }

Creates a shallow copy of 'item'.
@param {*} item The item to shallow "copy".
@return {*} A shallow copy of the item.


function occurrencesOf (obj, what) {
                    if(arguments.length < 2) return 0;

                    if(typeof obj === 'boolean') {
                        return 0;
                    }
                    if(typeof obj === 'number') {
                        return occurrencesOf(obj.toString(), what);
                    }
                    else if(typeof obj === 'function') {
                        return occurrencesOf(fixFirefoxFunctionString(obj.toString()), what);
                    }

                    var count = 0;
                    if(typeof obj === 'string') {
                        if(typeof what === 'string' || typeof what === 'number') {
                            var regexp = new RegExp(what.toString(), 'g'), m;
                            while(m = regexp.exec(obj)) count++; // jshint ignore:line
                        }
                    }
                    else if(typeof obj !== 'string') {
                        libs.object.every(obj, function (item) {
                            if(item === what) count++;
                        });
                    }
                    return count;
                }

function
occurrencesOf
(
obj
,
what
)
{
if
(
arguments
.
length
<
2
)
return
0
;
if
(
typeof
obj
===
'boolean'
)
{
return
0
;
}
if
(
typeof
obj
===
'number'
)
{
return
occurrencesOf
(
obj
.
toString
(
)
,
what
)
;
}
else
if
(
typeof
obj
===
'function'
)
{
return
occurrencesOf
(
fixFirefoxFunctionString
(
obj
.
toString
(
)
)
,
what
)
;
}
var
count
=
0
;
if
(
typeof
obj
===
'string'
)
{
if
(
typeof
what
===
'string'
||
typeof
what
===
'number'
)
{
var
regexp
=
new
RegExp
(
what
.
toString
(
)
,
'g'
)
,
m
;
while
(
m
=
regexp
.
exec
(
obj
)
)
count
++
;
// jshint ignore:line
}
}
else
if
(
typeof
obj
!==
'string'
)
{
libs
.
object
.
every
(
obj
,
function
(
item
)
{
if
(
item
===
what
)
count
++
;
}
)
;
}
return
count
;
}

Returns the number of occurences of "what"
@param {*} obj The item to count the occurences of "what" in.
@param {*} what The item to count the occurences of the item in the array.
@return {[type]} [description]

Returns the number of occurences of what


function keys (o) {
                    if(o === undefined || o === null) return [];

                    var keys = getKeys(o), idx;
                    if(libs.object.isArguments(o)) {
                        idx = keys.indexOf('length');
                        if(idx > -1) keys.splice(idx, 1);
                    }
                    return keys;
                }

function keys ( o ) { if ( o === undefined || o === null ) return [ ] ; var keys = getKeys ( o ) , idx ; if ( libs . object . isArguments ( o ) ) { idx = keys . indexOf ( 'length' ) ; if ( idx > - 1 ) keys . splice ( idx , 1 ) ; } return keys ; }

Returns the object's keys.
@param {Object} o The object to operate on.
@returns {Array<String|Number>} The object's key set
@function


function isNumeric () {
                    return libs.object.every(arguments, function (item) {
                        return !isNaN(parseFloat(item)) && isFinite(item);
                    });
                }

function isNumeric ( ) { return libs . object . every ( arguments , function ( item ) { return ! isNaN ( parseFloat ( item ) ) && isFinite ( item ) ; } ) ; }

Determines if an object can be converted to a number.
@param {...Object} o The object to operate on.
@returns {Boolean} True if the object is numeric, false otherwise.
@function

Determines if an object can be converted to a number .


function getNumeric () {
                    var vals = [];
                    libs.object.every(arguments, function (o) {
                        vals.push(libs.object.isNumeric(o) ? parseFloat(o) : NaN);
                    });
                    return vals.length === 1 ? vals[0] : vals;
                }

function getNumeric ( ) { var vals = [ ] ; libs . object . every ( arguments , function ( o ) { vals . push ( libs . object . isNumeric ( o ) ? parseFloat ( o ) : NaN ) ; } ) ; return vals . length === 1 ? vals [ 0 ] : vals ; }

Converts an object to a number.
@param {...Object} o The object to operate on.
@returns {Number} The object as a number.
@function


function isArguments () {
                    return libs.object.every(arguments, function (item) {
                        return Object.prototype.toString.call(item) === '[object Arguments]';
                    });
                }

function
isArguments
(
)
{
return
libs
.
object
.
every
(
arguments
,
function
(
item
)
{
return
Object
.
prototype
.
toString
.
call
(
item
)
===
'[object Arguments]'
;
}
)
;
}

True if the objects passed in are all arguments objects, false otherwise.
@param {Object} o The object to operate on.
@return {Boolean} True if the object is an arguments object, false otherwise

True if the objects passed in are all arguments objects false otherwise .


function toInt () {
                    var vals = [];
                    libs.object.every(arguments, function (o) {
                        var radix = /^0x/.test(o) ? 16 : 10; // Check for hex string
                        vals.push(libs.object.isNumeric(o) ? parseInt(o, radix) : NaN);
                    });
                    return vals.length === 1 ? vals[0] : vals;
                }

function
toInt
(
)
{
var
vals
=
[
]
;
libs
.
object
.
every
(
arguments
,
function
(
o
)
{
var
radix
=
/
^0x
/
.
test
(
o
)
16
:
10
;
// Check for hex string
vals
.
push
(
libs
.
object
.
isNumeric
(
o
)
parseInt
(
o
,
radix
)
:
)
;
}
)
;
return
vals
.
length
===
1
vals
[
0
]
:
vals
;
}

Convers an object to an integer, if possible.
@param {Object} o The object to operate on.
@returns {Number} The object as an integer or NaN.
@function

Convers an object to an integer if possible .


function random (o) {
                    if(typeof o === 'object') {
                        return o instanceof Array ?
                            o[Math.floor(Math.random() * o.length)] :
                            o[Object.keys(o)[Math.floor(Math.random() * Object.keys(o).length)]];
                    }
                    else if(typeof o === 'string' || typeof o === 'number') {
                        var val = o, negative = false;

                        if(o.length === 0) return '';
                        if(typeof o === 'number' && o < 0) {
                            negative = true;
                            val = Math.abs(val);
                        }

                        val = val.toString()[Math.floor(Math.random() * val.toString().length)];
                        if(typeof o === 'number') val = parseInt(val, 10);
                        return negative ? -val : val;
                    }
                    return o;
                }

function random ( o ) { if ( typeof o === 'object' ) { return o instanceof Array ? o [ Math . floor ( Math . random ( ) * o . length ) ] : o [ Object . keys ( o ) [ Math . floor ( Math . random ( ) * Object . keys ( o ) . length ) ] ] ; } else if ( typeof o === 'string' || typeof o === 'number' ) { var val = o , negative = false ; if ( o . length === 0 ) return '' ; if ( typeof o === 'number' && o < 0 ) { negative = true ; val = Math . abs ( val ) ; } val = val . toString ( ) [ Math . floor ( Math . random ( ) * val . toString ( ) . length ) ] ; if ( typeof o === 'number' ) val = parseInt ( val , 10 ) ; return negative ? - val : val ; } return o ; }

Returns a random array item, random object property, random character in a string, or random digit in a number.
@param {Object} o The object to operate on.
@returns {*}
@function

Returns a random array item random object property random character in a string or random digit in a number .


function any (o, f) {
                    f = f instanceof Function ? f : undefined;

                    if(f instanceof Function) {
                        var self = o, keys, property, value;
                        if(typeof self === 'number' || typeof self === 'function' || typeof self === 'boolean') self = o.toString();

                        // Firefox does some funky stuff here...
                        if(typeof o === 'function') self = fixFirefoxFunctionString(self);

                        // For Safari...
                        var isArgs = Object.prototype.toString.call(o) === '[object Arguments]', idx = -1;
                        keys = getKeys(self);
                        idx  = keys.indexOf('length');

                        if(isArgs && idx > -1) keys.splice(idx, 1);

                        for(var n = 0; n < keys.length; n++) {
                            property = keys[n];
                            value    = (typeof o === 'number' && !isNaN(parseFloat(self[property]))) ? parseFloat(self[property]) : self[property];
                            var ret = f.call(o, value, property, n, o);
                            if(ret !== undefined) return ret;
                        }
                    }
                    return undefined;
                }

Invokes the callback 'f' for every property the object contains. If the callback returns true, the
loop is broken and false is returned; otherwise true is returned.
@param {Object} o The object to operate on.
@param {Function} f The callback to invoke for each item within the object
@returns {Boolean} True if none of the callback invocations returned false.
@function

Invokes the callback f for every property the object contains . If the callback returns true the loop is broken and false is returned ; otherwise true is returned .


function first (o, n) {
                    var gotN = (n === 0 ? true : !!n),
                        v;

                    n = parseInt(n, 10);
                    n = isNaN(n) || !isFinite(n) ? 1 : n;

                    if(typeof o === 'boolean') {
                        return o;
                    }
                    else if(typeof o !== 'object') {
                        if(n !== 0) v = o.toString().slice(0, n); else return undefined;
                    }
                    else if(o instanceof Array) {
                        if(n === 1 && !gotN) return o[0];
                        if(n === 0 && !gotN) return undefined;

                        return n !== 0 ? o.slice(0, n) :  [];
                    }
                    else {
                        v = {};
                        libs.object.each(o, 0, n - 1, function (item, key) { v[key] = item; });
                        var keys = getKeys(v);
                        if(n === 1 && !gotN && keys.length === 0) return undefined;

                        return keys.length === 1 && !gotN ? v[keys[0]] : v;
                    }
                    return v.length === 1 && !gotN ? v[0] : v;
                }

function first ( o , n ) { var gotN = ( n === 0 ? true : ! ! n ) , v ; n = parseInt ( n , 10 ) ; n = isNaN ( n ) || ! isFinite ( n ) ? 1 : n ; if ( typeof o === 'boolean' ) { return o ; } else if ( typeof o !== 'object' ) { if ( n !== 0 ) v = o . toString ( ) . slice ( 0 , n ) ; else return undefined ; } else if ( o instanceof Array ) { if ( n === 1 && ! gotN ) return o [ 0 ] ; if ( n === 0 && ! gotN ) return undefined ; return n !== 0 ? o . slice ( 0 , n ) : [ ] ; } else { v = { } ; libs . object . each ( o , 0 , n - 1 , function ( item , key ) { v [ key ] = item ; } ) ; var keys = getKeys ( v ) ; if ( n === 1 && ! gotN && keys . length === 0 ) return undefined ; return keys . length === 1 && ! gotN ? v [ keys [ 0 ] ] : v ; } return v . length === 1 && ! gotN ? v [ 0 ] : v ; }

Returns the first n elements of an object. If the object is an array, and only one items is retrieved,
that item will be returned, rather than an array.
@param {Object} o The object to operate on.
@param {Number=} [n=1] The number of elements to return
@return {Array<*>} The first n elements of the array.

Returns the first n elements of an object . If the object is an array and only one items is retrieved that item will be returned rather than an array .


function last (o, n) {
                    if(typeof o === 'boolean') return o;
                    var gotN = (!!n || n === 0);

                    n = parseInt(n, 10);
                    n = isNaN(n) || !isFinite(n) ? 1 : n;
                    var v = null, keys, len = libs.object.size(o), idx;

                    if(typeof o === 'boolean') {
                        return o;
                    }
                    else if(libs.object.isArguments(o)) {
                        keys = getKeys(o);
                        idx  = keys.indexOf('length');

                        if(idx > -1) keys.splice(idx, 1);
                        v = []; len = keys.length;
                        // Arguments object should ignore undefined members...
                        libs.object.each(keys, 0, len, function (k) { if(o[k] !== undefined) v.unshift(o[k]); });
                        v = v.slice(0, n);
                    }
                    else if(typeof o !== 'object') {
                        if(n !== 0) v = o.toString().slice(-n); else return null;
                    }
                    else if(o instanceof Array) {
                        if(n === 1 && !gotN) return o[o.length -1];
                        if(n === 0 && !gotN) return undefined;

                        return n !== 0 ? o.slice(-n) : [];
                    }
                    else {
                        v = {};
                        if(n < 0) n = 0;
                        libs.object.each(o, len - n, len, function (item, key) { v[key] = item; });
                        keys = getKeys(v);

                        if(n === 1 && !gotN && keys.length === 0) return undefined;
                        return keys.length === 1 && !gotN ? v[keys[0]] : v;
                    }
                    return v.length === 1 && !gotN ? v[0] : v;
                }

Returns the last n elements of an object. If the object is an array, and only one items is retrieved,
that item will be returned rather than an array.
@param {Object} o The object to operate on.
@param {Number=} [n=1] The number of elements to return
@return {Array<*>} The last n elements of the array.
@function

Returns the last n elements of an object . If the object is an array and only one items is retrieved that item will be returned rather than an array .


function getCallback (o) {
                    var last = libs.object.last(o);
                    return last instanceof Function ? last : NULL_FUNCTION;
                }

function getCallback ( o ) { var last = libs . object . last ( o ) ; return last instanceof Function ? last : NULL_FUNCTION ; }

If the last item in the object is a function, it will be returned. Otherwise, an "empty" function will be returned.
Useful for ensuring that a callback can always be invoked, without checking if the argument is a function
over and over.
@param {Object} o The object to get the callback for.
@return {Function} If the last item in the object is a function, it will be returned. Otherwise, an "empty" function will be returned.

If the last item in the object is a function it will be returned . Otherwise an empty function will be returned . Useful for ensuring that a callback can always be invoked without checking if the argument is a function over and over .