mapbox-gl-rails 2.6.1 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mapbox-gl-compare.js +1 -1
- data/app/assets/javascripts/mapbox-gl-directions.js +762 -125
- data/app/assets/javascripts/mapbox-gl-draw.js +2 -1
- data/app/assets/javascripts/mapbox-gl-geocoder.js +2 -2
- data/app/assets/javascripts/mapbox-gl.js +42896 -41216
- data/app/assets/stylesheets/mapbox-gl-compare.scss +24 -1
- data/app/assets/stylesheets/mapbox-gl-geocoder.scss +1 -1
- data/lib/mapbox-gl/rails/version.rb +2 -2
- data/plugins.yaml +4 -4
- metadata +2 -2
@@ -119,7 +119,8 @@ polyline.encode = function(coordinates, precision) {
|
|
119
119
|
function flipped(coords) {
|
120
120
|
var flipped = [];
|
121
121
|
for (var i = 0; i < coords.length; i++) {
|
122
|
-
|
122
|
+
var coord = coords[i].slice();
|
123
|
+
flipped.push([coord[1], coord[0]]);
|
123
124
|
}
|
124
125
|
return flipped;
|
125
126
|
}
|
@@ -2938,9 +2939,9 @@ module.exports = isEqual;
|
|
2938
2939
|
},{}],9:[function(require,module,exports){
|
2939
2940
|
(function (global){
|
2940
2941
|
/**
|
2941
|
-
*
|
2942
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
2942
2943
|
* Build: `lodash modularize exports="npm" -o ./`
|
2943
|
-
* Copyright
|
2944
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
2944
2945
|
* Released under MIT license <https://lodash.com/license>
|
2945
2946
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
2946
2947
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
@@ -2948,28 +2949,68 @@ module.exports = isEqual;
|
|
2948
2949
|
var reInterpolate = require('lodash._reinterpolate'),
|
2949
2950
|
templateSettings = require('lodash.templatesettings');
|
2950
2951
|
|
2952
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
2953
|
+
var HOT_COUNT = 800,
|
2954
|
+
HOT_SPAN = 16;
|
2955
|
+
|
2951
2956
|
/** Used as references for various `Number` constants. */
|
2952
2957
|
var INFINITY = 1 / 0,
|
2953
2958
|
MAX_SAFE_INTEGER = 9007199254740991;
|
2954
2959
|
|
2955
2960
|
/** `Object#toString` result references. */
|
2956
2961
|
var argsTag = '[object Arguments]',
|
2962
|
+
arrayTag = '[object Array]',
|
2963
|
+
asyncTag = '[object AsyncFunction]',
|
2964
|
+
boolTag = '[object Boolean]',
|
2965
|
+
dateTag = '[object Date]',
|
2966
|
+
domExcTag = '[object DOMException]',
|
2957
2967
|
errorTag = '[object Error]',
|
2958
2968
|
funcTag = '[object Function]',
|
2959
2969
|
genTag = '[object GeneratorFunction]',
|
2960
|
-
|
2970
|
+
mapTag = '[object Map]',
|
2971
|
+
numberTag = '[object Number]',
|
2972
|
+
nullTag = '[object Null]',
|
2973
|
+
objectTag = '[object Object]',
|
2974
|
+
proxyTag = '[object Proxy]',
|
2975
|
+
regexpTag = '[object RegExp]',
|
2976
|
+
setTag = '[object Set]',
|
2977
|
+
stringTag = '[object String]',
|
2978
|
+
symbolTag = '[object Symbol]',
|
2979
|
+
undefinedTag = '[object Undefined]',
|
2980
|
+
weakMapTag = '[object WeakMap]';
|
2981
|
+
|
2982
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
2983
|
+
dataViewTag = '[object DataView]',
|
2984
|
+
float32Tag = '[object Float32Array]',
|
2985
|
+
float64Tag = '[object Float64Array]',
|
2986
|
+
int8Tag = '[object Int8Array]',
|
2987
|
+
int16Tag = '[object Int16Array]',
|
2988
|
+
int32Tag = '[object Int32Array]',
|
2989
|
+
uint8Tag = '[object Uint8Array]',
|
2990
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
2991
|
+
uint16Tag = '[object Uint16Array]',
|
2992
|
+
uint32Tag = '[object Uint32Array]';
|
2961
2993
|
|
2962
2994
|
/** Used to match empty string literals in compiled template source. */
|
2963
2995
|
var reEmptyStringLeading = /\b__p \+= '';/g,
|
2964
2996
|
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
2965
2997
|
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
2966
2998
|
|
2999
|
+
/**
|
3000
|
+
* Used to match `RegExp`
|
3001
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
3002
|
+
*/
|
3003
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
3004
|
+
|
2967
3005
|
/**
|
2968
3006
|
* Used to match
|
2969
3007
|
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
2970
3008
|
*/
|
2971
3009
|
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
2972
3010
|
|
3011
|
+
/** Used to detect host constructors (Safari). */
|
3012
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
3013
|
+
|
2973
3014
|
/** Used to detect unsigned integer values. */
|
2974
3015
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
2975
3016
|
|
@@ -2979,6 +3020,22 @@ var reNoMatch = /($^)/;
|
|
2979
3020
|
/** Used to match unescaped characters in compiled string literals. */
|
2980
3021
|
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
2981
3022
|
|
3023
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
3024
|
+
var typedArrayTags = {};
|
3025
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
3026
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
3027
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
3028
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
3029
|
+
typedArrayTags[uint32Tag] = true;
|
3030
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
3031
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
3032
|
+
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
3033
|
+
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
3034
|
+
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
3035
|
+
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
3036
|
+
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
3037
|
+
typedArrayTags[weakMapTag] = false;
|
3038
|
+
|
2982
3039
|
/** Used to escape characters for inclusion in compiled string literals. */
|
2983
3040
|
var stringEscapes = {
|
2984
3041
|
'\\': '\\',
|
@@ -2998,6 +3055,36 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self
|
|
2998
3055
|
/** Used as a reference to the global object. */
|
2999
3056
|
var root = freeGlobal || freeSelf || Function('return this')();
|
3000
3057
|
|
3058
|
+
/** Detect free variable `exports`. */
|
3059
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
3060
|
+
|
3061
|
+
/** Detect free variable `module`. */
|
3062
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
3063
|
+
|
3064
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
3065
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
3066
|
+
|
3067
|
+
/** Detect free variable `process` from Node.js. */
|
3068
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
3069
|
+
|
3070
|
+
/** Used to access faster Node.js helpers. */
|
3071
|
+
var nodeUtil = (function() {
|
3072
|
+
try {
|
3073
|
+
// Use `util.types` for Node.js 10+.
|
3074
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
3075
|
+
|
3076
|
+
if (types) {
|
3077
|
+
return types;
|
3078
|
+
}
|
3079
|
+
|
3080
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
3081
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
3082
|
+
} catch (e) {}
|
3083
|
+
}());
|
3084
|
+
|
3085
|
+
/* Node.js helper references. */
|
3086
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
3087
|
+
|
3001
3088
|
/**
|
3002
3089
|
* A faster alternative to `Function#apply`, this function invokes `func`
|
3003
3090
|
* with the `this` binding of `thisArg` and the arguments of `args`.
|
@@ -3029,7 +3116,7 @@ function apply(func, thisArg, args) {
|
|
3029
3116
|
*/
|
3030
3117
|
function arrayMap(array, iteratee) {
|
3031
3118
|
var index = -1,
|
3032
|
-
length = array ? array.length
|
3119
|
+
length = array == null ? 0 : array.length,
|
3033
3120
|
result = Array(length);
|
3034
3121
|
|
3035
3122
|
while (++index < length) {
|
@@ -3057,6 +3144,19 @@ function baseTimes(n, iteratee) {
|
|
3057
3144
|
return result;
|
3058
3145
|
}
|
3059
3146
|
|
3147
|
+
/**
|
3148
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
3149
|
+
*
|
3150
|
+
* @private
|
3151
|
+
* @param {Function} func The function to cap arguments for.
|
3152
|
+
* @returns {Function} Returns the new capped function.
|
3153
|
+
*/
|
3154
|
+
function baseUnary(func) {
|
3155
|
+
return function(value) {
|
3156
|
+
return func(value);
|
3157
|
+
};
|
3158
|
+
}
|
3159
|
+
|
3060
3160
|
/**
|
3061
3161
|
* The base implementation of `_.values` and `_.valuesIn` which creates an
|
3062
3162
|
* array of `object` property values corresponding to the property names
|
@@ -3084,6 +3184,18 @@ function escapeStringChar(chr) {
|
|
3084
3184
|
return '\\' + stringEscapes[chr];
|
3085
3185
|
}
|
3086
3186
|
|
3187
|
+
/**
|
3188
|
+
* Gets the value at `key` of `object`.
|
3189
|
+
*
|
3190
|
+
* @private
|
3191
|
+
* @param {Object} [object] The object to query.
|
3192
|
+
* @param {string} key The key of the property to get.
|
3193
|
+
* @returns {*} Returns the property value.
|
3194
|
+
*/
|
3195
|
+
function getValue(object, key) {
|
3196
|
+
return object == null ? undefined : object[key];
|
3197
|
+
}
|
3198
|
+
|
3087
3199
|
/**
|
3088
3200
|
* Creates a unary function that invokes `func` with its argument transformed.
|
3089
3201
|
*
|
@@ -3099,25 +3211,60 @@ function overArg(func, transform) {
|
|
3099
3211
|
}
|
3100
3212
|
|
3101
3213
|
/** Used for built-in method references. */
|
3102
|
-
var
|
3214
|
+
var funcProto = Function.prototype,
|
3215
|
+
objectProto = Object.prototype;
|
3216
|
+
|
3217
|
+
/** Used to detect overreaching core-js shims. */
|
3218
|
+
var coreJsData = root['__core-js_shared__'];
|
3219
|
+
|
3220
|
+
/** Used to resolve the decompiled source of functions. */
|
3221
|
+
var funcToString = funcProto.toString;
|
3103
3222
|
|
3104
3223
|
/** Used to check objects for own properties. */
|
3105
3224
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
3106
3225
|
|
3226
|
+
/** Used to detect methods masquerading as native. */
|
3227
|
+
var maskSrcKey = (function() {
|
3228
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
3229
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
3230
|
+
}());
|
3231
|
+
|
3107
3232
|
/**
|
3108
3233
|
* Used to resolve the
|
3109
3234
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
3110
3235
|
* of values.
|
3111
3236
|
*/
|
3112
|
-
var
|
3237
|
+
var nativeObjectToString = objectProto.toString;
|
3238
|
+
|
3239
|
+
/** Used to infer the `Object` constructor. */
|
3240
|
+
var objectCtorString = funcToString.call(Object);
|
3241
|
+
|
3242
|
+
/** Used to detect if a method is native. */
|
3243
|
+
var reIsNative = RegExp('^' +
|
3244
|
+
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
3245
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
3246
|
+
);
|
3113
3247
|
|
3114
3248
|
/** Built-in value references. */
|
3115
|
-
var
|
3116
|
-
|
3249
|
+
var Buffer = moduleExports ? root.Buffer : undefined,
|
3250
|
+
Symbol = root.Symbol,
|
3251
|
+
getPrototype = overArg(Object.getPrototypeOf, Object),
|
3252
|
+
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
3253
|
+
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
3254
|
+
|
3255
|
+
var defineProperty = (function() {
|
3256
|
+
try {
|
3257
|
+
var func = getNative(Object, 'defineProperty');
|
3258
|
+
func({}, '', {});
|
3259
|
+
return func;
|
3260
|
+
} catch (e) {}
|
3261
|
+
}());
|
3117
3262
|
|
3118
3263
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
3119
|
-
var
|
3120
|
-
|
3264
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
3265
|
+
nativeKeys = overArg(Object.keys, Object),
|
3266
|
+
nativeMax = Math.max,
|
3267
|
+
nativeNow = Date.now;
|
3121
3268
|
|
3122
3269
|
/** Used to convert symbols to primitives and strings. */
|
3123
3270
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
@@ -3132,18 +3279,26 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
3132
3279
|
* @returns {Array} Returns the array of property names.
|
3133
3280
|
*/
|
3134
3281
|
function arrayLikeKeys(value, inherited) {
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
skipIndexes = !!length;
|
3282
|
+
var isArr = isArray(value),
|
3283
|
+
isArg = !isArr && isArguments(value),
|
3284
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
3285
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
3286
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
3287
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
3288
|
+
length = result.length;
|
3143
3289
|
|
3144
3290
|
for (var key in value) {
|
3145
3291
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
3146
|
-
!(skipIndexes && (
|
3292
|
+
!(skipIndexes && (
|
3293
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
3294
|
+
key == 'length' ||
|
3295
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
3296
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
3297
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
3298
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
3299
|
+
// Skip index properties.
|
3300
|
+
isIndex(key, length)
|
3301
|
+
))) {
|
3147
3302
|
result.push(key);
|
3148
3303
|
}
|
3149
3304
|
}
|
@@ -3151,41 +3306,100 @@ function arrayLikeKeys(value, inherited) {
|
|
3151
3306
|
}
|
3152
3307
|
|
3153
3308
|
/**
|
3154
|
-
*
|
3309
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
3310
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
3311
|
+
* for equality comparisons.
|
3155
3312
|
*
|
3156
3313
|
* @private
|
3157
|
-
* @param {
|
3158
|
-
* @param {*} srcValue The source value.
|
3314
|
+
* @param {Object} object The object to modify.
|
3159
3315
|
* @param {string} key The key of the property to assign.
|
3160
|
-
* @param {
|
3161
|
-
* @returns {*} Returns the value to assign.
|
3316
|
+
* @param {*} value The value to assign.
|
3162
3317
|
*/
|
3163
|
-
function
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3318
|
+
function assignValue(object, key, value) {
|
3319
|
+
var objValue = object[key];
|
3320
|
+
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
3321
|
+
(value === undefined && !(key in object))) {
|
3322
|
+
baseAssignValue(object, key, value);
|
3167
3323
|
}
|
3168
|
-
return objValue;
|
3169
3324
|
}
|
3170
3325
|
|
3171
3326
|
/**
|
3172
|
-
*
|
3173
|
-
*
|
3174
|
-
* for equality comparisons.
|
3327
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
3328
|
+
* value checks.
|
3175
3329
|
*
|
3176
3330
|
* @private
|
3177
3331
|
* @param {Object} object The object to modify.
|
3178
3332
|
* @param {string} key The key of the property to assign.
|
3179
3333
|
* @param {*} value The value to assign.
|
3180
3334
|
*/
|
3181
|
-
function
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3335
|
+
function baseAssignValue(object, key, value) {
|
3336
|
+
if (key == '__proto__' && defineProperty) {
|
3337
|
+
defineProperty(object, key, {
|
3338
|
+
'configurable': true,
|
3339
|
+
'enumerable': true,
|
3340
|
+
'value': value,
|
3341
|
+
'writable': true
|
3342
|
+
});
|
3343
|
+
} else {
|
3185
3344
|
object[key] = value;
|
3186
3345
|
}
|
3187
3346
|
}
|
3188
3347
|
|
3348
|
+
/**
|
3349
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
3350
|
+
*
|
3351
|
+
* @private
|
3352
|
+
* @param {*} value The value to query.
|
3353
|
+
* @returns {string} Returns the `toStringTag`.
|
3354
|
+
*/
|
3355
|
+
function baseGetTag(value) {
|
3356
|
+
if (value == null) {
|
3357
|
+
return value === undefined ? undefinedTag : nullTag;
|
3358
|
+
}
|
3359
|
+
return (symToStringTag && symToStringTag in Object(value))
|
3360
|
+
? getRawTag(value)
|
3361
|
+
: objectToString(value);
|
3362
|
+
}
|
3363
|
+
|
3364
|
+
/**
|
3365
|
+
* The base implementation of `_.isArguments`.
|
3366
|
+
*
|
3367
|
+
* @private
|
3368
|
+
* @param {*} value The value to check.
|
3369
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
3370
|
+
*/
|
3371
|
+
function baseIsArguments(value) {
|
3372
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
3373
|
+
}
|
3374
|
+
|
3375
|
+
/**
|
3376
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
3377
|
+
*
|
3378
|
+
* @private
|
3379
|
+
* @param {*} value The value to check.
|
3380
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
3381
|
+
* else `false`.
|
3382
|
+
*/
|
3383
|
+
function baseIsNative(value) {
|
3384
|
+
if (!isObject(value) || isMasked(value)) {
|
3385
|
+
return false;
|
3386
|
+
}
|
3387
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
3388
|
+
return pattern.test(toSource(value));
|
3389
|
+
}
|
3390
|
+
|
3391
|
+
/**
|
3392
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
3393
|
+
*
|
3394
|
+
* @private
|
3395
|
+
* @param {*} value The value to check.
|
3396
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
3397
|
+
*/
|
3398
|
+
function baseIsTypedArray(value) {
|
3399
|
+
return isObjectLike(value) &&
|
3400
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
3401
|
+
}
|
3402
|
+
|
3189
3403
|
/**
|
3190
3404
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
3191
3405
|
*
|
@@ -3237,26 +3451,26 @@ function baseKeysIn(object) {
|
|
3237
3451
|
* @returns {Function} Returns the new function.
|
3238
3452
|
*/
|
3239
3453
|
function baseRest(func, start) {
|
3240
|
-
|
3241
|
-
return function() {
|
3242
|
-
var args = arguments,
|
3243
|
-
index = -1,
|
3244
|
-
length = nativeMax(args.length - start, 0),
|
3245
|
-
array = Array(length);
|
3246
|
-
|
3247
|
-
while (++index < length) {
|
3248
|
-
array[index] = args[start + index];
|
3249
|
-
}
|
3250
|
-
index = -1;
|
3251
|
-
var otherArgs = Array(start + 1);
|
3252
|
-
while (++index < start) {
|
3253
|
-
otherArgs[index] = args[index];
|
3254
|
-
}
|
3255
|
-
otherArgs[start] = array;
|
3256
|
-
return apply(func, this, otherArgs);
|
3257
|
-
};
|
3454
|
+
return setToString(overRest(func, start, identity), func + '');
|
3258
3455
|
}
|
3259
3456
|
|
3457
|
+
/**
|
3458
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
3459
|
+
*
|
3460
|
+
* @private
|
3461
|
+
* @param {Function} func The function to modify.
|
3462
|
+
* @param {Function} string The `toString` result.
|
3463
|
+
* @returns {Function} Returns `func`.
|
3464
|
+
*/
|
3465
|
+
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
3466
|
+
return defineProperty(func, 'toString', {
|
3467
|
+
'configurable': true,
|
3468
|
+
'enumerable': false,
|
3469
|
+
'value': constant(string),
|
3470
|
+
'writable': true
|
3471
|
+
});
|
3472
|
+
};
|
3473
|
+
|
3260
3474
|
/**
|
3261
3475
|
* The base implementation of `_.toString` which doesn't convert nullish
|
3262
3476
|
* values to empty strings.
|
@@ -3270,6 +3484,10 @@ function baseToString(value) {
|
|
3270
3484
|
if (typeof value == 'string') {
|
3271
3485
|
return value;
|
3272
3486
|
}
|
3487
|
+
if (isArray(value)) {
|
3488
|
+
// Recursively convert values (susceptible to call stack limits).
|
3489
|
+
return arrayMap(value, baseToString) + '';
|
3490
|
+
}
|
3273
3491
|
if (isSymbol(value)) {
|
3274
3492
|
return symbolToString ? symbolToString.call(value) : '';
|
3275
3493
|
}
|
@@ -3288,6 +3506,7 @@ function baseToString(value) {
|
|
3288
3506
|
* @returns {Object} Returns `object`.
|
3289
3507
|
*/
|
3290
3508
|
function copyObject(source, props, object, customizer) {
|
3509
|
+
var isNew = !object;
|
3291
3510
|
object || (object = {});
|
3292
3511
|
|
3293
3512
|
var index = -1,
|
@@ -3300,7 +3519,14 @@ function copyObject(source, props, object, customizer) {
|
|
3300
3519
|
? customizer(object[key], source[key], key, object, source)
|
3301
3520
|
: undefined;
|
3302
3521
|
|
3303
|
-
|
3522
|
+
if (newValue === undefined) {
|
3523
|
+
newValue = source[key];
|
3524
|
+
}
|
3525
|
+
if (isNew) {
|
3526
|
+
baseAssignValue(object, key, newValue);
|
3527
|
+
} else {
|
3528
|
+
assignValue(object, key, newValue);
|
3529
|
+
}
|
3304
3530
|
}
|
3305
3531
|
return object;
|
3306
3532
|
}
|
@@ -3338,6 +3564,66 @@ function createAssigner(assigner) {
|
|
3338
3564
|
});
|
3339
3565
|
}
|
3340
3566
|
|
3567
|
+
/**
|
3568
|
+
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
3569
|
+
* of source objects to the destination object for all destination properties
|
3570
|
+
* that resolve to `undefined`.
|
3571
|
+
*
|
3572
|
+
* @private
|
3573
|
+
* @param {*} objValue The destination value.
|
3574
|
+
* @param {*} srcValue The source value.
|
3575
|
+
* @param {string} key The key of the property to assign.
|
3576
|
+
* @param {Object} object The parent object of `objValue`.
|
3577
|
+
* @returns {*} Returns the value to assign.
|
3578
|
+
*/
|
3579
|
+
function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
3580
|
+
if (objValue === undefined ||
|
3581
|
+
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
3582
|
+
return srcValue;
|
3583
|
+
}
|
3584
|
+
return objValue;
|
3585
|
+
}
|
3586
|
+
|
3587
|
+
/**
|
3588
|
+
* Gets the native function at `key` of `object`.
|
3589
|
+
*
|
3590
|
+
* @private
|
3591
|
+
* @param {Object} object The object to query.
|
3592
|
+
* @param {string} key The key of the method to get.
|
3593
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
3594
|
+
*/
|
3595
|
+
function getNative(object, key) {
|
3596
|
+
var value = getValue(object, key);
|
3597
|
+
return baseIsNative(value) ? value : undefined;
|
3598
|
+
}
|
3599
|
+
|
3600
|
+
/**
|
3601
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
3602
|
+
*
|
3603
|
+
* @private
|
3604
|
+
* @param {*} value The value to query.
|
3605
|
+
* @returns {string} Returns the raw `toStringTag`.
|
3606
|
+
*/
|
3607
|
+
function getRawTag(value) {
|
3608
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
3609
|
+
tag = value[symToStringTag];
|
3610
|
+
|
3611
|
+
try {
|
3612
|
+
value[symToStringTag] = undefined;
|
3613
|
+
var unmasked = true;
|
3614
|
+
} catch (e) {}
|
3615
|
+
|
3616
|
+
var result = nativeObjectToString.call(value);
|
3617
|
+
if (unmasked) {
|
3618
|
+
if (isOwn) {
|
3619
|
+
value[symToStringTag] = tag;
|
3620
|
+
} else {
|
3621
|
+
delete value[symToStringTag];
|
3622
|
+
}
|
3623
|
+
}
|
3624
|
+
return result;
|
3625
|
+
}
|
3626
|
+
|
3341
3627
|
/**
|
3342
3628
|
* Checks if `value` is a valid array-like index.
|
3343
3629
|
*
|
@@ -3347,10 +3633,13 @@ function createAssigner(assigner) {
|
|
3347
3633
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
3348
3634
|
*/
|
3349
3635
|
function isIndex(value, length) {
|
3636
|
+
var type = typeof value;
|
3350
3637
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
3638
|
+
|
3351
3639
|
return !!length &&
|
3352
|
-
(
|
3353
|
-
|
3640
|
+
(type == 'number' ||
|
3641
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
3642
|
+
(value > -1 && value % 1 == 0 && value < length);
|
3354
3643
|
}
|
3355
3644
|
|
3356
3645
|
/**
|
@@ -3377,6 +3666,17 @@ function isIterateeCall(value, index, object) {
|
|
3377
3666
|
return false;
|
3378
3667
|
}
|
3379
3668
|
|
3669
|
+
/**
|
3670
|
+
* Checks if `func` has its source masked.
|
3671
|
+
*
|
3672
|
+
* @private
|
3673
|
+
* @param {Function} func The function to check.
|
3674
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
3675
|
+
*/
|
3676
|
+
function isMasked(func) {
|
3677
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
3678
|
+
}
|
3679
|
+
|
3380
3680
|
/**
|
3381
3681
|
* Checks if `value` is likely a prototype object.
|
3382
3682
|
*
|
@@ -3410,6 +3710,105 @@ function nativeKeysIn(object) {
|
|
3410
3710
|
return result;
|
3411
3711
|
}
|
3412
3712
|
|
3713
|
+
/**
|
3714
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
3715
|
+
*
|
3716
|
+
* @private
|
3717
|
+
* @param {*} value The value to convert.
|
3718
|
+
* @returns {string} Returns the converted string.
|
3719
|
+
*/
|
3720
|
+
function objectToString(value) {
|
3721
|
+
return nativeObjectToString.call(value);
|
3722
|
+
}
|
3723
|
+
|
3724
|
+
/**
|
3725
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
3726
|
+
*
|
3727
|
+
* @private
|
3728
|
+
* @param {Function} func The function to apply a rest parameter to.
|
3729
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
3730
|
+
* @param {Function} transform The rest array transform.
|
3731
|
+
* @returns {Function} Returns the new function.
|
3732
|
+
*/
|
3733
|
+
function overRest(func, start, transform) {
|
3734
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
3735
|
+
return function() {
|
3736
|
+
var args = arguments,
|
3737
|
+
index = -1,
|
3738
|
+
length = nativeMax(args.length - start, 0),
|
3739
|
+
array = Array(length);
|
3740
|
+
|
3741
|
+
while (++index < length) {
|
3742
|
+
array[index] = args[start + index];
|
3743
|
+
}
|
3744
|
+
index = -1;
|
3745
|
+
var otherArgs = Array(start + 1);
|
3746
|
+
while (++index < start) {
|
3747
|
+
otherArgs[index] = args[index];
|
3748
|
+
}
|
3749
|
+
otherArgs[start] = transform(array);
|
3750
|
+
return apply(func, this, otherArgs);
|
3751
|
+
};
|
3752
|
+
}
|
3753
|
+
|
3754
|
+
/**
|
3755
|
+
* Sets the `toString` method of `func` to return `string`.
|
3756
|
+
*
|
3757
|
+
* @private
|
3758
|
+
* @param {Function} func The function to modify.
|
3759
|
+
* @param {Function} string The `toString` result.
|
3760
|
+
* @returns {Function} Returns `func`.
|
3761
|
+
*/
|
3762
|
+
var setToString = shortOut(baseSetToString);
|
3763
|
+
|
3764
|
+
/**
|
3765
|
+
* Creates a function that'll short out and invoke `identity` instead
|
3766
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
3767
|
+
* milliseconds.
|
3768
|
+
*
|
3769
|
+
* @private
|
3770
|
+
* @param {Function} func The function to restrict.
|
3771
|
+
* @returns {Function} Returns the new shortable function.
|
3772
|
+
*/
|
3773
|
+
function shortOut(func) {
|
3774
|
+
var count = 0,
|
3775
|
+
lastCalled = 0;
|
3776
|
+
|
3777
|
+
return function() {
|
3778
|
+
var stamp = nativeNow(),
|
3779
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
3780
|
+
|
3781
|
+
lastCalled = stamp;
|
3782
|
+
if (remaining > 0) {
|
3783
|
+
if (++count >= HOT_COUNT) {
|
3784
|
+
return arguments[0];
|
3785
|
+
}
|
3786
|
+
} else {
|
3787
|
+
count = 0;
|
3788
|
+
}
|
3789
|
+
return func.apply(undefined, arguments);
|
3790
|
+
};
|
3791
|
+
}
|
3792
|
+
|
3793
|
+
/**
|
3794
|
+
* Converts `func` to its source code.
|
3795
|
+
*
|
3796
|
+
* @private
|
3797
|
+
* @param {Function} func The function to convert.
|
3798
|
+
* @returns {string} Returns the source code.
|
3799
|
+
*/
|
3800
|
+
function toSource(func) {
|
3801
|
+
if (func != null) {
|
3802
|
+
try {
|
3803
|
+
return funcToString.call(func);
|
3804
|
+
} catch (e) {}
|
3805
|
+
try {
|
3806
|
+
return (func + '');
|
3807
|
+
} catch (e) {}
|
3808
|
+
}
|
3809
|
+
return '';
|
3810
|
+
}
|
3811
|
+
|
3413
3812
|
/**
|
3414
3813
|
* Performs a
|
3415
3814
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
@@ -3464,11 +3863,10 @@ function eq(value, other) {
|
|
3464
3863
|
* _.isArguments([1, 2, 3]);
|
3465
3864
|
* // => false
|
3466
3865
|
*/
|
3467
|
-
|
3468
|
-
|
3469
|
-
|
3470
|
-
|
3471
|
-
}
|
3866
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
3867
|
+
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
3868
|
+
!propertyIsEnumerable.call(value, 'callee');
|
3869
|
+
};
|
3472
3870
|
|
3473
3871
|
/**
|
3474
3872
|
* Checks if `value` is classified as an `Array` object.
|
@@ -3525,33 +3923,23 @@ function isArrayLike(value) {
|
|
3525
3923
|
}
|
3526
3924
|
|
3527
3925
|
/**
|
3528
|
-
*
|
3529
|
-
* is an object.
|
3926
|
+
* Checks if `value` is a buffer.
|
3530
3927
|
*
|
3531
3928
|
* @static
|
3532
3929
|
* @memberOf _
|
3533
|
-
* @since 4.
|
3930
|
+
* @since 4.3.0
|
3534
3931
|
* @category Lang
|
3535
3932
|
* @param {*} value The value to check.
|
3536
|
-
* @returns {boolean} Returns `true` if `value` is
|
3537
|
-
* else `false`.
|
3933
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
3538
3934
|
* @example
|
3539
3935
|
*
|
3540
|
-
* _.
|
3541
|
-
* // => true
|
3542
|
-
*
|
3543
|
-
* _.isArrayLikeObject(document.body.children);
|
3936
|
+
* _.isBuffer(new Buffer(2));
|
3544
3937
|
* // => true
|
3545
3938
|
*
|
3546
|
-
* _.
|
3547
|
-
* // => false
|
3548
|
-
*
|
3549
|
-
* _.isArrayLikeObject(_.noop);
|
3939
|
+
* _.isBuffer(new Uint8Array(2));
|
3550
3940
|
* // => false
|
3551
3941
|
*/
|
3552
|
-
|
3553
|
-
return isObjectLike(value) && isArrayLike(value);
|
3554
|
-
}
|
3942
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
3555
3943
|
|
3556
3944
|
/**
|
3557
3945
|
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
@@ -3575,8 +3963,9 @@ function isError(value) {
|
|
3575
3963
|
if (!isObjectLike(value)) {
|
3576
3964
|
return false;
|
3577
3965
|
}
|
3578
|
-
|
3579
|
-
|
3966
|
+
var tag = baseGetTag(value);
|
3967
|
+
return tag == errorTag || tag == domExcTag ||
|
3968
|
+
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
3580
3969
|
}
|
3581
3970
|
|
3582
3971
|
/**
|
@@ -3597,10 +3986,13 @@ function isError(value) {
|
|
3597
3986
|
* // => false
|
3598
3987
|
*/
|
3599
3988
|
function isFunction(value) {
|
3989
|
+
if (!isObject(value)) {
|
3990
|
+
return false;
|
3991
|
+
}
|
3600
3992
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
3601
|
-
// in Safari
|
3602
|
-
var tag =
|
3603
|
-
return tag == funcTag || tag == genTag;
|
3993
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
3994
|
+
var tag = baseGetTag(value);
|
3995
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
3604
3996
|
}
|
3605
3997
|
|
3606
3998
|
/**
|
@@ -3661,7 +4053,7 @@ function isLength(value) {
|
|
3661
4053
|
*/
|
3662
4054
|
function isObject(value) {
|
3663
4055
|
var type = typeof value;
|
3664
|
-
return
|
4056
|
+
return value != null && (type == 'object' || type == 'function');
|
3665
4057
|
}
|
3666
4058
|
|
3667
4059
|
/**
|
@@ -3689,7 +4081,48 @@ function isObject(value) {
|
|
3689
4081
|
* // => false
|
3690
4082
|
*/
|
3691
4083
|
function isObjectLike(value) {
|
3692
|
-
return
|
4084
|
+
return value != null && typeof value == 'object';
|
4085
|
+
}
|
4086
|
+
|
4087
|
+
/**
|
4088
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
4089
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
4090
|
+
*
|
4091
|
+
* @static
|
4092
|
+
* @memberOf _
|
4093
|
+
* @since 0.8.0
|
4094
|
+
* @category Lang
|
4095
|
+
* @param {*} value The value to check.
|
4096
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
4097
|
+
* @example
|
4098
|
+
*
|
4099
|
+
* function Foo() {
|
4100
|
+
* this.a = 1;
|
4101
|
+
* }
|
4102
|
+
*
|
4103
|
+
* _.isPlainObject(new Foo);
|
4104
|
+
* // => false
|
4105
|
+
*
|
4106
|
+
* _.isPlainObject([1, 2, 3]);
|
4107
|
+
* // => false
|
4108
|
+
*
|
4109
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
4110
|
+
* // => true
|
4111
|
+
*
|
4112
|
+
* _.isPlainObject(Object.create(null));
|
4113
|
+
* // => true
|
4114
|
+
*/
|
4115
|
+
function isPlainObject(value) {
|
4116
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
4117
|
+
return false;
|
4118
|
+
}
|
4119
|
+
var proto = getPrototype(value);
|
4120
|
+
if (proto === null) {
|
4121
|
+
return true;
|
4122
|
+
}
|
4123
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
4124
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
4125
|
+
funcToString.call(Ctor) == objectCtorString;
|
3693
4126
|
}
|
3694
4127
|
|
3695
4128
|
/**
|
@@ -3711,9 +4144,28 @@ function isObjectLike(value) {
|
|
3711
4144
|
*/
|
3712
4145
|
function isSymbol(value) {
|
3713
4146
|
return typeof value == 'symbol' ||
|
3714
|
-
(isObjectLike(value) &&
|
4147
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
3715
4148
|
}
|
3716
4149
|
|
4150
|
+
/**
|
4151
|
+
* Checks if `value` is classified as a typed array.
|
4152
|
+
*
|
4153
|
+
* @static
|
4154
|
+
* @memberOf _
|
4155
|
+
* @since 3.0.0
|
4156
|
+
* @category Lang
|
4157
|
+
* @param {*} value The value to check.
|
4158
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
4159
|
+
* @example
|
4160
|
+
*
|
4161
|
+
* _.isTypedArray(new Uint8Array);
|
4162
|
+
* // => true
|
4163
|
+
*
|
4164
|
+
* _.isTypedArray([]);
|
4165
|
+
* // => false
|
4166
|
+
*/
|
4167
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
4168
|
+
|
3717
4169
|
/**
|
3718
4170
|
* Converts `value` to a string. An empty string is returned for `null`
|
3719
4171
|
* and `undefined` values. The sign of `-0` is preserved.
|
@@ -3722,8 +4174,8 @@ function isSymbol(value) {
|
|
3722
4174
|
* @memberOf _
|
3723
4175
|
* @since 4.0.0
|
3724
4176
|
* @category Lang
|
3725
|
-
* @param {*} value The value to
|
3726
|
-
* @returns {string} Returns the string.
|
4177
|
+
* @param {*} value The value to convert.
|
4178
|
+
* @returns {string} Returns the converted string.
|
3727
4179
|
* @example
|
3728
4180
|
*
|
3729
4181
|
* _.toString(null);
|
@@ -3890,7 +4342,8 @@ function keysIn(object) {
|
|
3890
4342
|
* compiled({ 'user': 'barney' });
|
3891
4343
|
* // => 'hello barney!'
|
3892
4344
|
*
|
3893
|
-
* // Use the ES delimiter as an
|
4345
|
+
* // Use the ES template literal delimiter as an "interpolate" delimiter.
|
4346
|
+
* // Disable support by replacing the "interpolate" delimiter.
|
3894
4347
|
* var compiled = _.template('hello ${ user }!');
|
3895
4348
|
* compiled({ 'user': 'pebbles' });
|
3896
4349
|
* // => 'hello pebbles!'
|
@@ -3944,9 +4397,9 @@ function template(string, options, guard) {
|
|
3944
4397
|
options = undefined;
|
3945
4398
|
}
|
3946
4399
|
string = toString(string);
|
3947
|
-
options = assignInWith({}, options, settings,
|
4400
|
+
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
3948
4401
|
|
3949
|
-
var imports = assignInWith({}, options.imports, settings.imports,
|
4402
|
+
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
3950
4403
|
importsKeys = keys(imports),
|
3951
4404
|
importsValues = baseValues(imports, importsKeys);
|
3952
4405
|
|
@@ -3965,7 +4418,14 @@ function template(string, options, guard) {
|
|
3965
4418
|
, 'g');
|
3966
4419
|
|
3967
4420
|
// Use a sourceURL for easier debugging.
|
3968
|
-
|
4421
|
+
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
4422
|
+
// with lookup (in case of e.g. prototype pollution), and strip newlines if any.
|
4423
|
+
// A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
|
4424
|
+
var sourceURL = hasOwnProperty.call(options, 'sourceURL')
|
4425
|
+
? ('//# sourceURL=' +
|
4426
|
+
(options.sourceURL + '').replace(/[\r\n]/g, ' ') +
|
4427
|
+
'\n')
|
4428
|
+
: '';
|
3969
4429
|
|
3970
4430
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
3971
4431
|
interpolateValue || (interpolateValue = esTemplateValue);
|
@@ -3996,7 +4456,9 @@ function template(string, options, guard) {
|
|
3996
4456
|
|
3997
4457
|
// If `variable` is not specified wrap a with-statement around the generated
|
3998
4458
|
// code to add the data object to the top of the scope chain.
|
3999
|
-
|
4459
|
+
// Like with sourceURL, we take care to not check the option's prototype,
|
4460
|
+
// as this configuration is a code injection vector.
|
4461
|
+
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
|
4000
4462
|
if (!variable) {
|
4001
4463
|
source = 'with (obj) {\n' + source + '\n}\n';
|
4002
4464
|
}
|
@@ -4068,15 +4530,77 @@ var attempt = baseRest(function(func, args) {
|
|
4068
4530
|
}
|
4069
4531
|
});
|
4070
4532
|
|
4533
|
+
/**
|
4534
|
+
* Creates a function that returns `value`.
|
4535
|
+
*
|
4536
|
+
* @static
|
4537
|
+
* @memberOf _
|
4538
|
+
* @since 2.4.0
|
4539
|
+
* @category Util
|
4540
|
+
* @param {*} value The value to return from the new function.
|
4541
|
+
* @returns {Function} Returns the new constant function.
|
4542
|
+
* @example
|
4543
|
+
*
|
4544
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
4545
|
+
*
|
4546
|
+
* console.log(objects);
|
4547
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
4548
|
+
*
|
4549
|
+
* console.log(objects[0] === objects[1]);
|
4550
|
+
* // => true
|
4551
|
+
*/
|
4552
|
+
function constant(value) {
|
4553
|
+
return function() {
|
4554
|
+
return value;
|
4555
|
+
};
|
4556
|
+
}
|
4557
|
+
|
4558
|
+
/**
|
4559
|
+
* This method returns the first argument it receives.
|
4560
|
+
*
|
4561
|
+
* @static
|
4562
|
+
* @since 0.1.0
|
4563
|
+
* @memberOf _
|
4564
|
+
* @category Util
|
4565
|
+
* @param {*} value Any value.
|
4566
|
+
* @returns {*} Returns `value`.
|
4567
|
+
* @example
|
4568
|
+
*
|
4569
|
+
* var object = { 'a': 1 };
|
4570
|
+
*
|
4571
|
+
* console.log(_.identity(object) === object);
|
4572
|
+
* // => true
|
4573
|
+
*/
|
4574
|
+
function identity(value) {
|
4575
|
+
return value;
|
4576
|
+
}
|
4577
|
+
|
4578
|
+
/**
|
4579
|
+
* This method returns `false`.
|
4580
|
+
*
|
4581
|
+
* @static
|
4582
|
+
* @memberOf _
|
4583
|
+
* @since 4.13.0
|
4584
|
+
* @category Util
|
4585
|
+
* @returns {boolean} Returns `false`.
|
4586
|
+
* @example
|
4587
|
+
*
|
4588
|
+
* _.times(2, _.stubFalse);
|
4589
|
+
* // => [false, false]
|
4590
|
+
*/
|
4591
|
+
function stubFalse() {
|
4592
|
+
return false;
|
4593
|
+
}
|
4594
|
+
|
4071
4595
|
module.exports = template;
|
4072
4596
|
|
4073
4597
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
4074
4598
|
},{"lodash._reinterpolate":6,"lodash.templatesettings":10}],10:[function(require,module,exports){
|
4075
4599
|
(function (global){
|
4076
4600
|
/**
|
4077
|
-
*
|
4601
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
4078
4602
|
* Build: `lodash modularize exports="npm" -o ./`
|
4079
|
-
* Copyright
|
4603
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
4080
4604
|
* Released under MIT license <https://lodash.com/license>
|
4081
4605
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
4082
4606
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
@@ -4087,10 +4611,12 @@ var reInterpolate = require('lodash._reinterpolate');
|
|
4087
4611
|
var INFINITY = 1 / 0;
|
4088
4612
|
|
4089
4613
|
/** `Object#toString` result references. */
|
4090
|
-
var
|
4614
|
+
var nullTag = '[object Null]',
|
4615
|
+
symbolTag = '[object Symbol]',
|
4616
|
+
undefinedTag = '[object Undefined]';
|
4091
4617
|
|
4092
4618
|
/** Used to match HTML entities and HTML characters. */
|
4093
|
-
var reUnescapedHtml = /[&<>"'
|
4619
|
+
var reUnescapedHtml = /[&<>"']/g,
|
4094
4620
|
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
4095
4621
|
|
4096
4622
|
/** Used to match template delimiters. */
|
@@ -4103,8 +4629,7 @@ var htmlEscapes = {
|
|
4103
4629
|
'<': '<',
|
4104
4630
|
'>': '>',
|
4105
4631
|
'"': '"',
|
4106
|
-
"'": '''
|
4107
|
-
'`': '`'
|
4632
|
+
"'": '''
|
4108
4633
|
};
|
4109
4634
|
|
4110
4635
|
/** Detect free variable `global` from Node.js. */
|
@@ -4116,6 +4641,26 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self
|
|
4116
4641
|
/** Used as a reference to the global object. */
|
4117
4642
|
var root = freeGlobal || freeSelf || Function('return this')();
|
4118
4643
|
|
4644
|
+
/**
|
4645
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
4646
|
+
* shorthands.
|
4647
|
+
*
|
4648
|
+
* @private
|
4649
|
+
* @param {Array} [array] The array to iterate over.
|
4650
|
+
* @param {Function} iteratee The function invoked per iteration.
|
4651
|
+
* @returns {Array} Returns the new mapped array.
|
4652
|
+
*/
|
4653
|
+
function arrayMap(array, iteratee) {
|
4654
|
+
var index = -1,
|
4655
|
+
length = array == null ? 0 : array.length,
|
4656
|
+
result = Array(length);
|
4657
|
+
|
4658
|
+
while (++index < length) {
|
4659
|
+
result[index] = iteratee(array[index], index, array);
|
4660
|
+
}
|
4661
|
+
return result;
|
4662
|
+
}
|
4663
|
+
|
4119
4664
|
/**
|
4120
4665
|
* The base implementation of `_.propertyOf` without support for deep paths.
|
4121
4666
|
*
|
@@ -4141,15 +4686,19 @@ var escapeHtmlChar = basePropertyOf(htmlEscapes);
|
|
4141
4686
|
/** Used for built-in method references. */
|
4142
4687
|
var objectProto = Object.prototype;
|
4143
4688
|
|
4689
|
+
/** Used to check objects for own properties. */
|
4690
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
4691
|
+
|
4144
4692
|
/**
|
4145
4693
|
* Used to resolve the
|
4146
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/
|
4694
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
4147
4695
|
* of values.
|
4148
4696
|
*/
|
4149
|
-
var
|
4697
|
+
var nativeObjectToString = objectProto.toString;
|
4150
4698
|
|
4151
4699
|
/** Built-in value references. */
|
4152
|
-
var Symbol = root.Symbol
|
4700
|
+
var Symbol = root.Symbol,
|
4701
|
+
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
4153
4702
|
|
4154
4703
|
/** Used to convert symbols to primitives and strings. */
|
4155
4704
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
@@ -4157,8 +4706,8 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
4157
4706
|
|
4158
4707
|
/**
|
4159
4708
|
* By default, the template delimiters used by lodash are like those in
|
4160
|
-
* embedded Ruby (ERB)
|
4161
|
-
* alternative delimiters.
|
4709
|
+
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
4710
|
+
* following template settings to use alternative delimiters.
|
4162
4711
|
*
|
4163
4712
|
* @static
|
4164
4713
|
* @memberOf _
|
@@ -4216,6 +4765,22 @@ var templateSettings = {
|
|
4216
4765
|
}
|
4217
4766
|
};
|
4218
4767
|
|
4768
|
+
/**
|
4769
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
4770
|
+
*
|
4771
|
+
* @private
|
4772
|
+
* @param {*} value The value to query.
|
4773
|
+
* @returns {string} Returns the `toStringTag`.
|
4774
|
+
*/
|
4775
|
+
function baseGetTag(value) {
|
4776
|
+
if (value == null) {
|
4777
|
+
return value === undefined ? undefinedTag : nullTag;
|
4778
|
+
}
|
4779
|
+
return (symToStringTag && symToStringTag in Object(value))
|
4780
|
+
? getRawTag(value)
|
4781
|
+
: objectToString(value);
|
4782
|
+
}
|
4783
|
+
|
4219
4784
|
/**
|
4220
4785
|
* The base implementation of `_.toString` which doesn't convert nullish
|
4221
4786
|
* values to empty strings.
|
@@ -4229,6 +4794,10 @@ function baseToString(value) {
|
|
4229
4794
|
if (typeof value == 'string') {
|
4230
4795
|
return value;
|
4231
4796
|
}
|
4797
|
+
if (isArray(value)) {
|
4798
|
+
// Recursively convert values (susceptible to call stack limits).
|
4799
|
+
return arrayMap(value, baseToString) + '';
|
4800
|
+
}
|
4232
4801
|
if (isSymbol(value)) {
|
4233
4802
|
return symbolToString ? symbolToString.call(value) : '';
|
4234
4803
|
}
|
@@ -4236,6 +4805,69 @@ function baseToString(value) {
|
|
4236
4805
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
4237
4806
|
}
|
4238
4807
|
|
4808
|
+
/**
|
4809
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
4810
|
+
*
|
4811
|
+
* @private
|
4812
|
+
* @param {*} value The value to query.
|
4813
|
+
* @returns {string} Returns the raw `toStringTag`.
|
4814
|
+
*/
|
4815
|
+
function getRawTag(value) {
|
4816
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
4817
|
+
tag = value[symToStringTag];
|
4818
|
+
|
4819
|
+
try {
|
4820
|
+
value[symToStringTag] = undefined;
|
4821
|
+
var unmasked = true;
|
4822
|
+
} catch (e) {}
|
4823
|
+
|
4824
|
+
var result = nativeObjectToString.call(value);
|
4825
|
+
if (unmasked) {
|
4826
|
+
if (isOwn) {
|
4827
|
+
value[symToStringTag] = tag;
|
4828
|
+
} else {
|
4829
|
+
delete value[symToStringTag];
|
4830
|
+
}
|
4831
|
+
}
|
4832
|
+
return result;
|
4833
|
+
}
|
4834
|
+
|
4835
|
+
/**
|
4836
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
4837
|
+
*
|
4838
|
+
* @private
|
4839
|
+
* @param {*} value The value to convert.
|
4840
|
+
* @returns {string} Returns the converted string.
|
4841
|
+
*/
|
4842
|
+
function objectToString(value) {
|
4843
|
+
return nativeObjectToString.call(value);
|
4844
|
+
}
|
4845
|
+
|
4846
|
+
/**
|
4847
|
+
* Checks if `value` is classified as an `Array` object.
|
4848
|
+
*
|
4849
|
+
* @static
|
4850
|
+
* @memberOf _
|
4851
|
+
* @since 0.1.0
|
4852
|
+
* @category Lang
|
4853
|
+
* @param {*} value The value to check.
|
4854
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
4855
|
+
* @example
|
4856
|
+
*
|
4857
|
+
* _.isArray([1, 2, 3]);
|
4858
|
+
* // => true
|
4859
|
+
*
|
4860
|
+
* _.isArray(document.body.children);
|
4861
|
+
* // => false
|
4862
|
+
*
|
4863
|
+
* _.isArray('abc');
|
4864
|
+
* // => false
|
4865
|
+
*
|
4866
|
+
* _.isArray(_.noop);
|
4867
|
+
* // => false
|
4868
|
+
*/
|
4869
|
+
var isArray = Array.isArray;
|
4870
|
+
|
4239
4871
|
/**
|
4240
4872
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
4241
4873
|
* and has a `typeof` result of "object".
|
@@ -4261,7 +4893,7 @@ function baseToString(value) {
|
|
4261
4893
|
* // => false
|
4262
4894
|
*/
|
4263
4895
|
function isObjectLike(value) {
|
4264
|
-
return
|
4896
|
+
return value != null && typeof value == 'object';
|
4265
4897
|
}
|
4266
4898
|
|
4267
4899
|
/**
|
@@ -4283,7 +4915,7 @@ function isObjectLike(value) {
|
|
4283
4915
|
*/
|
4284
4916
|
function isSymbol(value) {
|
4285
4917
|
return typeof value == 'symbol' ||
|
4286
|
-
(isObjectLike(value) &&
|
4918
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
4287
4919
|
}
|
4288
4920
|
|
4289
4921
|
/**
|
@@ -4294,8 +4926,8 @@ function isSymbol(value) {
|
|
4294
4926
|
* @memberOf _
|
4295
4927
|
* @since 4.0.0
|
4296
4928
|
* @category Lang
|
4297
|
-
* @param {*} value The value to
|
4298
|
-
* @returns {string} Returns the string.
|
4929
|
+
* @param {*} value The value to convert.
|
4930
|
+
* @returns {string} Returns the converted string.
|
4299
4931
|
* @example
|
4300
4932
|
*
|
4301
4933
|
* _.toString(null);
|
@@ -4312,8 +4944,8 @@ function toString(value) {
|
|
4312
4944
|
}
|
4313
4945
|
|
4314
4946
|
/**
|
4315
|
-
* Converts the characters "&", "<", ">", '"',
|
4316
|
-
*
|
4947
|
+
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
4948
|
+
* corresponding HTML entities.
|
4317
4949
|
*
|
4318
4950
|
* **Note:** No other characters are escaped. To escape additional
|
4319
4951
|
* characters use a third-party library like [_he_](https://mths.be/he).
|
@@ -4324,12 +4956,6 @@ function toString(value) {
|
|
4324
4956
|
* [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
4325
4957
|
* (under "semi-related fun fact") for more details.
|
4326
4958
|
*
|
4327
|
-
* Backticks are escaped because in IE < 9, they can break out of
|
4328
|
-
* attribute values or HTML comments. See [#59](https://html5sec.org/#59),
|
4329
|
-
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
|
4330
|
-
* [#133](https://html5sec.org/#133) of the
|
4331
|
-
* [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
|
4332
|
-
*
|
4333
4959
|
* When working with HTML you should always
|
4334
4960
|
* [quote attribute values](http://wonko.com/post/html-escaping) to reduce
|
4335
4961
|
* XSS vectors.
|
@@ -6206,7 +6832,8 @@ function fetchDirections() {
|
|
6206
6832
|
alternatives = _getState.alternatives,
|
6207
6833
|
congestion = _getState.congestion,
|
6208
6834
|
destination = _getState.destination,
|
6209
|
-
language = _getState.language
|
6835
|
+
language = _getState.language,
|
6836
|
+
exclude = _getState.exclude;
|
6210
6837
|
// if there is no destination set, do not make request because it will fail
|
6211
6838
|
|
6212
6839
|
|
@@ -6222,6 +6849,7 @@ function fetchDirections() {
|
|
6222
6849
|
options.push('steps=true');
|
6223
6850
|
options.push('overview=full');
|
6224
6851
|
if (language) options.push('language=' + language);
|
6852
|
+
if (exclude) options.push('exclude=' + exclude);
|
6225
6853
|
if (accessToken) options.push('access_token=' + accessToken);
|
6226
6854
|
request.abort();
|
6227
6855
|
request.open('GET', '' + api + profile + '/' + query + '.json?' + options.join('&'), true);
|
@@ -6407,6 +7035,10 @@ function reverse() {
|
|
6407
7035
|
if (state.destination.geometry) dispatch(originPoint(state.destination.geometry.coordinates));
|
6408
7036
|
if (state.origin.geometry) dispatch(destinationPoint(state.origin.geometry.coordinates));
|
6409
7037
|
if (state.origin.geometry && state.destination.geometry) dispatch(fetchDirections());
|
7038
|
+
var suggestions = document.getElementsByClassName('suggestions');
|
7039
|
+
for (var i = 0; i < suggestions.length; i++) {
|
7040
|
+
suggestions[i].style.visibility = 'hidden';
|
7041
|
+
};
|
6410
7042
|
};
|
6411
7043
|
}
|
6412
7044
|
|
@@ -6798,7 +7430,7 @@ var Geocoder = function () {
|
|
6798
7430
|
* - __loading__ `Emitted when the geocoder is looking up a query`
|
6799
7431
|
* - __results__ `{ results } Fired when the geocoder returns a response`
|
6800
7432
|
* - __result__ `{ result } Fired when input is set`
|
6801
|
-
* - __error__ `{ error } Error as string
|
7433
|
+
* - __error__ `{ error } Error as string`
|
6802
7434
|
* @param {Function} fn function that's called when the event is emitted.
|
6803
7435
|
* @returns {Geocoder} this;
|
6804
7436
|
*/
|
@@ -6807,9 +7439,11 @@ var Geocoder = function () {
|
|
6807
7439
|
key: 'on',
|
6808
7440
|
value: function on(type, fn) {
|
6809
7441
|
this._ev.on(type, fn);
|
7442
|
+
this._ev.on('error', function (err) {
|
7443
|
+
console.log(err);
|
7444
|
+
});
|
6810
7445
|
return this;
|
6811
7446
|
}
|
6812
|
-
|
6813
7447
|
/**
|
6814
7448
|
* Fire an event
|
6815
7449
|
* @param {String} type event name.
|
@@ -6918,17 +7552,17 @@ var Inputs = function () {
|
|
6918
7552
|
value: function animateToCoordinates(mode, coords) {
|
6919
7553
|
var _store$getState2 = this.store.getState(),
|
6920
7554
|
origin = _store$getState2.origin,
|
6921
|
-
destination = _store$getState2.destination
|
7555
|
+
destination = _store$getState2.destination,
|
7556
|
+
routePadding = _store$getState2.routePadding;
|
6922
7557
|
|
6923
7558
|
if (origin.geometry && destination.geometry && !(0, _lodash4.default)(origin.geometry, destination.geometry)) {
|
6924
|
-
|
6925
7559
|
// Animate map to fit bounds.
|
6926
7560
|
var bb = (0, _turfExtent2.default)({
|
6927
7561
|
type: 'FeatureCollection',
|
6928
7562
|
features: [origin, destination]
|
6929
7563
|
});
|
6930
7564
|
|
6931
|
-
this._map.fitBounds([[bb[0], bb[1]], [bb[2], bb[3]]], { padding:
|
7565
|
+
this._map.fitBounds([[bb[0], bb[1]], [bb[2], bb[3]]], { padding: routePadding });
|
6932
7566
|
} else {
|
6933
7567
|
this._map.flyTo({ center: coords });
|
6934
7568
|
}
|
@@ -7260,6 +7894,8 @@ var store = storeWithMiddleware(_reducers2.default);
|
|
7260
7894
|
* @param {String} [options.placeholderOrigin="Choose a starting place"] If set, this text will appear as the placeholder attribute for the origin input element.
|
7261
7895
|
* @param {String} [options.placeholderDestination="Choose destination"] If set, this text will appear as the placeholder attribute for the destination input element.
|
7262
7896
|
* @param {Boolean} [options.flyTo=true] If false, animating the map to a selected result is disabled.
|
7897
|
+
* @param {String} [options.exclude=null] Exclude certain road types from routing. The default is to not exclude anything. Search for `exclude` in `optional parameters`: https://docs.mapbox.com/api/navigation/#retrieve-directions
|
7898
|
+
* @param {number | PaddingOptions} [options.routePadding=80] Specify padding surrounding route. A single number of pixels or a [PaddingOptions](https://docs.mapbox.com/mapbox-gl-js/api/#paddingoptions) object.
|
7263
7899
|
* @example
|
7264
7900
|
* var MapboxDirections = require('../src/index');
|
7265
7901
|
* var directions = new MapboxDirections({
|
@@ -7826,7 +8462,7 @@ var MapboxDirections = function () {
|
|
7826
8462
|
* - __origin__ `{ feature } Fired when origin is set`
|
7827
8463
|
* - __destination__ `{ feature } Fired when destination is set`
|
7828
8464
|
* - __route__ `{ route } Fired when a route is updated`
|
7829
|
-
* - __error__ `{ error } Error as string
|
8465
|
+
* - __error__ `{ error } Error as string`
|
7830
8466
|
* @param {Function} fn function that's called when the event is emitted.
|
7831
8467
|
* @returns {MapboxDirections} this;
|
7832
8468
|
*/
|
@@ -8053,7 +8689,8 @@ var initialState = {
|
|
8053
8689
|
|
8054
8690
|
// Directions data
|
8055
8691
|
directions: [],
|
8056
|
-
routeIndex: 0
|
8692
|
+
routeIndex: 0,
|
8693
|
+
routePadding: 80
|
8057
8694
|
};
|
8058
8695
|
|
8059
8696
|
function data() {
|