diff --git a/build/airtable.browser.js b/build/airtable.browser.js index cb5e3b85..cd8dd1fe 100644 --- a/build/airtable.browser.js +++ b/build/airtable.browser.js @@ -23,7 +23,8 @@ module.exports = AirtableError; },{"./class":4}],2:[function(require,module,exports){ 'use strict'; -var _ = require('lodash'); +var forEach = require('lodash/forEach'); + var internalConfig = require('./internal_config.json'); var Class = require('./class'); var AirtableError = require('./airtable_error'); @@ -91,7 +92,7 @@ Base.createFunctor = function(airtable, baseId) { var baseFn = function() { return base.doCall.apply(base, arguments); }; - _.each(['table', 'runAction', 'getId'], function(baseMethod) { + forEach(['table', 'runAction', 'getId'], function(baseMethod) { baseFn[baseMethod] = base[baseMethod].bind(base); }); baseFn._base = base; @@ -101,7 +102,7 @@ Base.createFunctor = function(airtable, baseId) { module.exports = Base; -},{"./airtable_error":1,"./class":4,"./internal_config.json":6,"./run_action":10,"./table":11,"lodash":22}],3:[function(require,module,exports){ +},{"./airtable_error":1,"./class":4,"./internal_config.json":6,"./run_action":10,"./table":11,"lodash/forEach":167}],3:[function(require,module,exports){ 'use strict'; /** @@ -113,7 +114,7 @@ module.exports = Base; function callbackToPromise(fn, context, callbackArgIndex) { return function() { // If callbackArgIndex isn't provided, use the last argument. - if (callbackArgIndex === undefined) { + if (callbackArgIndex === void 0) { callbackArgIndex = arguments.length > 0 ? arguments.length - 1 : 0; } var callbackArg = arguments[callbackArgIndex]; @@ -256,22 +257,25 @@ module.exports={ },{}],7:[function(require,module,exports){ 'use strict'; -var _ = require('lodash'); +var isArray = require('lodash/isArray'); +var forEach = require('lodash/forEach'); +var isNil = require('lodash/isNil'); +var keys = require('lodash/keys'); // Adapted from jQuery.param: // https://github.com/jquery/jquery/blob/2.2-stable/src/serialize.js function buildParams(prefix, obj, addFn) { var name; - if (_.isArray(obj)) { + if (isArray(obj)) { // Serialize array item. - _.each(obj, function(value, index) { + forEach(obj, function(value, index) { if (/\[\]$/.test(prefix)) { // Treat each array item as a scalar. addFn(prefix, value); } else { // Item is non-scalar (array or object), encode its numeric index. buildParams( - prefix + '[' + (typeof value === 'object' && value !== null && value !== undefined ? index : '') + ']', + prefix + '[' + (typeof value === 'object' && value !== null ? index : '') + ']', value, addFn ); @@ -291,11 +295,11 @@ function buildParams(prefix, obj, addFn) { function objectToQueryParamString(obj) { var parts = []; var addFn = function(key, value) { - value = (value === null || value === undefined) ? '' : value; + value = isNil(value) ? '' : value; parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); }; - _.each(_.keys(obj), function(key) { + forEach(keys(obj), function(key) { var value = obj[key]; buildParams(key, value, addFn); }); @@ -305,11 +309,20 @@ function objectToQueryParamString(obj) { module.exports = objectToQueryParamString; -},{"lodash":22}],8:[function(require,module,exports){ +},{"lodash/forEach":167,"lodash/isArray":173,"lodash/isNil":179,"lodash/keys":188}],8:[function(require,module,exports){ 'use strict'; var assert = require('assert'); -var _ = require('lodash'); +var isPlainObject = require('lodash/isPlainObject'); +var isArray = require('lodash/isArray'); +var isFunction = require('lodash/isFunction'); +var isString = require('lodash/isString'); +var isNumber = require('lodash/isNumber'); +var includes = require('lodash/includes'); +var clone = require('lodash/clone'); +var forEach = require('lodash/forEach'); +var map = require('lodash/map'); +var keys = require('lodash/keys'); var check = require('./typecheck'); var Class = require('./class'); @@ -322,8 +335,8 @@ var Query = Class.extend({ * or `eachPage` is called. */ init: function(table, params) { - assert(_.isPlainObject(params)); - _.each(_.keys(params), function(key) { + assert(isPlainObject(params)); + forEach(keys(params), function(key) { var value = params[key]; assert(Query.paramValidators[key] && Query.paramValidators[key](value).pass, 'Invalid parameter for Query: ' + key); }); @@ -341,7 +354,7 @@ var Query = Class.extend({ * then calls `done(error, records)`. */ firstPage: function(done) { - assert(_.isFunction(done), + assert(isFunction(done), 'The first parameter to `firstPage` must be a function'); this.eachPage(function(records, fetchNextPage) { @@ -362,15 +375,15 @@ var Query = Class.extend({ * `done(error)`. */ eachPage: function(pageCallback, done) { - assert(_.isFunction(pageCallback), + assert(isFunction(pageCallback), 'The first parameter to `eachPage` must be a function'); - assert(_.isFunction(done) || _.isUndefined(done), + assert(isFunction(done) || (done === void 0), 'The second parameter to `eachPage` must be a function or undefined'); var that = this; var path = '/' + this._table._urlEncodedNameOrId(); - var params = _.clone(this._params); + var params = clone(this._params); var inner = function() { that._table._base.runAction('get', path, params, null, function(err, response, result) { @@ -389,7 +402,7 @@ var Query = Class.extend({ }; } - var records = _.map(result.records, function(recordJson) { + var records = map(result.records, function(recordJson) { return new Record(that._table, null, recordJson); }); @@ -404,7 +417,7 @@ var Query = Class.extend({ * Fetches all pages of results asynchronously. May take a long time. */ all: function(done) { - assert(_.isFunction(done), + assert(isFunction(done), 'The first parameter to `all` must be a function'); var allRecords = []; @@ -423,23 +436,23 @@ var Query = Class.extend({ Query.paramValidators = { fields: - check(check.isArrayOf(_.isString), 'the value for `fields` should be an array of strings'), + check(check.isArrayOf(isString), 'the value for `fields` should be an array of strings'), filterByFormula: - check(_.isString, 'the value for `filterByFormula` should be a string'), + check(isString, 'the value for `filterByFormula` should be a string'), maxRecords: - check(_.isNumber, 'the value for `maxRecords` should be a number'), + check(isNumber, 'the value for `maxRecords` should be a number'), pageSize: - check(_.isNumber, 'the value for `pageSize` should be a number'), + check(isNumber, 'the value for `pageSize` should be a number'), sort: check(check.isArrayOf(function(obj) { return ( - _.isPlainObject(obj) && - _.isString(obj.field) && - (_.isUndefined(obj.direction) || _.includes(['asc', 'desc'], obj.direction)) + isPlainObject(obj) && + isString(obj.field) && + ((obj.direction === void 0) || includes(['asc', 'desc'], obj.direction)) ); }), 'the value for `sort` should be an array of sort objects. ' + 'Each sort object must have a string `field` value, and an optional ' + @@ -447,21 +460,21 @@ Query.paramValidators = { ), view: - check(_.isString, 'the value for `view` should be a string'), + check(isString, 'the value for `view` should be a string'), cellFormat: check(function(cellFormat) { return ( - _.isString(cellFormat) && - _.includes(['json', 'string'], cellFormat) + isString(cellFormat) && + includes(['json', 'string'], cellFormat) ); }, 'the value for `cellFormat` should be "json" or "string"'), timeZone: - check(_.isString, 'the value for `timeZone` should be a string'), + check(isString, 'the value for `timeZone` should be a string'), userLocale: - check(_.isString, 'the value for `userLocale` should be a string'), + check(isString, 'the value for `userLocale` should be a string'), }; /** @@ -473,12 +486,13 @@ Query.paramValidators = { * errors: a list of error messages. */ Query.validateParams = function validateParams(params) { - assert(_.isPlainObject(params)); + assert(isPlainObject(params)); var validParams = {}; var ignoredKeys = []; var errors = []; - _.each(_.keys(params), function(key) { + + forEach(keys(params), function(key) { var value = params[key]; if (Query.paramValidators.hasOwnProperty(key)) { var validator = Query.paramValidators[key]; @@ -502,10 +516,10 @@ Query.validateParams = function validateParams(params) { module.exports = Query; -},{"./callback_to_promise":3,"./class":4,"./record":9,"./typecheck":12,"assert":13,"lodash":22}],9:[function(require,module,exports){ +},{"./callback_to_promise":3,"./class":4,"./record":9,"./typecheck":12,"assert":13,"lodash/clone":164,"lodash/forEach":167,"lodash/includes":171,"lodash/isArray":173,"lodash/isFunction":176,"lodash/isNumber":180,"lodash/isPlainObject":183,"lodash/isString":185,"lodash/keys":188,"lodash/map":190}],9:[function(require,module,exports){ 'use strict'; -var _ = require('lodash'); +var assign = require('lodash/assign'); var Class = require('./class'); var callbackToPromise = require('./callback_to_promise'); @@ -543,7 +557,7 @@ var Record = Class.extend({ done = opts; opts = {}; } - var updateBody = _.extend({ + var updateBody = assign({ fields: cellValuesByName }, opts); @@ -560,7 +574,7 @@ var Record = Class.extend({ done = opts; opts = {}; } - var updateBody = _.extend({ + var updateBody = assign({ fields: cellValuesByName }, opts); this._table._base.runAction('put', '/' + this._table._urlEncodedNameOrId() + '/' + this.id, {}, updateBody, function(err, response, results) { @@ -596,7 +610,7 @@ var Record = Class.extend({ module.exports = Record; -},{"./callback_to_promise":3,"./class":4,"lodash":22}],10:[function(require,module,exports){ +},{"./callback_to_promise":3,"./class":4,"lodash/assign":163}],10:[function(require,module,exports){ 'use strict'; var internalConfig = require('./internal_config.json'); @@ -614,7 +628,7 @@ function runAction(base, method, path, queryParams, bodyData, callback) { 'x-airtable-application-id': base.getId(), }; - var userAgent = 'Airtable.js/' + "0.5.6"; + var userAgent = 'Airtable.js/' + "0.5.7"; var isBrowser = typeof window !== 'undefined'; // Some browsers do not allow overriding the user agent. // https://github.com/Airtable/airtable.js/issues/52 @@ -661,13 +675,15 @@ function runAction(base, method, path, queryParams, bodyData, callback) { module.exports = runAction; -},{"./internal_config.json":6,"./object_to_query_param_string":7,"request":27}],11:[function(require,module,exports){ +},{"./internal_config.json":6,"./object_to_query_param_string":7,"request":202}],11:[function(require,module,exports){ 'use strict'; -var _ = require('lodash'); +var isPlainObject = require('lodash/isPlainObject'); +var assign = require('lodash/assign'); +var forEach = require('lodash/forEach'); +var map = require('lodash/map'); var assert = require('assert'); -var async = require('async'); var AirtableError = require('./airtable_error'); var Class = require('./class'); @@ -704,7 +720,7 @@ var Table = Class.extend({ record.fetch(done); }, _selectRecords: function(params) { - if (_.isUndefined(params)) { + if (params === void 0) { params = {}; } @@ -714,11 +730,11 @@ var Table = Class.extend({ 'Use `eachPage` or `firstPage` to fetch records.'); } - if (_.isPlainObject(params)) { + if (isPlainObject(params)) { var validationResults = Query.validateParams(params); if (validationResults.errors.length) { - var formattedErrors = validationResults.errors.map(function(error) { + var formattedErrors = map(validationResults.errors, function(error) { return ' * ' + error; }); @@ -745,7 +761,7 @@ var Table = Class.extend({ done = optionalParameters; optionalParameters = {}; } - var requestData = _.extend({fields: recordData}, optionalParameters); + var requestData = assign({fields: recordData}, optionalParameters); this._base.runAction('post', '/' + that._urlEncodedNameOrId() + '/', {}, requestData, function(err, resp, body) { if (err) { done(err); return; } @@ -782,21 +798,21 @@ var Table = Class.extend({ done = opts; opts = {}; } - var listRecordsParameters = _.extend({ + var listRecordsParameters = assign({ limit: limit, offset: offset }, opts); - async.waterfall([ - function(next) { - that._base.runAction('get', '/' + that._urlEncodedNameOrId() + '/', listRecordsParameters, null, next); - }, - function(response, results, next) { - var records = _.map(results.records, function(recordJson) { - return new Record(that, null, recordJson); - }); - next(null, records, results.offset); + this._base.runAction('get', '/' + this._urlEncodedNameOrId() + '/', listRecordsParameters, null, function (err, response, results) { + if (err) { + done(err); + return; } - ], done); + + var records = map(results.records, function(recordJson) { + return new Record(that, null, recordJson); + }); + done(null, records, results.offset); + }); }, _forEachRecord: function(opts, callback, done) { if (arguments.length === 2) { @@ -812,7 +828,7 @@ var Table = Class.extend({ that._listRecords(limit, offset, opts, function(err, page, newOffset) { if (err) { done(err); return; } - _.each(page, callback); + forEach(page, callback); if (newOffset) { offset = newOffset; @@ -828,10 +844,11 @@ var Table = Class.extend({ module.exports = Table; -},{"./airtable_error":1,"./callback_to_promise":3,"./class":4,"./deprecate":5,"./query":8,"./record":9,"assert":13,"async":17,"lodash":22}],12:[function(require,module,exports){ +},{"./airtable_error":1,"./callback_to_promise":3,"./class":4,"./deprecate":5,"./query":8,"./record":9,"assert":13,"lodash/assign":163,"lodash/forEach":167,"lodash/isPlainObject":183,"lodash/map":190}],12:[function(require,module,exports){ 'use strict'; -var _ = require('lodash'); +var includes = require('lodash/includes'); +var isArray = require('lodash/isArray'); function check(fn, error) { return function(value) { @@ -844,18 +861,18 @@ function check(fn, error) { } check.isOneOf = function isOneOf(options) { - return _.includes.bind(this, options); + return includes.bind(this, options); }; check.isArrayOf = function(itemValidator) { return function(value) { - return _.isArray(value) && _.every(value, itemValidator); + return isArray(value) && value.every(itemValidator); }; }; module.exports = check; -},{"lodash":22}],13:[function(require,module,exports){ +},{"lodash/includes":171,"lodash/isArray":173}],13:[function(require,module,exports){ (function (global){ 'use strict'; @@ -1971,18653 +1988,5567 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":15,"_process":18,"inherits":14}],17:[function(require,module,exports){ -(function (process,global,setImmediate){ -/*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ -(function () { - - var async = {}; - function noop() {} - function identity(v) { - return v; - } - function toBool(v) { - return !!v; - } - function notId(v) { - return !v; - } +},{"./support/isBuffer":15,"_process":17,"inherits":14}],17:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; - // global on the server, window in the browser - var previous_async; +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - // Establish the root object, `window` (`self`) in the browser, `global` - // on the server, or `this` in some virtual machines. We use `self` - // instead of `window` for `WebWorker` support. - var root = typeof self === 'object' && self.self === self && self || - typeof global === 'object' && global.global === global && global || - this; +var cachedSetTimeout; +var cachedClearTimeout; - if (root != null) { - previous_async = root.async; +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - return function() { - if (fn === null) throw new Error("Callback was already called."); - fn.apply(this, arguments); - fn = null; - }; + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; } - - function _once(fn) { - return function() { - if (fn === null) return; - fn.apply(this, arguments); - fn = null; - }; +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); } - - //// cross-browser compatiblity functions //// - - var _toString = Object.prototype.toString; - - var _isArray = Array.isArray || function (obj) { - return _toString.call(obj) === '[object Array]'; - }; - - // Ported from underscore.js isObject - var _isObject = function(obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; - }; - - function _isArrayLike(arr) { - return _isArray(arr) || ( - // has a positive integer length property - typeof arr.length === "number" && - arr.length >= 0 && - arr.length % 1 === 0 - ); + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); } - - function _arrayEach(arr, iterator) { - var index = -1, - length = arr.length; - - while (++index < length) { - iterator(arr[index], index, arr); + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); } } - function _map(arr, iterator) { - var index = -1, - length = arr.length, - result = Array(length); - while (++index < length) { - result[index] = iterator(arr[index], index, arr); +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); } - return result; } - function _range(count) { - return _map(Array(count), function (v, i) { return i; }); - } - function _reduce(arr, iterator, memo) { - _arrayEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - } - function _forEachOf(object, iterator) { - _arrayEach(_keys(object), function (key) { - iterator(object[key], key); - }); +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); } +} - function _indexOf(arr, item) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] === item) return i; - } - return -1; +function drainQueue() { + if (draining) { + return; } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - var _keys = Object.keys || function (obj) { - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); } } - return keys; - }; - - function _keyIterator(coll) { - var i = -1; - var len; - var keys; - if (_isArrayLike(coll)) { - len = coll.length; - return function next() { - i++; - return i < len ? i : null; - }; - } else { - keys = _keys(coll); - len = keys.length; - return function next() { - i++; - return i < len ? keys[i] : null; - }; - } + queueIndex = -1; + len = queue.length; } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) - // This accumulates the arguments passed into an array, after a given index. - // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). - function _restParam(func, startIndex) { - startIndex = startIndex == null ? func.length - 1 : +startIndex; - return function() { - var length = Math.max(arguments.length - startIndex, 0); - var rest = Array(length); - for (var index = 0; index < length; index++) { - rest[index] = arguments[index + startIndex]; - } - switch (startIndex) { - case 0: return func.call(this, rest); - case 1: return func.call(this, arguments[0], rest); - } - // Currently unused but handle cases outside of the switch statement: - // var args = Array(startIndex + 1); - // for (index = 0; index < startIndex; index++) { - // args[index] = arguments[index]; - // } - // args[startIndex] = rest; - // return func.apply(this, args); - }; +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } } - - function _withoutIndex(iterator) { - return function (value, index, callback) { - return iterator(value, callback); - }; + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); } +}; - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; - // capture the global reference to guard against fakeTimer mocks - var _setImmediate = typeof setImmediate === 'function' && setImmediate; +function noop() {} - var _delay = _setImmediate ? function(fn) { - // not a direct alias for IE10 compatibility - _setImmediate(fn); - } : function(fn) { - setTimeout(fn, 0); - }; +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; - if (typeof process === 'object' && typeof process.nextTick === 'function') { - async.nextTick = process.nextTick; - } else { - async.nextTick = _delay; - } - async.setImmediate = _setImmediate ? _delay : async.nextTick; +process.listeners = function (name) { return [] } +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; - async.forEach = - async.each = function (arr, iterator, callback) { - return async.eachOf(arr, _withoutIndex(iterator), callback); - }; +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; - async.forEachSeries = - async.eachSeries = function (arr, iterator, callback) { - return async.eachOfSeries(arr, _withoutIndex(iterator), callback); - }; +},{}],18:[function(require,module,exports){ +var isFunction = require('is-function') +module.exports = forEach - async.forEachLimit = - async.eachLimit = function (arr, limit, iterator, callback) { - return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback); - }; +var toString = Object.prototype.toString +var hasOwnProperty = Object.prototype.hasOwnProperty - async.forEachOf = - async.eachOf = function (object, iterator, callback) { - callback = _once(callback || noop); - object = object || []; +function forEach(list, iterator, context) { + if (!isFunction(iterator)) { + throw new TypeError('iterator must be a function') + } - var iter = _keyIterator(object); - var key, completed = 0; + if (arguments.length < 3) { + context = this + } + + if (toString.call(list) === '[object Array]') + forEachArray(list, iterator, context) + else if (typeof list === 'string') + forEachString(list, iterator, context) + else + forEachObject(list, iterator, context) +} - while ((key = iter()) != null) { - completed += 1; - iterator(object[key], key, only_once(done)); +function forEachArray(array, iterator, context) { + for (var i = 0, len = array.length; i < len; i++) { + if (hasOwnProperty.call(array, i)) { + iterator.call(context, array[i], i, array) } + } +} - if (completed === 0) callback(null); - - function done(err) { - completed--; - if (err) { - callback(err); - } - // Check key is null in case iterator isn't exhausted - // and done resolved synchronously. - else if (key === null && completed <= 0) { - callback(null); - } - } - }; +function forEachString(string, iterator, context) { + for (var i = 0, len = string.length; i < len; i++) { + // no such thing as a sparse string. + iterator.call(context, string.charAt(i), i, string) + } +} - async.forEachOfSeries = - async.eachOfSeries = function (obj, iterator, callback) { - callback = _once(callback || noop); - obj = obj || []; - var nextKey = _keyIterator(obj); - var key = nextKey(); - function iterate() { - var sync = true; - if (key === null) { - return callback(null); - } - iterator(obj[key], key, only_once(function (err) { - if (err) { - callback(err); - } - else { - key = nextKey(); - if (key === null) { - return callback(null); - } else { - if (sync) { - async.setImmediate(iterate); - } else { - iterate(); - } - } - } - })); - sync = false; +function forEachObject(object, iterator, context) { + for (var k in object) { + if (hasOwnProperty.call(object, k)) { + iterator.call(context, object[k], k, object) } - iterate(); - }; - + } +} +},{"is-function":20}],19:[function(require,module,exports){ +(function (global){ +var win; - async.forEachOfLimit = - async.eachOfLimit = function (obj, limit, iterator, callback) { - _eachOfLimit(limit)(obj, iterator, callback); - }; +if (typeof window !== "undefined") { + win = window; +} else if (typeof global !== "undefined") { + win = global; +} else if (typeof self !== "undefined"){ + win = self; +} else { + win = {}; +} - function _eachOfLimit(limit) { +module.exports = win; - return function (obj, iterator, callback) { - callback = _once(callback || noop); - obj = obj || []; - var nextKey = _keyIterator(obj); - if (limit <= 0) { - return callback(null); - } - var done = false; - var running = 0; - var errored = false; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],20:[function(require,module,exports){ +module.exports = isFunction - (function replenish () { - if (done && running <= 0) { - return callback(null); - } +var toString = Object.prototype.toString - while (running < limit && !errored) { - var key = nextKey(); - if (key === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iterator(obj[key], key, only_once(function (err) { - running -= 1; - if (err) { - callback(err); - errored = true; - } - else { - replenish(); - } - })); - } - })(); - }; - } +function isFunction (fn) { + var string = toString.call(fn) + return string === '[object Function]' || + (typeof fn === 'function' && string !== '[object RegExp]') || + (typeof window !== 'undefined' && + // IE8 and below + (fn === window.setTimeout || + fn === window.alert || + fn === window.confirm || + fn === window.prompt)) +}; +},{}],21:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); - function doParallel(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOf, obj, iterator, callback); - }; - } - function doParallelLimit(fn) { - return function (obj, limit, iterator, callback) { - return fn(_eachOfLimit(limit), obj, iterator, callback); - }; - } - function doSeries(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOfSeries, obj, iterator, callback); - }; - } +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'); - function _asyncMap(eachfn, arr, iterator, callback) { - callback = _once(callback || noop); - arr = arr || []; - var results = _isArrayLike(arr) ? [] : {}; - eachfn(arr, function (value, index, callback) { - iterator(value, function (err, v) { - results[index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } +module.exports = DataView; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = doParallelLimit(_asyncMap); - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.inject = - async.foldl = - async.reduce = function (arr, memo, iterator, callback) { - async.eachOfSeries(arr, function (x, i, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; +},{"./_getNative":105,"./_root":148}],22:[function(require,module,exports){ +var hashClear = require('./_hashClear'), + hashDelete = require('./_hashDelete'), + hashGet = require('./_hashGet'), + hashHas = require('./_hashHas'), + hashSet = require('./_hashSet'); - async.foldr = - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, identity).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} - async.transform = function (arr, memo, iterator, callback) { - if (arguments.length === 3) { - callback = iterator; - iterator = memo; - memo = _isArray(arr) ? [] : {}; - } +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; - async.eachOf(arr, function(v, k, cb) { - iterator(memo, v, k, cb); - }, function(err) { - callback(err, memo); - }); - }; +module.exports = Hash; - function _filter(eachfn, arr, iterator, callback) { - var results = []; - eachfn(arr, function (x, index, callback) { - iterator(x, function (v) { - if (v) { - results.push({index: index, value: x}); - } - callback(); - }); - }, function () { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - } +},{"./_hashClear":113,"./_hashDelete":114,"./_hashGet":115,"./_hashHas":116,"./_hashSet":117}],23:[function(require,module,exports){ +var listCacheClear = require('./_listCacheClear'), + listCacheDelete = require('./_listCacheDelete'), + listCacheGet = require('./_listCacheGet'), + listCacheHas = require('./_listCacheHas'), + listCacheSet = require('./_listCacheSet'); - async.select = - async.filter = doParallel(_filter); +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} - async.selectLimit = - async.filterLimit = doParallelLimit(_filter); +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; - async.selectSeries = - async.filterSeries = doSeries(_filter); +module.exports = ListCache; - function _reject(eachfn, arr, iterator, callback) { - _filter(eachfn, arr, function(value, cb) { - iterator(value, function(v) { - cb(!v); - }); - }, callback); - } - async.reject = doParallel(_reject); - async.rejectLimit = doParallelLimit(_reject); - async.rejectSeries = doSeries(_reject); - - function _createTester(eachfn, check, getResult) { - return function(arr, limit, iterator, cb) { - function done() { - if (cb) cb(getResult(false, void 0)); - } - function iteratee(x, _, callback) { - if (!cb) return callback(); - iterator(x, function (v) { - if (cb && check(v)) { - cb(getResult(true, x)); - cb = iterator = false; - } - callback(); - }); - } - if (arguments.length > 3) { - eachfn(arr, limit, iteratee, done); - } else { - cb = iterator; - iterator = limit; - eachfn(arr, iteratee, done); - } - }; - } +},{"./_listCacheClear":128,"./_listCacheDelete":129,"./_listCacheGet":130,"./_listCacheHas":131,"./_listCacheSet":132}],24:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); - async.any = - async.some = _createTester(async.eachOf, toBool, identity); +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); - async.someLimit = _createTester(async.eachOfLimit, toBool, identity); +module.exports = Map; - async.all = - async.every = _createTester(async.eachOf, notId, notId); +},{"./_getNative":105,"./_root":148}],25:[function(require,module,exports){ +var mapCacheClear = require('./_mapCacheClear'), + mapCacheDelete = require('./_mapCacheDelete'), + mapCacheGet = require('./_mapCacheGet'), + mapCacheHas = require('./_mapCacheHas'), + mapCacheSet = require('./_mapCacheSet'); - async.everyLimit = _createTester(async.eachOfLimit, notId, notId); +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} - function _findGetResult(v, x) { - return x; - } - async.detect = _createTester(async.eachOf, identity, _findGetResult); - async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult); - async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult); +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - callback(null, _map(results.sort(comparator), function (x) { - return x.value; - })); - } +module.exports = MapCache; - }); +},{"./_mapCacheClear":133,"./_mapCacheDelete":134,"./_mapCacheGet":135,"./_mapCacheHas":136,"./_mapCacheSet":137}],26:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } - }; +/* Built-in method references that are verified to be native. */ +var Promise = getNative(root, 'Promise'); - async.auto = function (tasks, concurrency, callback) { - if (typeof arguments[1] === 'function') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = _once(callback || noop); - var keys = _keys(tasks); - var remainingTasks = keys.length; - if (!remainingTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = remainingTasks; - } +module.exports = Promise; - var results = {}; - var runningTasks = 0; +},{"./_getNative":105,"./_root":148}],27:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); - var hasError = false; +/* Built-in method references that are verified to be native. */ +var Set = getNative(root, 'Set'); - var listeners = []; - function addListener(fn) { - listeners.unshift(fn); - } - function removeListener(fn) { - var idx = _indexOf(listeners, fn); - if (idx >= 0) listeners.splice(idx, 1); - } - function taskComplete() { - remainingTasks--; - _arrayEach(listeners.slice(0), function (fn) { - fn(); - }); - } +module.exports = Set; - addListener(function () { - if (!remainingTasks) { - callback(null, results); - } - }); +},{"./_getNative":105,"./_root":148}],28:[function(require,module,exports){ +var MapCache = require('./_MapCache'), + setCacheAdd = require('./_setCacheAdd'), + setCacheHas = require('./_setCacheHas'); - _arrayEach(keys, function (k) { - if (hasError) return; - var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; - var taskCallback = _restParam(function(err, args) { - runningTasks--; - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _forEachOf(results, function(val, rkey) { - safeResults[rkey] = val; - }); - safeResults[k] = args; - hasError = true; +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; - callback(err, safeResults); - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }); - var requires = task.slice(0, task.length - 1); - // prevent dead-locks - var len = requires.length; - var dep; - while (len--) { - if (!(dep = tasks[requires[len]])) { - throw new Error('Has nonexistent dependency in ' + requires.join(', ')); - } - if (_isArray(dep) && _indexOf(dep, k) >= 0) { - throw new Error('Has cyclic dependencies'); - } - } - function ready() { - return runningTasks < concurrency && _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - } - if (ready()) { - runningTasks++; - task[task.length - 1](taskCallback, results); - } - else { - addListener(listener); - } - function listener() { - if (ready()) { - runningTasks++; - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - } - }); - }; + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; +module.exports = SetCache; - async.retry = function(times, task, callback) { - var DEFAULT_TIMES = 5; - var DEFAULT_INTERVAL = 0; +},{"./_MapCache":25,"./_setCacheAdd":149,"./_setCacheHas":150}],29:[function(require,module,exports){ +var ListCache = require('./_ListCache'), + stackClear = require('./_stackClear'), + stackDelete = require('./_stackDelete'), + stackGet = require('./_stackGet'), + stackHas = require('./_stackHas'), + stackSet = require('./_stackSet'); - var attempts = []; +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} - var opts = { - times: DEFAULT_TIMES, - interval: DEFAULT_INTERVAL - }; +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; - function parseTimes(acc, t){ - if(typeof t === 'number'){ - acc.times = parseInt(t, 10) || DEFAULT_TIMES; - } else if(typeof t === 'object'){ - acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; - acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; - } else { - throw new Error('Unsupported argument type for \'times\': ' + typeof t); - } - } +module.exports = Stack; - var length = arguments.length; - if (length < 1 || length > 3) { - throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)'); - } else if (length <= 2 && typeof times === 'function') { - callback = task; - task = times; - } - if (typeof times !== 'function') { - parseTimes(opts, times); - } - opts.callback = callback; - opts.task = task; - - function wrappedTask(wrappedCallback, wrappedResults) { - function retryAttempt(task, finalAttempt) { - return function(seriesCallback) { - task(function(err, result){ - seriesCallback(!err || finalAttempt, {err: err, result: result}); - }, wrappedResults); - }; - } +},{"./_ListCache":23,"./_stackClear":154,"./_stackDelete":155,"./_stackGet":156,"./_stackHas":157,"./_stackSet":158}],30:[function(require,module,exports){ +var root = require('./_root'); - function retryInterval(interval){ - return function(seriesCallback){ - setTimeout(function(){ - seriesCallback(null); - }, interval); - }; - } +/** Built-in value references. */ +var Symbol = root.Symbol; - while (opts.times) { +module.exports = Symbol; - var finalAttempt = !(opts.times-=1); - attempts.push(retryAttempt(opts.task, finalAttempt)); - if(!finalAttempt && opts.interval > 0){ - attempts.push(retryInterval(opts.interval)); - } - } +},{"./_root":148}],31:[function(require,module,exports){ +var root = require('./_root'); - async.series(attempts, function(done, data){ - data = data[data.length - 1]; - (wrappedCallback || opts.callback)(data.err, data.result); - }); - } +/** Built-in value references. */ +var Uint8Array = root.Uint8Array; - // If a callback is passed, run this as a controll flow - return opts.callback ? wrappedTask() : wrappedTask; - }; +module.exports = Uint8Array; - async.waterfall = function (tasks, callback) { - callback = _once(callback || noop); - if (!_isArray(tasks)) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - function wrapIterator(iterator) { - return _restParam(function (err, args) { - if (err) { - callback.apply(null, [err].concat(args)); - } - else { - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - ensureAsync(iterator).apply(null, args); - } - }); - } - wrapIterator(async.iterator(tasks))(); - }; +},{"./_root":148}],32:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); - function _parallel(eachfn, tasks, callback) { - callback = callback || noop; - var results = _isArrayLike(tasks) ? [] : {}; +/* Built-in method references that are verified to be native. */ +var WeakMap = getNative(root, 'WeakMap'); - eachfn(tasks, function (task, key, callback) { - task(_restParam(function (err, args) { - if (args.length <= 1) { - args = args[0]; - } - results[key] = args; - callback(err); - })); - }, function (err) { - callback(err, results); - }); - } +module.exports = WeakMap; - async.parallel = function (tasks, callback) { - _parallel(async.eachOf, tasks, callback); - }; +},{"./_getNative":105,"./_root":148}],33:[function(require,module,exports){ +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} - async.parallelLimit = function(tasks, limit, callback) { - _parallel(_eachOfLimit(limit), tasks, callback); - }; +module.exports = apply; - async.series = function(tasks, callback) { - _parallel(async.eachOfSeries, tasks, callback); - }; +},{}],34:[function(require,module,exports){ +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; - async.iterator = function (tasks) { - function makeCallback(index) { - function fn() { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - } - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - } - return makeCallback(0); - }; + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} - async.apply = _restParam(function (fn, args) { - return _restParam(function (callArgs) { - return fn.apply( - null, args.concat(callArgs) - ); - }); - }); +module.exports = arrayEach; - function _concat(eachfn, arr, fn, callback) { - var result = []; - eachfn(arr, function (x, index, cb) { - fn(x, function (err, y) { - result = result.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, result); - }); +},{}],35:[function(require,module,exports){ +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; } - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); + } + return result; +} - async.whilst = function (test, iterator, callback) { - callback = callback || noop; - if (test()) { - var next = _restParam(function(err, args) { - if (err) { - callback(err); - } else if (test.apply(this, args)) { - iterator(next); - } else { - callback.apply(null, [null].concat(args)); - } - }); - iterator(next); - } else { - callback(null); - } - }; +module.exports = arrayFilter; - async.doWhilst = function (iterator, test, callback) { - var calls = 0; - return async.whilst(function() { - return ++calls <= 1 || test.apply(this, arguments); - }, iterator, callback); - }; +},{}],36:[function(require,module,exports){ +var baseTimes = require('./_baseTimes'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isIndex = require('./_isIndex'), + isTypedArray = require('./isTypedArray'); - async.until = function (test, iterator, callback) { - return async.whilst(function() { - return !test.apply(this, arguments); - }, iterator, callback); - }; +/** Used for built-in method references. */ +var objectProto = Object.prototype; - async.doUntil = function (iterator, test, callback) { - return async.doWhilst(iterator, function() { - return !test.apply(this, arguments); - }, callback); - }; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - async.during = function (test, iterator, callback) { - callback = callback || noop; +/** + * 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. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} - var next = _restParam(function(err, args) { - if (err) { - callback(err); - } else { - args.push(check); - test.apply(this, args); - } - }); +module.exports = arrayLikeKeys; - var check = function(err, truth) { - if (err) { - callback(err); - } else if (truth) { - iterator(next); - } else { - callback(null); - } - }; +},{"./_baseTimes":75,"./_isIndex":121,"./isArguments":172,"./isArray":173,"./isBuffer":175,"./isTypedArray":187}],37:[function(require,module,exports){ +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); - test(check); - }; + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} - async.doDuring = function (iterator, test, callback) { - var calls = 0; - async.during(function(next) { - if (calls++ < 1) { - next(null, true); - } else { - test.apply(this, arguments); - } - }, iterator, callback); - }; +module.exports = arrayMap; - function _queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } - else if(concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } - function _insert(q, data, pos, callback) { - if (callback != null && typeof callback !== "function") { - throw new Error("task callback must be a function"); - } - q.started = true; - if (!_isArray(data)) { - data = [data]; - } - if(data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - q.drain(); - }); - } - _arrayEach(data, function(task) { - var item = { - data: task, - callback: callback || noop - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } +},{}],38:[function(require,module,exports){ +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; - if (q.tasks.length === q.concurrency) { - q.saturated(); - } - }); - async.setImmediate(q.process); - } - function _next(q, tasks) { - return function(){ - workers -= 1; - - var removed = false; - var args = arguments; - _arrayEach(tasks, function (task) { - _arrayEach(workersList, function (worker, index) { - if (worker === task && !removed) { - workersList.splice(index, 1); - removed = true; - } - }); + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} - task.callback.apply(task, args); - }); - if (q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - } +module.exports = arrayPush; - var workers = 0; - var workersList = []; - var q = { - tasks: [], - concurrency: concurrency, - payload: payload, - saturated: noop, - empty: noop, - drain: noop, - started: false, - paused: false, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - kill: function () { - q.drain = noop; - q.tasks = []; - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - while(!q.paused && workers < q.concurrency && q.tasks.length){ - - var tasks = q.payload ? - q.tasks.splice(0, q.payload) : - q.tasks.splice(0, q.tasks.length); - - var data = _map(tasks, function (task) { - return task.data; - }); +},{}],39:[function(require,module,exports){ +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; - if (q.tasks.length === 0) { - q.empty(); - } - workers += 1; - workersList.push(tasks[0]); - var cb = only_once(_next(q, tasks)); - worker(data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - }, - workersList: function () { - return workersList; - }, - idle: function() { - return q.tasks.length + workers === 0; - }, - pause: function () { - q.paused = true; - }, - resume: function () { - if (q.paused === false) { return; } - q.paused = false; - var resumeCount = Math.min(q.concurrency, q.tasks.length); - // Need to call q.process once per concurrent - // worker to preserve full concurrency after pause - for (var w = 1; w <= resumeCount; w++) { - async.setImmediate(q.process); - } - } - }; - return q; + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; } + } + return false; +} - async.queue = function (worker, concurrency) { - var q = _queue(function (items, cb) { - worker(items[0], cb); - }, concurrency, 1); - - return q; - }; +module.exports = arraySome; - async.priorityQueue = function (worker, concurrency) { +},{}],40:[function(require,module,exports){ +var baseAssignValue = require('./_baseAssignValue'), + eq = require('./eq'); - function _compareTasks(a, b){ - return a.priority - b.priority; - } +/** Used for built-in method references. */ +var objectProto = Object.prototype; - function _binarySearch(sequence, item, compare) { - var beg = -1, - end = sequence.length - 1; - while (beg < end) { - var mid = beg + ((end - beg + 1) >>> 1); - if (compare(item, sequence[mid]) >= 0) { - beg = mid; - } else { - end = mid - 1; - } - } - return beg; - } +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - function _insert(q, data, priority, callback) { - if (callback != null && typeof callback !== "function") { - throw new Error("task callback must be a function"); - } - q.started = true; - if (!_isArray(data)) { - data = [data]; - } - if(data.length === 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - q.drain(); - }); - } - _arrayEach(data, function(task) { - var item = { - data: task, - priority: priority, - callback: typeof callback === 'function' ? callback : noop - }; +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} - q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); +module.exports = assignValue; - if (q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } +},{"./_baseAssignValue":44,"./eq":166}],41:[function(require,module,exports){ +var eq = require('./eq'); - // Start with a normal queue - var q = async.queue(worker, concurrency); +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} - // Override push to accept second parameter representing priority - q.push = function (data, priority, callback) { - _insert(q, data, priority, callback); - }; +module.exports = assocIndexOf; - // Remove unshift function - delete q.unshift; +},{"./eq":166}],42:[function(require,module,exports){ +var copyObject = require('./_copyObject'), + keys = require('./keys'); - return q; - }; +/** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ +function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); +} - async.cargo = function (worker, payload) { - return _queue(worker, 1, payload); - }; +module.exports = baseAssign; - function _console_fn(name) { - return _restParam(function (fn, args) { - fn.apply(null, args.concat([_restParam(function (err, args) { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _arrayEach(args, function (x) { - console[name](x); - }); - } - } - })])); - }); - } - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - var has = Object.prototype.hasOwnProperty; - hasher = hasher || identity; - var memoized = _restParam(function memoized(args) { - var callback = args.pop(); - var key = hasher.apply(null, args); - if (has.call(memo, key)) { - async.setImmediate(function () { - callback.apply(null, memo[key]); - }); - } - else if (has.call(queues, key)) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([_restParam(function (args) { - memo[key] = args; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, args); - } - })])); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; +},{"./_copyObject":89,"./keys":188}],43:[function(require,module,exports){ +var copyObject = require('./_copyObject'), + keysIn = require('./keysIn'); - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; +/** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ +function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); +} - function _times(mapper) { - return function (count, iterator, callback) { - mapper(_range(count), iterator, callback); - }; - } +module.exports = baseAssignIn; - async.times = _times(async.map); - async.timesSeries = _times(async.mapSeries); - async.timesLimit = function (count, limit, iterator, callback) { - return async.mapLimit(_range(count), limit, iterator, callback); - }; +},{"./_copyObject":89,"./keysIn":189}],44:[function(require,module,exports){ +var defineProperty = require('./_defineProperty'); - async.seq = function (/* functions... */) { - var fns = arguments; - return _restParam(function (args) { - var that = this; +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} - var callback = args[args.length - 1]; - if (typeof callback == 'function') { - args.pop(); - } else { - callback = noop; - } +module.exports = baseAssignValue; + +},{"./_defineProperty":96}],45:[function(require,module,exports){ +var Stack = require('./_Stack'), + arrayEach = require('./_arrayEach'), + assignValue = require('./_assignValue'), + baseAssign = require('./_baseAssign'), + baseAssignIn = require('./_baseAssignIn'), + cloneBuffer = require('./_cloneBuffer'), + copyArray = require('./_copyArray'), + copySymbols = require('./_copySymbols'), + copySymbolsIn = require('./_copySymbolsIn'), + getAllKeys = require('./_getAllKeys'), + getAllKeysIn = require('./_getAllKeysIn'), + getTag = require('./_getTag'), + initCloneArray = require('./_initCloneArray'), + initCloneByTag = require('./_initCloneByTag'), + initCloneObject = require('./_initCloneObject'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isMap = require('./isMap'), + isObject = require('./isObject'), + isSet = require('./isSet'), + keys = require('./keys'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values supported by `_.clone`. */ +var cloneableTags = {}; +cloneableTags[argsTag] = cloneableTags[arrayTag] = +cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = +cloneableTags[boolTag] = cloneableTags[dateTag] = +cloneableTags[float32Tag] = cloneableTags[float64Tag] = +cloneableTags[int8Tag] = cloneableTags[int16Tag] = +cloneableTags[int32Tag] = cloneableTags[mapTag] = +cloneableTags[numberTag] = cloneableTags[objectTag] = +cloneableTags[regexpTag] = cloneableTags[setTag] = +cloneableTags[stringTag] = cloneableTags[symbolTag] = +cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = +cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; +cloneableTags[errorTag] = cloneableTags[funcTag] = +cloneableTags[weakMapTag] = false; - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([_restParam(function (err, nextargs) { - cb(err, nextargs); - })])); - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }); - }; +/** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ +function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; - async.compose = function (/* functions... */) { - return async.seq.apply(null, Array.prototype.reverse.call(arguments)); - }; + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); - function _applyEach(eachfn) { - return _restParam(function(fns, args) { - var go = _restParam(function(args) { - var that = this; - var callback = args.pop(); - return eachfn(fns, function (fn, _, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }); - if (args.length) { - return go.apply(this, args); - } - else { - return go; - } - }); - } + return result; + } - async.applyEach = _applyEach(async.eachOf); - async.applyEachSeries = _applyEach(async.eachOfSeries); + if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } - async.forever = function (fn, callback) { - var done = only_once(callback || noop); - var task = ensureAsync(fn); - function next(err) { - if (err) { - return done(err); - } - task(next); - } - next(); - }; + var keysFunc = isFull + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); - function ensureAsync(fn) { - return _restParam(function (args) { - var callback = args.pop(); - args.push(function () { - var innerArgs = arguments; - if (sync) { - async.setImmediate(function () { - callback.apply(null, innerArgs); - }); - } else { - callback.apply(null, innerArgs); - } - }); - var sync = true; - fn.apply(this, args); - sync = false; - }); + var props = isArr ? undefined : keysFunc(value); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; +} - async.ensureAsync = ensureAsync; +module.exports = baseClone; - async.constant = _restParam(function(values) { - var args = [null].concat(values); - return function (callback) { - return callback.apply(this, args); - }; - }); +},{"./_Stack":29,"./_arrayEach":34,"./_assignValue":40,"./_baseAssign":42,"./_baseAssignIn":43,"./_cloneBuffer":83,"./_copyArray":88,"./_copySymbols":90,"./_copySymbolsIn":91,"./_getAllKeys":101,"./_getAllKeysIn":102,"./_getTag":110,"./_initCloneArray":118,"./_initCloneByTag":119,"./_initCloneObject":120,"./isArray":173,"./isBuffer":175,"./isMap":178,"./isObject":181,"./isSet":184,"./keys":188}],46:[function(require,module,exports){ +var isObject = require('./isObject'); - async.wrapSync = - async.asyncify = function asyncify(func) { - return _restParam(function (args) { - var callback = args.pop(); - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (_isObject(result) && typeof result.then === "function") { - result.then(function(value) { - callback(null, value); - })["catch"](function(err) { - callback(err.message ? err : new Error(err)); - }); - } else { - callback(null, result); - } - }); - }; +/** Built-in value references. */ +var objectCreate = Object.create; - // Node.js - if (typeof module === 'object' && module.exports) { - module.exports = async; - } - // AMD / RequireJS - else if (typeof define === 'function' && define.amd) { - define([], function () { - return async; - }); +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ +var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; } - // included directly via