Last active
January 8, 2019 01:01
-
-
Save josephrocca/9ec994542d9fcdeb48f536b37d75ae26 to your computer and use it in GitHub Desktop.
Chrome 40 Support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Workaround for a workaround for a workaround. | |
Includes: | |
- NodeList.forEach polyfill (not supported by polyfill.io) | |
- https://polyfill.io/v2/polyfill.js?features=default,es5,es6,Array.prototype.@@iterator,Array.prototype.entries,Array.prototype.find,Array.prototype.findIndex,Array.prototype.copyWithin,Array.prototype.findIndex,Array.prototype.includes,Array.prototype.keys,Array.prototype.values,DOMTokenList.prototype.@@iterator,DocumentFragment,Element.prototype.dataset,EventSource,Function.name,HTMLCanvasElement.prototype.toBlob,HTMLDocument,MutationObserver,NodeList.prototype.@@iterator,IntersectionObserver,IntersectionObserverEntry,NodeList.prototype.@@iterator,Object.entries,Object.values,Promise.prototype.finally,RegExp.prototype.flags,String.fromCodePoint,String.prototype.codePointAt,String.prototype.padEnd,String.prototype.padStart,String.prototype.repeat,Symbol.hasInstance,Symbol.isConcatSpreadable,Symbol.match,Symbol.replace,Symbol.search,Symbol.species,Symbol.split,Symbol.toPrimitive,Symbol.toStringTag,console.exception,fetch,screen.orientation,setImmediate&flags=gated,always | |
- https://cdn.rawgit.com/facebook/regenerator/master/packages/regenerator-runtime/runtime.js | |
- https://unpkg.com/@babel/[email protected]/babel.js | |
Usage: | |
<script> | |
var beforeCode = "async function test() {}"; | |
var afterCode = Babel.transform(beforeCode, { | |
presets: ['es2015','es2016','es2017','stage-3'], | |
plugins: ['transform-async-to-generator','transform-regenerator'], | |
}).code; | |
var script = document.createElement("script"); | |
script.innerHTML = afterCode; | |
document.head.appendChild(script); | |
</script> | |
*/ | |
if (window.NodeList && !NodeList.prototype.forEach) { | |
NodeList.prototype.forEach = function (callback, thisArg) { | |
thisArg = thisArg || window; | |
for (var i = 0; i < this.length; i++) { | |
callback.call(thisArg, this[i], i, this); | |
} | |
}; | |
} | |
/* Polyfill service v3.25.1 | |
* For detailed credits and licence information see https://github.com/financial-times/polyfill-service. | |
* | |
* UA detected: chrome/72.0.0 | |
* Features requested: Array.prototype.@@iterator,Array.prototype.copyWithin,Array.prototype.entries,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes,Array.prototype.keys,Array.prototype.values,AudioContext,DOMTokenList.prototype.@@iterator,DocumentFragment,Element.prototype.dataset,EventSource,Function.name,HTMLCanvasElement.prototype.toBlob,HTMLDocument,IntersectionObserver,IntersectionObserverEntry,MutationObserver,NodeList.prototype.@@iterator,Object.entries,Object.values,Promise.prototype.finally,RegExp.prototype.flags,String.fromCodePoint,String.prototype.codePointAt,String.prototype.padEnd,String.prototype.padStart,String.prototype.repeat,Symbol.hasInstance,Symbol.isConcatSpreadable,Symbol.match,Symbol.replace,Symbol.search,Symbol.species,Symbol.split,Symbol.toPrimitive,Symbol.toStringTag,console.exception,default,es5,es6,fetch,screen.orientation,setImmediate | |
* | |
* - Object.defineProperty, License: CC0 (required by "default", "es5", "Array.prototype.copyWithin", "es6", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.includes", "Element.prototype.dataset", "Function.name", "HTMLCanvasElement.prototype.toBlob", "IntersectionObserverEntry", "Object.values", "RegExp.prototype.flags", "String.prototype.codePointAt", "String.prototype.padEnd", "String.prototype.padStart", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "screen.orientation", "Array.from", "Array.isArray", "IntersectionObserver", "Array.of", "Array.prototype.fill", "Element.prototype.classList", "Event", "CustomEvent", "Event.focusin", "Event.hashchange", "Function.prototype.bind", "Promise.prototype.finally", "Map", "Object.assign", "Object.defineProperties", "Object.create", "Set", "Number.Epsilon", "Number.isSafeInteger", "Object.setPrototypeOf", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables", "Symbol", "WeakMap", "WeakSet", "_ArrayIterator", "_DOMTokenList", "DOMTokenList", "_StringIterator", "_Iterator") | |
* - Function.prototype.bind, License: MIT (required by "default", "es5", "IntersectionObserver", "Promise.prototype.finally", "Object.getOwnPropertyDescriptor", "Element.prototype.dataset", "Array.from", "es6", "Object.assign", "_Iterator", "_ArrayIterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator") | |
* - Object.getOwnPropertyDescriptor, License: CC0 (required by "default", "es5", "Element.prototype.dataset", "Array.from", "es6", "Object.assign", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables") | |
* - Object.keys, License: MIT (required by "default", "es5", "Object.entries", "Object.values", "Object.assign", "es6", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables") | |
* - Object.assign, License: CC0 (required by "default", "es6", "_Iterator", "_ArrayIterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "_StringIterator", "String.prototype.@@iterator") | |
* - Object.defineProperties, License: CC0 (required by "default", "es5", "Object.create", "Map", "es6", "URL", "location.origin", "_Iterator", "_ArrayIterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "_StringIterator", "String.prototype.@@iterator") | |
* - Array.prototype.forEach, License: CC0 (required by "default", "es5", "IntersectionObserver", "fetch", "URL", "Object.setPrototypeOf", "es6", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables", "WeakMap", "WeakSet") | |
* - Array.prototype.filter, License: CC0 (required by "default", "es5", "IntersectionObserver", "Symbol", "es6", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables") | |
* - Array.prototype.map, License: CC0 (required by "default", "es5", "IntersectionObserver", "Object.values", "Symbol", "es6", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables") | |
* - Object.create, License: CC0 (required by "default", "es5", "Map", "es6", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables", "_ArrayIterator", "Array.from", "_StringIterator") | |
* - Object.getOwnPropertyNames, License: CC0 (required by "default", "es5", "fetch", "Object.setPrototypeOf", "es6", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables") | |
* - Object.freeze, License: CC0 (required by "es5", "Symbol", "es6", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "default", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables") | |
* - Symbol, License: MIT (required by "es6", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Map", "default", "Set", "Symbol.iterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.unscopables", "_Iterator", "_ArrayIterator", "Array.from", "_StringIterator") | |
* - Symbol.iterator, License: MIT (required by "es6", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Map", "default", "Set", "String.prototype.@@iterator", "_Iterator", "_ArrayIterator", "Array.from", "_StringIterator") | |
* - Symbol.toStringTag, License: MIT (required by "es6", "_Iterator", "_ArrayIterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "default", "_StringIterator", "String.prototype.@@iterator") | |
* - _Iterator, License: MIT (required by "_ArrayIterator", "Array.prototype.@@iterator", "es6", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "default", "_StringIterator", "String.prototype.@@iterator") | |
* - Object.getPrototypeOf, License: CC0 (required by "default", "es5", "Array.prototype.copyWithin", "es6", "Map", "Object.setPrototypeOf") | |
* - Object.setPrototypeOf, License: MIT (required by "es6", "_ArrayIterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "default", "_StringIterator", "String.prototype.@@iterator") | |
* - String.prototype.includes, License: CC0 (required by "default", "es6", "String.prototype.contains", "_ArrayIterator", "Array.prototype.@@iterator", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from") | |
* - String.prototype.contains, License: CC0 (required by "_ArrayIterator", "Array.prototype.@@iterator", "es6", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "default") | |
* - _ArrayIterator, License: MIT (required by "Array.prototype.@@iterator", "es6", "Array.prototype.entries", "Array.prototype.keys", "DOMTokenList.prototype.@@iterator", "NodeList.prototype.@@iterator", "Array.from", "default") | |
* - Array.prototype.@@iterator, License: CC0 (required by "es6", "Array.prototype.values") | |
* - Array.prototype.copyWithin, License: MIT (required by "es6") | |
* - Array.prototype.entries, License: CC0 (required by "es6") | |
* - Array.prototype.find, License: CC0 (required by "es6") | |
* - Array.prototype.findIndex, License: CC0 (required by "es6") | |
* - Array.prototype.includes, License: CC0 | |
* - Array.prototype.keys, License: CC0 (required by "es6") | |
* - Array.prototype.values, License: MIT (required by "es6") | |
* - AudioContext, License: CC0 | |
* - DOMTokenList.prototype.@@iterator, License: MIT | |
* - DocumentFragment, License: CC0 (required by "DocumentFragment.prototype.append", "default", "DocumentFragment.prototype.prepend") | |
* - Document, License: CC0 (required by "default", "DocumentFragment.prototype.append", "DocumentFragment.prototype.prepend", "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith", "Element", "Element.prototype.dataset", "Element.prototype.classList", "Element.prototype.cloneNode", "Element.prototype.matches", "Element.prototype.closest", "Event", "IntersectionObserver", "CustomEvent", "Event.focusin", "Event.hashchange", "document.querySelector", "~html5-elements", "_mutation") | |
* - Element, License: CC0 (required by "default", "Element.prototype.dataset", "DocumentFragment.prototype.append", "DocumentFragment.prototype.prepend", "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.classList", "Element.prototype.cloneNode", "Element.prototype.matches", "Element.prototype.closest", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith", "Event", "IntersectionObserver", "CustomEvent", "Event.focusin", "Event.hashchange", "Node.prototype.contains", "document.querySelector", "_mutation") | |
* - document.querySelector, License: CC0 (required by "default", "Element.prototype.dataset", "Element.prototype.matches", "Element.prototype.closest") | |
* - Element.prototype.dataset, License: CC0 | |
* - EventSource, License: MIT | |
* - Function.name, License: MIT (required by "es6") | |
* - atob, License: MIT (required by "default", "HTMLCanvasElement.prototype.toBlob") | |
* - HTMLCanvasElement.prototype.toBlob, License: MIT | |
* - HTMLDocument, License: CC0 | |
* - Window, License: CC0 (required by "default", "console.exception", "Event", "IntersectionObserver", "CustomEvent", "Event.focusin", "Event.hashchange", "getComputedStyle", "console") | |
* - getComputedStyle, License: CC0 (required by "IntersectionObserver") | |
* - Array.isArray, License: CC0 (required by "default", "es5", "IntersectionObserver", "Array.from", "es6", "Map") | |
* - Array.prototype.indexOf, License: CC0 (required by "default", "es5", "IntersectionObserver", "Element.prototype.after", "Element.prototype.before", "Map", "es6", "Set") | |
* - Array.prototype.some, License: CC0 (required by "default", "es5", "IntersectionObserver") | |
* - Event, License: CC0 (required by "default", "IntersectionObserver", "CustomEvent", "Event.focusin", "Event.hashchange", "XMLHttpRequest", "fetch") | |
* - IntersectionObserver, License: CC0 (required by "IntersectionObserverEntry") | |
* - IntersectionObserverEntry, License: CC0 | |
* - MutationObserver, License: WTFPL | |
* - NodeList.prototype.@@iterator, License: MIT | |
* - Array.prototype.reduce, License: CC0 (required by "default", "es5", "Object.entries") | |
* - Object.entries, License: CC0 | |
* - Object.values, License: CC0 | |
* - Promise, License: MIT (required by "default", "es6", "Promise.prototype.finally", "fetch") | |
* - Promise.prototype.finally, License: MIT | |
* - RegExp.prototype.flags, License: MIT (required by "es6") | |
* - String.fromCodePoint, License: MIT | |
* - String.prototype.codePointAt, License: MIT (required by "es6") | |
* - String.prototype.padEnd, License: CC0 | |
* - String.prototype.padStart, License: CC0 | |
* - String.prototype.repeat, License: CC0 (required by "es6") | |
* - Symbol.hasInstance, License: MIT (required by "es6") | |
* - Symbol.isConcatSpreadable, License: MIT (required by "es6") | |
* - Symbol.match, License: MIT (required by "es6") | |
* - Symbol.replace, License: MIT (required by "es6") | |
* - Symbol.search, License: MIT (required by "es6") | |
* - Symbol.species, License: MIT (required by "es6", "Map", "default", "Set") | |
* - Symbol.split, License: MIT (required by "es6") | |
* - Symbol.toPrimitive, License: MIT (required by "es6") | |
* - console, License: CC0 (required by "console.exception") | |
* - console.exception, License: CC0 | |
* - XMLHttpRequest, License: CC0 (required by "default", "fetch") | |
* - fetch, License: MIT | |
* - screen.orientation, License: CC0 | |
* - setImmediate, License: CC0 | |
* - Number.isFinite, License: MIT (required by "es6", "Array.from", "default") | |
* - Number.isNaN, License: MIT (required by "default", "es6", "Array.from", "Map", "Set") | |
* - Array.from, License: CC0 (required by "default", "es6") | |
* - Array.of, License: MIT (required by "default", "es6") | |
* - Array.prototype.every, License: CC0 (required by "default", "es5") | |
* - Array.prototype.fill, License: CC0 (required by "default", "es6") | |
* - Array.prototype.lastIndexOf, License: CC0 (required by "default", "es5") | |
* - Array.prototype.reduceRight, License: CC0 (required by "default", "es5") | |
* - CustomEvent, License: CC0 (required by "default", "document.visibilityState") | |
* - _DOMTokenList, License: ISC (required by "DOMTokenList", "default") | |
* - DOMTokenList, License: CC0 (required by "default", "Element.prototype.classList") | |
* - Date.now, License: CC0 (required by "default", "es5", "requestAnimationFrame", "WeakMap", "es6", "WeakSet", "performance.now") | |
* - Date.prototype.toISOString, License: CC0 (required by "default", "es5") | |
* - _mutation, License: CC0 (required by "DocumentFragment.prototype.append", "default", "DocumentFragment.prototype.prepend", "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith") | |
* - DocumentFragment.prototype.append, License: CC0 (required by "default") | |
* - DocumentFragment.prototype.prepend, License: CC0 (required by "default") | |
* - Element.prototype.after, License: CC0 (required by "default") | |
* - Element.prototype.append, License: CC0 (required by "default") | |
* - Element.prototype.before, License: CC0 (required by "default") | |
* - Element.prototype.classList, License: ISC (required by "default") | |
* - Element.prototype.cloneNode, License: CC0 (required by "default") | |
* - Element.prototype.matches, License: CC0 (required by "default", "Element.prototype.closest") | |
* - Element.prototype.closest, License: CC0 (required by "default") | |
* - Element.prototype.prepend, License: CC0 (required by "default") | |
* - Element.prototype.remove, License: CC0 (required by "default") | |
* - Element.prototype.replaceWith, License: CC0 (required by "default") | |
* - Event.focusin, License: CC0 (required by "default") | |
* - Event.hashchange, License: CC0 (required by "default") | |
* - JSON, License: MIT (required by "default") | |
* - Map, License: CC0 (required by "default", "es6") | |
* - Node.prototype.contains, License: CC0 (required by "default") | |
* - Set, License: CC0 (required by "default", "es6") | |
* - String.prototype.endsWith, License: CC0 (required by "default", "es6") | |
* - String.prototype.startsWith, License: CC0 (required by "default", "es6") | |
* - String.prototype.trim, License: CC0 (required by "default", "es5") | |
* - URL, License: CC0 (required by "default") | |
* - document.visibilityState, License: CC0 (required by "default") | |
* - location.origin, License: CC0 (required by "default") | |
* - performance.now, License: CC0 (required by "requestAnimationFrame", "default") | |
* - requestAnimationFrame, License: MIT (required by "default") | |
* - ~html5-elements, License: MIT (required by "default") | |
* - Math.acosh, License: CC0 (required by "es6") | |
* - Math.asinh, License: CC0 (required by "es6") | |
* - Math.atanh, License: CC0 (required by "es6") | |
* - Math.cbrt, License: CC0 (required by "es6") | |
* - Math.clz32, License: CC0 (required by "es6") | |
* - Math.cosh, License: CC0 (required by "es6") | |
* - Math.expm1, License: CC0 (required by "es6") | |
* - Math.hypot, License: CC0 (required by "es6") | |
* - Math.imul, License: CC0 (required by "es6") | |
* - Math.log10, License: CC0 (required by "es6") | |
* - Math.log1p, License: CC0 (required by "es6") | |
* - Math.log2, License: CC0 (required by "es6") | |
* - Math.sign, License: CC0 (required by "es6") | |
* - Math.sinh, License: CC0 (required by "es6") | |
* - Math.tanh, License: CC0 (required by "es6") | |
* - Math.trunc, License: CC0 (required by "es6") | |
* - Number.Epsilon, License: MIT (required by "es6") | |
* - Number.MAX_SAFE_INTEGER, License: MIT (required by "es6") | |
* - Number.MIN_SAFE_INTEGER, License: MIT (required by "es6") | |
* - Number.isInteger, License: MIT (required by "es6") | |
* - Number.isSafeInteger, License: MIT (required by "es6") | |
* - Number.parseFloat, License: MIT (required by "es6") | |
* - Number.parseInt, License: MIT (required by "es6") | |
* - Object.is, License: CC0 (required by "es6") | |
* - _StringIterator, License: MIT (required by "String.prototype.@@iterator", "es6") | |
* - String.prototype.@@iterator, License: CC0 (required by "es6") | |
* - Symbol.unscopables, License: MIT (required by "es6") | |
* - WeakMap, License: https://github.com/webcomponents/webcomponentsjs/blob/master/LICENSE.md (required by "es6") | |
* - WeakSet, License: https://github.com/webcomponents/webcomponentsjs/blob/master/LICENSE.md (required by "es6") */ | |
(function(undefined) { | |
if (!(// In IE8, defineProperty could only act on DOM elements, so full support | |
// for the feature requires the ability to set a property on an arbitrary object | |
'defineProperty' in Object && (function() { | |
try { | |
var a = {}; | |
Object.defineProperty(a, 'test', {value:42}); | |
return true; | |
} catch(e) { | |
return false | |
} | |
}()))) { | |
// Object.defineProperty | |
(function (nativeDefineProperty) { | |
var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__'); | |
var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine'; | |
var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value'; | |
Object.defineProperty = function defineProperty(object, property, descriptor) { | |
// Where native support exists, assume it | |
if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) { | |
return nativeDefineProperty(object, property, descriptor); | |
} | |
if (object === null || !(object instanceof Object || typeof object === 'object')) { | |
throw new TypeError('Object.defineProperty called on non-object'); | |
} | |
if (!(descriptor instanceof Object)) { | |
throw new TypeError('Property description must be an object'); | |
} | |
var propertyString = String(property); | |
var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor; | |
var getterType = 'get' in descriptor && typeof descriptor.get; | |
var setterType = 'set' in descriptor && typeof descriptor.set; | |
// handle descriptor.get | |
if (getterType) { | |
if (getterType !== 'function') { | |
throw new TypeError('Getter must be a function'); | |
} | |
if (!supportsAccessors) { | |
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); | |
} | |
if (hasValueOrWritable) { | |
throw new TypeError(ERR_VALUE_ACCESSORS); | |
} | |
Object.__defineGetter__.call(object, propertyString, descriptor.get); | |
} else { | |
object[propertyString] = descriptor.value; | |
} | |
// handle descriptor.set | |
if (setterType) { | |
if (setterType !== 'function') { | |
throw new TypeError('Setter must be a function'); | |
} | |
if (!supportsAccessors) { | |
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); | |
} | |
if (hasValueOrWritable) { | |
throw new TypeError(ERR_VALUE_ACCESSORS); | |
} | |
Object.__defineSetter__.call(object, propertyString, descriptor.set); | |
} | |
// OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above | |
if ('value' in descriptor) { | |
object[propertyString] = descriptor.value; | |
} | |
return object; | |
}; | |
}(Object.defineProperty)); | |
} | |
if (!('bind' in Function.prototype)) { | |
// Function.prototype.bind | |
// https://github.com/es-shims/es5-shim/blob/d6d7ff1b131c7ba14c798cafc598bb6780d37d3b/es5-shim.js#L182 | |
Object.defineProperty(Function.prototype, 'bind', { | |
value: function bind(that) { // .length is 1 | |
// add necessary es5-shim utilities | |
var $Array = Array; | |
var $Object = Object; | |
var ObjectPrototype = $Object.prototype; | |
var ArrayPrototype = $Array.prototype; | |
var Empty = function Empty() {}; | |
var to_string = ObjectPrototype.toString; | |
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; | |
var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; }; | |
var array_slice = ArrayPrototype.slice; | |
var array_concat = ArrayPrototype.concat; | |
var array_push = ArrayPrototype.push; | |
var max = Math.max; | |
// /add necessary es5-shim utilities | |
// 1. Let Target be the this value. | |
var target = this; | |
// 2. If IsCallable(Target) is false, throw a TypeError exception. | |
if (!isCallable(target)) { | |
throw new TypeError('Function.prototype.bind called on incompatible ' + target); | |
} | |
// 3. Let A be a new (possibly empty) internal list of all of the | |
// argument values provided after thisArg (arg1, arg2 etc), in order. | |
// XXX slicedArgs will stand in for "A" if used | |
var args = array_slice.call(arguments, 1); // for normal call | |
// 4. Let F be a new native ECMAScript object. | |
// 11. Set the [[Prototype]] internal property of F to the standard | |
// built-in Function prototype object as specified in 15.3.3.1. | |
// 12. Set the [[Call]] internal property of F as described in | |
// 15.3.4.5.1. | |
// 13. Set the [[Construct]] internal property of F as described in | |
// 15.3.4.5.2. | |
// 14. Set the [[HasInstance]] internal property of F as described in | |
// 15.3.4.5.3. | |
var bound; | |
var binder = function () { | |
if (this instanceof bound) { | |
// 15.3.4.5.2 [[Construct]] | |
// When the [[Construct]] internal method of a function object, | |
// F that was created using the bind function is called with a | |
// list of arguments ExtraArgs, the following steps are taken: | |
// 1. Let target be the value of F's [[TargetFunction]] | |
// internal property. | |
// 2. If target has no [[Construct]] internal method, a | |
// TypeError exception is thrown. | |
// 3. Let boundArgs be the value of F's [[BoundArgs]] internal | |
// property. | |
// 4. Let args be a new list containing the same values as the | |
// list boundArgs in the same order followed by the same | |
// values as the list ExtraArgs in the same order. | |
// 5. Return the result of calling the [[Construct]] internal | |
// method of target providing args as the arguments. | |
var result = target.apply( | |
this, | |
array_concat.call(args, array_slice.call(arguments)) | |
); | |
if ($Object(result) === result) { | |
return result; | |
} | |
return this; | |
} else { | |
// 15.3.4.5.1 [[Call]] | |
// When the [[Call]] internal method of a function object, F, | |
// which was created using the bind function is called with a | |
// this value and a list of arguments ExtraArgs, the following | |
// steps are taken: | |
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal | |
// property. | |
// 2. Let boundThis be the value of F's [[BoundThis]] internal | |
// property. | |
// 3. Let target be the value of F's [[TargetFunction]] internal | |
// property. | |
// 4. Let args be a new list containing the same values as the | |
// list boundArgs in the same order followed by the same | |
// values as the list ExtraArgs in the same order. | |
// 5. Return the result of calling the [[Call]] internal method | |
// of target providing boundThis as the this value and | |
// providing args as the arguments. | |
// equiv: target.call(this, ...boundArgs, ...args) | |
return target.apply( | |
that, | |
array_concat.call(args, array_slice.call(arguments)) | |
); | |
} | |
}; | |
// 15. If the [[Class]] internal property of Target is "Function", then | |
// a. Let L be the length property of Target minus the length of A. | |
// b. Set the length own property of F to either 0 or L, whichever is | |
// larger. | |
// 16. Else set the length own property of F to 0. | |
var boundLength = max(0, target.length - args.length); | |
// 17. Set the attributes of the length own property of F to the values | |
// specified in 15.3.5.1. | |
var boundArgs = []; | |
for (var i = 0; i < boundLength; i++) { | |
array_push.call(boundArgs, '$' + i); | |
} | |
// XXX Build a dynamic function with desired amount of arguments is the only | |
// way to set the length property of a function. | |
// In environments where Content Security Policies enabled (Chrome extensions, | |
// for ex.) all use of eval or Function costructor throws an exception. | |
// However in all of these environments Function.prototype.bind exists | |
// and so this code will never be executed. | |
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder); | |
if (target.prototype) { | |
Empty.prototype = target.prototype; | |
bound.prototype = new Empty(); | |
// Clean up dangling references. | |
Empty.prototype = null; | |
} | |
// TODO | |
// 18. Set the [[Extensible]] internal property of F to true. | |
// TODO | |
// 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). | |
// 20. Call the [[DefineOwnProperty]] internal method of F with | |
// arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: | |
// thrower, [[Enumerable]]: false, [[Configurable]]: false}, and | |
// false. | |
// 21. Call the [[DefineOwnProperty]] internal method of F with | |
// arguments "arguments", PropertyDescriptor {[[Get]]: thrower, | |
// [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, | |
// and false. | |
// TODO | |
// NOTE Function objects created using Function.prototype.bind do not | |
// have a prototype property or the [[Code]], [[FormalParameters]], and | |
// [[Scope]] internal properties. | |
// XXX can't delete prototype in pure-js. | |
// 22. Return F. | |
return bound; | |
} | |
}); | |
} | |
if (!('getOwnPropertyDescriptor' in Object && typeof Object.getOwnPropertyDescriptor === 'function' && (function() { | |
try { | |
var object = {}; | |
object.test = 0; | |
return Object.getOwnPropertyDescriptor( | |
object, | |
"test" | |
).value === 0; | |
} catch (exception) { | |
return false | |
} | |
}()))) { | |
// Object.getOwnPropertyDescriptor | |
(function() { | |
var call = Function.prototype.call; | |
var prototypeOfObject = Object.prototype; | |
var owns = call.bind(prototypeOfObject.hasOwnProperty); | |
var lookupGetter; | |
var lookupSetter; | |
var supportsAccessors; | |
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { | |
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); | |
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); | |
} | |
function doesGetOwnPropertyDescriptorWork(object) { | |
try { | |
object.sentinel = 0; | |
return Object.getOwnPropertyDescriptor( | |
object, | |
"sentinel" | |
).value === 0; | |
} catch (exception) { | |
// returns falsy | |
} | |
} | |
// check whether getOwnPropertyDescriptor works if it's given. Otherwise, | |
// shim partially. | |
if (Object.defineProperty) { | |
var getOwnPropertyDescriptorWorksOnObject = | |
doesGetOwnPropertyDescriptorWork({}); | |
var getOwnPropertyDescriptorWorksOnDom = typeof document == "undefined" || | |
doesGetOwnPropertyDescriptorWork(document.createElement("div")); | |
if (!getOwnPropertyDescriptorWorksOnDom || | |
!getOwnPropertyDescriptorWorksOnObject | |
) { | |
var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor; | |
} | |
} | |
if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) { | |
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: "; | |
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { | |
if ((typeof object != "object" && typeof object != "function") || object === null) { | |
throw new TypeError(ERR_NON_OBJECT + object); | |
} | |
// make a valiant attempt to use the real getOwnPropertyDescriptor | |
// for I8's DOM elements. | |
if (getOwnPropertyDescriptorFallback) { | |
try { | |
return getOwnPropertyDescriptorFallback.call(Object, object, property); | |
} catch (exception) { | |
// try the shim if the real one doesn't work | |
} | |
} | |
// If object does not owns property return undefined immediately. | |
if (!owns(object, property)) { | |
return; | |
} | |
// If object has a property then it's for sure both `enumerable` and | |
// `configurable`. | |
var descriptor = { enumerable: true, configurable: true }; | |
// If JS engine supports accessor properties then property may be a | |
// getter or setter. | |
if (supportsAccessors) { | |
// Unfortunately `__lookupGetter__` will return a getter even | |
// if object has own non getter property along with a same named | |
// inherited getter. To avoid misbehavior we temporary remove | |
// `__proto__` so that `__lookupGetter__` will return getter only | |
// if it's owned by an object. | |
var prototype = object.__proto__; | |
object.__proto__ = prototypeOfObject; | |
var getter = lookupGetter(object, property); | |
var setter = lookupSetter(object, property); | |
// Once we have getter and setter we can put values back. | |
object.__proto__ = prototype; | |
if (getter || setter) { | |
if (getter) { | |
descriptor.get = getter; | |
} | |
if (setter) { | |
descriptor.set = setter; | |
} | |
// If it was accessor property we're done and return here | |
// in order to avoid adding `value` to the descriptor. | |
return descriptor; | |
} | |
} | |
// If we got this far we know that object has an own property that is | |
// not an accessor so we set it as a value and return descriptor. | |
descriptor.value = object[property]; | |
descriptor.writable = true; | |
return descriptor; | |
}; | |
} | |
}()); | |
} | |
if (!('keys' in Object && (function () { | |
// Safari 5.0 bug where Object.keys doesn't work with arguments | |
return (Object.keys(arguments)).length === 2; | |
}(1, 2)) && (function () { | |
try { | |
// In ES6 Object.keys works on all object except `null` and `undefined`. | |
Object.keys(''); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}()))) { | |
// Object.keys | |
Object.keys = (function() { | |
'use strict'; | |
// modified from https://github.com/es-shims/object-keys | |
var has = Object.prototype.hasOwnProperty; | |
var toStr = Object.prototype.toString; | |
var isEnumerable = Object.prototype.propertyIsEnumerable; | |
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); | |
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); | |
var dontEnums = [ | |
'toString', | |
'toLocaleString', | |
'valueOf', | |
'hasOwnProperty', | |
'isPrototypeOf', | |
'propertyIsEnumerable', | |
'constructor' | |
]; | |
var equalsConstructorPrototype = function (o) { | |
var ctor = o.constructor; | |
return ctor && ctor.prototype === o; | |
}; | |
var excludedKeys = { | |
$console: true, | |
$external: true, | |
$frame: true, | |
$frameElement: true, | |
$frames: true, | |
$innerHeight: true, | |
$innerWidth: true, | |
$outerHeight: true, | |
$outerWidth: true, | |
$pageXOffset: true, | |
$pageYOffset: true, | |
$parent: true, | |
$scrollLeft: true, | |
$scrollTop: true, | |
$scrollX: true, | |
$scrollY: true, | |
$self: true, | |
$webkitIndexedDB: true, | |
$webkitStorageInfo: true, | |
$window: true | |
}; | |
var hasAutomationEqualityBug = (function () { | |
/* global window */ | |
if (typeof window === 'undefined') { return false; } | |
for (var k in window) { | |
try { | |
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { | |
try { | |
equalsConstructorPrototype(window[k]); | |
} catch (e) { | |
return true; | |
} | |
} | |
} catch (e) { | |
return true; | |
} | |
} | |
return false; | |
}()); | |
var equalsConstructorPrototypeIfNotBuggy = function (o) { | |
/* global window */ | |
if (typeof window === 'undefined' || !hasAutomationEqualityBug) { | |
return equalsConstructorPrototype(o); | |
} | |
try { | |
return equalsConstructorPrototype(o); | |
} catch (e) { | |
return false; | |
} | |
}; | |
function isArgumentsObject(value) { | |
var str = toStr.call(value); | |
var isArgs = str === '[object Arguments]'; | |
if (!isArgs) { | |
isArgs = str !== '[object Array]' && | |
value !== null && | |
typeof value === 'object' && | |
typeof value.length === 'number' && | |
value.length >= 0 && | |
toStr.call(value.callee) === '[object Function]'; | |
} | |
return isArgs; | |
}; | |
return function keys(object) { | |
var isFunction = toStr.call(object) === '[object Function]'; | |
var isArguments = isArgumentsObject(object); | |
var isString = toStr.call(object) === '[object String]'; | |
var theKeys = []; | |
if (object === undefined || object === null) { | |
throw new TypeError('Cannot convert undefined or null to object'); | |
} | |
var skipProto = hasProtoEnumBug && isFunction; | |
if (isString && object.length > 0 && !has.call(object, 0)) { | |
for (var i = 0; i < object.length; ++i) { | |
theKeys.push(String(i)); | |
} | |
} | |
if (isArguments && object.length > 0) { | |
for (var j = 0; j < object.length; ++j) { | |
theKeys.push(String(j)); | |
} | |
} else { | |
for (var name in object) { | |
if (!(skipProto && name === 'prototype') && has.call(object, name)) { | |
theKeys.push(String(name)); | |
} | |
} | |
} | |
if (hasDontEnumBug) { | |
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); | |
for (var k = 0; k < dontEnums.length; ++k) { | |
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { | |
theKeys.push(dontEnums[k]); | |
} | |
} | |
} | |
return theKeys; | |
}; | |
}()); | |
} | |
if (!('assign' in Object)) { | |
// Object.assign | |
(function() { | |
// 7.1.13 ToObject ( argument ) | |
function toObject(argument) { | |
if (argument === null || argument === undefined) { | |
throw new TypeError('Cannot call method on ' + argument); | |
} | |
return Object(argument); | |
} | |
Object.defineProperty(Object, 'assign', { | |
enumerable: false, | |
configurable: true, | |
writable: true, | |
// 19.1.2.1 Object.assign ( target, ...sources ) | |
value: function assign(target, source) { // eslint-disable-line no-unused-vars | |
// 1. Let to be ? ToObject(target). | |
var to = toObject(target); | |
// 2. If only one argument was passed, return to. | |
if (arguments.length === 1) { | |
return to; | |
} | |
// 3. Let sources be the List of argument values starting with the second argument | |
var sources = Array.prototype.slice.call(arguments, 1); | |
// 4. For each element nextSource of sources, in ascending index order, do | |
var index1; | |
var index2; | |
var keys; | |
var key; | |
var from; | |
for (index1 = 0; index1 < sources.length; index1++) { | |
var nextSource = sources[index1]; | |
// 4a. If nextSource is undefined or null, let keys be a new empty List. | |
if (nextSource === undefined || nextSource === null) { | |
keys = []; | |
// 4b. Else, | |
} else { | |
// 4bi. Let from be ! ToObject(nextSource). | |
from = toObject(nextSource); | |
// 4bii. Let keys be ? from.[[OwnPropertyKeys]](). | |
/* | |
This step in our polyfill is not complying with the specification. | |
[[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols. | |
TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]]. | |
*/ | |
keys = Object.keys(from); | |
} | |
// 4c. For each element nextKey of keys in List order, do | |
for (index2 = 0; index2 < keys.length; index2++) { | |
var nextKey = keys[index2]; | |
// 4ci. Let desc be ? from.[[GetOwnProperty]](nextKey). | |
var desc = Object.getOwnPropertyDescriptor(from, nextKey); | |
// 4cii. If desc is not undefined and desc.[[Enumerable]] is true, then | |
if (desc !== undefined && desc.enumerable) { | |
// 4cii1. Let propValue be ? Get(from, nextKey). | |
var propValue = from[nextKey]; | |
// 4cii2. Perform ? Set(to, nextKey, propValue, true). | |
to[nextKey] = propValue; | |
} | |
} | |
} | |
// 5. Return to. | |
return to; | |
} | |
}); | |
}()); | |
} | |
if (!('defineProperties' in Object)) { | |
// Object.defineProperties | |
Object.defineProperties = function defineProperties(object, descriptors) { | |
for (var property in descriptors) { | |
if (descriptors.hasOwnProperty(property)) { | |
Object.defineProperty(object, property, descriptors[property]); | |
} | |
} | |
return object; | |
}; | |
} | |
if (!('forEach' in Array.prototype)) { | |
// Array.prototype.forEach | |
Array.prototype.forEach = function forEach(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1; | |
while (++index < length) { | |
if (index in arraylike) { | |
callback.call(scope, arraylike[index], index, object); | |
} | |
} | |
}; | |
} | |
if (!('filter' in Array.prototype)) { | |
// Array.prototype.filter | |
Array.prototype.filter = function filter(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1, | |
result = [], | |
element; | |
while (++index < length) { | |
element = arraylike[index]; | |
if (index in arraylike && callback.call(scope, element, index, object)) { | |
result.push(element); | |
} | |
} | |
return result; | |
}; | |
} | |
if (!('map' in Array.prototype)) { | |
// Array.prototype.map | |
Array.prototype.map = function map(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1, | |
result = []; | |
while (++index < length) { | |
if (index in arraylike) { | |
result[index] = callback.call(scope, arraylike[index], index, object); | |
} | |
} | |
return result; | |
}; | |
} | |
if (!('create' in Object)) { | |
// Object.create | |
(function(){ | |
function isPrimitive(o) { | |
return o == null || (typeof o !== 'object' && typeof o !== 'function'); | |
}; | |
Object.create = function create(prototype, properties) { | |
/* jshint evil: true */ | |
if (prototype !== null && isPrimitive(prototype)) { | |
throw new TypeError('Object prototype may only be an Object or null'); | |
} | |
var | |
object = new Function('e', 'function Object() {}Object.prototype=e;return new Object')(prototype); | |
object.constructor.prototype = prototype; | |
if (1 in arguments) { | |
Object.defineProperties(object, properties); | |
} | |
return object; | |
}; | |
}()); | |
} | |
if (!('getOwnPropertyNames' in Object)) { | |
// Object.getOwnPropertyNames | |
Object.getOwnPropertyNames = function getOwnPropertyNames(object) { | |
var buffer = []; | |
var key; | |
// Non-enumerable properties cannot be discovered but can be checked for by name. | |
// Define those used internally by JS to allow an incomplete solution | |
var commonProps = ['length', "name", "arguments", "caller", "prototype", "observe", "unobserve"]; | |
if (typeof object === 'undefined' || object === null) { | |
throw new TypeError('Cannot convert undefined or null to object'); | |
} | |
object = Object(object); | |
// Enumerable properties only | |
for (key in object) { | |
if (Object.prototype.hasOwnProperty.call(object, key)) { | |
buffer.push(key); | |
} | |
} | |
// Check for and add the common non-enumerable properties | |
for (var i=0, s=commonProps.length; i<s; i++) { | |
if (commonProps[i] in object) buffer.push(commonProps[i]); | |
} | |
return buffer; | |
}; | |
} | |
if (!('freeze' in Object)) { | |
// Object.freeze | |
Object.freeze = function freeze(object) { | |
// This feature cannot be implemented fully as a polyfill. | |
// We choose to silently fail which allows "securable" code | |
// to "gracefully" degrade to working but insecure code. | |
return object; | |
}; | |
} | |
if (!('Symbol' in this)) { | |
// Symbol | |
// A modification of https://github.com/WebReflection/get-own-property-symbols | |
// (C) Andrea Giammarchi - MIT Licensed | |
(function (Object, GOPS, global) { | |
var setDescriptor; | |
var id = 0; | |
var random = '' + Math.random(); | |
var prefix = '__\x01symbol:'; | |
var prefixLength = prefix.length; | |
var internalSymbol = '__\x01symbol@@' + random; | |
var DP = 'defineProperty'; | |
var DPies = 'defineProperties'; | |
var GOPN = 'getOwnPropertyNames'; | |
var GOPD = 'getOwnPropertyDescriptor'; | |
var PIE = 'propertyIsEnumerable'; | |
var ObjectProto = Object.prototype; | |
var hOP = ObjectProto.hasOwnProperty; | |
var pIE = ObjectProto[PIE]; | |
var toString = ObjectProto.toString; | |
var concat = Array.prototype.concat; | |
var cachedWindowNames = typeof window === 'object' ? Object.getOwnPropertyNames(window) : []; | |
var nGOPN = Object[GOPN]; | |
var gOPN = function getOwnPropertyNames (obj) { | |
if (toString.call(obj) === '[object Window]') { | |
try { | |
return nGOPN(obj); | |
} catch (e) { | |
// IE bug where layout engine calls userland gOPN for cross-domain `window` objects | |
return concat.call([], cachedWindowNames); | |
} | |
} | |
return nGOPN(obj); | |
}; | |
var gOPD = Object[GOPD]; | |
var create = Object.create; | |
var keys = Object.keys; | |
var freeze = Object.freeze || Object; | |
var defineProperty = Object[DP]; | |
var $defineProperties = Object[DPies]; | |
var descriptor = gOPD(Object, GOPN); | |
var addInternalIfNeeded = function (o, uid, enumerable) { | |
if (!hOP.call(o, internalSymbol)) { | |
try { | |
defineProperty(o, internalSymbol, { | |
enumerable: false, | |
configurable: false, | |
writable: false, | |
value: {} | |
}); | |
} catch (e) { | |
o[internalSymbol] = {}; | |
} | |
} | |
o[internalSymbol]['@@' + uid] = enumerable; | |
}; | |
var createWithSymbols = function (proto, descriptors) { | |
var self = create(proto); | |
gOPN(descriptors).forEach(function (key) { | |
if (propertyIsEnumerable.call(descriptors, key)) { | |
$defineProperty(self, key, descriptors[key]); | |
} | |
}); | |
return self; | |
}; | |
var copyAsNonEnumerable = function (descriptor) { | |
var newDescriptor = create(descriptor); | |
newDescriptor.enumerable = false; | |
return newDescriptor; | |
}; | |
var get = function get(){}; | |
var onlyNonSymbols = function (name) { | |
return name != internalSymbol && | |
!hOP.call(source, name); | |
}; | |
var onlySymbols = function (name) { | |
return name != internalSymbol && | |
hOP.call(source, name); | |
}; | |
var propertyIsEnumerable = function propertyIsEnumerable(key) { | |
var uid = '' + key; | |
return onlySymbols(uid) ? ( | |
hOP.call(this, uid) && | |
this[internalSymbol]['@@' + uid] | |
) : pIE.call(this, key); | |
}; | |
var setAndGetSymbol = function (uid) { | |
var descriptor = { | |
enumerable: false, | |
configurable: true, | |
get: get, | |
set: function (value) { | |
setDescriptor(this, uid, { | |
enumerable: false, | |
configurable: true, | |
writable: true, | |
value: value | |
}); | |
addInternalIfNeeded(this, uid, true); | |
} | |
}; | |
try { | |
defineProperty(ObjectProto, uid, descriptor); | |
} catch (e) { | |
ObjectProto[uid] = descriptor.value; | |
} | |
return freeze(source[uid] = defineProperty( | |
Object(uid), | |
'constructor', | |
sourceConstructor | |
)); | |
}; | |
var Symbol = function Symbol(description) { | |
if (this instanceof Symbol) { | |
throw new TypeError('Symbol is not a constructor'); | |
} | |
return setAndGetSymbol( | |
prefix.concat(description || '', random, ++id) | |
); | |
}; | |
var source = create(null); | |
var sourceConstructor = {value: Symbol}; | |
var sourceMap = function (uid) { | |
return source[uid]; | |
}; | |
var $defineProperty = function defineProp(o, key, descriptor) { | |
var uid = '' + key; | |
if (onlySymbols(uid)) { | |
setDescriptor(o, uid, descriptor.enumerable ? | |
copyAsNonEnumerable(descriptor) : descriptor); | |
addInternalIfNeeded(o, uid, !!descriptor.enumerable); | |
} else { | |
defineProperty(o, key, descriptor); | |
} | |
return o; | |
}; | |
var onlyInternalSymbols = function (obj) { | |
return function (name) { | |
return hOP.call(obj, internalSymbol) && hOP.call(obj[internalSymbol], '@@' + name); | |
}; | |
}; | |
var $getOwnPropertySymbols = function getOwnPropertySymbols(o) { | |
return gOPN(o).filter(o === ObjectProto ? onlyInternalSymbols(o) : onlySymbols).map(sourceMap); | |
} | |
; | |
descriptor.value = $defineProperty; | |
defineProperty(Object, DP, descriptor); | |
descriptor.value = $getOwnPropertySymbols; | |
defineProperty(Object, GOPS, descriptor); | |
descriptor.value = function getOwnPropertyNames(o) { | |
return gOPN(o).filter(onlyNonSymbols); | |
}; | |
defineProperty(Object, GOPN, descriptor); | |
descriptor.value = function defineProperties(o, descriptors) { | |
var symbols = $getOwnPropertySymbols(descriptors); | |
if (symbols.length) { | |
keys(descriptors).concat(symbols).forEach(function (uid) { | |
if (propertyIsEnumerable.call(descriptors, uid)) { | |
$defineProperty(o, uid, descriptors[uid]); | |
} | |
}); | |
} else { | |
$defineProperties(o, descriptors); | |
} | |
return o; | |
}; | |
defineProperty(Object, DPies, descriptor); | |
descriptor.value = propertyIsEnumerable; | |
defineProperty(ObjectProto, PIE, descriptor); | |
descriptor.value = Symbol; | |
defineProperty(global, 'Symbol', descriptor); | |
// defining `Symbol.for(key)` | |
descriptor.value = function (key) { | |
var uid = prefix.concat(prefix, key, random); | |
return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); | |
}; | |
defineProperty(Symbol, 'for', descriptor); | |
// defining `Symbol.keyFor(symbol)` | |
descriptor.value = function (symbol) { | |
if (onlyNonSymbols(symbol)) | |
throw new TypeError(symbol + ' is not a symbol'); | |
return hOP.call(source, symbol) ? | |
symbol.slice(prefixLength * 2, -random.length) : | |
void 0 | |
; | |
}; | |
defineProperty(Symbol, 'keyFor', descriptor); | |
descriptor.value = function getOwnPropertyDescriptor(o, key) { | |
var descriptor = gOPD(o, key); | |
if (descriptor && onlySymbols(key)) { | |
descriptor.enumerable = propertyIsEnumerable.call(o, key); | |
} | |
return descriptor; | |
}; | |
defineProperty(Object, GOPD, descriptor); | |
descriptor.value = function (proto, descriptors) { | |
return arguments.length === 1 || typeof descriptors === "undefined" ? | |
create(proto) : | |
createWithSymbols(proto, descriptors); | |
}; | |
defineProperty(Object, 'create', descriptor); | |
descriptor.value = function () { | |
var str = toString.call(this); | |
return (str === '[object String]' && onlySymbols(this)) ? '[object Symbol]' : str; | |
}; | |
defineProperty(ObjectProto, 'toString', descriptor); | |
setDescriptor = function (o, key, descriptor) { | |
var protoDescriptor = gOPD(ObjectProto, key); | |
delete ObjectProto[key]; | |
defineProperty(o, key, descriptor); | |
if (o !== ObjectProto) { | |
defineProperty(ObjectProto, key, protoDescriptor); | |
} | |
}; | |
}(Object, 'getOwnPropertySymbols', this)); | |
} | |
if (!('Symbol' in this && 'iterator' in this.Symbol)) { | |
// Symbol.iterator | |
Object.defineProperty(Symbol, 'iterator', {value: Symbol('iterator')}); | |
} | |
if (!('Symbol' in this && 'toStringTag' in this.Symbol)) { | |
// Symbol.toStringTag | |
Object.defineProperty(Symbol, 'toStringTag', { | |
value: Symbol('toStringTag') | |
}); | |
} | |
// _Iterator | |
// A modification of https://github.com/medikoo/es6-iterator | |
// Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) | |
var Iterator = (function () { // eslint-disable-line no-unused-vars | |
var clear = function () { | |
this.length = 0; | |
return this; | |
}; | |
var callable = function (fn) { | |
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function"); | |
return fn; | |
}; | |
var Iterator = function (list, context) { | |
if (!(this instanceof Iterator)) { | |
return new Iterator(list, context); | |
} | |
Object.defineProperties(this, { | |
__list__: { | |
writable: true, | |
value: list | |
}, | |
__context__: { | |
writable: true, | |
value: context | |
}, | |
__nextIndex__: { | |
writable: true, | |
value: 0 | |
} | |
}); | |
if (!context) return; | |
callable(context.on); | |
context.on('_add', this._onAdd.bind(this)); | |
context.on('_delete', this._onDelete.bind(this)); | |
context.on('_clear', this._onClear.bind(this)); | |
}; | |
Object.defineProperties(Iterator.prototype, Object.assign({ | |
constructor: { | |
value: Iterator, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_next: { | |
value: function () { | |
var i; | |
if (!this.__list__) return; | |
if (this.__redo__) { | |
i = this.__redo__.shift(); | |
if (i !== undefined) return i; | |
} | |
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; | |
this._unBind(); | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
next: { | |
value: function () { | |
return this._createResult(this._next()); | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_createResult: { | |
value: function (i) { | |
if (i === undefined) return { | |
done: true, | |
value: undefined | |
}; | |
return { | |
done: false, | |
value: this._resolve(i) | |
}; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_resolve: { | |
value: function (i) { | |
return this.__list__[i]; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_unBind: { | |
value: function () { | |
this.__list__ = null; | |
delete this.__redo__; | |
if (!this.__context__) return; | |
this.__context__.off('_add', this._onAdd.bind(this)); | |
this.__context__.off('_delete', this._onDelete.bind(this)); | |
this.__context__.off('_clear', this._onClear.bind(this)); | |
this.__context__ = null; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
toString: { | |
value: function () { | |
return '[object Iterator]'; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
} | |
}, { | |
_onAdd: { | |
value: function (index) { | |
if (index >= this.__nextIndex__) return; | |
++this.__nextIndex__; | |
if (!this.__redo__) { | |
Object.defineProperty(this, '__redo__', { | |
value: [index], | |
configurable: true, | |
enumerable: false, | |
writable: false | |
}); | |
return; | |
} | |
this.__redo__.forEach(function (redo, i) { | |
if (redo >= index) this.__redo__[i] = ++redo; | |
}, this); | |
this.__redo__.push(index); | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_onDelete: { | |
value: function (index) { | |
var i; | |
if (index >= this.__nextIndex__) return; | |
--this.__nextIndex__; | |
if (!this.__redo__) return; | |
i = this.__redo__.indexOf(index); | |
if (i !== -1) this.__redo__.splice(i, 1); | |
this.__redo__.forEach(function (redo, i) { | |
if (redo > index) this.__redo__[i] = --redo; | |
}, this); | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_onClear: { | |
value: function () { | |
if (this.__redo__) clear.call(this.__redo__); | |
this.__nextIndex__ = 0; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
} | |
})); | |
Object.defineProperty(Iterator.prototype, Symbol.iterator, { | |
value: function () { | |
return this; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}); | |
Object.defineProperty(Iterator.prototype, Symbol.toStringTag, { | |
value: 'Iterator', | |
configurable: false, | |
enumerable: false, | |
writable: true | |
}); | |
return Iterator; | |
}()); | |
if (!('getPrototypeOf' in Object)) { | |
// Object.getPrototypeOf | |
// Based on: https://github.com/es-shims/es5-shim/blob/master/es5-sham.js | |
// https://github.com/es-shims/es5-shim/issues#issue/2 | |
// http://ejohn.org/blog/objectgetprototypeof/ | |
// recommended by fschaefer on github | |
// | |
// sure, and webreflection says ^_^ | |
// ... this will nerever possibly return null | |
// ... Opera Mini breaks here with infinite loops | |
Object.getPrototypeOf = function getPrototypeOf(object) { | |
if (object !== Object(object)) { | |
throw new TypeError('Object.getPrototypeOf called on non-object'); | |
} | |
var proto = object.__proto__; | |
if (proto || proto === null) { | |
return proto; | |
} else if (typeof object.constructor == 'function' && object instanceof object.constructor) { | |
return object.constructor.prototype; | |
} else if (object instanceof Object) { | |
return Object.prototype; | |
} else { | |
// Correctly return null for Objects created with `Object.create(null)` | |
// (shammed or native) or `{ __proto__: null}`. Also returns null for | |
// cross-realm objects on browsers that lack `__proto__` support (like | |
// IE <11), but that's the best we can do. | |
return null; | |
} | |
}; | |
} | |
// Object.setPrototypeOf | |
// ES6-shim 0.16.0 (c) 2013-2014 Paul Miller (http://paulmillr.com) | |
// ES6-shim may be freely distributed under the MIT license. | |
// For more details and documentation: | |
// https://github.com/paulmillr/es6-shim/ | |
// NOTE: This versions needs object ownership | |
// because every promoted object needs to be reassigned | |
// otherwise uncompatible browsers cannot work as expected | |
// | |
// NOTE: This might need es5-shim or polyfills upfront | |
// because it's based on ES5 API. | |
// (probably just an IE <= 8 problem) | |
// | |
// NOTE: nodejs is fine in version 0.8, 0.10, and future versions. | |
(function () { | |
if (Object.setPrototypeOf) { return; } | |
/*jshint proto: true */ | |
// @author Andrea Giammarchi - @WebReflection | |
var getOwnPropertyNames = Object.getOwnPropertyNames; | |
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
var create = Object.create; | |
var defineProperty = Object.defineProperty; | |
var getPrototypeOf = Object.getPrototypeOf; | |
var objProto = Object.prototype; | |
var copyDescriptors = function (target, source) { | |
// define into target descriptors from source | |
getOwnPropertyNames(source).forEach(function (key) { | |
defineProperty( | |
target, | |
key, | |
getOwnPropertyDescriptor(source, key) | |
); | |
}); | |
return target; | |
}; | |
// used as fallback when no promotion is possible | |
var createAndCopy = function (origin, proto) { | |
return copyDescriptors(create(proto), origin); | |
}; | |
var set, setPrototypeOf; | |
try { | |
// this might fail for various reasons | |
// ignore if Chrome cought it at runtime | |
set = getOwnPropertyDescriptor(objProto, '__proto__').set; | |
set.call({}, null); | |
// setter not poisoned, it can promote | |
// Firefox, Chrome | |
setPrototypeOf = function (origin, proto) { | |
set.call(origin, proto); | |
return origin; | |
}; | |
} catch (e) { | |
// do one or more feature detections | |
set = { __proto__: null }; | |
// if proto does not work, needs to fallback | |
// some Opera, Rhino, ducktape | |
if (set instanceof Object) { | |
setPrototypeOf = createAndCopy; | |
} else { | |
// verify if null objects are buggy | |
/* eslint-disable no-proto */ | |
set.__proto__ = objProto; | |
/* eslint-enable no-proto */ | |
// if null objects are buggy | |
// nodejs 0.8 to 0.10 | |
if (set instanceof Object) { | |
setPrototypeOf = function (origin, proto) { | |
// use such bug to promote | |
/* eslint-disable no-proto */ | |
origin.__proto__ = proto; | |
/* eslint-enable no-proto */ | |
return origin; | |
}; | |
} else { | |
// try to use proto or fallback | |
// Safari, old Firefox, many others | |
setPrototypeOf = function (origin, proto) { | |
// if proto is not null | |
if (getPrototypeOf(origin)) { | |
// use __proto__ to promote | |
/* eslint-disable no-proto */ | |
origin.__proto__ = proto; | |
/* eslint-enable no-proto */ | |
return origin; | |
} else { | |
// otherwise unable to promote: fallback | |
return createAndCopy(origin, proto); | |
} | |
}; | |
} | |
} | |
} | |
Object.setPrototypeOf = setPrototypeOf; | |
}()); | |
if (!('includes' in String.prototype)) { | |
// String.prototype.includes | |
String.prototype.includes = function (string, index) { | |
if (typeof string === 'object' && string instanceof RegExp) throw new TypeError("First argument to String.prototype.includes must not be a regular expression"); | |
return this.indexOf(string, index) !== -1; | |
}; | |
} | |
if (!('contains' in String.prototype)) { | |
// String.prototype.contains | |
String.prototype.contains = String.prototype.includes; | |
} | |
// _ArrayIterator | |
// A modification of https://github.com/medikoo/es6-iterator | |
// Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) | |
var ArrayIterator = (function() { // eslint-disable-line no-unused-vars | |
var ArrayIterator = function(arr, kind) { | |
if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind); | |
Iterator.call(this, arr); | |
if (!kind) kind = 'value'; | |
else if (String.prototype.contains.call(kind, 'key+value')) kind = 'key+value'; | |
else if (String.prototype.contains.call(kind, 'key')) kind = 'key'; | |
else kind = 'value'; | |
Object.defineProperty(this, '__kind__', { | |
value: kind, | |
configurable: false, | |
enumerable: false, | |
writable: false | |
}); | |
}; | |
if (Object.setPrototypeOf) Object.setPrototypeOf(ArrayIterator, Iterator.prototype); | |
ArrayIterator.prototype = Object.create(Iterator.prototype, { | |
constructor: { | |
value: ArrayIterator, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_resolve: { | |
value: function(i) { | |
if (this.__kind__ === 'value') return this.__list__[i]; | |
if (this.__kind__ === 'key+value') return [i, this.__list__[i]]; | |
return i; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
toString: { | |
value: function() { | |
return '[object Array Iterator]'; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
} | |
}); | |
return ArrayIterator; | |
}()); | |
if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype[Symbol.iterator])) { | |
// Array.prototype.@@iterator | |
/* global Symbol, ArrayIterator*/ | |
Array.prototype[Symbol.iterator] = function values () { | |
return new ArrayIterator(this); | |
}; | |
} | |
if (!('copyWithin' in Array.prototype)) { | |
// Array.prototype.copyWithin | |
(function () { | |
function hasProperty(o, p) { | |
while (o) { | |
if (Object.prototype.hasOwnProperty.call(o, p)) { | |
return true; | |
} | |
if (typeof o !== 'object') { | |
return false; | |
} | |
o = Object.getPrototypeOf(o); | |
} | |
return false; | |
} | |
function toInteger(n) { | |
n = Number(n); | |
if (isNaN(n)) { | |
return 0; | |
} | |
if (n === 0 || n === Infinity || n === -Infinity) { | |
return n; | |
} else { | |
return ((n < 0) ? -1 : 1) * Math.floor(Math.abs(n)); | |
} | |
} | |
Object.defineProperty(Array.prototype, 'copyWithin', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
// 22.1.3.3 Array.prototype.copyWithin ( target, start [ , end ] ) | |
value: function (target, start/*, end*/) { | |
var end = arguments[2]; | |
// 22.1.3.3.1 Let O be ? ToObject(this value). | |
if (this === null || this === undefined) { | |
throw new TypeError('Cannot call method on ' + this); | |
} | |
var o = Object(this); | |
// 22.1.3.3.2 Let len be ? ToLength(? Get(O, "length")). | |
var len = toInteger(o.length); | |
if (len <= 0) { | |
len = 0; | |
} | |
if (len === Infinity) { | |
len = Math.pow(2, 53) - 1; | |
} else { | |
len = Math.min(len, Math.pow(2, 53) - 1); | |
} | |
len = Math.max(len, 0); | |
// 22.1.3.3.3 Let relativeTarget be ? ToInteger(target). | |
var relativeTarget = toInteger(target); | |
// 22.1.3.3.4 If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let to be min(relativeTarget, len). | |
var to; | |
if (relativeTarget < 0) { | |
to = Math.max(len + relativeTarget, 0); | |
} else { | |
to = Math.min(relativeTarget, len); | |
} | |
// 22.1.3.3.5 Let relativeStart be ? ToInteger(start). | |
var relativeStart = toInteger(start); | |
// 22.1.3.3.6 If relativeStart < 0, let from be max((len + relativeStart), 0); else let from be min(relativeStart, len). | |
var from; | |
if (relativeStart < 0) { | |
from = Math.max(len + relativeStart, 0); | |
} else { | |
from = Math.min(relativeStart, len); | |
} | |
// 22.1.3.3.7 If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToInteger(end). | |
var relativeEnd; | |
if (end === undefined) { | |
relativeEnd = len; | |
} else { | |
relativeEnd = toInteger(end); | |
} | |
// 22.1.3.3.8 If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let final be min(relativeEnd, len). | |
var final; | |
if (relativeEnd < 0) { | |
final = Math.max(len + relativeEnd, 0); | |
} else { | |
final = Math.min(relativeEnd, len); | |
} | |
// 22.1.3.3.9 Let count be min(final-from, len-to). | |
var count = Math.min(final - from, len - to); | |
// 22.1.3.3.10 If from<to and to<from+count, then | |
var direction; | |
if (from < to && to < from + count) { | |
// 22.1.3.3.10.a Let direction be -1. | |
direction = -1; | |
// 22.1.3.3.10.b Let from be from + count - 1. | |
from = from + count - 1; | |
// 22.1.3.3.10.c Let to be to + count - 1. | |
to = to + count - 1; | |
} else { | |
// 22.1.3.3.11 Else, | |
// 22.1.3.3.11.a Let direction be 1. | |
direction = 1; | |
} | |
// 22.1.3.3.12 Repeat, while count > 0 | |
while (count > 0) { | |
// 22.1.3.3.12.a Let fromKey be ! ToString(from). | |
var fromKey = String(from); | |
// 22.1.3.3.12.b Let toKey be ! ToString(to). | |
var toKey = String(to); | |
// 22.1.3.3.12.c Let fromPresent be ? HasProperty(O, fromKey). | |
var fromPresent = hasProperty(o, fromKey); | |
// 22.1.3.3.12.d If fromPresent is true, then | |
if (fromPresent) { | |
// 22.1.3.3.12.d.i Let fromVal be ? Get(O, fromKey). | |
var fromVal = o[fromKey]; | |
// 22.1.3.3.12.d.ii Perform ? Set(O, toKey, fromVal, true). | |
o[toKey] = fromVal; | |
} else { | |
// 22.1.3.3.12.e Else fromPresent is false, | |
// 22.1.3.3.12.e.i Perform ? DeletePropertyOrThrow(O, toKey). | |
delete o[toKey]; | |
} | |
// 22.1.3.3.12.f Let from be from + direction. | |
from = from + direction; | |
// 22.1.3.3.12.g Let to be to + direction. | |
to = to + direction; | |
// 22.1.3.3.12.h Let count be count - 1. | |
count = count - 1; | |
} | |
// 22.1.3.3.13 Return O. | |
return o; | |
} | |
}); | |
}()); | |
} | |
if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype.entries)) { | |
// Array.prototype.entries | |
Object.defineProperty(Array.prototype, 'entries', { | |
value: function () { | |
return new ArrayIterator(this, 'key+value'); | |
} | |
}); | |
} | |
if (!('find' in Array.prototype)) { | |
// Array.prototype.find | |
Object.defineProperty(Array.prototype, 'find', { | |
configurable: true, | |
value: function find(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1, | |
element; | |
while (++index < length) { | |
if (index in arraylike) { | |
element = arraylike[index]; | |
if (callback.call(scope, element, index, object)) { | |
return element; | |
} | |
} | |
} | |
}, | |
writable: true | |
}); | |
} | |
if (!('findIndex' in Array.prototype)) { | |
// Array.prototype.findIndex | |
Object.defineProperty(Array.prototype, 'findIndex', { | |
configurable: true, | |
value: function findIndex(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1; | |
while (++index < length) { | |
if (index in arraylike) { | |
if (callback.call(scope, arraylike[index], index, object)) { | |
return index; | |
} | |
} | |
} | |
return -1; | |
}, | |
writable: true | |
}); | |
} | |
if (!('includes' in Array.prototype)) { | |
// Array.prototype.includes | |
(function () { | |
Object.defineProperty(Array.prototype, 'includes', { | |
configurable: true, | |
value: function includes (searchElement /*, fromIndex*/) { | |
'use strict'; | |
var O = Object(this); | |
var len = parseInt(O.length) || 0; | |
if (len === 0) { | |
return false; | |
} | |
var n = parseInt(arguments[1]) || 0; | |
var k; | |
if (n >= 0) { | |
k = n; | |
} else { | |
k = len + n; | |
if (k < 0) { | |
k = 0; | |
} | |
} | |
var currentElement; | |
while (k < len) { | |
currentElement = O[k]; | |
if (searchElement === currentElement || | |
(searchElement !== searchElement && currentElement !== currentElement)) { | |
return true; | |
} | |
k++; | |
} | |
return false; | |
}, | |
writable: true | |
}); | |
}()); | |
} | |
if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype.keys)) { | |
// Array.prototype.keys | |
/* global ArrayIterator*/ | |
Object.defineProperty(Array.prototype, 'keys', { | |
value: function () { | |
return new ArrayIterator(this, 'key'); | |
} | |
}); | |
} | |
if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype[Symbol.iterator] && !!Array.prototype.values && (Array.prototype[Symbol.iterator] === Array.prototype.values))) { | |
// Array.prototype.values | |
/* global Symbol */ | |
Object.defineProperty(Array.prototype, 'values', { | |
value: Array.prototype[Symbol.iterator], | |
enumerable: false, | |
writable: false | |
}); | |
} | |
if (!('Symbol' in this && 'iterator' in this.Symbol && !!document.createElement('div').classList[Symbol.iterator])) { | |
// DOMTokenList.prototype.@@iterator | |
/* global Symbol, ArrayIterator*/ | |
DOMTokenList.prototype[Symbol.iterator] = function () { | |
return new ArrayIterator(this); | |
}; | |
} | |
if (!('DocumentFragment' in this && this.DocumentFragment === document.createDocumentFragment().constructor)) { | |
// DocumentFragment | |
this.DocumentFragment = document.createDocumentFragment().constructor; | |
} | |
if (!("Document" in this)) { | |
// Document | |
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) { | |
if (this.HTMLDocument) { // IE8 | |
// HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter. | |
this.Document = this.HTMLDocument; | |
} else { | |
// Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made. | |
this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')()); | |
this.Document.prototype = document; | |
} | |
} | |
} | |
if (!('Element' in this && 'HTMLElement' in this)) { | |
// Element | |
(function () { | |
// IE8 | |
if (window.Element && !window.HTMLElement) { | |
window.HTMLElement = window.Element; | |
return; | |
} | |
// create Element constructor | |
window.Element = window.HTMLElement = new Function('return function Element() {}')(); | |
// generate sandboxed iframe | |
var vbody = document.appendChild(document.createElement('body')); | |
var frame = vbody.appendChild(document.createElement('iframe')); | |
// use sandboxed iframe to replicate Element functionality | |
var frameDocument = frame.contentWindow.document; | |
var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*')); | |
var cache = {}; | |
// polyfill Element.prototype on an element | |
var shiv = function (element, deep) { | |
var | |
childNodes = element.childNodes || [], | |
index = -1, | |
key, value, childNode; | |
if (element.nodeType === 1 && element.constructor !== Element) { | |
element.constructor = Element; | |
for (key in cache) { | |
value = cache[key]; | |
element[key] = value; | |
} | |
} | |
while (childNode = deep && childNodes[++index]) { | |
shiv(childNode, deep); | |
} | |
return element; | |
}; | |
var elements = document.getElementsByTagName('*'); | |
var nativeCreateElement = document.createElement; | |
var interval; | |
var loopLimit = 100; | |
prototype.attachEvent('onpropertychange', function (event) { | |
var | |
propertyName = event.propertyName, | |
nonValue = !cache.hasOwnProperty(propertyName), | |
newValue = prototype[propertyName], | |
oldValue = cache[propertyName], | |
index = -1, | |
element; | |
while (element = elements[++index]) { | |
if (element.nodeType === 1) { | |
if (nonValue || element[propertyName] === oldValue) { | |
element[propertyName] = newValue; | |
} | |
} | |
} | |
cache[propertyName] = newValue; | |
}); | |
prototype.constructor = Element; | |
if (!prototype.hasAttribute) { | |
// <Element>.hasAttribute | |
prototype.hasAttribute = function hasAttribute(name) { | |
return this.getAttribute(name) !== null; | |
}; | |
} | |
// Apply Element prototype to the pre-existing DOM as soon as the body element appears. | |
function bodyCheck() { | |
if (!(loopLimit--)) clearTimeout(interval); | |
if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) { | |
shiv(document, true); | |
if (interval && document.body.prototype) clearTimeout(interval); | |
return (!!document.body.prototype); | |
} | |
return false; | |
} | |
if (!bodyCheck()) { | |
document.onreadystatechange = bodyCheck; | |
interval = setInterval(bodyCheck, 25); | |
} | |
// Apply to any new elements created after load | |
document.createElement = function createElement(nodeName) { | |
var element = nativeCreateElement(String(nodeName).toLowerCase()); | |
return shiv(element); | |
}; | |
// remove sandboxed iframe | |
document.removeChild(vbody); | |
}()); | |
} | |
if (!('document' in this && 'querySelector' in this.document)) { | |
// document.querySelector | |
(function () { | |
var | |
head = document.getElementsByTagName('head')[0]; | |
function getElementsByQuery(node, selector, one) { | |
var | |
generator = document.createElement('div'), | |
id = 'qsa' + String(Math.random()).slice(3), | |
style, elements; | |
generator.innerHTML = 'x<style>' + selector + '{qsa:' + id + ';}'; | |
style = head.appendChild(generator.lastChild); | |
elements = getElements(node, selector, one, id); | |
head.removeChild(style); | |
return one ? elements[0] : elements; | |
} | |
function getElements(node, selector, one, id) { | |
var | |
validNode = /1|9/.test(node.nodeType), | |
childNodes = node.childNodes, | |
elements = [], | |
index = -1, | |
childNode; | |
if (validNode && node.currentStyle && node.currentStyle.qsa === id) { | |
if (elements.push(node) && one) { | |
return elements; | |
} | |
} | |
while (childNode = childNodes[++index]) { | |
elements = elements.concat(getElements(childNode, selector, one, id)); | |
if (one && elements.length) { | |
return elements; | |
} | |
} | |
return elements; | |
} | |
Document.prototype.querySelector = Element.prototype.querySelector = function querySelectorAll(selector) { | |
return getElementsByQuery(this, selector, true); | |
}; | |
Document.prototype.querySelectorAll = Element.prototype.querySelectorAll = function querySelectorAll(selector) { | |
return getElementsByQuery(this, selector, false); | |
}; | |
}()); | |
} | |
if (!((function(){ | |
if (!document.documentElement.dataset) { | |
return false; | |
} | |
var el = document.createElement('div'); | |
el.setAttribute("data-a-b", "c"); | |
return el.dataset && el.dataset.aB == "c"; | |
}()))) { | |
// Element.prototype.dataset | |
Object.defineProperty(Element.prototype, 'dataset', { | |
get: function() { | |
var element = this; | |
var attributes = this.attributes; | |
var map = {}; | |
for (var i = 0; i < attributes.length; i++) { | |
var attribute = attributes[i]; | |
if (attribute && attribute.name && (/^data-\w[\w\-]*$/).test(attribute.name)) { | |
var name = attribute.name; | |
var value = attribute.value; | |
var propName = name.substr(5).replace(/-./g, function (prop) { | |
return prop.charAt(1).toUpperCase(); | |
}); | |
Object.defineProperty(map, propName, { | |
enumerable: this.enumerable, | |
get: function() { | |
return this.value; | |
}.bind({value: value || ''}), | |
set: function setter(name, value) { | |
if (typeof value !== 'undefined') { | |
this.setAttribute(name, value); | |
} else { | |
this.removeAttribute(name); | |
} | |
}.bind(element, name) | |
}); | |
} | |
} | |
return map; | |
} | |
}); | |
} | |
if (!('EventSource' in this && typeof this.EventSource === 'function')) { | |
// EventSource | |
/** @license | |
* eventsource.js | |
* Available under MIT License (MIT) | |
* https://github.com/Yaffle/EventSource/ | |
*/ | |
/*jslint indent: 2, vars: true, plusplus: true */ | |
/*global setTimeout, clearTimeout */ | |
(function (global) { | |
"use strict"; | |
var setTimeout = global.setTimeout; | |
var clearTimeout = global.clearTimeout; | |
var k = function () { | |
}; | |
function XHRTransport(xhr, onStartCallback, onProgressCallback, onFinishCallback, thisArg) { | |
this._internal = new XHRTransportInternal(xhr, onStartCallback, onProgressCallback, onFinishCallback, thisArg); | |
} | |
XHRTransport.prototype.open = function (url, withCredentials) { | |
this._internal.open(url, withCredentials); | |
}; | |
XHRTransport.prototype.cancel = function () { | |
this._internal.cancel(); | |
}; | |
function XHRTransportInternal(xhr, onStartCallback, onProgressCallback, onFinishCallback, thisArg) { | |
this.onStartCallback = onStartCallback; | |
this.onProgressCallback = onProgressCallback; | |
this.onFinishCallback = onFinishCallback; | |
this.thisArg = thisArg; | |
this.xhr = xhr; | |
this.state = 0; | |
this.charOffset = 0; | |
this.offset = 0; | |
this.url = ""; | |
this.withCredentials = false; | |
this.timeout = 0; | |
} | |
XHRTransportInternal.prototype.onStart = function () { | |
if (this.state === 1) { | |
this.state = 2; | |
var status = 0; | |
var statusText = ""; | |
var contentType = undefined; | |
if (!("contentType" in this.xhr)) { | |
try { | |
status = this.xhr.status; | |
statusText = this.xhr.statusText; | |
contentType = this.xhr.getResponseHeader("Content-Type"); | |
} catch (error) { | |
// https://bugs.webkit.org/show_bug.cgi?id=29121 | |
status = 0; | |
statusText = ""; | |
contentType = undefined; | |
// FF < 14, WebKit | |
// https://bugs.webkit.org/show_bug.cgi?id=29658 | |
// https://bugs.webkit.org/show_bug.cgi?id=77854 | |
} | |
} else { | |
status = 200; | |
statusText = "OK"; | |
contentType = this.xhr.contentType; | |
} | |
if (contentType == undefined) { | |
contentType = ""; | |
} | |
this.onStartCallback.call(this.thisArg, status, statusText, contentType); | |
} | |
}; | |
XHRTransportInternal.prototype.onProgress = function () { | |
this.onStart(); | |
if (this.state === 2 || this.state === 3) { | |
this.state = 3; | |
var responseText = ""; | |
try { | |
responseText = this.xhr.responseText; | |
} catch (error) { | |
// IE 8 - 9 with XMLHttpRequest | |
} | |
var chunkStart = this.charOffset; | |
var length = responseText.length; | |
for (var i = this.offset; i < length; i += 1) { | |
var c = responseText.charCodeAt(i); | |
if (c === "\n".charCodeAt(0) || c === "\r".charCodeAt(0)) { | |
this.charOffset = i + 1; | |
} | |
} | |
this.offset = length; | |
var chunk = responseText.slice(chunkStart, this.charOffset); | |
this.onProgressCallback.call(this.thisArg, chunk); | |
} | |
}; | |
XHRTransportInternal.prototype.onFinish = function () { | |
// IE 8 fires "onload" without "onprogress | |
this.onProgress(); | |
if (this.state === 3) { | |
this.state = 4; | |
if (this.timeout !== 0) { | |
clearTimeout(this.timeout); | |
this.timeout = 0; | |
} | |
this.onFinishCallback.call(this.thisArg); | |
} | |
}; | |
XHRTransportInternal.prototype.onReadyStateChange = function () { | |
if (this.xhr != undefined) { // Opera 12 | |
if (this.xhr.readyState === 4) { | |
if (this.xhr.status === 0) { | |
this.onFinish(); | |
} else { | |
this.onFinish(); | |
} | |
} else if (this.xhr.readyState === 3) { | |
this.onProgress(); | |
} else if (this.xhr.readyState === 2) { | |
// Opera 10.63 throws exception for `this.xhr.status` | |
// this.onStart(); | |
} | |
} | |
}; | |
XHRTransportInternal.prototype.onTimeout2 = function () { | |
this.timeout = 0; | |
var tmp = (/^data\:([^,]*?)(base64)?,([\S]*)$/).exec(this.url); | |
var contentType = tmp[1]; | |
var data = tmp[2] === "base64" ? global.atob(tmp[3]) : decodeURIComponent(tmp[3]); | |
if (this.state === 1) { | |
this.state = 2; | |
this.onStartCallback.call(this.thisArg, 200, "OK", contentType); | |
} | |
if (this.state === 2 || this.state === 3) { | |
this.state = 3; | |
this.onProgressCallback.call(this.thisArg, data); | |
} | |
if (this.state === 3) { | |
this.state = 4; | |
this.onFinishCallback.call(this.thisArg); | |
} | |
}; | |
XHRTransportInternal.prototype.onTimeout1 = function () { | |
this.timeout = 0; | |
this.open(this.url, this.withCredentials); | |
}; | |
XHRTransportInternal.prototype.onTimeout0 = function () { | |
var that = this; | |
this.timeout = setTimeout(function () { | |
that.onTimeout0(); | |
}, 500); | |
if (this.xhr.readyState === 3) { | |
this.onProgress(); | |
} | |
}; | |
XHRTransportInternal.prototype.handleEvent = function (event) { | |
if (event.type === "load") { | |
this.onFinish(); | |
} else if (event.type === "error") { | |
this.onFinish(); | |
} else if (event.type === "abort") { | |
// improper fix to match Firefox behaviour, but it is better than just ignore abort | |
// see https://bugzilla.mozilla.org/show_bug.cgi?id=768596 | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=880200 | |
// https://code.google.com/p/chromium/issues/detail?id=153570 | |
// IE 8 fires "onload" without "onprogress | |
this.onFinish(); | |
} else if (event.type === "progress") { | |
this.onProgress(); | |
} else if (event.type === "readystatechange") { | |
this.onReadyStateChange(); | |
} | |
}; | |
XHRTransportInternal.prototype.open = function (url, withCredentials) { | |
this.cancel(); | |
this.url = url; | |
this.withCredentials = withCredentials; | |
this.state = 1; | |
this.charOffset = 0; | |
this.offset = 0; | |
var that = this; | |
var tmp = (/^data\:([^,]*?)(?:;base64)?,[\S]*$/).exec(url); | |
if (tmp != undefined) { | |
this.timeout = setTimeout(function () { | |
that.onTimeout2(); | |
}, 0); | |
return; | |
} | |
// loading indicator in Safari, Chrome < 14 | |
// loading indicator in Firefox | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=736723 | |
if ((!("ontimeout" in this.xhr) || ("sendAsBinary" in this.xhr) || ("mozAnon" in this.xhr)) && global.document != undefined && global.document.readyState != undefined && global.document.readyState !== "complete") { | |
this.timeout = setTimeout(function () { | |
that.onTimeout1(); | |
}, 4); | |
return; | |
} | |
// XDomainRequest#abort removes onprogress, onerror, onload | |
this.xhr.onload = function (event) { | |
that.handleEvent({type: "load"}); | |
}; | |
this.xhr.onerror = function () { | |
that.handleEvent({type: "error"}); | |
}; | |
this.xhr.onabort = function () { | |
that.handleEvent({type: "abort"}); | |
}; | |
this.xhr.onprogress = function () { | |
that.handleEvent({type: "progress"}); | |
}; | |
// IE 8-9 (XMLHTTPRequest) | |
// Firefox 3.5 - 3.6 - ? < 9.0 | |
// onprogress is not fired sometimes or delayed | |
// see also #64 | |
this.xhr.onreadystatechange = function () { | |
that.handleEvent({type: "readystatechange"}); | |
}; | |
this.xhr.open("GET", url, true); | |
// withCredentials should be set after "open" for Safari and Chrome (< 19 ?) | |
this.xhr.withCredentials = withCredentials; | |
this.xhr.responseType = "text"; | |
if ("setRequestHeader" in this.xhr) { | |
// Request header field Cache-Control is not allowed by Access-Control-Allow-Headers. | |
// "Cache-control: no-cache" are not honored in Chrome and Firefox | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=428916 | |
//this.xhr.setRequestHeader("Cache-Control", "no-cache"); | |
this.xhr.setRequestHeader("Accept", "text/event-stream"); | |
// Request header field Last-Event-ID is not allowed by Access-Control-Allow-Headers. | |
//this.xhr.setRequestHeader("Last-Event-ID", this.lastEventId); | |
} | |
try { | |
this.xhr.send(undefined); | |
} catch (error1) { | |
// Safari 5.1.7, Opera 12 | |
throw error1; | |
} | |
if (("readyState" in this.xhr) && global.opera != undefined) { | |
// workaround for Opera issue with "progress" events | |
this.timeout = setTimeout(function () { | |
that.onTimeout0(); | |
}, 0); | |
} | |
}; | |
XHRTransportInternal.prototype.cancel = function () { | |
if (this.state !== 0 && this.state !== 4) { | |
this.state = 4; | |
this.xhr.onload = k; | |
this.xhr.onerror = k; | |
this.xhr.onabort = k; | |
this.xhr.onprogress = k; | |
this.xhr.onreadystatechange = k; | |
this.xhr.abort(); | |
if (this.timeout !== 0) { | |
clearTimeout(this.timeout); | |
this.timeout = 0; | |
} | |
this.onFinishCallback.call(this.thisArg); | |
} | |
this.state = 0; | |
}; | |
function Map() { | |
this._data = {}; | |
} | |
Map.prototype.get = function (key) { | |
return this._data[key + "~"]; | |
}; | |
Map.prototype.set = function (key, value) { | |
this._data[key + "~"] = value; | |
}; | |
Map.prototype["delete"] = function (key) { | |
delete this._data[key + "~"]; | |
}; | |
function EventTarget() { | |
this._listeners = new Map(); | |
} | |
function throwError(e) { | |
setTimeout(function () { | |
throw e; | |
}, 0); | |
} | |
EventTarget.prototype.dispatchEvent = function (event) { | |
event.target = this; | |
var type = event.type.toString(); | |
var listeners = this._listeners; | |
var typeListeners = listeners.get(type); | |
if (typeListeners == undefined) { | |
return; | |
} | |
var length = typeListeners.length; | |
var listener = undefined; | |
for (var i = 0; i < length; i += 1) { | |
listener = typeListeners[i]; | |
try { | |
if (typeof listener.handleEvent === "function") { | |
listener.handleEvent(event); | |
} else { | |
listener.call(this, event); | |
} | |
} catch (e) { | |
throwError(e); | |
} | |
} | |
}; | |
EventTarget.prototype.addEventListener = function (type, callback) { | |
type = type.toString(); | |
var listeners = this._listeners; | |
var typeListeners = listeners.get(type); | |
if (typeListeners == undefined) { | |
typeListeners = []; | |
listeners.set(type, typeListeners); | |
} | |
for (var i = typeListeners.length; i >= 0; i -= 1) { | |
if (typeListeners[i] === callback) { | |
return; | |
} | |
} | |
typeListeners.push(callback); | |
}; | |
EventTarget.prototype.removeEventListener = function (type, callback) { | |
type = type.toString(); | |
var listeners = this._listeners; | |
var typeListeners = listeners.get(type); | |
if (typeListeners == undefined) { | |
return; | |
} | |
var length = typeListeners.length; | |
var filtered = []; | |
for (var i = 0; i < length; i += 1) { | |
if (typeListeners[i] !== callback) { | |
filtered.push(typeListeners[i]); | |
} | |
} | |
if (filtered.length === 0) { | |
listeners["delete"](type); | |
} else { | |
listeners.set(type, filtered); | |
} | |
}; | |
function Event(type) { | |
this.type = type; | |
this.target = undefined; | |
} | |
function MessageEvent(type, options) { | |
Event.call(this, type); | |
this.data = options.data; | |
this.lastEventId = options.lastEventId; | |
} | |
MessageEvent.prototype = Event.prototype; | |
var XHR = global.XMLHttpRequest; | |
var XDR = global.XDomainRequest; | |
var isCORSSupported = XHR != undefined && (new XHR()).withCredentials != undefined; | |
var Transport = isCORSSupported || (XHR != undefined && XDR == undefined) ? XHR : XDR; | |
var WAITING = -1; | |
var CONNECTING = 0; | |
var OPEN = 1; | |
var CLOSED = 2; | |
var AFTER_CR = 3; | |
var FIELD_START = 4; | |
var FIELD = 5; | |
var VALUE_START = 6; | |
var VALUE = 7; | |
var contentTypeRegExp = /^text\/event\-stream;?(\s*charset\=utf\-8)?$/i; | |
var MINIMUM_DURATION = 1000; | |
var MAXIMUM_DURATION = 18000000; | |
var getDuration = function (value, def) { | |
var n = value; | |
if (n !== n) { | |
n = def; | |
} | |
return (n < MINIMUM_DURATION ? MINIMUM_DURATION : (n > MAXIMUM_DURATION ? MAXIMUM_DURATION : n)); | |
}; | |
var fire = function (that, f, event) { | |
try { | |
if (typeof f === "function") { | |
f.call(that, event); | |
} | |
} catch (e) { | |
throwError(e); | |
} | |
}; | |
function EventSource(url, options) { | |
EventTarget.call(this); | |
this.onopen = undefined; | |
this.onmessage = undefined; | |
this.onerror = undefined; | |
this.url = ""; | |
this.readyState = CONNECTING; | |
this.withCredentials = false; | |
this._internal = new EventSourceInternal(this, url, options); | |
} | |
function EventSourceInternal(es, url, options) { | |
this.url = url.toString(); | |
this.readyState = CONNECTING; | |
this.withCredentials = isCORSSupported && options != undefined && Boolean(options.withCredentials); | |
this.es = es; | |
this.initialRetry = getDuration(1000, 0); | |
this.heartbeatTimeout = getDuration(45000, 0); | |
this.lastEventId = ""; | |
this.retry = this.initialRetry; | |
this.wasActivity = false; | |
var CurrentTransport = options != undefined && options.Transport != undefined ? options.Transport : Transport; | |
var xhr = new CurrentTransport(); | |
this.transport = new XHRTransport(xhr, this.onStart, this.onProgress, this.onFinish, this); | |
this.timeout = 0; | |
this.currentState = WAITING; | |
this.dataBuffer = []; | |
this.lastEventIdBuffer = ""; | |
this.eventTypeBuffer = ""; | |
this.state = FIELD_START; | |
this.fieldStart = 0; | |
this.valueStart = 0; | |
this.es.url = this.url; | |
this.es.readyState = this.readyState; | |
this.es.withCredentials = this.withCredentials; | |
this.onTimeout(); | |
} | |
EventSourceInternal.prototype.onStart = function (status, statusText, contentType) { | |
if (this.currentState === CONNECTING) { | |
if (contentType == undefined) { | |
contentType = ""; | |
} | |
if (status === 200 && contentTypeRegExp.test(contentType)) { | |
this.currentState = OPEN; | |
this.wasActivity = true; | |
this.retry = this.initialRetry; | |
this.readyState = OPEN; | |
this.es.readyState = OPEN; | |
var event = new Event("open"); | |
this.es.dispatchEvent(event); | |
fire(this.es, this.es.onopen, event); | |
} else if (status !== 0) { | |
var message = ""; | |
if (status !== 200) { | |
message = "EventSource's response has a status " + status + " " + statusText.replace(/\s+/g, " ") + " that is not 200. Aborting the connection."; | |
} else { | |
message = "EventSource's response has a Content-Type specifying an unsupported type: " + contentType.replace(/\s+/g, " ") + ". Aborting the connection."; | |
} | |
throwError(new Error(message)); | |
this.close(); | |
var event = new Event("error"); | |
this.es.dispatchEvent(event); | |
fire(this.es, this.es.onerror, event); | |
} | |
} | |
}; | |
EventSourceInternal.prototype.onProgress = function (chunk) { | |
if (this.currentState === OPEN) { | |
var length = chunk.length; | |
if (length !== 0) { | |
this.wasActivity = true; | |
} | |
for (var position = 0; position < length; position += 1) { | |
var c = chunk.charCodeAt(position); | |
if (this.state === AFTER_CR && c === "\n".charCodeAt(0)) { | |
this.state = FIELD_START; | |
} else { | |
if (this.state === AFTER_CR) { | |
this.state = FIELD_START; | |
} | |
if (c === "\r".charCodeAt(0) || c === "\n".charCodeAt(0)) { | |
if (this.state !== FIELD_START) { | |
if (this.state === FIELD) { | |
this.valueStart = position + 1; | |
} | |
var field = chunk.slice(this.fieldStart, this.valueStart - 1); | |
var value = chunk.slice(this.valueStart + (this.valueStart < position && chunk.charCodeAt(this.valueStart) === " ".charCodeAt(0) ? 1 : 0), position); | |
if (field === "data") { | |
this.dataBuffer.push(value); | |
} else if (field === "id") { | |
this.lastEventIdBuffer = value; | |
} else if (field === "event") { | |
this.eventTypeBuffer = value; | |
} else if (field === "retry") { | |
this.initialRetry = getDuration(Number(value), this.initialRetry); | |
this.retry = this.initialRetry; | |
} else if (field === "heartbeatTimeout") { | |
this.heartbeatTimeout = getDuration(Number(value), this.heartbeatTimeout); | |
if (this.timeout !== 0) { | |
clearTimeout(this.timeout); | |
var that = this; | |
this.timeout = setTimeout(function () { | |
that.onTimeout(); | |
}, this.heartbeatTimeout); | |
} | |
} | |
} | |
if (this.state === FIELD_START) { | |
if (this.dataBuffer.length !== 0) { | |
this.lastEventId = this.lastEventIdBuffer; | |
if (this.eventTypeBuffer === "") { | |
this.eventTypeBuffer = "message"; | |
} | |
var event = new MessageEvent(this.eventTypeBuffer, { | |
data: this.dataBuffer.join("\n"), | |
lastEventId: this.lastEventIdBuffer | |
}); | |
this.es.dispatchEvent(event); | |
if (this.eventTypeBuffer === "message") { | |
fire(this.es, this.es.onmessage, event); | |
} | |
if (this.currentState === CLOSED) { | |
return; | |
} | |
} | |
this.dataBuffer.length = 0; | |
this.eventTypeBuffer = ""; | |
} | |
this.state = c === "\r".charCodeAt(0) ? AFTER_CR : FIELD_START; | |
} else { | |
if (this.state === FIELD_START) { | |
this.fieldStart = position; | |
this.state = FIELD; | |
} | |
if (this.state === FIELD) { | |
if (c === ":".charCodeAt(0)) { | |
this.valueStart = position + 1; | |
this.state = VALUE_START; | |
} | |
} else if (this.state === VALUE_START) { | |
this.state = VALUE; | |
} | |
} | |
} | |
} | |
} | |
}; | |
EventSourceInternal.prototype.onFinish = function () { | |
if (this.currentState === OPEN || this.currentState === CONNECTING) { | |
this.currentState = WAITING; | |
if (this.timeout !== 0) { | |
clearTimeout(this.timeout); | |
this.timeout = 0; | |
} | |
if (this.retry > this.initialRetry * 16) { | |
this.retry = this.initialRetry * 16; | |
} | |
if (this.retry > MAXIMUM_DURATION) { | |
this.retry = MAXIMUM_DURATION; | |
} | |
var that = this; | |
this.timeout = setTimeout(function () { | |
that.onTimeout(); | |
}, this.retry); | |
this.retry = this.retry * 2 + 1; | |
this.readyState = CONNECTING; | |
this.es.readyState = CONNECTING; | |
var event = new Event("error"); | |
this.es.dispatchEvent(event); | |
fire(this.es, this.es.onerror, event); | |
} | |
}; | |
EventSourceInternal.prototype.onTimeout = function () { | |
this.timeout = 0; | |
if (this.currentState !== WAITING) { | |
if (!this.wasActivity) { | |
throwError(new Error("No activity within " + this.heartbeatTimeout + " milliseconds. Reconnecting.")); | |
this.transport.cancel(); | |
} else { | |
this.wasActivity = false; | |
var that = this; | |
this.timeout = setTimeout(function () { | |
that.onTimeout(); | |
}, this.heartbeatTimeout); | |
} | |
return; | |
} | |
this.wasActivity = false; | |
var that = this; | |
this.timeout = setTimeout(function () { | |
that.onTimeout(); | |
}, this.heartbeatTimeout); | |
this.currentState = CONNECTING; | |
this.dataBuffer.length = 0; | |
this.eventTypeBuffer = ""; | |
this.lastEventIdBuffer = this.lastEventId; | |
this.fieldStart = 0; | |
this.valueStart = 0; | |
this.state = FIELD_START; | |
var s = this.url.slice(0, 5); | |
if (s !== "data:" && s !== "blob:") { | |
s = this.url + ((this.url.indexOf("?", 0) === -1 ? "?" : "&") + "lastEventId=" + encodeURIComponent(this.lastEventId) + "&r=" + (Math.random() + 1).toString().slice(2)); | |
} else { | |
s = this.url; | |
} | |
try { | |
this.transport.open(s, this.withCredentials); | |
} catch (error) { | |
this.close(); | |
throw error; | |
} | |
}; | |
EventSourceInternal.prototype.close = function () { | |
this.currentState = CLOSED; | |
this.transport.cancel(); | |
if (this.timeout !== 0) { | |
clearTimeout(this.timeout); | |
this.timeout = 0; | |
} | |
this.readyState = CLOSED; | |
this.es.readyState = CLOSED; | |
}; | |
function F() { | |
this.CONNECTING = CONNECTING; | |
this.OPEN = OPEN; | |
this.CLOSED = CLOSED; | |
} | |
F.prototype = EventTarget.prototype; | |
EventSource.prototype = new F(); | |
EventSource.prototype.close = function () { | |
this._internal.close(); | |
}; | |
F.call(EventSource); | |
if (isCORSSupported) { | |
EventSource.prototype.withCredentials = undefined; | |
} | |
var isEventSourceSupported = function () { | |
// Opera 12 fails this test, but this is fine. | |
return global.EventSource != undefined && ("withCredentials" in global.EventSource.prototype); | |
}; | |
if (Transport != undefined && (global.EventSource == undefined || (isCORSSupported && !isEventSourceSupported()))) { | |
// Why replace a native EventSource ? | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=444328 | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=831392 | |
// https://code.google.com/p/chromium/issues/detail?id=260144 | |
// https://code.google.com/p/chromium/issues/detail?id=225654 | |
// ... | |
global.NativeEventSource = global.EventSource; | |
global.EventSource = EventSource; | |
} | |
}(typeof window !== 'undefined' ? window : this)); | |
} | |
if (!('name' in Function.prototype && (function x() {}).name === 'x')) { | |
// Function.name | |
(function () { | |
var | |
accessorName = 'name', | |
fnNameMatchRegex = /^\s*function\s+([^\(\s]*)\s*/, | |
$Function = Function, | |
FunctionName = 'Function', | |
FunctionProto = $Function.prototype, | |
FunctionProtoCtor = FunctionProto.constructor, | |
getFunctionName = function(fn) { | |
var match, name; | |
if (fn === $Function || fn === FunctionProtoCtor) { | |
name = FunctionName; | |
} | |
else if (fn !== FunctionProto) { | |
match = ('' + fn).match(fnNameMatchRegex); | |
name = match && match[1]; | |
} | |
return name || ''; | |
}; | |
Object.defineProperty(FunctionProto, accessorName, { | |
get: function Function$name() { | |
var | |
fn = this, | |
fnName = getFunctionName(fn); | |
// Since named function definitions have immutable names, also memoize the | |
// output by defining the `name` property directly on this Function | |
// instance so the accessor function will not need to be invoked again. | |
if (fn !== FunctionProto) { | |
Object.defineProperty(fn, accessorName, { | |
value: fnName, | |
configurable: true | |
}); | |
} | |
return fnName; | |
}, | |
configurable: true | |
}); | |
}()); | |
} | |
if (!('atob' in this)) { | |
// atob | |
;(function () { | |
var object = | |
typeof exports != 'undefined' ? exports : | |
typeof self != 'undefined' ? self : // #8: web workers | |
$.global; // #31: ExtendScript | |
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; | |
function InvalidCharacterError(message) { | |
this.message = message; | |
} | |
InvalidCharacterError.prototype = new Error; | |
InvalidCharacterError.prototype.name = 'InvalidCharacterError'; | |
// encoder | |
// [https://gist.github.com/999166] by [https://github.com/nignag] | |
object.btoa || ( | |
object.btoa = function (input) { | |
var str = String(input); | |
for ( | |
// initialize result and counter | |
var block, charCode, idx = 0, map = chars, output = ''; | |
// if the next str index does not exist: | |
// change the mapping table to "=" | |
// check if d has no fractional digits | |
str.charAt(idx | 0) || (map = '=', idx % 1); | |
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 | |
output += map.charAt(63 & block >> 8 - idx % 1 * 8) | |
) { | |
charCode = str.charCodeAt(idx += 3/4); | |
if (charCode > 0xFF) { | |
throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); | |
} | |
block = block << 8 | charCode; | |
} | |
return output; | |
}); | |
// decoder | |
// [https://gist.github.com/1020396] by [https://github.com/atk] | |
object.atob || ( | |
object.atob = function (input) { | |
var str = String(input).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /= | |
if (str.length % 4 == 1) { | |
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); | |
} | |
for ( | |
// initialize result and counters | |
var bc = 0, bs, buffer, idx = 0, output = ''; | |
// get next character | |
buffer = str.charAt(idx++); | |
// character found in table? initialize bit storage and add its ascii value; | |
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, | |
// and if not first of each 4 characters, | |
// convert the first 8 bits to one ascii character | |
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 | |
) { | |
// try to find character in table (0-63, not found => -1) | |
buffer = chars.indexOf(buffer); | |
} | |
return output; | |
}); | |
}()); | |
} | |
if (!('toBlob' in HTMLCanvasElement.prototype)) { | |
// HTMLCanvasElement.prototype.toBlob | |
(function () { | |
'use strict'; | |
Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { | |
value: function (callback, type, quality) { | |
var binStr = atob( this.toDataURL(type, quality).split(',')[1] ), | |
len = binStr.length, | |
arr = new Uint8Array(len); | |
for (var i=0; i<len; i++ ) { | |
arr[i] = binStr.charCodeAt(i); | |
} | |
callback(new Blob([arr], { type: type || 'image/png' } ) ); | |
} | |
}); | |
}()); | |
} | |
if (!("HTMLDocument" in this)) { | |
// HTMLDocument | |
this.HTMLDocument = this.Document; | |
} | |
if (!('Window' in this)) { | |
// Window | |
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) { | |
(function (global) { | |
if (global.constructor) { | |
global.Window = global.constructor; | |
} else { | |
(global.Window = global.constructor = new Function('return function Window() {}')()).prototype = this; | |
} | |
}(this)); | |
} | |
} | |
if (!('getComputedStyle' in this)) { | |
// getComputedStyle | |
(function (global) { | |
function getComputedStylePixel(element, property, fontSize) { | |
var | |
// Internet Explorer sometimes struggles to read currentStyle until the element's document is accessed. | |
value = element.document && element.currentStyle[property].match(/([\d\.]+)(%|cm|em|in|mm|pc|pt|)/) || [0, 0, ''], | |
size = value[1], | |
suffix = value[2], | |
rootSize; | |
fontSize = !fontSize ? fontSize : /%|em/.test(suffix) && element.parentElement ? getComputedStylePixel(element.parentElement, 'fontSize', null) : 16; | |
rootSize = property == 'fontSize' ? fontSize : /width/i.test(property) ? element.clientWidth : element.clientHeight; | |
return suffix == '%' ? size / 100 * rootSize : | |
suffix == 'cm' ? size * 0.3937 * 96 : | |
suffix == 'em' ? size * fontSize : | |
suffix == 'in' ? size * 96 : | |
suffix == 'mm' ? size * 0.3937 * 96 / 10 : | |
suffix == 'pc' ? size * 12 * 96 / 72 : | |
suffix == 'pt' ? size * 96 / 72 : | |
size; | |
} | |
function setShortStyleProperty(style, property) { | |
var | |
borderSuffix = property == 'border' ? 'Width' : '', | |
t = property + 'Top' + borderSuffix, | |
r = property + 'Right' + borderSuffix, | |
b = property + 'Bottom' + borderSuffix, | |
l = property + 'Left' + borderSuffix; | |
style[property] = (style[t] == style[r] && style[t] == style[b] && style[t] == style[l] ? [ style[t] ] : | |
style[t] == style[b] && style[l] == style[r] ? [ style[t], style[r] ] : | |
style[l] == style[r] ? [ style[t], style[r], style[b] ] : | |
[ style[t], style[r], style[b], style[l] ]).join(' '); | |
} | |
// <CSSStyleDeclaration> | |
function CSSStyleDeclaration(element) { | |
var | |
style = this, | |
currentStyle = element.currentStyle, | |
fontSize = getComputedStylePixel(element, 'fontSize'), | |
unCamelCase = function (match) { | |
return '-' + match.toLowerCase(); | |
}, | |
property; | |
for (property in currentStyle) { | |
Array.prototype.push.call(style, property == 'styleFloat' ? 'float' : property.replace(/[A-Z]/, unCamelCase)); | |
if (property == 'width') { | |
style[property] = element.offsetWidth + 'px'; | |
} else if (property == 'height') { | |
style[property] = element.offsetHeight + 'px'; | |
} else if (property == 'styleFloat') { | |
style.float = currentStyle[property]; | |
} else if (/margin.|padding.|border.+W/.test(property) && style[property] != 'auto') { | |
style[property] = Math.round(getComputedStylePixel(element, property, fontSize)) + 'px'; | |
} else if (/^outline/.test(property)) { | |
// errors on checking outline | |
try { | |
style[property] = currentStyle[property]; | |
} catch (error) { | |
style.outlineColor = currentStyle.color; | |
style.outlineStyle = style.outlineStyle || 'none'; | |
style.outlineWidth = style.outlineWidth || '0px'; | |
style.outline = [style.outlineColor, style.outlineWidth, style.outlineStyle].join(' '); | |
} | |
} else { | |
style[property] = currentStyle[property]; | |
} | |
} | |
setShortStyleProperty(style, 'margin'); | |
setShortStyleProperty(style, 'padding'); | |
setShortStyleProperty(style, 'border'); | |
style.fontSize = Math.round(fontSize) + 'px'; | |
} | |
CSSStyleDeclaration.prototype = { | |
constructor: CSSStyleDeclaration, | |
// <CSSStyleDeclaration>.getPropertyPriority | |
getPropertyPriority: function () { | |
throw new Error('NotSupportedError: DOM Exception 9'); | |
}, | |
// <CSSStyleDeclaration>.getPropertyValue | |
getPropertyValue: function (property) { | |
return this[property.replace(/-\w/g, function (match) { | |
return match[1].toUpperCase(); | |
})]; | |
}, | |
// <CSSStyleDeclaration>.item | |
item: function (index) { | |
return this[index]; | |
}, | |
// <CSSStyleDeclaration>.removeProperty | |
removeProperty: function () { | |
throw new Error('NoModificationAllowedError: DOM Exception 7'); | |
}, | |
// <CSSStyleDeclaration>.setProperty | |
setProperty: function () { | |
throw new Error('NoModificationAllowedError: DOM Exception 7'); | |
}, | |
// <CSSStyleDeclaration>.getPropertyCSSValue | |
getPropertyCSSValue: function () { | |
throw new Error('NotSupportedError: DOM Exception 9'); | |
} | |
}; | |
// <Global>.getComputedStyle | |
global.getComputedStyle = function getComputedStyle(element) { | |
return new CSSStyleDeclaration(element); | |
}; | |
}(this)); | |
} | |
if (!('isArray' in Array)) { | |
// Array.isArray | |
(function (toString) { | |
Object.defineProperty(Array, 'isArray', { | |
configurable: true, | |
value: function isArray(object) { | |
return toString.call(object) === '[object Array]'; | |
}, | |
writable: true | |
}); | |
}(Object.prototype.toString)); | |
} | |
if (!('indexOf' in Array.prototype)) { | |
// Array.prototype.indexOf | |
Array.prototype.indexOf = function indexOf(searchElement) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
var | |
arraylike = this instanceof String ? this.split('') : this, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = Number(arguments[1]) || 0; | |
index = (index < 0 ? Math.max(length + index, 0) : index) - 1; | |
while (++index < length) { | |
if (index in arraylike && arraylike[index] === searchElement) { | |
return index; | |
} | |
} | |
return -1; | |
}; | |
} | |
if (!('some' in Array.prototype)) { | |
// Array.prototype.some | |
Array.prototype.some = function some(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1; | |
while (++index < length) { | |
if (index in arraylike && callback.call(scope, arraylike[index], index, object)) { | |
return true; | |
} | |
} | |
return false; | |
}; | |
} | |
if (!((function(global) { | |
if (!('Event' in global)) return false; | |
if (typeof global.Event === 'function') return true; | |
try { | |
// In IE 9-11, the Event object exists but cannot be instantiated | |
new Event('click'); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
}(this)))) { | |
// Event | |
(function () { | |
var unlistenableWindowEvents = { | |
click: 1, | |
dblclick: 1, | |
keyup: 1, | |
keypress: 1, | |
keydown: 1, | |
mousedown: 1, | |
mouseup: 1, | |
mousemove: 1, | |
mouseover: 1, | |
mouseenter: 1, | |
mouseleave: 1, | |
mouseout: 1, | |
storage: 1, | |
storagecommit: 1, | |
textinput: 1 | |
}; | |
// This polyfill depends on availability of `document` so will not run in a worker | |
// However, we asssume there are no browsers with worker support that lack proper | |
// support for `Event` within the worker | |
if (typeof document === 'undefined' || typeof window === 'undefined') return; | |
function indexOf(array, element) { | |
var | |
index = -1, | |
length = array.length; | |
while (++index < length) { | |
if (index in array && array[index] === element) { | |
return index; | |
} | |
} | |
return -1; | |
} | |
var existingProto = (window.Event && window.Event.prototype) || null; | |
window.Event = Window.prototype.Event = function Event(type, eventInitDict) { | |
if (!type) { | |
throw new Error('Not enough arguments'); | |
} | |
var event; | |
// Shortcut if browser supports createEvent | |
if ('createEvent' in document) { | |
event = document.createEvent('Event'); | |
var bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false; | |
var cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false; | |
event.initEvent(type, bubbles, cancelable); | |
return event; | |
} | |
event = document.createEventObject(); | |
event.type = type; | |
event.bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false; | |
event.cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false; | |
return event; | |
}; | |
if (existingProto) { | |
Object.defineProperty(window.Event, 'prototype', { | |
configurable: false, | |
enumerable: false, | |
writable: true, | |
value: existingProto | |
}); | |
} | |
if (!('createEvent' in document)) { | |
window.addEventListener = Window.prototype.addEventListener = Document.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener() { | |
var | |
element = this, | |
type = arguments[0], | |
listener = arguments[1]; | |
if (element === window && type in unlistenableWindowEvents) { | |
throw new Error('In IE8 the event: ' + type + ' is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.'); | |
} | |
if (!element._events) { | |
element._events = {}; | |
} | |
if (!element._events[type]) { | |
element._events[type] = function (event) { | |
var | |
list = element._events[event.type].list, | |
events = list.slice(), | |
index = -1, | |
length = events.length, | |
eventElement; | |
event.preventDefault = function preventDefault() { | |
if (event.cancelable !== false) { | |
event.returnValue = false; | |
} | |
}; | |
event.stopPropagation = function stopPropagation() { | |
event.cancelBubble = true; | |
}; | |
event.stopImmediatePropagation = function stopImmediatePropagation() { | |
event.cancelBubble = true; | |
event.cancelImmediate = true; | |
}; | |
event.currentTarget = element; | |
event.relatedTarget = event.fromElement || null; | |
event.target = event.target || event.srcElement || element; | |
event.timeStamp = new Date().getTime(); | |
if (event.clientX) { | |
event.pageX = event.clientX + document.documentElement.scrollLeft; | |
event.pageY = event.clientY + document.documentElement.scrollTop; | |
} | |
while (++index < length && !event.cancelImmediate) { | |
if (index in events) { | |
eventElement = events[index]; | |
if (indexOf(list, eventElement) !== -1 && typeof eventElement === 'function') { | |
eventElement.call(element, event); | |
} | |
} | |
} | |
}; | |
element._events[type].list = []; | |
if (element.attachEvent) { | |
element.attachEvent('on' + type, element._events[type]); | |
} | |
} | |
element._events[type].list.push(listener); | |
}; | |
window.removeEventListener = Window.prototype.removeEventListener = Document.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener() { | |
var | |
element = this, | |
type = arguments[0], | |
listener = arguments[1], | |
index; | |
if (element._events && element._events[type] && element._events[type].list) { | |
index = indexOf(element._events[type].list, listener); | |
if (index !== -1) { | |
element._events[type].list.splice(index, 1); | |
if (!element._events[type].list.length) { | |
if (element.detachEvent) { | |
element.detachEvent('on' + type, element._events[type]); | |
} | |
delete element._events[type]; | |
} | |
} | |
} | |
}; | |
window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) { | |
if (!arguments.length) { | |
throw new Error('Not enough arguments'); | |
} | |
if (!event || typeof event.type !== 'string') { | |
throw new Error('DOM Events Exception 0'); | |
} | |
var element = this, type = event.type; | |
try { | |
if (!event.bubbles) { | |
event.cancelBubble = true; | |
var cancelBubbleEvent = function (event) { | |
event.cancelBubble = true; | |
(element || window).detachEvent('on' + type, cancelBubbleEvent); | |
}; | |
this.attachEvent('on' + type, cancelBubbleEvent); | |
} | |
this.fireEvent('on' + type, event); | |
} catch (error) { | |
event.target = element; | |
do { | |
event.currentTarget = element; | |
if ('_events' in element && typeof element._events[type] === 'function') { | |
element._events[type].call(element, event); | |
} | |
if (typeof element['on' + type] === 'function') { | |
element['on' + type].call(element, event); | |
} | |
element = element.nodeType === 9 ? element.parentWindow : element.parentNode; | |
} while (element && !event.cancelBubble); | |
} | |
return true; | |
}; | |
// Add the DOMContentLoaded Event | |
document.attachEvent('onreadystatechange', function() { | |
if (document.readyState === 'complete') { | |
document.dispatchEvent(new Event('DOMContentLoaded', { | |
bubbles: true | |
})); | |
} | |
}); | |
} | |
}()); | |
} | |
if (!('IntersectionObserver' in this && | |
'IntersectionObserverEntry' in this)) { | |
// IntersectionObserver | |
/** | |
* Copyright 2016 Google Inc. All Rights Reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
(function(window, document) { | |
'use strict'; | |
// Exits early if all IntersectionObserver and IntersectionObserverEntry | |
// features are natively supported. | |
if ('IntersectionObserver' in window && | |
'IntersectionObserverEntry' in window && | |
'intersectionRatio' in window.IntersectionObserverEntry.prototype) { | |
return; | |
} | |
/** | |
* An IntersectionObserver registry. This registry exists to hold a strong | |
* reference to IntersectionObserver instances currently observering a target | |
* element. Without this registry, instances without another reference may be | |
* garbage collected. | |
*/ | |
var registry = []; | |
/** | |
* Creates the global IntersectionObserverEntry constructor. | |
* https://wicg.github.io/IntersectionObserver/#intersection-observer-entry | |
* @param {Object} entry A dictionary of instance properties. | |
* @constructor | |
*/ | |
function IntersectionObserverEntry(entry) { | |
this.time = entry.time; | |
this.target = entry.target; | |
this.rootBounds = entry.rootBounds; | |
this.boundingClientRect = entry.boundingClientRect; | |
this.intersectionRect = entry.intersectionRect || getEmptyRect(); | |
try { | |
this.isIntersecting = !!entry.intersectionRect; | |
} catch (err) { | |
// This means we are using the IntersectionObserverEntry polyfill which has only defined a getter | |
} | |
// Calculates the intersection ratio. | |
var targetRect = this.boundingClientRect; | |
var targetArea = targetRect.width * targetRect.height; | |
var intersectionRect = this.intersectionRect; | |
var intersectionArea = intersectionRect.width * intersectionRect.height; | |
// Sets intersection ratio. | |
if (targetArea) { | |
this.intersectionRatio = intersectionArea / targetArea; | |
} else { | |
// If area is zero and is intersecting, sets to 1, otherwise to 0 | |
this.intersectionRatio = this.isIntersecting ? 1 : 0; | |
} | |
} | |
/** | |
* Creates the global IntersectionObserver constructor. | |
* https://wicg.github.io/IntersectionObserver/#intersection-observer-interface | |
* @param {Function} callback The function to be invoked after intersection | |
* changes have queued. The function is not invoked if the queue has | |
* been emptied by calling the `takeRecords` method. | |
* @param {Object=} opt_options Optional configuration options. | |
* @constructor | |
*/ | |
function IntersectionObserver(callback, opt_options) { | |
var options = opt_options || {}; | |
if (typeof callback != 'function') { | |
throw new Error('callback must be a function'); | |
} | |
if (options.root && options.root.nodeType != 1) { | |
throw new Error('root must be an Element'); | |
} | |
// Binds and throttles `this._checkForIntersections`. | |
this._checkForIntersections = throttle( | |
this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT); | |
// Private properties. | |
this._callback = callback; | |
this._observationTargets = []; | |
this._queuedEntries = []; | |
this._rootMarginValues = this._parseRootMargin(options.rootMargin); | |
// Public properties. | |
this.thresholds = this._initThresholds(options.threshold); | |
this.root = options.root || null; | |
this.rootMargin = this._rootMarginValues.map(function(margin) { | |
return margin.value + margin.unit; | |
}).join(' '); | |
} | |
/** | |
* The minimum interval within which the document will be checked for | |
* intersection changes. | |
*/ | |
IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100; | |
/** | |
* The frequency in which the polyfill polls for intersection changes. | |
* this can be updated on a per instance basis and must be set prior to | |
* calling `observe` on the first target. | |
*/ | |
IntersectionObserver.prototype.POLL_INTERVAL = null; | |
/** | |
* Starts observing a target element for intersection changes based on | |
* the thresholds values. | |
* @param {Element} target The DOM element to observe. | |
*/ | |
IntersectionObserver.prototype.observe = function(target) { | |
// If the target is already being observed, do nothing. | |
if (this._observationTargets.some(function(item) { | |
return item.element == target; | |
})) { | |
return; | |
} | |
if (!(target && target.nodeType == 1)) { | |
throw new Error('target must be an Element'); | |
} | |
this._registerInstance(); | |
this._observationTargets.push({element: target, entry: null}); | |
this._monitorIntersections(); | |
}; | |
/** | |
* Stops observing a target element for intersection changes. | |
* @param {Element} target The DOM element to observe. | |
*/ | |
IntersectionObserver.prototype.unobserve = function(target) { | |
this._observationTargets = | |
this._observationTargets.filter(function(item) { | |
return item.element != target; | |
}); | |
if (!this._observationTargets.length) { | |
this._unmonitorIntersections(); | |
this._unregisterInstance(); | |
} | |
}; | |
/** | |
* Stops observing all target elements for intersection changes. | |
*/ | |
IntersectionObserver.prototype.disconnect = function() { | |
this._observationTargets = []; | |
this._unmonitorIntersections(); | |
this._unregisterInstance(); | |
}; | |
/** | |
* Returns any queue entries that have not yet been reported to the | |
* callback and clears the queue. This can be used in conjunction with the | |
* callback to obtain the absolute most up-to-date intersection information. | |
* @return {Array} The currently queued entries. | |
*/ | |
IntersectionObserver.prototype.takeRecords = function() { | |
var records = this._queuedEntries.slice(); | |
this._queuedEntries = []; | |
return records; | |
}; | |
/** | |
* Accepts the threshold value from the user configuration object and | |
* returns a sorted array of unique threshold values. If a value is not | |
* between 0 and 1 and error is thrown. | |
* @private | |
* @param {Array|number=} opt_threshold An optional threshold value or | |
* a list of threshold values, defaulting to [0]. | |
* @return {Array} A sorted list of unique and valid threshold values. | |
*/ | |
IntersectionObserver.prototype._initThresholds = function(opt_threshold) { | |
var threshold = opt_threshold || [0]; | |
if (!Array.isArray(threshold)) threshold = [threshold]; | |
return threshold.sort().filter(function(t, i, a) { | |
if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) { | |
throw new Error('threshold must be a number between 0 and 1 inclusively'); | |
} | |
return t !== a[i - 1]; | |
}); | |
}; | |
/** | |
* Accepts the rootMargin value from the user configuration object | |
* and returns an array of the four margin values as an object containing | |
* the value and unit properties. If any of the values are not properly | |
* formatted or use a unit other than px or %, and error is thrown. | |
* @private | |
* @param {string=} opt_rootMargin An optional rootMargin value, | |
* defaulting to '0px'. | |
* @return {Array<Object>} An array of margin objects with the keys | |
* value and unit. | |
*/ | |
IntersectionObserver.prototype._parseRootMargin = function(opt_rootMargin) { | |
var marginString = opt_rootMargin || '0px'; | |
var margins = marginString.split(/\s+/).map(function(margin) { | |
var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin); | |
if (!parts) { | |
throw new Error('rootMargin must be specified in pixels or percent'); | |
} | |
return {value: parseFloat(parts[1]), unit: parts[2]}; | |
}); | |
// Handles shorthand. | |
margins[1] = margins[1] || margins[0]; | |
margins[2] = margins[2] || margins[0]; | |
margins[3] = margins[3] || margins[1]; | |
return margins; | |
}; | |
/** | |
* Starts polling for intersection changes if the polling is not already | |
* happening, and if the page's visibilty state is visible. | |
* @private | |
*/ | |
IntersectionObserver.prototype._monitorIntersections = function() { | |
if (!this._monitoringIntersections) { | |
this._monitoringIntersections = true; | |
this._checkForIntersections(); | |
// If a poll interval is set, use polling instead of listening to | |
// resize and scroll events or DOM mutations. | |
if (this.POLL_INTERVAL) { | |
this._monitoringInterval = setInterval( | |
this._checkForIntersections, this.POLL_INTERVAL); | |
} | |
else { | |
addEvent(window, 'resize', this._checkForIntersections, true); | |
addEvent(document, 'scroll', this._checkForIntersections, true); | |
if ('MutationObserver' in window) { | |
this._domObserver = new MutationObserver(this._checkForIntersections); | |
this._domObserver.observe(document, { | |
attributes: true, | |
childList: true, | |
characterData: true, | |
subtree: true | |
}); | |
} | |
} | |
} | |
}; | |
/** | |
* Stops polling for intersection changes. | |
* @private | |
*/ | |
IntersectionObserver.prototype._unmonitorIntersections = function() { | |
if (this._monitoringIntersections) { | |
this._monitoringIntersections = false; | |
clearInterval(this._monitoringInterval); | |
this._monitoringInterval = null; | |
removeEvent(window, 'resize', this._checkForIntersections, true); | |
removeEvent(document, 'scroll', this._checkForIntersections, true); | |
if (this._domObserver) { | |
this._domObserver.disconnect(); | |
this._domObserver = null; | |
} | |
} | |
}; | |
/** | |
* Scans each observation target for intersection changes and adds them | |
* to the internal entries queue. If new entries are found, it | |
* schedules the callback to be invoked. | |
* @private | |
*/ | |
IntersectionObserver.prototype._checkForIntersections = function() { | |
var rootIsInDom = this._rootIsInDom(); | |
var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect(); | |
this._observationTargets.forEach(function(item) { | |
var target = item.element; | |
var targetRect = getBoundingClientRect(target); | |
var rootContainsTarget = this._rootContainsTarget(target); | |
var oldEntry = item.entry; | |
var intersectionRect = rootIsInDom && rootContainsTarget && | |
this._computeTargetAndRootIntersection(target, rootRect); | |
var newEntry = item.entry = new IntersectionObserverEntry({ | |
time: now(), | |
target: target, | |
boundingClientRect: targetRect, | |
rootBounds: rootRect, | |
intersectionRect: intersectionRect | |
}); | |
if (!oldEntry) { | |
this._queuedEntries.push(newEntry); | |
} else if (rootIsInDom && rootContainsTarget) { | |
// If the new entry intersection ratio has crossed any of the | |
// thresholds, add a new entry. | |
if (this._hasCrossedThreshold(oldEntry, newEntry)) { | |
this._queuedEntries.push(newEntry); | |
} | |
} else { | |
// If the root is not in the DOM or target is not contained within | |
// root but the previous entry for this target had an intersection, | |
// add a new record indicating removal. | |
if (oldEntry && oldEntry.isIntersecting) { | |
this._queuedEntries.push(newEntry); | |
} | |
} | |
}, this); | |
if (this._queuedEntries.length) { | |
this._callback(this.takeRecords(), this); | |
} | |
}; | |
/** | |
* Accepts a target and root rect computes the intersection between then | |
* following the algorithm in the spec. | |
* TODO(philipwalton): at this time clip-path is not considered. | |
* https://wicg.github.io/IntersectionObserver/#calculate-intersection-rect-algo | |
* @param {Element} target The target DOM element | |
* @param {Object} rootRect The bounding rect of the root after being | |
* expanded by the rootMargin value. | |
* @return {?Object} The final intersection rect object or undefined if no | |
* intersection is found. | |
* @private | |
*/ | |
IntersectionObserver.prototype._computeTargetAndRootIntersection = | |
function(target, rootRect) { | |
// If the element isn't displayed, an intersection can't happen. | |
if (window.getComputedStyle(target).display == 'none') return; | |
var targetRect = getBoundingClientRect(target); | |
var intersectionRect = targetRect; | |
var parent = getParentNode(target); | |
var atRoot = false; | |
while (!atRoot) { | |
var parentRect = null; | |
var parentComputedStyle = parent.nodeType == 1 ? | |
window.getComputedStyle(parent) : {}; | |
// If the parent isn't displayed, an intersection can't happen. | |
if (parentComputedStyle.display == 'none') return; | |
if (parent == this.root || parent == document) { | |
atRoot = true; | |
parentRect = rootRect; | |
} else { | |
// If the element has a non-visible overflow, and it's not the <body> | |
// or <html> element, update the intersection rect. | |
// Note: <body> and <html> cannot be clipped to a rect that's not also | |
// the document rect, so no need to compute a new intersection. | |
if (parent != document.body && | |
parent != document.documentElement && | |
parentComputedStyle.overflow != 'visible') { | |
parentRect = getBoundingClientRect(parent); | |
} | |
} | |
// If either of the above conditionals set a new parentRect, | |
// calculate new intersection data. | |
if (parentRect) { | |
intersectionRect = computeRectIntersection(parentRect, intersectionRect); | |
if (!intersectionRect) break; | |
} | |
parent = getParentNode(parent); | |
} | |
return intersectionRect; | |
}; | |
/** | |
* Returns the root rect after being expanded by the rootMargin value. | |
* @return {Object} The expanded root rect. | |
* @private | |
*/ | |
IntersectionObserver.prototype._getRootRect = function() { | |
var rootRect; | |
if (this.root) { | |
rootRect = getBoundingClientRect(this.root); | |
} else { | |
// Use <html>/<body> instead of window since scroll bars affect size. | |
var html = document.documentElement; | |
var body = document.body; | |
rootRect = { | |
top: 0, | |
left: 0, | |
right: html.clientWidth || body.clientWidth, | |
width: html.clientWidth || body.clientWidth, | |
bottom: html.clientHeight || body.clientHeight, | |
height: html.clientHeight || body.clientHeight | |
}; | |
} | |
return this._expandRectByRootMargin(rootRect); | |
}; | |
/** | |
* Accepts a rect and expands it by the rootMargin value. | |
* @param {Object} rect The rect object to expand. | |
* @return {Object} The expanded rect. | |
* @private | |
*/ | |
IntersectionObserver.prototype._expandRectByRootMargin = function(rect) { | |
var margins = this._rootMarginValues.map(function(margin, i) { | |
return margin.unit == 'px' ? margin.value : | |
margin.value * (i % 2 ? rect.width : rect.height) / 100; | |
}); | |
var newRect = { | |
top: rect.top - margins[0], | |
right: rect.right + margins[1], | |
bottom: rect.bottom + margins[2], | |
left: rect.left - margins[3] | |
}; | |
newRect.width = newRect.right - newRect.left; | |
newRect.height = newRect.bottom - newRect.top; | |
return newRect; | |
}; | |
/** | |
* Accepts an old and new entry and returns true if at least one of the | |
* threshold values has been crossed. | |
* @param {?IntersectionObserverEntry} oldEntry The previous entry for a | |
* particular target element or null if no previous entry exists. | |
* @param {IntersectionObserverEntry} newEntry The current entry for a | |
* particular target element. | |
* @return {boolean} Returns true if a any threshold has been crossed. | |
* @private | |
*/ | |
IntersectionObserver.prototype._hasCrossedThreshold = | |
function(oldEntry, newEntry) { | |
// To make comparing easier, an entry that has a ratio of 0 | |
// but does not actually intersect is given a value of -1 | |
var oldRatio = oldEntry && oldEntry.isIntersecting ? | |
oldEntry.intersectionRatio || 0 : -1; | |
var newRatio = newEntry.isIntersecting ? | |
newEntry.intersectionRatio || 0 : -1; | |
// Ignore unchanged ratios | |
if (oldRatio === newRatio) return; | |
for (var i = 0; i < this.thresholds.length; i++) { | |
var threshold = this.thresholds[i]; | |
// Return true if an entry matches a threshold or if the new ratio | |
// and the old ratio are on the opposite sides of a threshold. | |
if (threshold == oldRatio || threshold == newRatio || | |
threshold < oldRatio !== threshold < newRatio) { | |
return true; | |
} | |
} | |
}; | |
/** | |
* Returns whether or not the root element is an element and is in the DOM. | |
* @return {boolean} True if the root element is an element and is in the DOM. | |
* @private | |
*/ | |
IntersectionObserver.prototype._rootIsInDom = function() { | |
return !this.root || containsDeep(document, this.root); | |
}; | |
/** | |
* Returns whether or not the target element is a child of root. | |
* @param {Element} target The target element to check. | |
* @return {boolean} True if the target element is a child of root. | |
* @private | |
*/ | |
IntersectionObserver.prototype._rootContainsTarget = function(target) { | |
return containsDeep(this.root || document, target); | |
}; | |
/** | |
* Adds the instance to the global IntersectionObserver registry if it isn't | |
* already present. | |
* @private | |
*/ | |
IntersectionObserver.prototype._registerInstance = function() { | |
if (registry.indexOf(this) < 0) { | |
registry.push(this); | |
} | |
}; | |
/** | |
* Removes the instance from the global IntersectionObserver registry. | |
* @private | |
*/ | |
IntersectionObserver.prototype._unregisterInstance = function() { | |
var index = registry.indexOf(this); | |
if (index != -1) registry.splice(index, 1); | |
}; | |
/** | |
* Returns the result of the performance.now() method or null in browsers | |
* that don't support the API. | |
* @return {number} The elapsed time since the page was requested. | |
*/ | |
function now() { | |
return window.performance && performance.now && performance.now(); | |
} | |
/** | |
* Throttles a function and delays its executiong, so it's only called at most | |
* once within a given time period. | |
* @param {Function} fn The function to throttle. | |
* @param {number} timeout The amount of time that must pass before the | |
* function can be called again. | |
* @return {Function} The throttled function. | |
*/ | |
function throttle(fn, timeout) { | |
var timer = null; | |
return function () { | |
if (!timer) { | |
timer = setTimeout(function() { | |
fn(); | |
timer = null; | |
}, timeout); | |
} | |
}; | |
} | |
/** | |
* Adds an event handler to a DOM node ensuring cross-browser compatibility. | |
* @param {Node} node The DOM node to add the event handler to. | |
* @param {string} event The event name. | |
* @param {Function} fn The event handler to add. | |
* @param {boolean} opt_useCapture Optionally adds the even to the capture | |
* phase. Note: this only works in modern browsers. | |
*/ | |
function addEvent(node, event, fn, opt_useCapture) { | |
if (typeof node.addEventListener == 'function') { | |
node.addEventListener(event, fn, opt_useCapture || false); | |
} | |
else if (typeof node.attachEvent == 'function') { | |
node.attachEvent('on' + event, fn); | |
} | |
} | |
/** | |
* Removes a previously added event handler from a DOM node. | |
* @param {Node} node The DOM node to remove the event handler from. | |
* @param {string} event The event name. | |
* @param {Function} fn The event handler to remove. | |
* @param {boolean} opt_useCapture If the event handler was added with this | |
* flag set to true, it should be set to true here in order to remove it. | |
*/ | |
function removeEvent(node, event, fn, opt_useCapture) { | |
if (typeof node.removeEventListener == 'function') { | |
node.removeEventListener(event, fn, opt_useCapture || false); | |
} | |
else if (typeof node.detatchEvent == 'function') { | |
node.detatchEvent('on' + event, fn); | |
} | |
} | |
/** | |
* Returns the intersection between two rect objects. | |
* @param {Object} rect1 The first rect. | |
* @param {Object} rect2 The second rect. | |
* @return {?Object} The intersection rect or undefined if no intersection | |
* is found. | |
*/ | |
function computeRectIntersection(rect1, rect2) { | |
var top = Math.max(rect1.top, rect2.top); | |
var bottom = Math.min(rect1.bottom, rect2.bottom); | |
var left = Math.max(rect1.left, rect2.left); | |
var right = Math.min(rect1.right, rect2.right); | |
var width = right - left; | |
var height = bottom - top; | |
return (width >= 0 && height >= 0) && { | |
top: top, | |
bottom: bottom, | |
left: left, | |
right: right, | |
width: width, | |
height: height | |
}; | |
} | |
/** | |
* Shims the native getBoundingClientRect for compatibility with older IE. | |
* @param {Element} el The element whose bounding rect to get. | |
* @return {Object} The (possibly shimmed) rect of the element. | |
*/ | |
function getBoundingClientRect(el) { | |
var rect; | |
try { | |
rect = el.getBoundingClientRect(); | |
} catch (err) { | |
// Ignore Windows 7 IE11 "Unspecified error" | |
// https://github.com/WICG/IntersectionObserver/pull/205 | |
} | |
if (!rect) return getEmptyRect(); | |
// Older IE | |
if (!(rect.width && rect.height)) { | |
rect = { | |
top: rect.top, | |
right: rect.right, | |
bottom: rect.bottom, | |
left: rect.left, | |
width: rect.right - rect.left, | |
height: rect.bottom - rect.top | |
}; | |
} | |
return rect; | |
} | |
/** | |
* Returns an empty rect object. An empty rect is returned when an element | |
* is not in the DOM. | |
* @return {Object} The empty rect. | |
*/ | |
function getEmptyRect() { | |
return { | |
top: 0, | |
bottom: 0, | |
left: 0, | |
right: 0, | |
width: 0, | |
height: 0 | |
}; | |
} | |
/** | |
* Checks to see if a parent element contains a child elemnt (including inside | |
* shadow DOM). | |
* @param {Node} parent The parent element. | |
* @param {Node} child The child element. | |
* @return {boolean} True if the parent node contains the child node. | |
*/ | |
function containsDeep(parent, child) { | |
var node = child; | |
while (node) { | |
if (node == parent) return true; | |
node = getParentNode(node); | |
} | |
return false; | |
} | |
/** | |
* Gets the parent node of an element or its host element if the parent node | |
* is a shadow root. | |
* @param {Node} node The node whose parent to get. | |
* @return {Node|null} The parent node or null if no parent exists. | |
*/ | |
function getParentNode(node) { | |
var parent = node.parentNode; | |
if (parent && parent.nodeType == 11 && parent.host) { | |
// If the parent is a shadow root, return the host element. | |
return parent.host; | |
} | |
return parent; | |
} | |
// Exposes the constructors globally. | |
window.IntersectionObserver = IntersectionObserver; | |
window.IntersectionObserverEntry = IntersectionObserverEntry; | |
}(window, document)); | |
} | |
if (!('IntersectionObserverEntry' in window && 'isIntersecting' in window.IntersectionObserverEntry.prototype)) { | |
// IntersectionObserverEntry | |
// Minimal polyfill for Edge 15's lack of `isIntersecting` | |
// See: https://github.com/WICG/IntersectionObserver/issues/211 | |
Object.defineProperty(IntersectionObserverEntry.prototype, | |
'isIntersecting', { | |
get: function () { | |
return this.intersectionRatio > 0; | |
} | |
} | |
); | |
} | |
if (!("MutationObserver" in this)) { | |
// MutationObserver | |
/*! | |
* Shim for MutationObserver interface | |
* Author: Graeme Yeates (github.com/megawac) | |
* Repository: https://github.com/megawac/MutationObserver.js | |
* License: WTFPL V2, 2004 (wtfpl.net). | |
* Though credit and staring the repo will make me feel pretty, you can modify and redistribute as you please. | |
* Attempts to follow spec (http:// www.w3.org/TR/dom/#mutation-observers) as closely as possible for native javascript | |
* See https://github.com/WebKit/webkit/blob/master/Source/WebCore/dom/MutationObserver.cpp for current webkit source c++ implementation | |
*/ | |
/** | |
* prefix bugs: | |
- https://bugs.webkit.org/show_bug.cgi?id=85161 | |
- https://bugzilla.mozilla.org/show_bug.cgi?id=749920 | |
* Don't use WebKitMutationObserver as Safari (6.0.5-6.1) use a buggy implementation | |
*/ | |
window.MutationObserver = window.MutationObserver || (function(undefined) { | |
"use strict"; | |
/** | |
* @param {function(Array.<MutationRecord>, MutationObserver)} listener | |
* @constructor | |
*/ | |
function MutationObserver(listener) { | |
/** | |
* @type {Array.<Object>} | |
* @private | |
*/ | |
this._watched = []; | |
/** @private */ | |
this._listener = listener; | |
} | |
/** | |
* Start a recursive timeout function to check all items being observed for mutations | |
* @type {MutationObserver} observer | |
* @private | |
*/ | |
function startMutationChecker(observer) { | |
(function check() { | |
var mutations = observer.takeRecords(); | |
if (mutations.length) { // fire away | |
// calling the listener with context is not spec but currently consistent with FF and WebKit | |
observer._listener(mutations, observer); | |
} | |
/** @private */ | |
observer._timeout = setTimeout(check, MutationObserver._period); | |
})(); | |
} | |
/** | |
* Period to check for mutations (~32 times/sec) | |
* @type {number} | |
* @expose | |
*/ | |
MutationObserver._period = 30 /*ms+runtime*/ ; | |
/** | |
* Exposed API | |
* @expose | |
* @final | |
*/ | |
MutationObserver.prototype = { | |
/** | |
* see http:// dom.spec.whatwg.org/#dom-mutationobserver-observe | |
* not going to throw here but going to follow the current spec config sets | |
* @param {Node|null} $target | |
* @param {Object|null} config : MutationObserverInit configuration dictionary | |
* @expose | |
* @return undefined | |
*/ | |
observe: function($target, config) { | |
/** | |
* Using slightly different names so closure can go ham | |
* @type {!Object} : A custom mutation config | |
*/ | |
var settings = { | |
attr: !! (config.attributes || config.attributeFilter || config.attributeOldValue), | |
// some browsers enforce that subtree must be set with childList, attributes or characterData. | |
// We don't care as spec doesn't specify this rule. | |
kids: !! config.childList, | |
descendents: !! config.subtree, | |
charData: !! (config.characterData || config.characterDataOldValue) | |
}; | |
var watched = this._watched; | |
// remove already observed target element from pool | |
for (var i = 0; i < watched.length; i++) { | |
if (watched[i].tar === $target) watched.splice(i, 1); | |
} | |
if (config.attributeFilter) { | |
/** | |
* converts to a {key: true} dict for faster lookup | |
* @type {Object.<String,Boolean>} | |
*/ | |
settings.afilter = reduce(config.attributeFilter, function(a, b) { | |
a[b] = true; | |
return a; | |
}, {}); | |
} | |
watched.push({ | |
tar: $target, | |
fn: createMutationSearcher($target, settings) | |
}); | |
// reconnect if not connected | |
if (!this._timeout) { | |
startMutationChecker(this); | |
} | |
}, | |
/** | |
* Finds mutations since last check and empties the "record queue" i.e. mutations will only be found once | |
* @expose | |
* @return {Array.<MutationRecord>} | |
*/ | |
takeRecords: function() { | |
var mutations = []; | |
var watched = this._watched; | |
for (var i = 0; i < watched.length; i++) { | |
watched[i].fn(mutations); | |
} | |
return mutations; | |
}, | |
/** | |
* @expose | |
* @return undefined | |
*/ | |
disconnect: function() { | |
this._watched = []; // clear the stuff being observed | |
clearTimeout(this._timeout); // ready for garbage collection | |
/** @private */ | |
this._timeout = null; | |
} | |
}; | |
/** | |
* Simple MutationRecord pseudoclass. No longer exposing as its not fully compliant | |
* @param {Object} data | |
* @return {Object} a MutationRecord | |
*/ | |
function MutationRecord(data) { | |
var settings = { // technically these should be on proto so hasOwnProperty will return false for non explicitly props | |
type: null, | |
target: null, | |
addedNodes: [], | |
removedNodes: [], | |
previousSibling: null, | |
nextSibling: null, | |
attributeName: null, | |
attributeNamespace: null, | |
oldValue: null | |
}; | |
for (var prop in data) { | |
if (has(settings, prop) && data[prop] !== undefined) settings[prop] = data[prop]; | |
} | |
return settings; | |
} | |
/** | |
* Creates a func to find all the mutations | |
* | |
* @param {Node} $target | |
* @param {!Object} config : A custom mutation config | |
*/ | |
function createMutationSearcher($target, config) { | |
/** type {Elestuct} */ | |
var $oldstate = clone($target, config); // create the cloned datastructure | |
/** | |
* consumes array of mutations we can push to | |
* | |
* @param {Array.<MutationRecord>} mutations | |
*/ | |
return function(mutations) { | |
var olen = mutations.length, dirty; | |
if (config.charData && $target.nodeType === 3 && $target.nodeValue !== $oldstate.charData) { | |
mutations.push(new MutationRecord({ | |
type: "characterData", | |
target: $target, | |
oldValue: $oldstate.charData | |
})); | |
} | |
// Alright we check base level changes in attributes... easy | |
if (config.attr && $oldstate.attr) { | |
findAttributeMutations(mutations, $target, $oldstate.attr, config.afilter); | |
} | |
// check childlist or subtree for mutations | |
if (config.kids || config.descendents) { | |
dirty = searchSubtree(mutations, $target, $oldstate, config); | |
} | |
// reclone data structure if theres changes | |
if (dirty || mutations.length !== olen) { | |
/** type {Elestuct} */ | |
$oldstate = clone($target, config); | |
} | |
}; | |
} | |
/* attributes + attributeFilter helpers */ | |
// Check if the environment has the attribute bug (#4) which cause | |
// element.attributes.style to always be null. | |
var hasAttributeBug = document.createElement("i"); | |
hasAttributeBug.style.top = 0; | |
hasAttributeBug = hasAttributeBug.attributes.style.value != "null"; | |
/** | |
* Gets an attribute value in an environment without attribute bug | |
* | |
* @param {Node} el | |
* @param {Attr} attr | |
* @return {String} an attribute value | |
*/ | |
function getAttributeSimple(el, attr) { | |
// There is a potential for a warning to occur here if the attribute is a | |
// custom attribute in IE<9 with a custom .toString() method. This is | |
// just a warning and doesn't affect execution (see #21) | |
return attr.value; | |
} | |
/** | |
* Gets an attribute value with special hack for style attribute (see #4) | |
* | |
* @param {Node} el | |
* @param {Attr} attr | |
* @return {String} an attribute value | |
*/ | |
function getAttributeWithStyleHack(el, attr) { | |
// As with getAttributeSimple there is a potential warning for custom attribtues in IE7. | |
return attr.name !== "style" ? attr.value : el.style.cssText; | |
} | |
var getAttributeValue = hasAttributeBug ? getAttributeSimple : getAttributeWithStyleHack; | |
/** | |
* fast helper to check to see if attributes object of an element has changed | |
* doesnt handle the textnode case | |
* | |
* @param {Array.<MutationRecord>} mutations | |
* @param {Node} $target | |
* @param {Object.<string, string>} $oldstate : Custom attribute clone data structure from clone | |
* @param {Object} filter | |
*/ | |
function findAttributeMutations(mutations, $target, $oldstate, filter) { | |
var checked = {}; | |
var attributes = $target.attributes; | |
var attr; | |
var name; | |
var i = attributes.length; | |
while (i--) { | |
attr = attributes[i]; | |
name = attr.name; | |
if (!filter || has(filter, name)) { | |
if (getAttributeValue($target, attr) !== $oldstate[name]) { | |
// The pushing is redundant but gzips very nicely | |
mutations.push(MutationRecord({ | |
type: "attributes", | |
target: $target, | |
attributeName: name, | |
oldValue: $oldstate[name], | |
attributeNamespace: attr.namespaceURI // in ie<8 it incorrectly will return undefined | |
})); | |
} | |
checked[name] = true; | |
} | |
} | |
for (name in $oldstate) { | |
if (!(checked[name])) { | |
mutations.push(MutationRecord({ | |
target: $target, | |
type: "attributes", | |
attributeName: name, | |
oldValue: $oldstate[name] | |
})); | |
} | |
} | |
} | |
/** | |
* searchSubtree: array of mutations so far, element, element clone, bool | |
* synchronous dfs comparision of two nodes | |
* This function is applied to any observed element with childList or subtree specified | |
* Sorry this is kind of confusing as shit, tried to comment it a bit... | |
* codereview.stackexchange.com/questions/38351 discussion of an earlier version of this func | |
* | |
* @param {Array} mutations | |
* @param {Node} $target | |
* @param {!Object} $oldstate : A custom cloned node from clone() | |
* @param {!Object} config : A custom mutation config | |
*/ | |
function searchSubtree(mutations, $target, $oldstate, config) { | |
// Track if the tree is dirty and has to be recomputed (#14). | |
var dirty; | |
/* | |
* Helper to identify node rearrangment and stuff... | |
* There is no gaurentee that the same node will be identified for both added and removed nodes | |
* if the positions have been shuffled. | |
* conflicts array will be emptied by end of operation | |
*/ | |
function resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes) { | |
// the distance between the first conflicting node and the last | |
var distance = conflicts.length - 1; | |
// prevents same conflict being resolved twice consider when two nodes switch places. | |
// only one should be given a mutation event (note -~ is used as a math.ceil shorthand) | |
var counter = -~((distance - numAddedNodes) / 2); | |
var $cur; | |
var oldstruct; | |
var conflict; | |
while ((conflict = conflicts.pop())) { | |
$cur = $kids[conflict.i]; | |
oldstruct = $oldkids[conflict.j]; | |
// attempt to determine if there was node rearrangement... won't gaurentee all matches | |
// also handles case where added/removed nodes cause nodes to be identified as conflicts | |
if (config.kids && counter && Math.abs(conflict.i - conflict.j) >= distance) { | |
mutations.push(MutationRecord({ | |
type: "childList", | |
target: node, | |
addedNodes: [$cur], | |
removedNodes: [$cur], | |
// haha don't rely on this please | |
nextSibling: $cur.nextSibling, | |
previousSibling: $cur.previousSibling | |
})); | |
counter--; // found conflict | |
} | |
// Alright we found the resorted nodes now check for other types of mutations | |
if (config.attr && oldstruct.attr) findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter); | |
if (config.charData && $cur.nodeType === 3 && $cur.nodeValue !== oldstruct.charData) { | |
mutations.push(MutationRecord({ | |
type: "characterData", | |
target: $cur, | |
oldValue: oldstruct.charData | |
})); | |
} | |
// now look @ subtree | |
if (config.descendents) findMutations($cur, oldstruct); | |
} | |
} | |
/** | |
* Main worker. Finds and adds mutations if there are any | |
* @param {Node} node | |
* @param {!Object} old : A cloned data structure using internal clone | |
*/ | |
function findMutations(node, old) { | |
var $kids = node.childNodes; | |
var $oldkids = old.kids; | |
var klen = $kids.length; | |
// $oldkids will be undefined for text and comment nodes | |
var olen = $oldkids ? $oldkids.length : 0; | |
// if (!olen && !klen) return; // both empty; clearly no changes | |
// we delay the intialization of these for marginal performance in the expected case (actually quite signficant on large subtrees when these would be otherwise unused) | |
// map of checked element of ids to prevent registering the same conflict twice | |
var map; | |
// array of potential conflicts (ie nodes that may have been re arranged) | |
var conflicts; | |
var id; // element id from getElementId helper | |
var idx; // index of a moved or inserted element | |
var oldstruct; | |
// current and old nodes | |
var $cur; | |
var $old; | |
// track the number of added nodes so we can resolve conflicts more accurately | |
var numAddedNodes = 0; | |
// iterate over both old and current child nodes at the same time | |
var i = 0, j = 0; | |
// while there is still anything left in $kids or $oldkids (same as i < $kids.length || j < $oldkids.length;) | |
while( i < klen || j < olen ) { | |
// current and old nodes at the indexs | |
$cur = $kids[i]; | |
oldstruct = $oldkids[j]; | |
$old = oldstruct && oldstruct.node; | |
if ($cur === $old) { // expected case - optimized for this case | |
// check attributes as specified by config | |
if (config.attr && oldstruct.attr) /* oldstruct.attr instead of textnode check */findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter); | |
// check character data if node is a comment or textNode and it's being observed | |
if (config.charData && oldstruct.charData !== undefined && $cur.nodeValue !== oldstruct.charData) { | |
mutations.push(MutationRecord({ | |
type: "characterData", | |
target: $cur, | |
oldValue: oldstruct.charData | |
})); | |
} | |
// resolve conflicts; it will be undefined if there are no conflicts - otherwise an array | |
if (conflicts) resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes); | |
// recurse on next level of children. Avoids the recursive call when there are no children left to iterate | |
if (config.descendents && ($cur.childNodes.length || oldstruct.kids && oldstruct.kids.length)) findMutations($cur, oldstruct); | |
i++; | |
j++; | |
} else { // (uncommon case) lookahead until they are the same again or the end of children | |
dirty = true; | |
if (!map) { // delayed initalization (big perf benefit) | |
map = {}; | |
conflicts = []; | |
} | |
if ($cur) { | |
// check id is in the location map otherwise do a indexOf search | |
if (!(map[id = getElementId($cur)])) { // to prevent double checking | |
// mark id as found | |
map[id] = true; | |
// custom indexOf using comparitor checking oldkids[i].node === $cur | |
if ((idx = indexOfCustomNode($oldkids, $cur, j)) === -1) { | |
if (config.kids) { | |
mutations.push(MutationRecord({ | |
type: "childList", | |
target: node, | |
addedNodes: [$cur], // $cur is a new node | |
nextSibling: $cur.nextSibling, | |
previousSibling: $cur.previousSibling | |
})); | |
numAddedNodes++; | |
} | |
} else { | |
conflicts.push({ // add conflict | |
i: i, | |
j: idx | |
}); | |
} | |
} | |
i++; | |
} | |
if ($old && | |
// special case: the changes may have been resolved: i and j appear congurent so we can continue using the expected case | |
$old !== $kids[i] | |
) { | |
if (!(map[id = getElementId($old)])) { | |
map[id] = true; | |
if ((idx = indexOf($kids, $old, i)) === -1) { | |
if (config.kids) { | |
mutations.push(MutationRecord({ | |
type: "childList", | |
target: old.node, | |
removedNodes: [$old], | |
nextSibling: $oldkids[j + 1], // praise no indexoutofbounds exception | |
previousSibling: $oldkids[j - 1] | |
})); | |
numAddedNodes--; | |
} | |
} else { | |
conflicts.push({ | |
i: idx, | |
j: j | |
}); | |
} | |
} | |
j++; | |
} | |
}// end uncommon case | |
}// end loop | |
// resolve any remaining conflicts | |
if (conflicts) resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes); | |
} | |
findMutations($target, $oldstate); | |
return dirty; | |
} | |
/** | |
* Utility | |
* Cones a element into a custom data structure designed for comparision. https://gist.github.com/megawac/8201012 | |
* | |
* @param {Node} $target | |
* @param {!Object} config : A custom mutation config | |
* @return {!Object} : Cloned data structure | |
*/ | |
function clone($target, config) { | |
var recurse = true; // set true so childList we'll always check the first level | |
return (function copy($target) { | |
var elestruct = { | |
/** @type {Node} */ | |
node: $target | |
}; | |
// Store current character data of target text or comment node if the config requests | |
// those properties to be observed. | |
if (config.charData && ($target.nodeType === 3 || $target.nodeType === 8)) { | |
elestruct.charData = $target.nodeValue; | |
} | |
// its either a element, comment, doc frag or document node | |
else { | |
// Add attr only if subtree is specified or top level and avoid if | |
// attributes is a document object (#13). | |
if (config.attr && recurse && $target.nodeType === 1) { | |
/** | |
* clone live attribute list to an object structure {name: val} | |
* @type {Object.<string, string>} | |
*/ | |
elestruct.attr = reduce($target.attributes, function(memo, attr) { | |
if (!config.afilter || config.afilter[attr.name]) { | |
memo[attr.name] = getAttributeValue($target, attr); | |
} | |
return memo; | |
}, {}); | |
} | |
// whether we should iterate the children of $target node | |
if (recurse && ((config.kids || config.charData) || (config.attr && config.descendents)) ) { | |
/** @type {Array.<!Object>} : Array of custom clone */ | |
elestruct.kids = map($target.childNodes, copy); | |
} | |
recurse = config.descendents; | |
} | |
return elestruct; | |
})($target); | |
} | |
/** | |
* indexOf an element in a collection of custom nodes | |
* | |
* @param {NodeList} set | |
* @param {!Object} $node : A custom cloned node | |
* @param {number} idx : index to start the loop | |
* @return {number} | |
*/ | |
function indexOfCustomNode(set, $node, idx) { | |
return indexOf(set, $node, idx, JSCompiler_renameProperty("node")); | |
} | |
// using a non id (eg outerHTML or nodeValue) is extremely naive and will run into issues with nodes that may appear the same like <li></li> | |
var counter = 1; // don't use 0 as id (falsy) | |
/** @const */ | |
var expando = "mo_id"; | |
/** | |
* Attempt to uniquely id an element for hashing. We could optimize this for legacy browsers but it hopefully wont be called enough to be a concern | |
* | |
* @param {Node} $ele | |
* @return {(string|number)} | |
*/ | |
function getElementId($ele) { | |
try { | |
return $ele.id || ($ele[expando] = $ele[expando] || counter++); | |
} catch (o_O) { // ie <8 will throw if you set an unknown property on a text node | |
try { | |
return $ele.nodeValue; // naive | |
} catch (shitie) { // when text node is removed: https://gist.github.com/megawac/8355978 :( | |
return counter++; | |
} | |
} | |
} | |
/** | |
* **map** Apply a mapping function to each item of a set | |
* @param {Array|NodeList} set | |
* @param {Function} iterator | |
*/ | |
function map(set, iterator) { | |
var results = []; | |
for (var index = 0; index < set.length; index++) { | |
results[index] = iterator(set[index], index, set); | |
} | |
return results; | |
} | |
/** | |
* **Reduce** builds up a single result from a list of values | |
* @param {Array|NodeList|NamedNodeMap} set | |
* @param {Function} iterator | |
* @param {*} [memo] Initial value of the memo. | |
*/ | |
function reduce(set, iterator, memo) { | |
for (var index = 0; index < set.length; index++) { | |
memo = iterator(memo, set[index], index, set); | |
} | |
return memo; | |
} | |
/** | |
* **indexOf** find index of item in collection. | |
* @param {Array|NodeList} set | |
* @param {Object} item | |
* @param {number} idx | |
* @param {string} [prop] Property on set item to compare to item | |
*/ | |
function indexOf(set, item, idx, prop) { | |
for (/*idx = ~~idx*/; idx < set.length; idx++) {// start idx is always given as this is internal | |
if ((prop ? set[idx][prop] : set[idx]) === item) return idx; | |
} | |
return -1; | |
} | |
/** | |
* @param {Object} obj | |
* @param {(string|number)} prop | |
* @return {boolean} | |
*/ | |
function has(obj, prop) { | |
return obj[prop] !== undefined; // will be nicely inlined by gcc | |
} | |
// GCC hack see http:// stackoverflow.com/a/23202438/1517919 | |
function JSCompiler_renameProperty(a) { | |
return a; | |
} | |
return MutationObserver; | |
})(void 0); | |
} | |
if (!('Symbol' in this && 'iterator' in this.Symbol && (function () { | |
var fragment = document.createDocumentFragment(); | |
fragment.appendChild(document.createElement('div')); | |
return !!fragment.childNodes[Symbol.iterator]; | |
})())) { | |
// NodeList.prototype.@@iterator | |
/* global Symbol, ArrayIterator*/ | |
NodeList.prototype[Symbol.iterator] = function () { | |
return new ArrayIterator(this); | |
}; | |
} | |
if (!('reduce' in Array.prototype)) { | |
// Array.prototype.reduce | |
Array.prototype.reduce = function reduce(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = -1, | |
previousValue; | |
if (1 in arguments) { | |
previousValue = arguments[1]; | |
} else { | |
while (++index < length && !(index in arraylike)) {} | |
if (index >= length) { | |
throw new TypeError('Reduce of empty array with no initial value'); | |
} | |
previousValue = arraylike[index]; | |
} | |
while (++index < length) { | |
if (index in arraylike) { | |
previousValue = callback(previousValue, arraylike[index], index, object); | |
} | |
} | |
return previousValue; | |
}; | |
} | |
if (!('entries' in Object)) { | |
// Object.entries | |
Object.entries = function entries(object) { | |
var keys = Object.keys(object); | |
return keys | |
.reduce(function(entries, key) { | |
var entry = typeof key === 'string' && object.propertyIsEnumerable(key) ? [ | |
[key, object[key]] | |
] : []; | |
return entries.concat(entry); | |
}, []); | |
}; | |
} | |
if (!('values' in Object)) { | |
// Object.values | |
(function () { | |
Object.defineProperty(Object, 'values', { | |
configurable: true, | |
enumerable: false, | |
value: function (object) { | |
return Object.keys(object).map(function (key) { | |
return object[key]; | |
}); | |
}, | |
writable: true | |
}); | |
}()); | |
} | |
if (!('Promise' in this)) { | |
// Promise | |
!function(n){function t(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return n[e].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=n,t.c=r,t.p="",t(0)}({0:/*!***********************!*\ | |
!*** ./src/global.js ***! | |
\***********************/ | |
function(n,t,r){(function(n){var t=r(/*! ./yaku */80);try{(n||{}).Promise=t,window.Promise=t}catch(err){}}).call(t,function(){return this}())},80:/*!*********************!*\ | |
!*** ./src/yaku.js ***! | |
\*********************/ | |
function(n,t){(function(t){!function(){"use strict";function r(){return un[B][G]||J}function e(n,t){for(var r in t)n[r]=t[r]}function o(n){return n&&"object"==typeof n}function i(n){return"function"==typeof n}function u(n,t){return n instanceof t}function c(n){return u(n,U)}function f(n,t,r){if(!t(n))throw v(r)}function s(){try{return C.apply(F,arguments)}catch(e){return rn.e=e,rn}}function a(n,t){return C=n,F=t,s}function l(n,t){function r(){for(var r=0;r<o;)t(e[r],e[r+1]),e[r++]=S,e[r++]=S;o=0,e.length>n&&(e.length=n)}var e=O(n),o=0;return function(n,t){e[o++]=n,e[o++]=t,2===o&&un.nextTick(r)}}function h(n,t){var r,e,o,c,f=0;if(!n)throw v(W);var s=n[un[B][D]];if(i(s))e=s.call(n);else{if(!i(n.next)){if(u(n,O)){for(r=n.length;f<r;)t(n[f],f++);return f}throw v(W)}e=n}for(;!(o=e.next()).done;)if(c=a(t)(o.value,f++),c===rn)throw i(e[K])&&e[K](),c.e;return f}function v(n){return new TypeError(n)}function _(n){return(n?"":X)+(new U).stack}function d(n,t){var r="on"+n.toLowerCase(),e=H[r];I&&I.listeners(n).length?n===tn?I.emit(n,t._v,t):I.emit(n,t):e?e({reason:t._v,promise:t}):un[n](t._v,t)}function p(n){return n&&n._s}function w(n){if(p(n))return new n(en);var t,r,e;return t=new n(function(n,o){if(t)throw v();r=n,e=o}),f(r,i),f(e,i),t}function m(n,t){return function(r){A&&(n[Q]=_(!0)),t===q?T(n,r):k(n,t,r)}}function y(n,t,r,e){return i(r)&&(t._onFulfilled=r),i(e)&&(n[M]&&d(nn,n),t._onRejected=e),A&&(t._p=n),n[n._c++]=t,n._s!==z&&cn(n,t),t}function j(n){if(n._umark)return!0;n._umark=!0;for(var t,r=0,e=n._c;r<e;)if(t=n[r++],t._onRejected||j(t))return!0}function x(n,t){function r(n){return e.push(n.replace(/^\s+|\s+$/g,""))}var e=[];return A&&(t[Q]&&r(t[Q]),function o(n){n&&N in n&&(o(n._next),r(n[N]+""),o(n._p))}(t)),(n&&n.stack?n.stack:n)+("\n"+e.join("\n")).replace(on,"")}function g(n,t){return n(t)}function k(n,t,r){var e=0,o=n._c;if(n._s===z)for(n._s=t,n._v=r,t===$&&(A&&c(r)&&(r.longStack=x(r,n)),fn(n));e<o;)cn(n,n[e++]);return n}function T(n,t){if(t===n&&t)return k(n,$,v(Y)),n;if(t!==P&&(i(t)||o(t))){var r=a(b)(t);if(r===rn)return k(n,$,r.e),n;i(r)?(A&&p(t)&&(n._next=t),p(t)?R(n,t,r):un.nextTick(function(){R(n,t,r)})):k(n,q,t)}else k(n,q,t);return n}function b(n){return n.then}function R(n,t,r){var e=a(r,t)(function(r){t&&(t=P,T(n,r))},function(r){t&&(t=P,k(n,$,r))});e===rn&&t&&(k(n,$,e.e),t=P)}var S,C,F,P=null,E="object"==typeof window,H=E?window:t,I=H.process,L=H.console,A=!1,O=Array,U=Error,$=1,q=2,z=3,B="Symbol",D="iterator",G="species",J=B+"("+G+")",K="return",M="_uh",N="_pt",Q="_st",V="Invalid this",W="Invalid argument",X="\nFrom previous ",Y="Chaining cycle detected for promise",Z="Uncaught (in promise)",nn="rejectionHandled",tn="unhandledRejection",rn={e:P},en=function(){},on=/^.+\/node_modules\/yaku\/.+\n?/gm,un=n.exports=function(n){var t,r=this;if(!o(r)||r._s!==S)throw v(V);if(r._s=z,A&&(r[N]=_()),n!==en){if(!i(n))throw v(W);t=a(n)(m(r,q),m(r,$)),t===rn&&k(r,$,t.e)}};un["default"]=un,e(un.prototype,{then:function(n,t){if(void 0===this._s)throw v();return y(this,w(un.speciesConstructor(this,un)),n,t)},"catch":function(n){return this.then(S,n)},"finally":function(n){function t(t){return un.resolve(n()).then(function(){return t})}return this.then(t,t)},_c:0,_p:P}),un.resolve=function(n){return p(n)?n:T(w(this),n)},un.reject=function(n){return k(w(this),$,n)},un.race=function(n){var t=this,r=w(t),e=function(n){k(r,q,n)},o=function(n){k(r,$,n)},i=a(h)(n,function(n){t.resolve(n).then(e,o)});return i===rn?t.reject(i.e):r},un.all=function(n){function t(n){k(o,$,n)}var r,e=this,o=w(e),i=[];return r=a(h)(n,function(n,u){e.resolve(n).then(function(n){i[u]=n,--r||k(o,q,i)},t)}),r===rn?e.reject(r.e):(r||k(o,q,[]),o)},un.Symbol=H[B]||{},a(function(){Object.defineProperty(un,r(),{get:function(){return this}})})(),un.speciesConstructor=function(n,t){var e=n.constructor;return e?e[r()]||t:t},un.unhandledRejection=function(n,t){L&&L.error(Z,A?t.longStack:x(n,t))},un.rejectionHandled=en,un.enableLongStackTrace=function(){A=!0},un.nextTick=E?function(n){setTimeout(n)}:I.nextTick,un._s=1;var cn=l(999,function(n,t){var r,e;return e=n._s!==$?t._onFulfilled:t._onRejected,e===S?void k(t,n._s,n._v):(r=a(g)(e,n._v),r===rn?void k(t,$,r.e):void T(t,r))}),fn=l(9,function(n){j(n)||(n[M]=1,d(tn,n))})}()}).call(t,function(){return this}())}}); | |
} | |
if (!('Promise' in this && 'finally' in Promise.prototype)) { | |
// Promise.prototype.finally | |
(function () { | |
// Based on https://github.com/tc39/proposal-promise-finally/blob/master/polyfill.js | |
var then = Function.prototype.bind.call(Function.prototype.call, Promise.prototype.then); | |
// 7.3.20 SpeciesConstructor(O, defaultConstructor) | |
var speciesConstructor = function (O, defaultConstructor) { | |
// 7.3.20.1 Assert: Type(O) is Object. | |
if (!O || (typeof O !== 'object' && typeof O !== 'function')) { | |
throw new TypeError('Assertion failed: Type(O) is not Object'); | |
} | |
// 7.3.20.2 Let C be ? Get(O, "constructor"). | |
var C = O.constructor; | |
// 7.3.20.3 If C is undefined, return defaultConstructor. | |
if (typeof C === 'undefined') { | |
return defaultConstructor; | |
} | |
// 7.3.20.4 If Type(C) is not Object, throw a TypeError exception | |
if (!C || (typeof C !== 'object' && typeof C !== 'function')) { | |
throw new TypeError('O.constructor is not an Object'); | |
} | |
// 7.3.20.5 Let S be ? Get(C, @@species). | |
var S = typeof Symbol === 'function' && typeof Symbol.species === 'symbol' ? C[Symbol.species] : undefined; | |
// 7.3.20.6 If S is either undefined or null, return defaultConstructor. | |
if (S === undefined || S === null) { | |
return defaultConstructor; | |
} | |
// 7.3.20.7 If IsConstructor(S) is true, return S. | |
if (typeof S === 'function' && S.prototype) { | |
return S; | |
} | |
// 7.3.20.8 Throw a TypeError exception. | |
throw new TypeError('no constructor found'); | |
}; | |
var getPromise = function (C, handler) { | |
return new C(function (resolve) { | |
resolve(handler()); | |
}); | |
}; | |
var promiseFinally = function (onFinally) { | |
// 1.1 Let promise be the this value. | |
var promise = this; | |
var handler; | |
if (typeof onFinally === 'function') { | |
handler = onFinally; | |
} else { | |
handler = function () {}; | |
} | |
// 1.2 If IsPromise(promise) is false, throw a TypeError exception. | |
// N.B. IsPromise is called within Promise.prototype.then (25.4.5.3) | |
var newPromise = then( | |
promise, // throws if IsPromise(promise) is not true | |
function (x) { | |
return then(getPromise(C, handler), function () { | |
return x; | |
}); | |
}, | |
function (e) { | |
return then(getPromise(C, handler), function () { | |
throw e; | |
}); | |
} | |
); | |
// 1.3 Let C be ? SpeciesConstructor(promise, %Promise%). | |
var C = speciesConstructor(promise, Promise); // throws if SpeciesConstructor throws | |
// 1.4 Let resultCapablity be ? NewPromiseCapablity(C). | |
// 1.5 Return PerformPromiseFinally(promise, onFinaaly, resultCapability). | |
return newPromise; | |
}; | |
Promise.prototype['finally'] = promiseFinally; | |
}()); | |
} | |
if (!('flags' in RegExp.prototype)) { | |
// RegExp.prototype.flags | |
Object.defineProperty(RegExp.prototype, 'flags', { | |
configurable: true, | |
enumerable: false, | |
get: function () { | |
// 21.2.5.3.1 Let R be the this value. | |
var r = this; | |
// 21.2.5.3.2 If Type(R) is not Object, throw a TypeError exception. | |
if (typeof r !== 'object') { | |
throw new TypeError('Method called on incompatible type: must be an object.'); | |
} | |
// 21.2.5.3.3 Let result be the empty String. | |
var result = ''; | |
// 21.2.5.3.4 Let global be ToBoolean(? Get(R, "global")). | |
var global = !!r.global; | |
// 21.2.5.3.5 If global is true, append the code unit 0x0067 (LATIN SMALL LETTER G) as the last code unit of result. | |
if (global) { | |
result += 'g'; | |
} | |
// 21.2.5.3.6 Let ignoreCase be ToBoolean(? Get(R, "ignoreCase")). | |
var ignoreCase = !!r.ignoreCase; | |
// 21.2.5.3.7 If ignoreCase is true, append the code unit 0x0069 (LATIN SMALL LETTER I) as the last code unit of result. | |
if (ignoreCase) { | |
result += 'i'; | |
} | |
// 21.2.5.3.8 Let multiline be ToBoolean(? Get(R, "multiline")). | |
var multiline = !!r.multiline; | |
// 21.2.5.3.9 If multiline is true, append the code unit 0x006D (LATIN SMALL LETTER M) as the last code unit of result. | |
if (multiline) { | |
result += 'm'; | |
} | |
// 21.2.5.3.10 Let unicode be ToBoolean(? Get(R, "unicode")). | |
var unicode = !!r.unicode; | |
// 21.2.5.3.11 If unicode is true, append the code unit 0x0075 (LATIN SMALL LETTER U) as the last code unit of result. | |
if (unicode) { | |
result += 'u'; | |
} | |
// 21.2.5.3.12 Let sticky be ToBoolean(? Get(R, "sticky")). | |
var sticky = !!sticky; | |
// 21.2.5.3.13 If sticky is true, append the code unit 0x0079 (LATIN SMALL LETTER Y) as the last code unit of result. | |
if (sticky) { | |
result += 'y'; | |
} | |
// 21.2.5.3.14 Return result. | |
return result; | |
} | |
}); | |
} | |
if (!('fromCodePoint' in String)) { | |
// String.fromCodePoint | |
/*! http://mths.be/fromcodepoint v0.2.1 by @mathias */ | |
(function() { | |
var defineProperty = (function() { | |
// IE 8 only supports `Object.defineProperty` on DOM elements | |
try { | |
var object = {}; | |
var $defineProperty = Object.defineProperty; | |
var result = $defineProperty(object, object, object) && $defineProperty; | |
} catch(error) {} | |
return result; | |
}()); | |
var stringFromCharCode = String.fromCharCode; | |
var floor = Math.floor; | |
var fromCodePoint = function(_) { | |
var MAX_SIZE = 0x4000; | |
var codeUnits = []; | |
var highSurrogate; | |
var lowSurrogate; | |
var index = -1; | |
var length = arguments.length; | |
if (!length) { | |
return ''; | |
} | |
var result = ''; | |
while (++index < length) { | |
var codePoint = Number(arguments[index]); | |
if ( | |
!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` | |
codePoint < 0 || // not a valid Unicode code point | |
codePoint > 0x10FFFF || // not a valid Unicode code point | |
floor(codePoint) != codePoint // not an integer | |
) { | |
throw RangeError('Invalid code point: ' + codePoint); | |
} | |
if (codePoint <= 0xFFFF) { // BMP code point | |
codeUnits.push(codePoint); | |
} else { // Astral code point; split in surrogate halves | |
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae | |
codePoint -= 0x10000; | |
highSurrogate = (codePoint >> 10) + 0xD800; | |
lowSurrogate = (codePoint % 0x400) + 0xDC00; | |
codeUnits.push(highSurrogate, lowSurrogate); | |
} | |
if (index + 1 == length || codeUnits.length > MAX_SIZE) { | |
result += stringFromCharCode.apply(null, codeUnits); | |
codeUnits.length = 0; | |
} | |
} | |
return result; | |
}; | |
if (defineProperty) { | |
defineProperty(String, 'fromCodePoint', { | |
'value': fromCodePoint, | |
'configurable': true, | |
'writable': true | |
}); | |
} else { | |
String.fromCodePoint = fromCodePoint; | |
} | |
}()); | |
} | |
if (!('codePointAt' in String.prototype)) { | |
// String.prototype.codePointAt | |
(function () { | |
function toInteger(n) { | |
// 7.1.4.1 Let number be ? ToNumber(argument). | |
n = Number(n); | |
// 7.1.4.2 If number is NaN, return +0. | |
if (isNaN(n)) { | |
return 0; | |
} | |
// 7.1.4.3 If number is +0, -0, +∞, or -∞, return number. | |
if (n === 0 || n === Infinity || n === -Infinity) { | |
return n; | |
} | |
// 7.1.4.4 Return the number value that is the same sign as number and whose magnitude is floor(abs(number)). | |
return ((n < 0) ? -1 : 1) * Math.floor(Math.abs(n)); | |
} | |
Object.defineProperty(String.prototype, 'codePointAt', { | |
value: function (pos) { | |
// 21.1.3.3.1 Let O be ? RequireObjectCoercible(this value). | |
var o; | |
if (this === null || this === undefined) { | |
throw new TypeError('Cannot call String.prototype.codePointAt on ' + this); | |
} else { | |
o = this; | |
} | |
// 21.1.3.3.2 Let S be ? ToString(O). | |
var s = String(o); | |
// 21.1.3.3.3 Let position be ? ToInteger(pos). | |
var position = toInteger(pos); | |
// 21.1.3.3.4 Let size be the length of S. | |
var size = s.length; | |
// 21.1.3.3.5 If position < 0 or position ≥ size, return undefined. | |
if (position < 0 || position >= size) return undefined; | |
// 21.1.3.3.6 Let first be the numeric value of the code unit at index position within the String S. | |
var first = s.charCodeAt(position); | |
// 21.1.3.3.7 If first < 0xD800 or first > 0xDBFF or position+1 = size, return first. | |
if (first < 0xD800 || first > 0xDBFF || position + 1 === size) return first; | |
// 21.1.3.3.8 Let second be the numeric value of the code unit at index position+1 within the String S. | |
var second = s.charCodeAt(position + 1); | |
// 21.1.3.3.9 If second < 0xDC00 or second > 0xDFFF, return first. | |
if (second < 0xDC00 || second > 0xDFFF) return first; | |
// 21.1.3.3.10 Return UTF16Decode(first, second). | |
return ((first - 0xD800) * 1024) + (second - 0xDC00) + 0x10000; | |
} | |
}); | |
}()); | |
} | |
if (!('padEnd' in String.prototype)) { | |
// String.prototype.padEnd | |
(function () { | |
Object.defineProperty(String.prototype, 'padEnd', { | |
configurable: true, | |
enumerable: false, | |
value: function padEnd (targetLength) { | |
targetLength = targetLength | 0; | |
if (targetLength <= this.length) return String(this); | |
var padString = String(arguments[1] || " "); | |
var repeat = Math.ceil((targetLength - this.length) / padString.length); | |
while (repeat--) { | |
padString += padString; | |
} | |
return String(this) + padString.substr(0, targetLength - this.length); | |
}, | |
writable: true | |
}); | |
}()); | |
} | |
if (!('padStart' in String.prototype)) { | |
// String.prototype.padStart | |
(function () { | |
Object.defineProperty(String.prototype, 'padStart', { | |
configurable: true, | |
enumerable: false, | |
value: function padStart (targetLength) { | |
targetLength = targetLength | 0; | |
if (targetLength <= this.length) return String(this); | |
var padString = String(arguments[1] || " "); | |
var repeat = Math.ceil((targetLength - this.length) / padString.length); | |
while (repeat--) { | |
padString += padString; | |
} | |
return padString.substr(0, targetLength - this.length) + String(this); | |
}, | |
writable: true | |
}); | |
}()); | |
} | |
if (!('repeat' in String.prototype)) { | |
// String.prototype.repeat | |
String.prototype.repeat = function repeat(count) { | |
'use strict'; | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (count < 0 || count === Infinity) { | |
throw new RangeError(count + ' is less than zero or equal to infinity'); | |
} | |
return new Array((parseInt(count, 10) || 0) + 1).join(this); | |
}; | |
} | |
if (!('Symbol' in this && 'hasInstance' in this.Symbol)) { | |
// Symbol.hasInstance | |
Object.defineProperty(Symbol, 'hasInstance', {value: Symbol('hasInstance')}); | |
} | |
if (!('Symbol' in this && 'isConcatSpreadable' in this.Symbol)) { | |
// Symbol.isConcatSpreadable | |
Object.defineProperty(Symbol, 'isConcatSpreadable', {value: Symbol('isConcatSpreadable')}); | |
} | |
if (!('Symbol' in this && 'match' in this.Symbol)) { | |
// Symbol.match | |
Object.defineProperty(Symbol, 'match', {value: Symbol('match')}); | |
} | |
if (!('Symbol' in this && 'replace' in this.Symbol)) { | |
// Symbol.replace | |
Object.defineProperty(Symbol, 'replace', {value: Symbol('replace')}); | |
} | |
if (!('Symbol' in this && 'search' in this.Symbol)) { | |
// Symbol.search | |
Object.defineProperty(Symbol, 'search', {value: Symbol('search')}); | |
} | |
if (!('Symbol' in this && 'species' in this.Symbol)) { | |
// Symbol.species | |
Object.defineProperty(Symbol, 'species', {value: Symbol('species')}); | |
} | |
if (!('Symbol' in this && 'split' in this.Symbol)) { | |
// Symbol.split | |
Object.defineProperty(Symbol, 'split', {value: Symbol('split')}); | |
} | |
if (!('Symbol' in this && 'toPrimitive' in this.Symbol)) { | |
// Symbol.toPrimitive | |
Object.defineProperty(Symbol, 'toPrimitive', {value: Symbol('toPrimitive')}); | |
} | |
if (!('console' in this)) { | |
// console | |
this.console = this.console || {}; | |
} | |
if (!('console' in this && 'exception' in this.console)) { | |
// console.exception | |
this.console.exception = function exception() {}; | |
} | |
if (!('XMLHttpRequest' in this && 'prototype' in this.XMLHttpRequest && 'addEventListener' in this.XMLHttpRequest.prototype)) { | |
// XMLHttpRequest | |
(function (global, NativeXMLHttpRequest) { | |
// <Global>.XMLHttpRequest | |
global.XMLHttpRequest = function XMLHttpRequest() { | |
var request = this, nativeRequest = request._request = NativeXMLHttpRequest ? new NativeXMLHttpRequest() : new ActiveXObject('MSXML2.XMLHTTP.3.0'); | |
nativeRequest.onreadystatechange = function () { | |
request.readyState = nativeRequest.readyState; | |
var readyState = request.readyState === 4; | |
request.response = request.responseText = readyState ? nativeRequest.responseText : null; | |
request.status = readyState ? nativeRequest.status : null; | |
request.statusText = readyState ? nativeRequest.statusText : null; | |
request.dispatchEvent(new Event('readystatechange')); | |
if (readyState) { | |
request.dispatchEvent(new Event('load')); | |
} | |
}; | |
if ('onerror' in nativeRequest) { | |
nativeRequest.onerror = function () { | |
request.dispatchEvent(new Event('error')); | |
}; | |
} | |
}; | |
global.XMLHttpRequest.UNSENT = 0; | |
global.XMLHttpRequest.OPENED = 1; | |
global.XMLHttpRequest.HEADERS_RECEIVED = 2; | |
global.XMLHttpRequest.LOADING = 3; | |
global.XMLHttpRequest.DONE = 4; | |
var XMLHttpRequestPrototype = global.XMLHttpRequest.prototype; | |
XMLHttpRequestPrototype.addEventListener = global.addEventListener; | |
XMLHttpRequestPrototype.removeEventListener = global.removeEventListener; | |
XMLHttpRequestPrototype.dispatchEvent = global.dispatchEvent; | |
XMLHttpRequestPrototype.abort = function abort() { | |
return this._request(); | |
}; | |
XMLHttpRequestPrototype.getAllResponseHeaders = function getAllResponseHeaders() { | |
return this._request.getAllResponseHeaders(); | |
}; | |
XMLHttpRequestPrototype.getResponseHeader = function getResponseHeader(header) { | |
return this._request.getResponseHeader(header); | |
}; | |
XMLHttpRequestPrototype.open = function open(method, url) { | |
// method, url, async, username, password | |
this._request.open(method, url, arguments[2], arguments[3], arguments[4]); | |
}; | |
XMLHttpRequestPrototype.overrideMimeType = function overrideMimeType(mimetype) { | |
this._request.overrideMimeType(mimetype); | |
}; | |
XMLHttpRequestPrototype.send = function send() { | |
this._request.send(0 in arguments ? arguments[0] : null); | |
}; | |
XMLHttpRequestPrototype.setRequestHeader = function setRequestHeader(header, value) { | |
this._request.setRequestHeader(header, value); | |
}; | |
}(this, this.XMLHttpRequest)); | |
} | |
if (!('fetch' in this)) { | |
// fetch | |
(function(self) { | |
'use strict'; | |
var support = { | |
searchParams: 'URLSearchParams' in self, | |
iterable: 'Symbol' in self && 'iterator' in Symbol, | |
blob: 'FileReader' in self && 'Blob' in self && (function() { | |
try { | |
new Blob() | |
return true | |
} catch(e) { | |
return false | |
} | |
})(), | |
formData: 'FormData' in self, | |
arrayBuffer: 'ArrayBuffer' in self | |
} | |
if (support.arrayBuffer) { | |
var viewClasses = [ | |
'[object Int8Array]', | |
'[object Uint8Array]', | |
'[object Uint8ClampedArray]', | |
'[object Int16Array]', | |
'[object Uint16Array]', | |
'[object Int32Array]', | |
'[object Uint32Array]', | |
'[object Float32Array]', | |
'[object Float64Array]' | |
] | |
var isDataView = function(obj) { | |
return obj && DataView.prototype.isPrototypeOf(obj) | |
} | |
var isArrayBufferView = ArrayBuffer.isView || function(obj) { | |
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 | |
} | |
} | |
function normalizeName(name) { | |
if (typeof name !== 'string') { | |
name = String(name) | |
} | |
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { | |
throw new TypeError('Invalid character in header field name') | |
} | |
return name.toLowerCase() | |
} | |
function normalizeValue(value) { | |
if (typeof value !== 'string') { | |
value = String(value) | |
} | |
return value | |
} | |
// Build a destructive iterator for the value list | |
function iteratorFor(items) { | |
var iterator = { | |
next: function() { | |
var value = items.shift() | |
return {done: value === undefined, value: value} | |
} | |
} | |
if (support.iterable) { | |
iterator[Symbol.iterator] = function() { | |
return iterator | |
} | |
} | |
return iterator | |
} | |
function Headers(headers) { | |
this.map = {} | |
if (headers instanceof Headers) { | |
headers.forEach(function(value, name) { | |
this.append(name, value) | |
}, this) | |
} else if (Array.isArray(headers)) { | |
headers.forEach(function(header) { | |
this.append(header[0], header[1]) | |
}, this) | |
} else if (headers) { | |
Object.getOwnPropertyNames(headers).forEach(function(name) { | |
this.append(name, headers[name]) | |
}, this) | |
} | |
} | |
Headers.prototype.append = function(name, value) { | |
name = normalizeName(name) | |
value = normalizeValue(value) | |
var oldValue = this.map[name] | |
this.map[name] = oldValue ? oldValue+','+value : value | |
} | |
Headers.prototype['delete'] = function(name) { | |
delete this.map[normalizeName(name)] | |
} | |
Headers.prototype.get = function(name) { | |
name = normalizeName(name) | |
return this.has(name) ? this.map[name] : null | |
} | |
Headers.prototype.has = function(name) { | |
return this.map.hasOwnProperty(normalizeName(name)) | |
} | |
Headers.prototype.set = function(name, value) { | |
this.map[normalizeName(name)] = normalizeValue(value) | |
} | |
Headers.prototype.forEach = function(callback, thisArg) { | |
for (var name in this.map) { | |
if (this.map.hasOwnProperty(name)) { | |
callback.call(thisArg, this.map[name], name, this) | |
} | |
} | |
} | |
Headers.prototype.keys = function() { | |
var items = [] | |
this.forEach(function(value, name) { items.push(name) }) | |
return iteratorFor(items) | |
} | |
Headers.prototype.values = function() { | |
var items = [] | |
this.forEach(function(value) { items.push(value) }) | |
return iteratorFor(items) | |
} | |
Headers.prototype.entries = function() { | |
var items = [] | |
this.forEach(function(value, name) { items.push([name, value]) }) | |
return iteratorFor(items) | |
} | |
if (support.iterable) { | |
Headers.prototype[Symbol.iterator] = Headers.prototype.entries | |
} | |
function consumed(body) { | |
if (body.bodyUsed) { | |
return Promise.reject(new TypeError('Already read')) | |
} | |
body.bodyUsed = true | |
} | |
function fileReaderReady(reader) { | |
return new Promise(function(resolve, reject) { | |
reader.onload = function() { | |
resolve(reader.result) | |
} | |
reader.onerror = function() { | |
reject(reader.error) | |
} | |
}) | |
} | |
function readBlobAsArrayBuffer(blob) { | |
var reader = new FileReader() | |
var promise = fileReaderReady(reader) | |
reader.readAsArrayBuffer(blob) | |
return promise | |
} | |
function readBlobAsText(blob) { | |
var reader = new FileReader() | |
var promise = fileReaderReady(reader) | |
reader.readAsText(blob) | |
return promise | |
} | |
function readArrayBufferAsText(buf) { | |
var view = new Uint8Array(buf) | |
var chars = new Array(view.length) | |
for (var i = 0; i < view.length; i++) { | |
chars[i] = String.fromCharCode(view[i]) | |
} | |
return chars.join('') | |
} | |
function bufferClone(buf) { | |
if (buf.slice) { | |
return buf.slice(0) | |
} else { | |
var view = new Uint8Array(buf.byteLength) | |
view.set(new Uint8Array(buf)) | |
return view.buffer | |
} | |
} | |
function Body() { | |
this.bodyUsed = false | |
this._initBody = function(body) { | |
this._bodyInit = body | |
if (!body) { | |
this._bodyText = '' | |
} else if (typeof body === 'string') { | |
this._bodyText = body | |
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) { | |
this._bodyBlob = body | |
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) { | |
this._bodyFormData = body | |
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { | |
this._bodyText = body.toString() | |
} else if (support.arrayBuffer && support.blob && isDataView(body)) { | |
this._bodyArrayBuffer = bufferClone(body.buffer) | |
// IE 10-11 can't handle a DataView body. | |
this._bodyInit = new Blob([this._bodyArrayBuffer]) | |
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { | |
this._bodyArrayBuffer = bufferClone(body) | |
} else { | |
throw new Error('unsupported BodyInit type') | |
} | |
if (!this.headers.get('content-type')) { | |
if (typeof body === 'string') { | |
this.headers.set('content-type', 'text/plain;charset=UTF-8') | |
} else if (this._bodyBlob && this._bodyBlob.type) { | |
this.headers.set('content-type', this._bodyBlob.type) | |
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { | |
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') | |
} | |
} | |
} | |
if (support.blob) { | |
this.blob = function() { | |
var rejected = consumed(this) | |
if (rejected) { | |
return rejected | |
} | |
if (this._bodyBlob) { | |
return Promise.resolve(this._bodyBlob) | |
} else if (this._bodyArrayBuffer) { | |
return Promise.resolve(new Blob([this._bodyArrayBuffer])) | |
} else if (this._bodyFormData) { | |
throw new Error('could not read FormData body as blob') | |
} else { | |
return Promise.resolve(new Blob([this._bodyText])) | |
} | |
} | |
this.arrayBuffer = function() { | |
if (this._bodyArrayBuffer) { | |
return consumed(this) || Promise.resolve(this._bodyArrayBuffer) | |
} else { | |
return this.blob().then(readBlobAsArrayBuffer) | |
} | |
} | |
} | |
this.text = function() { | |
var rejected = consumed(this) | |
if (rejected) { | |
return rejected | |
} | |
if (this._bodyBlob) { | |
return readBlobAsText(this._bodyBlob) | |
} else if (this._bodyArrayBuffer) { | |
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) | |
} else if (this._bodyFormData) { | |
throw new Error('could not read FormData body as text') | |
} else { | |
return Promise.resolve(this._bodyText) | |
} | |
} | |
if (support.formData) { | |
this.formData = function() { | |
return this.text().then(decode) | |
} | |
} | |
this.json = function() { | |
return this.text().then(JSON.parse) | |
} | |
return this | |
} | |
// HTTP methods whose capitalization should be normalized | |
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'] | |
function normalizeMethod(method) { | |
var upcased = method.toUpperCase() | |
return (methods.indexOf(upcased) > -1) ? upcased : method | |
} | |
function Request(input, options) { | |
options = options || {} | |
var body = options.body | |
if (input instanceof Request) { | |
if (input.bodyUsed) { | |
throw new TypeError('Already read') | |
} | |
this.url = input.url | |
this.credentials = input.credentials | |
if (!options.headers) { | |
this.headers = new Headers(input.headers) | |
} | |
this.method = input.method | |
this.mode = input.mode | |
if (!body && input._bodyInit != null) { | |
body = input._bodyInit | |
input.bodyUsed = true | |
} | |
} else { | |
this.url = String(input) | |
} | |
this.credentials = options.credentials || this.credentials || 'omit' | |
if (options.headers || !this.headers) { | |
this.headers = new Headers(options.headers) | |
} | |
this.method = normalizeMethod(options.method || this.method || 'GET') | |
this.mode = options.mode || this.mode || null | |
this.referrer = null | |
if ((this.method === 'GET' || this.method === 'HEAD') && body) { | |
throw new TypeError('Body not allowed for GET or HEAD requests') | |
} | |
this._initBody(body) | |
} | |
Request.prototype.clone = function() { | |
return new Request(this, { body: this._bodyInit }) | |
} | |
function decode(body) { | |
var form = new FormData() | |
body.trim().split('&').forEach(function(bytes) { | |
if (bytes) { | |
var split = bytes.split('=') | |
var name = split.shift().replace(/\+/g, ' ') | |
var value = split.join('=').replace(/\+/g, ' ') | |
form.append(decodeURIComponent(name), decodeURIComponent(value)) | |
} | |
}) | |
return form | |
} | |
function parseHeaders(rawHeaders) { | |
var headers = new Headers() | |
rawHeaders.split(/\r?\n/).forEach(function(line) { | |
var parts = line.split(':') | |
var key = parts.shift().trim() | |
if (key) { | |
var value = parts.join(':').trim() | |
headers.append(key, value) | |
} | |
}) | |
return headers | |
} | |
Body.call(Request.prototype) | |
function Response(bodyInit, options) { | |
if (!options) { | |
options = {} | |
} | |
this.type = 'default' | |
this.status = 'status' in options ? options.status : 200 | |
this.ok = this.status >= 200 && this.status < 300 | |
this.statusText = 'statusText' in options ? options.statusText : 'OK' | |
this.headers = new Headers(options.headers) | |
this.url = options.url || '' | |
this._initBody(bodyInit) | |
} | |
Body.call(Response.prototype) | |
Response.prototype.clone = function() { | |
return new Response(this._bodyInit, { | |
status: this.status, | |
statusText: this.statusText, | |
headers: new Headers(this.headers), | |
url: this.url | |
}) | |
} | |
Response.error = function() { | |
var response = new Response(null, {status: 0, statusText: ''}) | |
response.type = 'error' | |
return response | |
} | |
var redirectStatuses = [301, 302, 303, 307, 308] | |
Response.redirect = function(url, status) { | |
if (redirectStatuses.indexOf(status) === -1) { | |
throw new RangeError('Invalid status code') | |
} | |
return new Response(null, {status: status, headers: {location: url}}) | |
} | |
self.Headers = Headers | |
self.Request = Request | |
self.Response = Response | |
self.fetch = function(input, init) { | |
return new Promise(function(resolve, reject) { | |
var request = new Request(input, init) | |
var xhr = new XMLHttpRequest() | |
xhr.onload = function() { | |
var options = { | |
status: xhr.status, | |
statusText: xhr.statusText, | |
headers: parseHeaders(xhr.getAllResponseHeaders() || '') | |
} | |
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') | |
var body = 'response' in xhr ? xhr.response : xhr.responseText | |
resolve(new Response(body, options)) | |
} | |
xhr.onerror = function() { | |
reject(new TypeError('Network request failed')) | |
} | |
xhr.ontimeout = function() { | |
reject(new TypeError('Network request failed')) | |
} | |
xhr.open(request.method, request.url, true) | |
if (request.credentials === 'include') { | |
xhr.withCredentials = true | |
} | |
if ('responseType' in xhr && support.blob) { | |
xhr.responseType = 'blob' | |
} | |
request.headers.forEach(function(value, name) { | |
xhr.setRequestHeader(name, value) | |
}) | |
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) | |
}) | |
} | |
self.fetch.polyfill = true | |
})(typeof self !== 'undefined' ? self : this); | |
} | |
if (!('screen' in this && 'orientation' in this.screen && typeof this.screen.orientation === 'object')) { | |
// screen.orientation | |
(function() { | |
var propName, nativeGetter; | |
var err = ' not supported in the screen.orientation polyfill'; | |
function getVal() { | |
var val; | |
if (nativeGetter) val = nativeGetter.call(window.screen); | |
// If object we assume it's compliant with the spec | |
if (typeof val === 'object') return val; | |
// If no native implementation is available, guess based on screen width and height (impossible to tell whether device is upside down so consider both portrait orientations to be primary, likewise landscape) | |
if (typeof val === 'undefined') { | |
val = (screen.width > screen.height) ? 'landscape-primary' : 'portrait-primary'; | |
} | |
return { | |
type: val, | |
angle: (val.indexOf('secondary') !== -1) ? 180 : 0, | |
onchange: function() { | |
throw new Error('onchange'+err); | |
}, | |
lock: function(){ | |
throw new Error('lock method'+err); | |
}, | |
unlock: function(){ | |
throw new Error('unlock method'+err); | |
} | |
}; | |
} | |
// Find a native impl if it exists | |
if ('orientation' in screen) propName = 'orientation'; | |
else if ('mozOrientation' in screen) propName = 'mozOrientation'; | |
else if ('msOrientation' in screen) propName = 'msOrientation'; | |
nativeGetter = ('getOwnPropertyDescriptor' in Object && Object.getOwnPropertyDescriptor(window.screen, propName)) || | |
('__lookupGetter__' in window.screen && window.screen.__lookupGetter__(propName)); | |
// For completeness, but no browser above our baseline lacks the screen property | |
if (!('screen' in window)) window.screen = {}; | |
// If the value is not an object, the feature either doesn't exist or is incorrectly implemented | |
if (typeof window.screen.orientation !== 'object') { | |
// Attempt to use a dynamic getter, otherwise just set it to the initial value on load | |
try { | |
Object.defineProperty(window.screen, 'orientation', { | |
get: getVal | |
}); | |
} catch(e1) { | |
// screen is read-only in some browsers | |
try { | |
window.screen.orientation = getVal(); | |
} catch (e2) {} | |
} | |
} | |
}()); | |
} | |
if (!('setImmediate' in this)) { | |
// setImmediate | |
(function (global, undefined) { | |
"use strict"; | |
if (global.setImmediate) { | |
return; | |
} | |
var nextHandle = 1; // Spec says greater than zero | |
var tasksByHandle = {}; | |
var currentlyRunningATask = false; | |
var doc = global.document; | |
var setImmediate; | |
function addFromSetImmediateArguments(args) { | |
tasksByHandle[nextHandle] = partiallyApplied.apply(undefined, args); | |
return nextHandle++; | |
} | |
// This function accepts the same arguments as setImmediate, but | |
// returns a function that requires no arguments. | |
function partiallyApplied(handler) { | |
var args = [].slice.call(arguments, 1); | |
return function() { | |
if (typeof handler === "function") { | |
handler.apply(undefined, args); | |
} else { | |
(new Function("" + handler))(); | |
} | |
}; | |
} | |
function runIfPresent(handle) { | |
// From the spec: "Wait until any invocations of this algorithm started before this one have completed." | |
// So if we're currently running a task, we'll need to delay this invocation. | |
if (currentlyRunningATask) { | |
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a | |
// "too much recursion" error. | |
setTimeout(partiallyApplied(runIfPresent, handle), 0); | |
} else { | |
var task = tasksByHandle[handle]; | |
if (task) { | |
currentlyRunningATask = true; | |
try { | |
task(); | |
} finally { | |
clearImmediate(handle); | |
currentlyRunningATask = false; | |
} | |
} | |
} | |
} | |
function clearImmediate(handle) { | |
delete tasksByHandle[handle]; | |
} | |
function installNextTickImplementation() { | |
setImmediate = function() { | |
var handle = addFromSetImmediateArguments(arguments); | |
process.nextTick(partiallyApplied(runIfPresent, handle)); | |
return handle; | |
}; | |
} | |
function canUsePostMessage() { | |
// The test against `importScripts` prevents this implementation from being installed inside a web worker, | |
// where `global.postMessage` means something completely different and can't be used for this purpose. | |
if (global.postMessage && !global.importScripts) { | |
var postMessageIsAsynchronous = true; | |
var oldOnMessage = global.onmessage; | |
global.onmessage = function() { | |
postMessageIsAsynchronous = false; | |
}; | |
global.postMessage("", "*"); | |
global.onmessage = oldOnMessage; | |
return postMessageIsAsynchronous; | |
} | |
} | |
function installPostMessageImplementation() { | |
// Installs an event handler on `global` for the `message` event: see | |
// * https://developer.mozilla.org/en/DOM/window.postMessage | |
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages | |
var messagePrefix = "setImmediate$" + Math.random() + "$"; | |
var onGlobalMessage = function(event) { | |
if (event.source === global && | |
typeof event.data === "string" && | |
event.data.indexOf(messagePrefix) === 0) { | |
runIfPresent(+event.data.slice(messagePrefix.length)); | |
} | |
}; | |
if (global.addEventListener) { | |
global.addEventListener("message", onGlobalMessage, false); | |
} else { | |
global.attachEvent("onmessage", onGlobalMessage); | |
} | |
setImmediate = function() { | |
var handle = addFromSetImmediateArguments(arguments); | |
global.postMessage(messagePrefix + handle, "*"); | |
return handle; | |
}; | |
} | |
function installMessageChannelImplementation() { | |
var channel = new MessageChannel(); | |
channel.port1.onmessage = function(event) { | |
var handle = event.data; | |
runIfPresent(handle); | |
}; | |
setImmediate = function() { | |
var handle = addFromSetImmediateArguments(arguments); | |
channel.port2.postMessage(handle); | |
return handle; | |
}; | |
} | |
function installReadyStateChangeImplementation() { | |
var html = doc.documentElement; | |
setImmediate = function() { | |
var handle = addFromSetImmediateArguments(arguments); | |
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted | |
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. | |
var script = doc.createElement("script"); | |
script.onreadystatechange = function () { | |
runIfPresent(handle); | |
script.onreadystatechange = null; | |
html.removeChild(script); | |
script = null; | |
}; | |
html.appendChild(script); | |
return handle; | |
}; | |
} | |
function installSetTimeoutImplementation() { | |
setImmediate = function() { | |
var handle = addFromSetImmediateArguments(arguments); | |
setTimeout(partiallyApplied(runIfPresent, handle), 0); | |
return handle; | |
}; | |
} | |
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. | |
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); | |
attachTo = attachTo && attachTo.setTimeout ? attachTo : global; | |
// Don't get fooled by e.g. browserify environments. | |
if ({}.toString.call(global.process) === "[object process]") { | |
// For Node.js before 0.9 | |
installNextTickImplementation(); | |
} else if (canUsePostMessage()) { | |
// For non-IE10 modern browsers | |
installPostMessageImplementation(); | |
} else if (global.MessageChannel) { | |
// For web workers, where supported | |
installMessageChannelImplementation(); | |
} else if (doc && "onreadystatechange" in doc.createElement("script")) { | |
// For IE 6–8 | |
installReadyStateChangeImplementation(); | |
} else { | |
// For older browsers | |
installSetTimeoutImplementation(); | |
} | |
attachTo.setImmediate = setImmediate; | |
attachTo.clearImmediate = clearImmediate; | |
}(this)); // eslint-disable-line no-undef | |
} | |
if (!('isFinite' in Number)) { | |
// Number.isFinite | |
Number.isFinite = Number.isFinite || function(value) { | |
return typeof value === "number" && isFinite(value); | |
}; | |
} | |
if (!('isNaN' in Number)) { | |
// Number.isNaN | |
Number.isNaN = Number.isNaN || function(value) { | |
return typeof value === "number" && isNaN(value); | |
}; | |
} | |
if (!('from' in Array && (function () { | |
try { | |
Array.from({ length: -Infinity }); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}()))) { | |
// Array.from | |
// Wrapped in IIFE to prevent leaking to global scope. | |
(function () { | |
'use strict'; | |
function toInteger(value) { | |
var number = Number(value); | |
return sign(number) * Math.floor(Math.abs(Math.min(Math.max(number || 0, 0), 9007199254740991))); | |
} | |
var has = Object.prototype.hasOwnProperty; | |
var strValue = String.prototype.valueOf; | |
var tryStringObject = function tryStringObject(value) { | |
try { | |
strValue.call(value); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}; | |
function sign(number) { | |
return number >= 0 ? 1 : -1; | |
} | |
var toStr = Object.prototype.toString; | |
var strClass = '[object String]'; | |
var hasSymbols = typeof Symbol === 'function'; | |
var hasToStringTag = hasSymbols && 'toStringTag' in Symbol; | |
function isString(value) { | |
if (typeof value === 'string') { | |
return true; | |
} | |
if (typeof value !== 'object') { | |
return false; | |
} | |
return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; | |
} | |
var fnToStr = Function.prototype.toString; | |
var constructorRegex = /^\s*class /; | |
var isES6ClassFn = function isES6ClassFn(value) { | |
try { | |
var fnStr = fnToStr.call(value); | |
var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); | |
var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); | |
var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); | |
return constructorRegex.test(spaceStripped); | |
} catch (e) { | |
return false; // not a function | |
} | |
}; | |
var tryFunctionObject = function tryFunctionObject(value) { | |
try { | |
if (isES6ClassFn(value)) { | |
return false; | |
} | |
fnToStr.call(value); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}; | |
var fnClass = '[object Function]'; | |
var genClass = '[object GeneratorFunction]'; | |
function isCallable(value) { | |
if (!value) { | |
return false; | |
} | |
if (typeof value !== 'function' && typeof value !== 'object') { | |
return false; | |
} | |
if (hasToStringTag) { | |
return tryFunctionObject(value); | |
} | |
if (isES6ClassFn(value)) { | |
return false; | |
} | |
var strClass = toStr.call(value); | |
return strClass === fnClass || strClass === genClass; | |
}; | |
var isArray = Array.isArray; | |
var parseIterable = function (iterator) { | |
var done = false; | |
var iterableResponse; | |
var tempArray = []; | |
if (iterator && typeof iterator.next === 'function') { | |
while (!done) { | |
iterableResponse = iterator.next(); | |
if ( | |
has.call(iterableResponse, 'value') && | |
has.call(iterableResponse, 'done') | |
) { | |
if (iterableResponse.done === true) { | |
done = true; | |
break; // eslint-disable-line no-restricted-syntax | |
} else if (iterableResponse.done !== false) { | |
break; // eslint-disable-line no-restricted-syntax | |
} | |
tempArray.push(iterableResponse.value); | |
} else if (iterableResponse.done === true) { | |
done = true; | |
break; // eslint-disable-line no-restricted-syntax | |
} else { | |
break; // eslint-disable-line no-restricted-syntax | |
} | |
} | |
} | |
return done ? tempArray : false; | |
}; | |
var iteratorSymbol; | |
var forOf; | |
var hasSet = typeof Set === 'function'; | |
var hasMap = typeof Map === 'function'; | |
if (hasSymbols) { | |
iteratorSymbol = Symbol.iterator; | |
} else { | |
var iterate; | |
try { | |
iterate = Function('iterable', 'var arr = []; for (var value of iterable) arr.push(value); return arr;'); // eslint-disable-line no-new-func | |
} catch (e) {} | |
var supportsStrIterator = (function () { | |
try { | |
var supported = false; | |
var obj = { // eslint-disable-line no-unused-vars | |
'@@iterator': function () { | |
return { | |
'next': function () { | |
supported = true; | |
return { | |
'done': true, | |
'value': undefined | |
}; | |
} | |
}; | |
} | |
}; | |
iterate(obj); | |
return supported; | |
} catch (e) { | |
return false; | |
} | |
}()); | |
if (supportsStrIterator) { | |
iteratorSymbol = '@@iterator'; | |
} else if (typeof Set === 'function') { | |
var s = new Set(); | |
s.add(0); | |
try { | |
if (iterate(s).length === 1) { | |
forOf = iterate; | |
} | |
} catch (e) {} | |
} | |
} | |
var isSet; | |
if (hasSet) { | |
var setSize = Object.getOwnPropertyDescriptor(Set.prototype, 'size').get; | |
isSet = function (set) { | |
try { | |
setSize.call(set); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}; | |
} | |
var isMap; | |
if (hasMap) { | |
var mapSize = Object.getOwnPropertyDescriptor(Map.prototype, 'size').get; | |
isMap = function (m) { | |
try { | |
mapSize.call(m); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}; | |
} | |
var setForEach = hasSet && Set.prototype.forEach; | |
var mapForEach = hasMap && Map.prototype.forEach; | |
var usingIterator = function (items) { | |
var tempArray = []; | |
if (has.call(items, iteratorSymbol)) { | |
return items[iteratorSymbol](); | |
} else if (setForEach && isSet(items)) { | |
setForEach.call(items, function (val) { | |
tempArray.push(val); | |
}); | |
return { | |
next: function () { | |
return tempArray.length === 0 | |
? { | |
done: true | |
} | |
: { | |
value: tempArray.splice(0, 1)[0], | |
done: false | |
}; | |
} | |
}; | |
} else if (mapForEach && isMap(items)) { | |
mapForEach.call(items, function (val, key) { | |
tempArray.push([key, val]); | |
}); | |
return { | |
next: function () { | |
return tempArray.length === 0 | |
? { | |
done: true | |
} | |
: { | |
value: tempArray.splice(0, 1)[0], | |
done: false | |
}; | |
} | |
}; | |
} | |
return items; | |
}; | |
var strMatch = String.prototype.match; | |
var parseIterableLike = function (items) { | |
var arr = parseIterable(usingIterator(items)); | |
if (!arr) { | |
if (isString(items)) { | |
arr = strMatch.call(items, /[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g) || []; | |
} else if (forOf && !isArray(items)) { | |
// Safari 8's native Map or Set can't be iterated except with for..of | |
try { | |
arr = forOf(items); | |
} catch (e) {} | |
} | |
} | |
return arr || items; | |
}; | |
/*! https://mths.be/array-from v0.2.0 by @mathias */ | |
Object.defineProperty(Array, 'from', { | |
configurable: true, | |
value: function from(items) { | |
var C = this; | |
if (items === null || typeof items === 'undefined') { | |
throw new TypeError('`Array.from` requires an array-like object, not `null` or `undefined`'); | |
} | |
var mapFn, T; | |
if (typeof arguments[1] !== 'undefined') { | |
mapFn = arguments[1]; | |
if (!isCallable(mapFn)) { | |
throw new TypeError('When provided, the second argument to `Array.from` must be a function'); | |
} | |
if (arguments.length > 2) { | |
T = arguments[2]; | |
} | |
} | |
var arrayLike = Object(parseIterableLike(items)); | |
var len = toInteger(arrayLike.length); | |
var A = isCallable(C) ? Object(new C(len)) : new Array(len); | |
var k = 0; | |
var kValue, mappedValue; | |
while (k < len) { | |
kValue = arrayLike[k]; | |
if (mapFn) { | |
mappedValue = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.apply(T, [kValue, k]); | |
} else { | |
mappedValue = kValue; | |
} | |
Object.defineProperty(A, k, { | |
'configurable': true, | |
'enumerable': true, | |
'value': mappedValue, | |
'writable': true | |
}); | |
k += 1; | |
} | |
A.length = len; | |
return A; | |
}, | |
writable: true | |
}); | |
}()); | |
} | |
if (!('of' in Array)) { | |
// Array.of | |
/*! https://mths.be/array-of v0.1.0 by @mathias */ | |
(function () { | |
'use strict'; | |
var defineProperty = (function () { | |
// IE 8 only supports `Object.defineProperty` on DOM elements | |
try { | |
var object = {}; | |
var $defineProperty = Object.defineProperty; | |
var result = $defineProperty(object, object, object) && $defineProperty; | |
} catch (error) { /**/ } | |
return result; | |
}()); | |
var isConstructor = function isConstructor(Constructor) { | |
try { | |
return !!new Constructor(); | |
} catch (_) { | |
return false; | |
} | |
}; | |
var of = function of() { | |
var items = arguments; | |
var length = items.length; | |
var Me = this; | |
var result = isConstructor(Me) ? new Me(length) : new Array(length); | |
var index = 0; | |
var value; | |
while (index < length) { | |
value = items[index]; | |
if (defineProperty) { | |
defineProperty(result, index, { | |
'value': value, | |
'writable': true, | |
'enumerable': true, | |
'configurable': true | |
}); | |
} else { | |
result[index] = value; | |
} | |
index += 1; | |
} | |
result.length = length; | |
return result; | |
}; | |
if (defineProperty) { | |
defineProperty(Array, 'of', { | |
'value': of, | |
'configurable': true, | |
'writable': true | |
}); | |
} else { | |
Array.of = of; | |
} | |
}()); | |
} | |
if (!('every' in Array.prototype)) { | |
// Array.prototype.every | |
Array.prototype.every = function every(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
scope = arguments[1], | |
arraylike = object instanceof String ? object.split('') : object, | |
length = Number(arraylike.length) || 0, | |
index = -1; | |
while (++index < length) { | |
if (index in arraylike && !callback.call(scope, arraylike[index], index, object)) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
} | |
if (!('fill' in Array.prototype)) { | |
// Array.prototype.fill | |
Object.defineProperty(Array.prototype, 'fill', { | |
configurable: true, | |
value: function fill(value) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
var arrayLike = Object(this); | |
var length = Math.max(Math.min(arrayLike.length, 9007199254740991), 0) || 0; | |
var relativeStart = 1 in arguments ? parseInt(Number(arguments[1]), 10) || 0 : 0; | |
relativeStart = relativeStart < 0 ? Math.max(length + relativeStart, 0) : Math.min(relativeStart, length); | |
var relativeEnd = 2 in arguments && arguments[2] !== undefined ? parseInt(Number(arguments[2]), 10) || 0 : length; | |
relativeEnd = relativeEnd < 0 ? Math.max(length + arguments[2], 0) : Math.min(relativeEnd, length); | |
while (relativeStart < relativeEnd) { | |
arrayLike[relativeStart] = value; | |
++relativeStart; | |
} | |
return arrayLike; | |
}, | |
writable: true | |
}); | |
} | |
if (!('lastIndexOf' in Array.prototype)) { | |
// Array.prototype.lastIndexOf | |
Array.prototype.lastIndexOf = function lastIndexOf(searchElement) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
var | |
arraylike = this instanceof String ? this.split('') : this, | |
length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
index = Number(arguments[1]) || 0; | |
index = 1 in arguments ? (index < 0 ? Math.max(length + index, 0) : index) + 1 : length; | |
while (--index >= 0) { | |
if (index in arraylike && arraylike[index] === searchElement) { | |
return index; | |
} | |
} | |
return -1; | |
}; | |
} | |
if (!('reduceRight' in Array.prototype)) { | |
// Array.prototype.reduceRight | |
Array.prototype.reduceRight = function reduceRight(callback) { | |
if (this === undefined || this === null) { | |
throw new TypeError(this + ' is not an object'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
object = Object(this), | |
arraylike = object instanceof String ? object.split('') : object, | |
length = -1, | |
index = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, | |
previousValue; | |
if (1 in arguments) { | |
previousValue = arguments[1]; | |
} else { | |
while (--index > length && !(index in arraylike)) {} | |
if (index <= length) { | |
throw new TypeError('Reduce of empty array with no initial value'); | |
} | |
previousValue = arraylike[index]; | |
} | |
while (--index > length) { | |
if (index in arraylike) { | |
previousValue = callback(previousValue, arraylike[index], index, object); | |
} | |
} | |
return previousValue; | |
}; | |
} | |
if (!('CustomEvent' in this && | |
// In Safari, typeof CustomEvent == 'object' but it otherwise works fine | |
(typeof this.CustomEvent === 'function' || | |
(this.CustomEvent.toString().indexOf('CustomEventConstructor')>-1)))) { | |
// CustomEvent | |
this.CustomEvent = function CustomEvent(type, eventInitDict) { | |
if (!type) { | |
throw Error('TypeError: Failed to construct "CustomEvent": An event name must be provided.'); | |
} | |
var event; | |
eventInitDict = eventInitDict || {bubbles: false, cancelable: false, detail: null}; | |
if ('createEvent' in document) { | |
try { | |
event = document.createEvent('CustomEvent'); | |
event.initCustomEvent(type, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail); | |
} catch (error) { | |
// for browsers which don't support CustomEvent at all, we use a regular event instead | |
event = document.createEvent('Event'); | |
event.initEvent(type, eventInitDict.bubbles, eventInitDict.cancelable); | |
event.detail = eventInitDict.detail; | |
} | |
} else { | |
// IE8 | |
event = new Event(type, eventInitDict); | |
event.detail = eventInitDict && eventInitDict.detail || null; | |
} | |
return event; | |
}; | |
CustomEvent.prototype = Event.prototype; | |
} | |
// _DOMTokenList | |
/* | |
Copyright (c) 2016, John Gardner | |
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
*/ | |
var _DOMTokenList = (function() { // eslint-disable-line no-unused-vars | |
var dpSupport = true; | |
var defineGetter = function (object, name, fn, configurable) { | |
if (Object.defineProperty) | |
Object.defineProperty(object, name, { | |
configurable: false === dpSupport ? true : !!configurable, | |
get: fn | |
}); | |
else object.__defineGetter__(name, fn); | |
}; | |
/** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */ | |
try { | |
defineGetter({}, "support"); | |
} | |
catch (e) { | |
dpSupport = false; | |
} | |
var _DOMTokenList = function (el, prop) { | |
var that = this; | |
var tokens = []; | |
var tokenMap = {}; | |
var length = 0; | |
var maxLength = 0; | |
var addIndexGetter = function (i) { | |
defineGetter(that, i, function () { | |
preop(); | |
return tokens[i]; | |
}, false); | |
}; | |
var reindex = function () { | |
/** Define getter functions for array-like access to the tokenList's contents. */ | |
if (length >= maxLength) | |
for (; maxLength < length; ++maxLength) { | |
addIndexGetter(maxLength); | |
} | |
}; | |
/** Helper function called at the start of each class method. Internal use only. */ | |
var preop = function () { | |
var error; | |
var i; | |
var args = arguments; | |
var rSpace = /\s+/; | |
/** Validate the token/s passed to an instance method, if any. */ | |
if (args.length) | |
for (i = 0; i < args.length; ++i) | |
if (rSpace.test(args[i])) { | |
error = new SyntaxError('String "' + args[i] + '" ' + "contains" + ' an invalid character'); | |
error.code = 5; | |
error.name = "InvalidCharacterError"; | |
throw error; | |
} | |
/** Split the new value apart by whitespace*/ | |
if (typeof el[prop] === "object") { | |
tokens = ("" + el[prop].baseVal).replace(/^\s+|\s+$/g, "").split(rSpace); | |
} else { | |
tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace); | |
} | |
/** Avoid treating blank strings as single-item token lists */ | |
if ("" === tokens[0]) tokens = []; | |
/** Repopulate the internal token lists */ | |
tokenMap = {}; | |
for (i = 0; i < tokens.length; ++i) | |
tokenMap[tokens[i]] = true; | |
length = tokens.length; | |
reindex(); | |
}; | |
/** Populate our internal token list if the targeted attribute of the subject element isn't empty. */ | |
preop(); | |
/** Return the number of tokens in the underlying string. Read-only. */ | |
defineGetter(that, "length", function () { | |
preop(); | |
return length; | |
}); | |
/** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */ | |
that.toLocaleString = | |
that.toString = function () { | |
preop(); | |
return tokens.join(" "); | |
}; | |
that.item = function (idx) { | |
preop(); | |
return tokens[idx]; | |
}; | |
that.contains = function (token) { | |
preop(); | |
return !!tokenMap[token]; | |
}; | |
that.add = function () { | |
preop.apply(that, args = arguments); | |
for (var args, token, i = 0, l = args.length; i < l; ++i) { | |
token = args[i]; | |
if (!tokenMap[token]) { | |
tokens.push(token); | |
tokenMap[token] = true; | |
} | |
} | |
/** Update the targeted attribute of the attached element if the token list's changed. */ | |
if (length !== tokens.length) { | |
length = tokens.length >>> 0; | |
if (typeof el[prop] === "object") { | |
el[prop].baseVal = tokens.join(" "); | |
} else { | |
el[prop] = tokens.join(" "); | |
} | |
reindex(); | |
} | |
}; | |
that.remove = function () { | |
preop.apply(that, args = arguments); | |
/** Build a hash of token names to compare against when recollecting our token list. */ | |
for (var args, ignore = {}, i = 0, t = []; i < args.length; ++i) { | |
ignore[args[i]] = true; | |
delete tokenMap[args[i]]; | |
} | |
/** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */ | |
for (i = 0; i < tokens.length; ++i) | |
if (!ignore[tokens[i]]) t.push(tokens[i]); | |
tokens = t; | |
length = t.length >>> 0; | |
/** Update the targeted attribute of the attached element. */ | |
if (typeof el[prop] === "object") { | |
el[prop].baseVal = tokens.join(" "); | |
} else { | |
el[prop] = tokens.join(" "); | |
} | |
reindex(); | |
}; | |
that.toggle = function (token, force) { | |
preop.apply(that, [token]); | |
/** Token state's being forced. */ | |
if (undefined !== force) { | |
if (force) { | |
that.add(token); | |
return true; | |
} else { | |
that.remove(token); | |
return false; | |
} | |
} | |
/** Token already exists in tokenList. Remove it, and return FALSE. */ | |
if (tokenMap[token]) { | |
that.remove(token); | |
return false; | |
} | |
/** Otherwise, add the token and return TRUE. */ | |
that.add(token); | |
return true; | |
}; | |
return that; | |
}; | |
return _DOMTokenList; | |
}()); | |
if (!('DOMTokenList' in this && (function (x) { | |
return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true; | |
})(document.createElement('x')))) { | |
// DOMTokenList | |
(function (global) { | |
var nativeImpl = "DOMTokenList" in global && global.DOMTokenList; | |
if ( | |
!nativeImpl || | |
( | |
!!document.createElementNS && | |
!!document.createElementNS('http://www.w3.org/2000/svg', 'svg') && | |
!(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList) | |
) | |
) { | |
global.DOMTokenList = _DOMTokenList; | |
} | |
// Add second argument to native DOMTokenList.toggle() if necessary | |
(function () { | |
var e = document.createElement('span'); | |
if (!('classList' in e)) return; | |
e.classList.toggle('x', false); | |
if (!e.classList.contains('x')) return; | |
e.classList.constructor.prototype.toggle = function toggle(token /*, force*/) { | |
var force = arguments[1]; | |
if (force === undefined) { | |
var add = !this.contains(token); | |
this[add ? 'add' : 'remove'](token); | |
return add; | |
} | |
force = !!force; | |
this[force ? 'add' : 'remove'](token); | |
return force; | |
}; | |
}()); | |
// Add multiple arguments to native DOMTokenList.add() if necessary | |
(function () { | |
var e = document.createElement('span'); | |
if (!('classList' in e)) return; | |
e.classList.add('a', 'b'); | |
if (e.classList.contains('b')) return; | |
var native = e.classList.constructor.prototype.add; | |
e.classList.constructor.prototype.add = function () { | |
var args = arguments; | |
var l = arguments.length; | |
for (var i = 0; i < l; i++) { | |
native.call(this, args[i]); | |
} | |
}; | |
}()); | |
// Add multiple arguments to native DOMTokenList.remove() if necessary | |
(function () { | |
var e = document.createElement('span'); | |
if (!('classList' in e)) return; | |
e.classList.add('a'); | |
e.classList.add('b'); | |
e.classList.remove('a', 'b'); | |
if (!e.classList.contains('b')) return; | |
var native = e.classList.constructor.prototype.remove; | |
e.classList.constructor.prototype.remove = function () { | |
var args = arguments; | |
var l = arguments.length; | |
for (var i = 0; i < l; i++) { | |
native.call(this, args[i]); | |
} | |
}; | |
}()); | |
}(this)); | |
} | |
if (!('Date' in this && 'now' in this.Date && 'getTime' in this.Date.prototype)) { | |
// Date.now | |
Date.now = function now() { | |
return new Date().getTime(); | |
}; | |
} | |
if (!('Date' in this && 'toISOString' in Date.prototype)) { | |
// Date.prototype.toISOString | |
Date.prototype.toISOString = function toISOString() { | |
var date = this; | |
function pad(str, len) { | |
var pad = "0000"; | |
str = '' + str; | |
return pad.substr(0, len - str.length) + str; | |
} | |
var y = date.getUTCFullYear(), | |
m = pad(date.getUTCMonth() + 1, 2), | |
d = pad(date.getUTCDate(), 2), | |
h = pad(date.getUTCHours(), 2), | |
i = pad(date.getUTCMinutes(), 2), | |
s = pad(date.getUTCSeconds(), 2), | |
ms = pad(date.getUTCMilliseconds(), 3); | |
return y +'-'+ m +'-'+ d + 'T' + h +':'+ i +':'+ s +'.'+ ms +'Z'; | |
}; | |
} | |
// _mutation | |
var _mutation = (function () { // eslint-disable-line no-unused-vars | |
function isNode(object) { | |
// DOM, Level2 | |
if (typeof Node === 'function') { | |
return object instanceof Node; | |
} | |
// Older browsers, check if it looks like a Node instance) | |
return object && | |
typeof object === "object" && | |
object.nodeName && | |
object.nodeType >= 1 && | |
object.nodeType <= 12; | |
} | |
// http://dom.spec.whatwg.org/#mutation-method-macro | |
return function mutation(nodes) { | |
if (nodes.length === 1) { | |
return isNode(nodes[0]) ? nodes[0] : document.createTextNode(nodes[0] + ''); | |
} | |
var fragment = document.createDocumentFragment(); | |
for (var i = 0; i < nodes.length; i++) { | |
fragment.appendChild(isNode(nodes[i]) ? nodes[i] : document.createTextNode(nodes[i] + '')); | |
} | |
return fragment; | |
}; | |
}()); | |
if (!('DocumentFragment' in this && 'append' in DocumentFragment.prototype)) { | |
// DocumentFragment.prototype.append | |
DocumentFragment.prototype.append = function append() { | |
this.appendChild(_mutation(arguments)); | |
}; | |
} | |
if (!('DocumentFragment' in this && 'prepend' in DocumentFragment.prototype)) { | |
// DocumentFragment.prototype.prepend | |
DocumentFragment.prototype.prepend = function prepend() { | |
this.insertBefore(_mutation(arguments), this.firstChild); | |
}; | |
} | |
if (!('Element' in this && 'after' in Element.prototype)) { | |
// Element.prototype.after | |
Document.prototype.after = Element.prototype.after = function after() { | |
if (this.parentNode) { | |
var args = Array.prototype.slice.call(arguments), | |
viableNextSibling = this.nextSibling, | |
idx = viableNextSibling ? args.indexOf(viableNextSibling) : -1; | |
while (idx !== -1) { | |
viableNextSibling = viableNextSibling.nextSibling; | |
if (!viableNextSibling) { | |
break; | |
} | |
idx = args.indexOf(viableNextSibling); | |
} | |
this.parentNode.insertBefore(_mutation(arguments), viableNextSibling); | |
} | |
}; | |
// Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists | |
// TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. | |
if ("Text" in this) { | |
Text.prototype.after = Element.prototype.after; | |
} | |
} | |
if (!('Element' in this && 'append' in Element.prototype)) { | |
// Element.prototype.append | |
Document.prototype.append = Element.prototype.append = function append() { | |
this.appendChild(_mutation(arguments)); | |
}; | |
} | |
if (!('Element' in this && 'before' in Element.prototype)) { | |
// Element.prototype.before | |
Document.prototype.before = Element.prototype.before = function before() { | |
if (this.parentNode) { | |
var args = Array.prototype.slice.call(arguments), | |
viablePreviousSibling = this.previousSibling, | |
idx = viablePreviousSibling ? args.indexOf(viablePreviousSibling) : -1; | |
while (idx !== -1) { | |
viablePreviousSibling = viablePreviousSibling.previousSibling; | |
if (!viablePreviousSibling) { | |
break; | |
} | |
idx = args.indexOf(viablePreviousSibling); | |
} | |
this.parentNode.insertBefore( | |
_mutation(arguments), | |
viablePreviousSibling ? viablePreviousSibling.nextSibling : this.parentNode.firstChild | |
); | |
} | |
}; | |
// Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists | |
// TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. | |
if ("Text" in this) { | |
Text.prototype.before = Element.prototype.before; | |
} | |
} | |
if (!('document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () { | |
var e = document.createElement('span'); | |
e.classList.add('a', 'b'); | |
return e.classList.contains('b'); | |
}()))) { | |
// Element.prototype.classList | |
/* | |
Copyright (c) 2016, John Gardner | |
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
*/ | |
(function (global) { | |
var dpSupport = true; | |
var defineGetter = function (object, name, fn, configurable) { | |
if (Object.defineProperty) | |
Object.defineProperty(object, name, { | |
configurable: false === dpSupport ? true : !!configurable, | |
get: fn | |
}); | |
else object.__defineGetter__(name, fn); | |
}; | |
/** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */ | |
try { | |
defineGetter({}, "support"); | |
} | |
catch (e) { | |
dpSupport = false; | |
} | |
/** Polyfills a property with a DOMTokenList */ | |
var addProp = function (o, name, attr) { | |
defineGetter(o.prototype, name, function () { | |
var tokenList; | |
var THIS = this, | |
/** Prevent this from firing twice for some reason. What the hell, IE. */ | |
gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name; | |
if(THIS[gibberishProperty]) return tokenList; | |
THIS[gibberishProperty] = true; | |
/** | |
* IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead. | |
* | |
* What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror") | |
* that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML | |
* element instead, this would conflict with element types which use indexed properties (such as forms and | |
* select lists). | |
*/ | |
if (false === dpSupport) { | |
var visage; | |
var mirror = addProp.mirror || document.createElement("div"); | |
var reflections = mirror.childNodes; | |
var l = reflections.length; | |
for (var i = 0; i < l; ++i) | |
if (reflections[i]._R === THIS) { | |
visage = reflections[i]; | |
break; | |
} | |
/** Couldn't find an element's reflection inside the mirror. Materialise one. */ | |
visage || (visage = mirror.appendChild(document.createElement("div"))); | |
tokenList = DOMTokenList.call(visage, THIS, attr); | |
} else tokenList = new DOMTokenList(THIS, attr); | |
defineGetter(THIS, name, function () { | |
return tokenList; | |
}); | |
delete THIS[gibberishProperty]; | |
return tokenList; | |
}, true); | |
}; | |
addProp(global.Element, "classList", "className"); | |
addProp(global.HTMLElement, "classList", "className"); | |
addProp(global.HTMLLinkElement, "relList", "rel"); | |
addProp(global.HTMLAnchorElement, "relList", "rel"); | |
addProp(global.HTMLAreaElement, "relList", "rel"); | |
}(this)); | |
} | |
if (!('document' in this && "cloneNode" in document.documentElement && (function() { | |
var div = document.createElement('div'), test = document.createElement('input'); | |
test.type = "radio"; | |
test.checked = true; | |
div.appendChild(test); | |
var result = test.cloneNode(false), result2; | |
try { | |
result2 = div.cloneNode(); | |
} catch (e) {} | |
return !!result.checked && (!result2 || result2.childNodes.length === 0); | |
})())) { | |
// Element.prototype.cloneNode | |
Element.prototype.cloneNode = (function(nativeFunc, undefined) { | |
return function(deep) { | |
if (deep === undefined) { | |
deep = false; | |
} | |
var clone = nativeFunc.call(this, deep); | |
if ('checked' in this) clone.checked = this.checked; | |
return clone; | |
}; | |
}(Element.prototype.cloneNode)); | |
} | |
if (!('document' in this && "matches" in document.documentElement)) { | |
// Element.prototype.matches | |
Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) { | |
var element = this; | |
var elements = (element.document || element.ownerDocument).querySelectorAll(selector); | |
var index = 0; | |
while (elements[index] && elements[index] !== element) { | |
++index; | |
} | |
return !!elements[index]; | |
}; | |
} | |
if (!('document' in this && "closest" in document.documentElement)) { | |
// Element.prototype.closest | |
Element.prototype.closest = function closest(selector) { | |
var node = this; | |
while (node) { | |
if (node.matches(selector)) return node; | |
else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement; | |
} | |
return null; | |
}; | |
} | |
if (!('Element' in this && 'prepend' in Element.prototype)) { | |
// Element.prototype.prepend | |
Document.prototype.prepend = Element.prototype.prepend = function prepend() { | |
this.insertBefore(_mutation(arguments), this.firstChild); | |
}; | |
} | |
if (!('Element' in this && 'remove' in Element.prototype)) { | |
// Element.prototype.remove | |
Document.prototype.remove = Element.prototype.remove = function remove() { | |
if (this.parentNode) { | |
this.parentNode.removeChild(this); | |
} | |
}; | |
// Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists | |
// TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. | |
if ("Text" in this) { | |
Text.prototype.remove = Element.prototype.remove; | |
} | |
} | |
if (!('Element' in this && 'replaceWith' in Element.prototype)) { | |
// Element.prototype.replaceWith | |
Document.prototype.replaceWith = Element.prototype.replaceWith = function replaceWith() { | |
if (this.parentNode) { | |
this.parentNode.replaceChild(_mutation(arguments), this); | |
} | |
}; | |
// Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists | |
// TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. | |
if ('Text' in this) { | |
Text.prototype.replaceWith = Element.prototype.replaceWith; | |
} | |
} | |
// Event.focusin | |
this.addEventListener('focus', function (event) { | |
event.target.dispatchEvent(new Event('focusin', { | |
bubbles: true, | |
cancelable: true | |
})); | |
}, true); | |
this.addEventListener('blur', function (event) { | |
event.target.dispatchEvent(new Event('focusout', { | |
bubbles: true, | |
cancelable: true | |
})); | |
}, true); | |
if (!('onhashchange' in this && (this.onhashchange == null || typeof this.onhashchange === 'function'))) { | |
// Event.hashchange | |
(function (global) { | |
var hash = global.location.hash; | |
function poll () { | |
if (hash !== global.location.hash) { | |
hash = global.location.hash; | |
global.dispatchEvent(new Event('hashchange')); | |
} | |
setTimeout(poll, 500); | |
}; | |
// Make sure a check for 'onhashchange' in window will pass (note: setting to undefined IE<9 causes 'Not implemented' error) | |
global.onhashchange = function() {}; | |
poll(); | |
}(this)); | |
} | |
if (!('JSON' in this)) { | |
// JSON | |
/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ | |
;(function () { | |
// Detect the `define` function exposed by asynchronous module loaders. The | |
// strict `define` check is necessary for compatibility with `r.js`. | |
var isLoader = typeof define === "function" && define.amd; | |
// A set of types used to distinguish objects from primitives. | |
var objectTypes = { | |
"function": true, | |
"object": true | |
}; | |
// Detect the `exports` object exposed by CommonJS implementations. | |
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; | |
// Use the `global` object exposed by Node (including Browserify via | |
// `insert-module-globals`), Narwhal, and Ringo as the default context, | |
// and the `window` object in browsers. Rhino exports a `global` function | |
// instead. | |
var root = objectTypes[typeof window] && window || this, | |
freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global; | |
if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) { | |
root = freeGlobal; | |
} | |
// Public: Initializes JSON 3 using the given `context` object, attaching the | |
// `stringify` and `parse` functions to the specified `exports` object. | |
function runInContext(context, exports) { | |
context || (context = root["Object"]()); | |
exports || (exports = root["Object"]()); | |
// Native constructor aliases. | |
var Number = context["Number"] || root["Number"], | |
String = context["String"] || root["String"], | |
Object = context["Object"] || root["Object"], | |
Date = context["Date"] || root["Date"], | |
SyntaxError = context["SyntaxError"] || root["SyntaxError"], | |
TypeError = context["TypeError"] || root["TypeError"], | |
Math = context["Math"] || root["Math"], | |
nativeJSON = context["JSON"] || root["JSON"]; | |
// Delegate to the native `stringify` and `parse` implementations. | |
if (typeof nativeJSON == "object" && nativeJSON) { | |
exports.stringify = nativeJSON.stringify; | |
exports.parse = nativeJSON.parse; | |
} | |
// Convenience aliases. | |
var objectProto = Object.prototype, | |
getClass = objectProto.toString, | |
isProperty, forEach, undef; | |
// Test the `Date#getUTC*` methods. Based on work by @Yaffle. | |
var isExtended = new Date(-3509827334573292); | |
try { | |
// The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical | |
// results for certain dates in Opera >= 10.53. | |
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && | |
// Safari < 2.0.2 stores the internal millisecond time value correctly, | |
// but clips the values returned by the date methods to the range of | |
// signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). | |
isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; | |
} catch (exception) {} | |
// Internal: Determines whether the native `JSON.stringify` and `parse` | |
// implementations are spec-compliant. Based on work by Ken Snyder. | |
function has(name) { | |
if (has[name] !== undef) { | |
// Return cached feature test result. | |
return has[name]; | |
} | |
var isSupported; | |
if (name == "bug-string-char-index") { | |
// IE <= 7 doesn't support accessing string characters using square | |
// bracket notation. IE 8 only supports this for primitives. | |
isSupported = "a"[0] != "a"; | |
} else if (name == "json") { | |
// Indicates whether both `JSON.stringify` and `JSON.parse` are | |
// supported. | |
isSupported = has("json-stringify") && has("json-parse"); | |
} else { | |
var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; | |
// Test `JSON.stringify`. | |
if (name == "json-stringify") { | |
var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended; | |
if (stringifySupported) { | |
// A test function object with a custom `toJSON` method. | |
(value = function () { | |
return 1; | |
}).toJSON = value; | |
try { | |
stringifySupported = | |
// Firefox 3.1b1 and b2 serialize string, number, and boolean | |
// primitives as object literals. | |
stringify(0) === "0" && | |
// FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object | |
// literals. | |
stringify(new Number()) === "0" && | |
stringify(new String()) == '""' && | |
// FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or | |
// does not define a canonical JSON representation (this applies to | |
// objects with `toJSON` properties as well, *unless* they are nested | |
// within an object or array). | |
stringify(getClass) === undef && | |
// IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and | |
// FF 3.1b3 pass this test. | |
stringify(undef) === undef && | |
// Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, | |
// respectively, if the value is omitted entirely. | |
stringify() === undef && | |
// FF 3.1b1, 2 throw an error if the given value is not a number, | |
// string, array, object, Boolean, or `null` literal. This applies to | |
// objects with custom `toJSON` methods as well, unless they are nested | |
// inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` | |
// methods entirely. | |
stringify(value) === "1" && | |
stringify([value]) == "[1]" && | |
// Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of | |
// `"[null]"`. | |
stringify([undef]) == "[null]" && | |
// YUI 3.0.0b1 fails to serialize `null` literals. | |
stringify(null) == "null" && | |
// FF 3.1b1, 2 halts serialization if an array contains a function: | |
// `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 | |
// elides non-JSON values from objects and arrays, unless they | |
// define custom `toJSON` methods. | |
stringify([undef, getClass, null]) == "[null,null,null]" && | |
// Simple serialization test. FF 3.1b1 uses Unicode escape sequences | |
// where character escape codes are expected (e.g., `\b` => `\u0008`). | |
stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && | |
// FF 3.1b1 and b2 ignore the `filter` and `width` arguments. | |
stringify(null, value) === "1" && | |
stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && | |
// JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly | |
// serialize extended years. | |
stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && | |
// The milliseconds are optional in ES 5, but required in 5.1. | |
stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && | |
// Firefox <= 11.0 incorrectly serializes years prior to 0 as negative | |
// four-digit years instead of six-digit years. Credits: @Yaffle. | |
stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && | |
// Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond | |
// values less than 1000. Credits: @Yaffle. | |
stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; | |
} catch (exception) { | |
stringifySupported = false; | |
} | |
} | |
isSupported = stringifySupported; | |
} | |
// Test `JSON.parse`. | |
if (name == "json-parse") { | |
var parse = exports.parse; | |
if (typeof parse == "function") { | |
try { | |
// FF 3.1b1, b2 will throw an exception if a bare literal is provided. | |
// Conforming implementations should also coerce the initial argument to | |
// a string prior to parsing. | |
if (parse("0") === 0 && !parse(false)) { | |
// Simple parsing test. | |
value = parse(serialized); | |
var parseSupported = value["a"].length == 5 && value["a"][0] === 1; | |
if (parseSupported) { | |
try { | |
// Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. | |
parseSupported = !parse('"\t"'); | |
} catch (exception) {} | |
if (parseSupported) { | |
try { | |
// FF 4.0 and 4.0.1 allow leading `+` signs and leading | |
// decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow | |
// certain octal literals. | |
parseSupported = parse("01") !== 1; | |
} catch (exception) {} | |
} | |
if (parseSupported) { | |
try { | |
// FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal | |
// points. These environments, along with FF 3.1b1 and 2, | |
// also allow trailing commas in JSON objects and arrays. | |
parseSupported = parse("1.") !== 1; | |
} catch (exception) {} | |
} | |
} | |
} | |
} catch (exception) { | |
parseSupported = false; | |
} | |
} | |
isSupported = parseSupported; | |
} | |
} | |
return has[name] = !!isSupported; | |
} | |
if (!has("json")) { | |
// Common `[[Class]]` name aliases. | |
var functionClass = "[object Function]", | |
dateClass = "[object Date]", | |
numberClass = "[object Number]", | |
stringClass = "[object String]", | |
arrayClass = "[object Array]", | |
booleanClass = "[object Boolean]"; | |
// Detect incomplete support for accessing string characters by index. | |
var charIndexBuggy = has("bug-string-char-index"); | |
// Define additional utility methods if the `Date` methods are buggy. | |
if (!isExtended) { | |
var floor = Math.floor; | |
// A mapping between the months of the year and the number of days between | |
// January 1st and the first of the respective month. | |
var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; | |
// Internal: Calculates the number of days between the Unix epoch and the | |
// first day of the given month. | |
var getDay = function (year, month) { | |
return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); | |
}; | |
} | |
// Internal: Determines if a property is a direct property of the given | |
// object. Delegates to the native `Object#hasOwnProperty` method. | |
if (!(isProperty = objectProto.hasOwnProperty)) { | |
isProperty = function (property) { | |
var members = {}, constructor; | |
if ((members.__proto__ = null, members.__proto__ = { | |
// The *proto* property cannot be set multiple times in recent | |
// versions of Firefox and SeaMonkey. | |
"toString": 1 | |
}, members).toString != getClass) { | |
// Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but | |
// supports the mutable *proto* property. | |
isProperty = function (property) { | |
// Capture and break the object's prototype chain (see section 8.6.2 | |
// of the ES 5.1 spec). The parenthesized expression prevents an | |
// unsafe transformation by the Closure Compiler. | |
var original = this.__proto__, result = property in (this.__proto__ = null, this); | |
// Restore the original prototype chain. | |
this.__proto__ = original; | |
return result; | |
}; | |
} else { | |
// Capture a reference to the top-level `Object` constructor. | |
constructor = members.constructor; | |
// Use the `constructor` property to simulate `Object#hasOwnProperty` in | |
// other environments. | |
isProperty = function (property) { | |
var parent = (this.constructor || constructor).prototype; | |
return property in this && !(property in parent && this[property] === parent[property]); | |
}; | |
} | |
members = null; | |
return isProperty.call(this, property); | |
}; | |
} | |
// Internal: Normalizes the `for...in` iteration algorithm across | |
// environments. Each enumerated key is yielded to a `callback` function. | |
forEach = function (object, callback) { | |
var size = 0, Properties, members, property; | |
// Tests for bugs in the current environment's `for...in` algorithm. The | |
// `valueOf` property inherits the non-enumerable flag from | |
// `Object.prototype` in older versions of IE, Netscape, and Mozilla. | |
(Properties = function () { | |
this.valueOf = 0; | |
}).prototype.valueOf = 0; | |
// Iterate over a new instance of the `Properties` class. | |
members = new Properties(); | |
for (property in members) { | |
// Ignore all properties inherited from `Object.prototype`. | |
if (isProperty.call(members, property)) { | |
size++; | |
} | |
} | |
Properties = members = null; | |
// Normalize the iteration algorithm. | |
if (!size) { | |
// A list of non-enumerable properties inherited from `Object.prototype`. | |
members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; | |
// IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable | |
// properties. | |
forEach = function (object, callback) { | |
var isFunction = getClass.call(object) == functionClass, property, length; | |
var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty; | |
for (property in object) { | |
// Gecko <= 1.0 enumerates the `prototype` property of functions under | |
// certain conditions; IE does not. | |
if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { | |
callback(property); | |
} | |
} | |
// Manually invoke the callback for each non-enumerable property. | |
for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); | |
}; | |
} else if (size == 2) { | |
// Safari <= 2.0.4 enumerates shadowed properties twice. | |
forEach = function (object, callback) { | |
// Create a set of iterated properties. | |
var members = {}, isFunction = getClass.call(object) == functionClass, property; | |
for (property in object) { | |
// Store each property name to prevent double enumeration. The | |
// `prototype` property of functions is not enumerated due to cross- | |
// environment inconsistencies. | |
if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { | |
callback(property); | |
} | |
} | |
}; | |
} else { | |
// No bugs detected; use the standard `for...in` algorithm. | |
forEach = function (object, callback) { | |
var isFunction = getClass.call(object) == functionClass, property, isConstructor; | |
for (property in object) { | |
if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { | |
callback(property); | |
} | |
} | |
// Manually invoke the callback for the `constructor` property due to | |
// cross-environment inconsistencies. | |
if (isConstructor || isProperty.call(object, (property = "constructor"))) { | |
callback(property); | |
} | |
}; | |
} | |
return forEach(object, callback); | |
}; | |
// Public: Serializes a JavaScript `value` as a JSON string. The optional | |
// `filter` argument may specify either a function that alters how object and | |
// array members are serialized, or an array of strings and numbers that | |
// indicates which properties should be serialized. The optional `width` | |
// argument may be either a string or number that specifies the indentation | |
// level of the output. | |
if (!has("json-stringify")) { | |
// Internal: A map of control characters and their escaped equivalents. | |
var Escapes = { | |
92: "\\\\", | |
34: '\\"', | |
8: "\\b", | |
12: "\\f", | |
10: "\\n", | |
13: "\\r", | |
9: "\\t" | |
}; | |
// Internal: Converts `value` into a zero-padded string such that its | |
// length is at least equal to `width`. The `width` must be <= 6. | |
var leadingZeroes = "000000"; | |
var toPaddedString = function (width, value) { | |
// The `|| 0` expression is necessary to work around a bug in | |
// Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. | |
return (leadingZeroes + (value || 0)).slice(-width); | |
}; | |
// Internal: Double-quotes a string `value`, replacing all ASCII control | |
// characters (characters with code unit values between 0 and 31) with | |
// their escaped equivalents. This is an implementation of the | |
// `Quote(value)` operation defined in ES 5.1 section 15.12.3. | |
var unicodePrefix = "\\u00"; | |
var quote = function (value) { | |
var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; | |
var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); | |
for (; index < length; index++) { | |
var charCode = value.charCodeAt(index); | |
// If the character is a control character, append its Unicode or | |
// shorthand escape sequence; otherwise, append the character as-is. | |
switch (charCode) { | |
case 8: case 9: case 10: case 12: case 13: case 34: case 92: | |
result += Escapes[charCode]; | |
break; | |
default: | |
if (charCode < 32) { | |
result += unicodePrefix + toPaddedString(2, charCode.toString(16)); | |
break; | |
} | |
result += useCharIndex ? symbols[index] : value.charAt(index); | |
} | |
} | |
return result + '"'; | |
}; | |
// Internal: Recursively serializes an object. Implements the | |
// `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. | |
var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { | |
var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; | |
try { | |
// Necessary for host object support. | |
value = object[property]; | |
} catch (exception) {} | |
if (typeof value == "object" && value) { | |
className = getClass.call(value); | |
if (className == dateClass && !isProperty.call(value, "toJSON")) { | |
if (value > -1 / 0 && value < 1 / 0) { | |
// Dates are serialized according to the `Date#toJSON` method | |
// specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 | |
// for the ISO 8601 date time string format. | |
if (getDay) { | |
// Manually compute the year, month, date, hours, minutes, | |
// seconds, and milliseconds if the `getUTC*` methods are | |
// buggy. Adapted from @Yaffle's `date-shim` project. | |
date = floor(value / 864e5); | |
for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); | |
for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); | |
date = 1 + date - getDay(year, month); | |
// The `time` value specifies the time within the day (see ES | |
// 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used | |
// to compute `A modulo B`, as the `%` operator does not | |
// correspond to the `modulo` operation for negative numbers. | |
time = (value % 864e5 + 864e5) % 864e5; | |
// The hours, minutes, seconds, and milliseconds are obtained by | |
// decomposing the time within the day. See section 15.9.1.10. | |
hours = floor(time / 36e5) % 24; | |
minutes = floor(time / 6e4) % 60; | |
seconds = floor(time / 1e3) % 60; | |
milliseconds = time % 1e3; | |
} else { | |
year = value.getUTCFullYear(); | |
month = value.getUTCMonth(); | |
date = value.getUTCDate(); | |
hours = value.getUTCHours(); | |
minutes = value.getUTCMinutes(); | |
seconds = value.getUTCSeconds(); | |
milliseconds = value.getUTCMilliseconds(); | |
} | |
// Serialize extended years correctly. | |
value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + | |
"-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + | |
// Months, dates, hours, minutes, and seconds should have two | |
// digits; milliseconds should have three. | |
"T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + | |
// Milliseconds are optional in ES 5.0, but required in 5.1. | |
"." + toPaddedString(3, milliseconds) + "Z"; | |
} else { | |
value = null; | |
} | |
} else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { | |
// Prototype <= 1.6.1 adds non-standard `toJSON` methods to the | |
// `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 | |
// ignores all `toJSON` methods on these objects unless they are | |
// defined directly on an instance. | |
value = value.toJSON(property); | |
} | |
} | |
if (callback) { | |
// If a replacement function was provided, call it to obtain the value | |
// for serialization. | |
value = callback.call(object, property, value); | |
} | |
if (value === null) { | |
return "null"; | |
} | |
className = getClass.call(value); | |
if (className == booleanClass) { | |
// Booleans are represented literally. | |
return "" + value; | |
} else if (className == numberClass) { | |
// JSON numbers must be finite. `Infinity` and `NaN` are serialized as | |
// `"null"`. | |
return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; | |
} else if (className == stringClass) { | |
// Strings are double-quoted and escaped. | |
return quote("" + value); | |
} | |
// Recursively serialize objects and arrays. | |
if (typeof value == "object") { | |
// Check for cyclic structures. This is a linear search; performance | |
// is inversely proportional to the number of unique nested objects. | |
for (length = stack.length; length--;) { | |
if (stack[length] === value) { | |
// Cyclic structures cannot be serialized by `JSON.stringify`. | |
throw TypeError(); | |
} | |
} | |
// Add the object to the stack of traversed objects. | |
stack.push(value); | |
results = []; | |
// Save the current indentation level and indent one additional level. | |
prefix = indentation; | |
indentation += whitespace; | |
if (className == arrayClass) { | |
// Recursively serialize array elements. | |
for (index = 0, length = value.length; index < length; index++) { | |
element = serialize(index, value, callback, properties, whitespace, indentation, stack); | |
results.push(element === undef ? "null" : element); | |
} | |
result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; | |
} else { | |
// Recursively serialize object members. Members are selected from | |
// either a user-specified list of property names, or the object | |
// itself. | |
forEach(properties || value, function (property) { | |
var element = serialize(property, value, callback, properties, whitespace, indentation, stack); | |
if (element !== undef) { | |
// According to ES 5.1 section 15.12.3: "If `gap` {whitespace} | |
// is not the empty string, let `member` {quote(property) + ":"} | |
// be the concatenation of `member` and the `space` character." | |
// The "`space` character" refers to the literal space | |
// character, not the `space` {width} argument provided to | |
// `JSON.stringify`. | |
results.push(quote(property) + ":" + (whitespace ? " " : "") + element); | |
} | |
}); | |
result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; | |
} | |
// Remove the object from the traversed object stack. | |
stack.pop(); | |
return result; | |
} | |
}; | |
// Public: `JSON.stringify`. See ES 5.1 section 15.12.3. | |
exports.stringify = function (source, filter, width) { | |
var whitespace, callback, properties, className; | |
if (objectTypes[typeof filter] && filter) { | |
if ((className = getClass.call(filter)) == functionClass) { | |
callback = filter; | |
} else if (className == arrayClass) { | |
// Convert the property names array into a makeshift set. | |
properties = {}; | |
for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); | |
} | |
} | |
if (width) { | |
if ((className = getClass.call(width)) == numberClass) { | |
// Convert the `width` to an integer and create a string containing | |
// `width` number of space characters. | |
if ((width -= width % 1) > 0) { | |
for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); | |
} | |
} else if (className == stringClass) { | |
whitespace = width.length <= 10 ? width : width.slice(0, 10); | |
} | |
} | |
// Opera <= 7.54u2 discards the values associated with empty string keys | |
// (`""`) only if they are used directly within an object member list | |
// (e.g., `!("" in { "": 1})`). | |
return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); | |
}; | |
} | |
// Public: Parses a JSON source string. | |
if (!has("json-parse")) { | |
var fromCharCode = String.fromCharCode; | |
// Internal: A map of escaped control characters and their unescaped | |
// equivalents. | |
var Unescapes = { | |
92: "\\", | |
34: '"', | |
47: "/", | |
98: "\b", | |
116: "\t", | |
110: "\n", | |
102: "\f", | |
114: "\r" | |
}; | |
// Internal: Stores the parser state. | |
var Index, Source; | |
// Internal: Resets the parser state and throws a `SyntaxError`. | |
var abort = function () { | |
Index = Source = null; | |
throw SyntaxError(); | |
}; | |
// Internal: Returns the next token, or `"$"` if the parser has reached | |
// the end of the source string. A token may be a string, number, `null` | |
// literal, or Boolean literal. | |
var lex = function () { | |
var source = Source, length = source.length, value, begin, position, isSigned, charCode; | |
while (Index < length) { | |
charCode = source.charCodeAt(Index); | |
switch (charCode) { | |
case 9: case 10: case 13: case 32: | |
// Skip whitespace tokens, including tabs, carriage returns, line | |
// feeds, and space characters. | |
Index++; | |
break; | |
case 123: case 125: case 91: case 93: case 58: case 44: | |
// Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at | |
// the current position. | |
value = charIndexBuggy ? source.charAt(Index) : source[Index]; | |
Index++; | |
return value; | |
case 34: | |
// `"` delimits a JSON string; advance to the next character and | |
// begin parsing the string. String tokens are prefixed with the | |
// sentinel `@` character to distinguish them from punctuators and | |
// end-of-string tokens. | |
for (value = "@", Index++; Index < length;) { | |
charCode = source.charCodeAt(Index); | |
if (charCode < 32) { | |
// Unescaped ASCII control characters (those with a code unit | |
// less than the space character) are not permitted. | |
abort(); | |
} else if (charCode == 92) { | |
// A reverse solidus (`\`) marks the beginning of an escaped | |
// control character (including `"`, `\`, and `/`) or Unicode | |
// escape sequence. | |
charCode = source.charCodeAt(++Index); | |
switch (charCode) { | |
case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: | |
// Revive escaped control characters. | |
value += Unescapes[charCode]; | |
Index++; | |
break; | |
case 117: | |
// `\u` marks the beginning of a Unicode escape sequence. | |
// Advance to the first character and validate the | |
// four-digit code point. | |
begin = ++Index; | |
for (position = Index + 4; Index < position; Index++) { | |
charCode = source.charCodeAt(Index); | |
// A valid sequence comprises four hexdigits (case- | |
// insensitive) that form a single hexadecimal value. | |
if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { | |
// Invalid Unicode escape sequence. | |
abort(); | |
} | |
} | |
// Revive the escaped character. | |
value += fromCharCode("0x" + source.slice(begin, Index)); | |
break; | |
default: | |
// Invalid escape sequence. | |
abort(); | |
} | |
} else { | |
if (charCode == 34) { | |
// An unescaped double-quote character marks the end of the | |
// string. | |
break; | |
} | |
charCode = source.charCodeAt(Index); | |
begin = Index; | |
// Optimize for the common case where a string is valid. | |
while (charCode >= 32 && charCode != 92 && charCode != 34) { | |
charCode = source.charCodeAt(++Index); | |
} | |
// Append the string as-is. | |
value += source.slice(begin, Index); | |
} | |
} | |
if (source.charCodeAt(Index) == 34) { | |
// Advance to the next character and return the revived string. | |
Index++; | |
return value; | |
} | |
// Unterminated string. | |
abort(); | |
default: | |
// Parse numbers and literals. | |
begin = Index; | |
// Advance past the negative sign, if one is specified. | |
if (charCode == 45) { | |
isSigned = true; | |
charCode = source.charCodeAt(++Index); | |
} | |
// Parse an integer or floating-point value. | |
if (charCode >= 48 && charCode <= 57) { | |
// Leading zeroes are interpreted as octal literals. | |
if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { | |
// Illegal octal literal. | |
abort(); | |
} | |
isSigned = false; | |
// Parse the integer component. | |
for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); | |
// Floats cannot contain a leading decimal point; however, this | |
// case is already accounted for by the parser. | |
if (source.charCodeAt(Index) == 46) { | |
position = ++Index; | |
// Parse the decimal component. | |
for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); | |
if (position == Index) { | |
// Illegal trailing decimal. | |
abort(); | |
} | |
Index = position; | |
} | |
// Parse exponents. The `e` denoting the exponent is | |
// case-insensitive. | |
charCode = source.charCodeAt(Index); | |
if (charCode == 101 || charCode == 69) { | |
charCode = source.charCodeAt(++Index); | |
// Skip past the sign following the exponent, if one is | |
// specified. | |
if (charCode == 43 || charCode == 45) { | |
Index++; | |
} | |
// Parse the exponential component. | |
for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); | |
if (position == Index) { | |
// Illegal empty exponent. | |
abort(); | |
} | |
Index = position; | |
} | |
// Coerce the parsed value to a JavaScript number. | |
return +source.slice(begin, Index); | |
} | |
// A negative sign may only precede numbers. | |
if (isSigned) { | |
abort(); | |
} | |
// `true`, `false`, and `null` literals. | |
if (source.slice(Index, Index + 4) == "true") { | |
Index += 4; | |
return true; | |
} else if (source.slice(Index, Index + 5) == "false") { | |
Index += 5; | |
return false; | |
} else if (source.slice(Index, Index + 4) == "null") { | |
Index += 4; | |
return null; | |
} | |
// Unrecognized token. | |
abort(); | |
} | |
} | |
// Return the sentinel `$` character if the parser has reached the end | |
// of the source string. | |
return "$"; | |
}; | |
// Internal: Parses a JSON `value` token. | |
var get = function (value) { | |
var results, hasMembers; | |
if (value == "$") { | |
// Unexpected end of input. | |
abort(); | |
} | |
if (typeof value == "string") { | |
if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { | |
// Remove the sentinel `@` character. | |
return value.slice(1); | |
} | |
// Parse object and array literals. | |
if (value == "[") { | |
// Parses a JSON array, returning a new JavaScript array. | |
results = []; | |
for (;; hasMembers || (hasMembers = true)) { | |
value = lex(); | |
// A closing square bracket marks the end of the array literal. | |
if (value == "]") { | |
break; | |
} | |
// If the array literal contains elements, the current token | |
// should be a comma separating the previous element from the | |
// next. | |
if (hasMembers) { | |
if (value == ",") { | |
value = lex(); | |
if (value == "]") { | |
// Unexpected trailing `,` in array literal. | |
abort(); | |
} | |
} else { | |
// A `,` must separate each array element. | |
abort(); | |
} | |
} | |
// Elisions and leading commas are not permitted. | |
if (value == ",") { | |
abort(); | |
} | |
results.push(get(value)); | |
} | |
return results; | |
} else if (value == "{") { | |
// Parses a JSON object, returning a new JavaScript object. | |
results = {}; | |
for (;; hasMembers || (hasMembers = true)) { | |
value = lex(); | |
// A closing curly brace marks the end of the object literal. | |
if (value == "}") { | |
break; | |
} | |
// If the object literal contains members, the current token | |
// should be a comma separator. | |
if (hasMembers) { | |
if (value == ",") { | |
value = lex(); | |
if (value == "}") { | |
// Unexpected trailing `,` in object literal. | |
abort(); | |
} | |
} else { | |
// A `,` must separate each object member. | |
abort(); | |
} | |
} | |
// Leading commas are not permitted, object property names must be | |
// double-quoted strings, and a `:` must separate each property | |
// name and value. | |
if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { | |
abort(); | |
} | |
results[value.slice(1)] = get(lex()); | |
} | |
return results; | |
} | |
// Unexpected token encountered. | |
abort(); | |
} | |
return value; | |
}; | |
// Internal: Updates a traversed object member. | |
var update = function (source, property, callback) { | |
var element = walk(source, property, callback); | |
if (element === undef) { | |
delete source[property]; | |
} else { | |
source[property] = element; | |
} | |
}; | |
// Internal: Recursively traverses a parsed JSON object, invoking the | |
// `callback` function for each value. This is an implementation of the | |
// `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. | |
var walk = function (source, property, callback) { | |
var value = source[property], length; | |
if (typeof value == "object" && value) { | |
// `forEach` can't be used to traverse an array in Opera <= 8.54 | |
// because its `Object#hasOwnProperty` implementation returns `false` | |
// for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). | |
if (getClass.call(value) == arrayClass) { | |
for (length = value.length; length--;) { | |
update(value, length, callback); | |
} | |
} else { | |
forEach(value, function (property) { | |
update(value, property, callback); | |
}); | |
} | |
} | |
return callback.call(source, property, value); | |
}; | |
// Public: `JSON.parse`. See ES 5.1 section 15.12.2. | |
exports.parse = function (source, callback) { | |
var result, value; | |
Index = 0; | |
Source = "" + source; | |
result = get(lex()); | |
// If a JSON string contains multiple tokens, it is invalid. | |
if (lex() != "$") { | |
abort(); | |
} | |
// Reset the parser state. | |
Index = Source = null; | |
return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; | |
}; | |
} | |
} | |
exports["runInContext"] = runInContext; | |
return exports; | |
} | |
if (freeExports && !isLoader) { | |
// Export for CommonJS environments. | |
runInContext(root, freeExports); | |
} else { | |
// Export for web browsers and JavaScript engines. | |
var nativeJSON = root.JSON, | |
previousJSON = root["JSON3"], | |
isRestored = false; | |
var JSON3 = runInContext(root, (root["JSON3"] = { | |
// Public: Restores the original value of the global `JSON` object and | |
// returns a reference to the `JSON3` object. | |
"noConflict": function () { | |
if (!isRestored) { | |
isRestored = true; | |
root.JSON = nativeJSON; | |
root["JSON3"] = previousJSON; | |
nativeJSON = previousJSON = null; | |
} | |
return JSON3; | |
} | |
})); | |
root.JSON = { | |
"parse": JSON3.parse, | |
"stringify": JSON3.stringify | |
}; | |
} | |
// Export for asynchronous module loaders. | |
if (isLoader) { | |
define(function () { | |
return JSON3; | |
}); | |
} | |
}).call(this); | |
} | |
if (!('Map' in this && (function() { | |
try { | |
return (new Map([[1,1], [2,2]])).size === 2; | |
} catch (e) { | |
return false; | |
} | |
}()))) { | |
// Map | |
(function (global) { | |
// 7.2.11. SameValueZero ( x, y ) | |
var sameValueZero = function (x, y) { | |
// 1. If Type(x) is different from Type(y), return false. | |
if (typeof x !== typeof y) { | |
return false; | |
} | |
// 2. If Type(x) is Number, then | |
if (typeof x === 'number') { | |
// a. If x is NaN and y is NaN, return true. | |
if (isNaN(x) && isNaN(y)) { | |
return true; | |
} | |
// b. If x is +0 and y is -0, return true. | |
if (x === +0 && y === -0) { | |
return true; | |
} | |
// c. If x is -0 and y is +0, return true. | |
if (x === -0 && y === +0) { | |
return true; | |
} | |
// d. If x is the same Number value as y, return true. | |
if (x === y) { | |
return true; | |
} | |
// e. Return false. | |
return false; | |
} | |
// 3. Return SameValueNonNumber(x, y). | |
return x === y; | |
}; | |
// 7.3.9. GetMethod ( V, P ) | |
function getMethod(V, P) { | |
// 1. Assert: IsPropertyKey(P) is true. | |
// 2. Let func be ? GetV(V, P). | |
var func = V[P]; | |
// 3. If func is either undefined or null, return undefined. | |
if (func === null || func === undefined) { | |
return undefined; | |
} | |
// 4. If IsCallable(func) is false, throw a TypeError exception. | |
if (typeof func !== 'function') { | |
throw new TypeError('Method not callable: ' + P); | |
} | |
// 5. Return func. | |
return func; | |
} | |
// 7.4.1. GetIterator ( obj [ , method ] ) | |
// The abstract operation GetIterator with argument obj and optional argument method performs the following steps: | |
function getIterator(obj /*, method */) { | |
// 1. If method is not present, then | |
if (!(1 in arguments)) { | |
// a. Set method to ? GetMethod(obj, @@iterator). | |
var method = getMethod(obj, Symbol.iterator); | |
} | |
// 2. Let iterator be ? Call(method, obj). | |
var iterator = method.call(obj); | |
// 3. If Type(iterator) is not Object, throw a TypeError exception. | |
if (typeof iterator !== 'object') { | |
throw new TypeError('bad iterator'); | |
} | |
// 4. Let nextMethod be ? GetV(iterator, "next"). | |
var nextMethod = iterator.next; | |
// 5. Let iteratorRecord be Record {[[Iterator]]: iterator, [[NextMethod]]: nextMethod, [[Done]]: false}. | |
var iteratorRecord = Object.create(null); | |
iteratorRecord['[[Iterator]]'] = iterator; | |
iteratorRecord['[[NextMethod]]'] = nextMethod; | |
iteratorRecord['[[Done]]'] = false; | |
// 6. Return iteratorRecord. | |
return iteratorRecord; | |
} | |
// 7.4.2. IteratorNext ( iteratorRecord [ , value ] ) | |
function iteratorNext(iteratorRecord /* [, value] */) { | |
// 1. If value is not present, then | |
if (!(1 in arguments)) { | |
// a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « »). | |
var result = iteratorRecord['[[NextMethod]]'].call(iteratorRecord['[[Iterator]]']); | |
// 2. Else, | |
} else { | |
// a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « value »). | |
var result = iteratorRecord['[[NextMethod]]'].call(iteratorRecord['[[Iterator]]'], arguments[1]); | |
} | |
// 3. If Type(result) is not Object, throw a TypeError exception. | |
if (typeof result !== 'object') { | |
throw new TypeError('bad iterator'); | |
} | |
// 4. Return result. | |
return result; | |
} | |
// 7.4.3 IteratorComplete ( iterResult ) | |
function iteratorComplete(iterResult) { | |
// 1. Assert: Type(iterResult) is Object. | |
if (typeof iterResult !== 'object') { | |
throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.'); | |
} | |
// 2. Return ToBoolean(? Get(iterResult, "done")). | |
return Boolean(iterResult['done']); | |
} | |
// 7.4.4 IteratorValue ( iterResult ) | |
function iteratorValue(iterResult) { | |
// Assert: Type(iterResult) is Object. | |
if (typeof iterResult !== 'object') { | |
throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.'); | |
} | |
// Return ? Get(iterResult, "value"). | |
return iterResult.value; | |
} | |
// 7.4.5. IteratorStep ( iteratorRecord ) | |
function iteratorStep(iteratorRecord) { | |
// 1. Let result be ? IteratorNext(iteratorRecord). | |
var result = iteratorNext(iteratorRecord); | |
// 2. Let done be ? IteratorComplete(result). | |
var done = iteratorComplete(result); | |
// 3. If done is true, return false. | |
if (done === true) { | |
return false; | |
} | |
// 4. Return result. | |
return result; | |
} | |
// 7.4.6. IteratorClose ( iteratorRecord, completion ) | |
function iteratorClose(iteratorRecord, completion) { | |
// 1. Assert: Type(iteratorRecord.[[Iterator]]) is Object. | |
if (typeof iteratorRecord['[[Iterator]]'] !== 'object') { | |
throw new Error(Object.prototype.toString.call(iteratorRecord['[[Iterator]]']) + 'is not an Object.'); | |
} | |
// 2. Assert: completion is a Completion Record. | |
// Polyfill.io - Ignoring this step as there is no way to check if something is a Completion Record in userland JavaScript. | |
// 3. Let iterator be iteratorRecord.[[Iterator]]. | |
var iterator = iteratorRecord['[[Iterator]]']; | |
// 4. Let return be ? GetMethod(iterator, "return"). | |
// Polyfill.io - We name it returnMethod because return is a keyword and can not be used as an identifier (E.G. variable name, function name etc). | |
var returnMethod = getMethod(iterator, "return"); | |
// 5. If return is undefined, return Completion(completion). | |
if (returnMethod === undefined) { | |
return completion; | |
} | |
// 6. Let innerResult be Call(return, iterator, « »). | |
try { | |
var innerResult = returnMethod.call(iterator); | |
} catch (error) { | |
var innerException = error; | |
} | |
// 7. If completion.[[Type]] is throw, return Completion(completion). | |
if (completion) { | |
return completion; | |
} | |
// 8. If innerResult.[[Type]] is throw, return Completion(innerResult). | |
if (innerException) { | |
throw innerException; | |
} | |
// 9. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception. | |
if (!(typeof innerResult !== 'object')) { | |
throw new TypeError("Iterator's return method returned a non-object."); | |
} | |
// 10. Return Completion(completion). | |
return completion; | |
} | |
// 7.4.7. CreateIterResultObject ( value, done ) | |
function createIterResultObject(value, done) { | |
// 1. Assert: Type(done) is Boolean. | |
if (typeof done !== 'boolean') { | |
throw new Error(); | |
} | |
// 2. Let obj be ObjectCreate(%ObjectPrototype%). | |
var obj = {}; | |
// 3. Perform CreateDataProperty(obj, "value", value). | |
obj.value = value; | |
// 4. Perform CreateDataProperty(obj, "done", done). | |
obj.done = done; | |
// 5. Return obj. | |
return obj; | |
} | |
// 9.1.13. OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] ) | |
var ordinaryCreateFromConstructor = function (constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars | |
var internalSlotsList = arguments[2] || {}; | |
/* | |
1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object. | |
The corresponding object must be an intrinsic that is intended to be used as the[[Prototype]] value of an object. | |
*/ | |
// Polyfill.io - We ignore the above step and instead pass the intrinsic directly. | |
// 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto). | |
// Polyfill.io - We ignore the above step and always use the prototype of the constructor. | |
var proto = Object.getPrototypeOf(constructor); | |
// 3. Return ObjectCreate(proto, internalSlotsList). | |
// Polyfill.io - We do not pass internalSlotsList to Object.create because Object.create does use the default ordinary object definitions specified in 9.1. | |
var obj = Object.create(proto); | |
for (var name in internalSlotsList) { | |
if (Object.prototype.hasOwnProperty.call(internalSlotsList, name)) { | |
Object.defineProperty(obj, name, { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: internalSlotsList[name] | |
}); | |
} | |
} | |
return obj; | |
}; | |
// Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol. | |
var undefMarker = Symbol('undef'); | |
var supportsGetters = (function () { | |
try { | |
var a = {}; | |
Object.defineProperty(a, 't', { | |
configurable: true, | |
enumerable: false, | |
get: function () { | |
return true; | |
}, | |
set: undefined | |
}); | |
return !!a.t; | |
} catch (e) { | |
return false; | |
} | |
}()); | |
var isCallable = function (fn) { | |
return typeof fn === 'function'; | |
}; | |
// 23.1.1.1 Map ( [ iterable ] ) | |
var Map = function Map(/* iterable */) { | |
// 1. If NewTarget is undefined, throw a TypeError exception. | |
if (!(this instanceof Map)) { | |
throw new TypeError('Constructor Map requires "new"'); | |
} | |
// 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%", « [[MapData]] »). | |
var map = ordinaryCreateFromConstructor(this, "%MapPrototype%", { | |
_keys: [], | |
_values: [], | |
_size: 0, | |
_es6Map: true | |
}); | |
// 3. Set map.[[MapData]] to a new empty List. | |
// Polyfill.io - This step was done as part of step two. | |
// Some old engines do not support ES5 getters/setters. Since Map only requires these for the size property, we can fall back to setting the size property statically each time the size of the map changes. | |
if (!supportsGetters) { | |
Object.defineProperty(map, 'size', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: 0 | |
}); | |
} | |
// 4. If iterable is not present, let iterable be undefined. | |
var iterable = arguments[0] || undefined; | |
// 5. If iterable is either undefined or null, return map. | |
if (iterable === null || iterable === undefined) { | |
return map; | |
} | |
// 6. Let adder be ? Get(map, "set"). | |
var adder = map.set; | |
// 7. If IsCallable(adder) is false, throw a TypeError exception. | |
if (!isCallable(adder)) { | |
throw new TypeError("Map.prototype.set is not a function"); | |
} | |
// 8. Let iteratorRecord be ? GetIterator(iterable). | |
try { | |
var iteratorRecord = getIterator(iterable); | |
// 9. Repeat, | |
while (true) { | |
// a. Let next be ? IteratorStep(iteratorRecord). | |
var next = iteratorStep(iteratorRecord); | |
// b. If next is false, return map. | |
if (next === false) { | |
return map; | |
} | |
// c. Let nextItem be ? IteratorValue(next). | |
var nextItem = iteratorValue(next); | |
// d. If Type(nextItem) is not Object, then | |
if (typeof nextItem !== 'object') { | |
// i. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}. | |
try { | |
throw new TypeError('Iterator value ' + nextItem + ' is not an entry object'); | |
} catch (error) { | |
// ii. Return ? IteratorClose(iteratorRecord, error). | |
return iteratorClose(iteratorRecord, error); | |
} | |
} | |
try { | |
// Polyfill.io - The try catch accounts for steps: f, h, and j. | |
// e. Let k be Get(nextItem, "0"). | |
var k = nextItem[0]; | |
// f. If k is an abrupt completion, return ? IteratorClose(iteratorRecord, k). | |
// g. Let v be Get(nextItem, "1"). | |
var v = nextItem[1]; | |
// h. If v is an abrupt completion, return ? IteratorClose(iteratorRecord, v). | |
// i. Let status be Call(adder, map, « k.[[Value]], v.[[Value]] »). | |
adder.call(map, k, v); | |
} catch (e) { | |
// j. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status). | |
return iteratorClose(iteratorRecord, e); | |
} | |
} | |
} catch (e) { | |
// Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those. | |
if (Array.isArray(iterable) || | |
Object.prototype.toString.call(iterable) === '[object Arguments]' || | |
// IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property | |
(!!iterable.callee)) { | |
var index; | |
var length = iterable.length; | |
for (index = 0; index < length; index++) { | |
adder.call(map, iterable[index][0], iterable[index][1]); | |
} | |
} | |
} | |
return map; | |
}; | |
// 23.1.2.1. Map.prototype | |
// The initial value of Map.prototype is the intrinsic object %MapPrototype%. | |
// This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. | |
Object.defineProperty(Map, 'prototype', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: {} | |
}); | |
// 23.1.2.2 get Map [ @@species ] | |
if (supportsGetters) { | |
Object.defineProperty(Map, Symbol.species, { | |
configurable: true, | |
enumerable: false, | |
get: function () { | |
// 1. Return the this value. | |
return this; | |
}, | |
set: undefined | |
}); | |
} else { | |
Object.defineProperty(Map, Symbol.species, { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: Map | |
}); | |
} | |
// 23.1.3.1 Map.prototype.clear ( ) | |
Object.defineProperty(Map.prototype, 'clear', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function clear() { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do | |
for (var i = 0; i < entries.length; i++) { | |
// 5.a. Set p.[[Key]] to empty. | |
M._keys[i] = undefMarker; | |
// 5.b. Set p.[[Value]] to empty. | |
M._values[i] = undefMarker; | |
} | |
this._size = 0; | |
if (!supportsGetters) { | |
this.size = this._size; | |
} | |
// 6. Return undefined. | |
return undefined; | |
} | |
}); | |
// 23.1.3.2. Map.prototype.constructor | |
Object.defineProperty(Map.prototype, 'constructor', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: Map | |
}); | |
// 23.1.3.3. Map.prototype.delete ( key ) | |
Object.defineProperty(Map.prototype, 'delete', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function (key) { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do | |
for (var i = 0; i < entries.length; i++) { | |
// a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then | |
if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { | |
// i. Set p.[[Key]] to empty. | |
this._keys[i] = undefMarker; | |
// ii. Set p.[[Value]] to empty. | |
this._values[i] = undefMarker; | |
--this._size; | |
if (!supportsGetters) { | |
this.size = this._size; | |
} | |
// iii. Return true. | |
return true; | |
} | |
} | |
// 6. Return false. | |
return false; | |
} | |
}); | |
// 23.1.3.4. Map.prototype.entries ( ) | |
Object.defineProperty(Map.prototype, 'entries', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function entries () { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. Return ? CreateMapIterator(M, "key+value"). | |
return createMapIterator(M, 'key+value'); | |
} | |
}); | |
// 23.1.3.5. Map.prototype.forEach ( callbackfn [ , thisArg ] ) | |
Object.defineProperty(Map.prototype, 'forEach', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function (callbackFn) { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. If IsCallable(callbackfn) is false, throw a TypeError exception. | |
if (!isCallable(callbackFn)) { | |
throw new TypeError(Object.prototype.toString.call(callbackFn) + ' is not a function.'); | |
} | |
// 5. If thisArg is present, let T be thisArg; else let T be undefined. | |
if (arguments[1]) { | |
var T = arguments[1]; | |
} | |
// 6. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 7. For each Record {[[Key]], [[Value]]} e that is an element of entries, in original key insertion order, do | |
for (var i = 0; i < entries.length; i++) { | |
// a. If e.[[Key]] is not empty, then | |
if (M._keys[i] !== undefMarker && M._values[i] !== undefMarker ) { | |
// i. Perform ? Call(callbackfn, T, « e.[[Value]], e.[[Key]], M »). | |
callbackFn.call(T, M._values[i], M._keys[i], M); | |
} | |
} | |
// 8. Return undefined. | |
return undefined; | |
} | |
}); | |
// 23.1.3.6. Map.prototype.get ( key ) | |
Object.defineProperty(Map.prototype, 'get', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function get(key) { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do | |
for (var i = 0; i < entries.length; i++) { | |
// a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return p.[[Value]]. | |
if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { | |
return M._values[i]; | |
} | |
} | |
// 6. Return undefined. | |
return undefined; | |
} | |
}); | |
// 23.1.3.7. Map.prototype.has ( key ) | |
Object.defineProperty(Map.prototype, 'has', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function has (key) { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do | |
for (var i = 0; i < entries.length; i++) { | |
// a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return true. | |
if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { | |
return true; | |
} | |
} | |
// 6. Return false. | |
return false; | |
} | |
}); | |
// 23.1.3.8. Map.prototype.keys ( ) | |
Object.defineProperty(Map.prototype, 'keys', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function keys () { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. Return ? CreateMapIterator(M, "key"). | |
return createMapIterator(M, "key"); | |
} | |
}); | |
// 23.1.3.9. Map.prototype.set ( key, value ) | |
Object.defineProperty(Map.prototype, 'set', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function set(key, value) { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do | |
for (var i = 0; i < entries.length; i++) { | |
// a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then | |
if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { | |
// i. Set p.[[Value]] to value. | |
M._values[i] = value; | |
// Return M. | |
return M; | |
} | |
} | |
// 6. If key is -0, let key be +0. | |
if (key === -0) { | |
key = 0; | |
} | |
// 7. Let p be the Record {[[Key]]: key, [[Value]]: value}. | |
var p = {}; | |
p['[[Key]]'] = key; | |
p['[[Value]]'] = value; | |
// 8. Append p as the last element of entries. | |
M._keys.push(p['[[Key]]']); | |
M._values.push(p['[[Value]]']); | |
++M._size; | |
if (!supportsGetters) { | |
M.size = M._size; | |
} | |
// 9. Return M. | |
return M; | |
} | |
}); | |
// 23.1.3.10. get Map.prototype.size | |
if (supportsGetters) { | |
Object.defineProperty(Map.prototype, 'size', { | |
configurable: true, | |
enumerable: false, | |
get: function () { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. If Type(M) is not Object, throw a TypeError exception. | |
if (typeof M !== 'object') { | |
throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (M._es6Map !== true) { | |
throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M)); | |
} | |
// 4. Let entries be the List that is M.[[MapData]]. | |
var entries = M._keys; | |
// 5. Let count be 0. | |
var count = 0; | |
// 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do | |
for (var i = 0; i < entries.length; i++) { | |
// a. If p.[[Key]] is not empty, set count to count+1. | |
if (M._keys[i] !== undefMarker) { | |
count = count + 1; | |
} | |
} | |
// 7. Return count. | |
return count; | |
}, | |
set: undefined | |
}); | |
} | |
// 23.1.3.11. Map.prototype.values ( ) | |
Object.defineProperty(Map.prototype, 'values', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function values () { | |
// 1. Let M be the this value. | |
var M = this; | |
// 2. Return ? CreateMapIterator(M, "value"). | |
return createMapIterator(M, 'value'); | |
} | |
}); | |
// 23.1.3.12. Map.prototype [ @@iterator ] ( ) | |
// The initial value of the @@iterator property is the same function object as the initial value of the entries property. | |
Object.defineProperty(Map.prototype, Symbol.iterator, { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: Map.prototype.entries | |
}); | |
// 23.1.3.13. Map.prototype [ @@toStringTag ] | |
// The initial value of the @@toStringTag property is the String value "Map". | |
// This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. | |
// Polyfill.io - Safari 8 implements Map.name but as a non-configurable property, which means it would throw an error if we try and configure it here. | |
if (!('name' in Map)) { | |
// 19.2.4.2 name | |
Object.defineProperty(Map, 'name', { | |
configurable: true, | |
enumerable: false, | |
writable: false, | |
value: 'Map' | |
}); | |
} | |
// 23.1.5.1. CreateMapIterator ( map, kind ) | |
function createMapIterator(map, kind) { | |
// 1. If Type(map) is not Object, throw a TypeError exception. | |
if (typeof map !== 'object') { | |
throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map)); | |
} | |
// 2. If map does not have a [[MapData]] internal slot, throw a TypeError exception. | |
if (map._es6Map !== true) { | |
throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map)); | |
} | |
// 3. Let iterator be ObjectCreate(%MapIteratorPrototype%, « [[Map]], [[MapNextIndex]], [[MapIterationKind]] »). | |
var iterator = Object.create(MapIteratorPrototype); | |
// 4. Set iterator.[[Map]] to map. | |
Object.defineProperty(iterator, '[[Map]]', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: map | |
}); | |
// 5. Set iterator.[[MapNextIndex]] to 0. | |
Object.defineProperty(iterator, '[[MapNextIndex]]', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: 0 | |
}); | |
// 6. Set iterator.[[MapIterationKind]] to kind. | |
Object.defineProperty(iterator, '[[MapIterationKind]]', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: kind | |
}); | |
// 7. Return iterator. | |
return iterator; | |
} | |
// 23.1.5.2. The %MapIteratorPrototype% Object | |
var MapIteratorPrototype = { | |
// Polyfill.io - We use this as a quick way to check if an object is a Map Iterator instance. | |
isMapIterator: true, | |
// 23.1.5.2.1. %MapIteratorPrototype%.next ( ) | |
next: function next () { | |
// 1. Let O be the this value. | |
var O = this; | |
// 2. If Type(O) is not Object, throw a TypeError exception. | |
if (typeof O !== 'object') { | |
throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O)); | |
} | |
// 3. If O does not have all of the internal slots of a Map Iterator Instance (23.1.5.3), throw a TypeError exception. | |
if (!O.isMapIterator) { | |
throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O)); | |
} | |
// 4. Let m be O.[[Map]]. | |
var m = O['[[Map]]']; | |
// 5. Let index be O.[[MapNextIndex]]. | |
var index = O['[[MapNextIndex]]']; | |
// 6. Let itemKind be O.[[MapIterationKind]]. | |
var itemKind = O['[[MapIterationKind]]']; | |
// 7. If m is undefined, return CreateIterResultObject(undefined, true). | |
if (m === undefined) { | |
return createIterResultObject(undefined, true); | |
} | |
// 8. Assert: m has a [[MapData]] internal slot. | |
if (!m._es6Map) { | |
throw new Error(); | |
} | |
// 9. Let entries be the List that is m.[[MapData]]. | |
var entries = m._keys; | |
// 10. Let numEntries be the number of elements of entries. | |
var numEntries = entries.length; | |
// 11. NOTE: numEntries must be redetermined each time this method is evaluated. | |
// 12. Repeat, while index is less than numEntries, | |
while (index < numEntries) { | |
// a. Let e be the Record {[[Key]], [[Value]]} that is the value of entries[index]. | |
var e = Object.create(null); | |
e['[[Key]]'] = m._keys[index]; | |
e['[[Value]]'] = m._values[index]; | |
// b. Set index to index+1. | |
index = index + 1; | |
// c. Set O.[[MapNextIndex]] to index. | |
O['[[MapNextIndex]]'] = index; | |
// d. If e.[[Key]] is not empty, then | |
if (e['[[Key]]'] !== undefMarker) { | |
// i. If itemKind is "key", let result be e.[[Key]]. | |
if (itemKind === 'key') { | |
var result = e['[[Key]]']; | |
// ii. Else if itemKind is "value", let result be e.[[Value]]. | |
} else if (itemKind === 'value') { | |
var result = e['[[Value]]']; | |
// iii. Else, | |
} else { | |
// 1. Assert: itemKind is "key+value". | |
if (itemKind !== 'key+value') { | |
throw new Error(); | |
} | |
// 2. Let result be CreateArrayFromList(« e.[[Key]], e.[[Value]] »). | |
var result = [ | |
e['[[Key]]'], | |
e['[[Value]]'] | |
]; | |
} | |
// iv. Return CreateIterResultObject(result, false). | |
return createIterResultObject(result, false); | |
} | |
} | |
// 13. Set O.[[Map]] to undefined. | |
O['[[Map]]'] = undefined; | |
// 14. Return CreateIterResultObject(undefined, true). | |
return createIterResultObject(undefined, true); | |
} | |
// 23.1.5.2.2 %MapIteratorPrototype% [ @@toStringTag ] | |
// The initial value of the @@toStringTag property is the String value "Map Iterator". | |
// This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. | |
}; | |
Object.defineProperty(MapIteratorPrototype, Symbol.iterator, { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: function iterator() { | |
return this; | |
} | |
}); | |
// Export the object | |
try { | |
Object.defineProperty(global, 'Map', { | |
configurable: true, | |
enumerable: false, | |
writable: true, | |
value: Map | |
}); | |
} catch (e) { | |
// IE8 throws an error here if we set enumerable to false. | |
// More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx | |
global['Map'] = Map; | |
} | |
}(this)); | |
} | |
if (!(document.contains)) { | |
// Node.prototype.contains | |
(function() { | |
function contains(node) { | |
if (!(0 in arguments)) { | |
throw new TypeError('1 argument is required'); | |
} | |
do { | |
if (this === node) { | |
return true; | |
} | |
} while (node = node && node.parentNode); | |
return false; | |
} | |
// IE | |
if ('HTMLElement' in this && 'contains' in HTMLElement.prototype) { | |
try { | |
delete HTMLElement.prototype.contains; | |
} catch (e) {} | |
} | |
if ('Node' in this) { | |
Node.prototype.contains = contains; | |
} else { | |
document.contains = Element.prototype.contains = contains; | |
} | |
}()); | |
} | |
if (!('Set' in this && (function() { | |
return (new Set([1,2])).size === 2; | |
}()))) { | |
// Set | |
(function(global) { | |
// Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol. | |
var undefMarker = Symbol('undef'); | |
// NaN cannot be found in an array using indexOf, so we encode NaNs using a private symbol. | |
var NaNMarker = Symbol('NaN'); | |
function encodeVal(data) { | |
return Number.isNaN(data) ? NaNMarker : data; | |
} | |
function decodeVal(encodedData) { | |
return (encodedData === NaNMarker) ? NaN : encodedData; | |
} | |
function makeIterator(setInst, getter) { | |
var nextIdx = 0; | |
return { | |
next: function() { | |
while (setInst._values[nextIdx] === undefMarker) nextIdx++; | |
if (nextIdx === setInst._values.length) { | |
return {value: void 0, done: true}; | |
} | |
else { | |
return {value: getter.call(setInst, nextIdx++), done: false}; | |
} | |
} | |
}; | |
} | |
var Set = function Set() { | |
var data = arguments[0]; | |
this._values = []; | |
this.size = this._size = 0; | |
// If `data` is iterable (indicated by presence of a forEach method), pre-populate the set | |
data && (typeof data.forEach === 'function') && data.forEach(function (item) { | |
this.add.call(this, item); | |
}, this); | |
}; | |
// Some old engines do not support ES5 getters/setters. Since Set only requires these for the size property, we can fall back to setting the size property statically each time the size of the set changes. | |
try { | |
Object.defineProperty(Set.prototype, 'size', { | |
get: function() { | |
return this._size; | |
} | |
}); | |
} catch(e) { | |
} | |
Set.prototype['add'] = function(value) { | |
value = encodeVal(value); | |
if (this._values.indexOf(value) === -1) { | |
this._values.push(value); | |
this.size = ++this._size; | |
} | |
return this; | |
}; | |
Set.prototype['has'] = function(value) { | |
return (this._values.indexOf(encodeVal(value)) !== -1); | |
}; | |
Set.prototype['delete'] = function(value) { | |
var idx = this._values.indexOf(encodeVal(value)); | |
if (idx === -1) return false; | |
this._values[idx] = undefMarker; | |
this.size = --this._size; | |
return true; | |
}; | |
Set.prototype['clear'] = function() { | |
this._values = []; | |
this.size = this._size = 0; | |
}; | |
Set.prototype[Symbol.iterator] = | |
Set.prototype['values'] = | |
Set.prototype['keys'] = function() { | |
var iterator = makeIterator(this, function(i) { return decodeVal(this._values[i]); }); | |
iterator[Symbol.iterator] = this.keys.bind(this); | |
return iterator; | |
}; | |
Set.prototype['entries'] = function() { | |
var iterator = makeIterator(this, function(i) { return [decodeVal(this._values[i]), decodeVal(this._values[i])]; }); | |
iterator[Symbol.iterator] = this.entries.bind(this); | |
return iterator; | |
}; | |
Set.prototype['forEach'] = function(callbackFn, thisArg) { | |
thisArg = thisArg || global; | |
var iterator = this.entries(); | |
var result = iterator.next(); | |
while (result.done === false) { | |
callbackFn.call(thisArg, result.value[1], result.value[0], this); | |
result = iterator.next(); | |
} | |
}; | |
Set.prototype['constructor'] = | |
Set.prototype[Symbol.species] = Set; | |
Set.prototype.constructor = Set; | |
Set.name = "Set"; | |
// Export the object | |
global.Set = Set; | |
}(this)); | |
} | |
if (!('endsWith' in String.prototype)) { | |
// String.prototype.endsWith | |
String.prototype.endsWith = function (string) { | |
var index = arguments.length < 2 ? this.length : arguments[1]; | |
var foundIndex = this.lastIndexOf(string); | |
return foundIndex !== -1 && foundIndex === index - string.length; | |
}; | |
} | |
if (!('startsWith' in String.prototype)) { | |
// String.prototype.startsWith | |
String.prototype.startsWith = function (string) { | |
var index = arguments.length < 2 ? 0 : arguments[1]; | |
return this.slice(index).indexOf(string) === 0; | |
}; | |
} | |
if (!('trim' in String.prototype)) { | |
// String.prototype.trim | |
String.prototype.trim = function trim() { | |
return this.replace(/^\s+|\s+$/g, ''); | |
}; | |
} | |
if (!((function (global) { | |
/* | |
* Browsers may have: | |
* No global URL object | |
* URL with static methods only - may have a dummy constructor | |
* URL with members except searchParams | |
* Full URL API support | |
*/ | |
'use strict'; | |
try { | |
var nativeURL = new global.URL('http://example.com'); | |
return 'href' in nativeURL && 'searchParams' in nativeURL; | |
} | |
catch (error) { | |
return false; | |
} | |
}(this)))) { | |
// URL | |
// URL Polyfill | |
// Draft specification: https://url.spec.whatwg.org | |
// Notes: | |
// - Primarily useful for parsing URLs and modifying query parameters | |
// - Should work in IE8+ and everything more modern, with es5.js polyfills | |
(function (global) { | |
'use strict'; | |
function isSequence(o) { | |
if (!o) return false; | |
if ('Symbol' in global && 'iterator' in global.Symbol && | |
typeof o[Symbol.iterator] === 'function') return true; | |
if (Array.isArray(o)) return true; | |
return false; | |
} | |
function toArray(iter) { | |
return ('from' in Array) ? Array.from(iter) : Array.prototype.slice.call(iter); | |
} | |
(function() { | |
// Browsers may have: | |
// * No global URL object | |
// * URL with static methods only - may have a dummy constructor | |
// * URL with members except searchParams | |
// * Full URL API support | |
var origURL = global.URL; | |
var nativeURL; | |
try { | |
if (origURL) { | |
nativeURL = new global.URL('http://example.com'); | |
if ('searchParams' in nativeURL) | |
return; | |
if (!('href' in nativeURL)) | |
nativeURL = undefined; | |
} | |
} catch (_) {} | |
// NOTE: Doesn't do the encoding/decoding dance | |
function urlencoded_serialize(pairs) { | |
var output = '', first = true; | |
pairs.forEach(function (pair) { | |
var name = encodeURIComponent(pair.name); | |
var value = encodeURIComponent(pair.value); | |
if (!first) output += '&'; | |
output += name + '=' + value; | |
first = false; | |
}); | |
return output.replace(/%20/g, '+'); | |
} | |
// NOTE: Doesn't do the encoding/decoding dance | |
function urlencoded_parse(input, isindex) { | |
var sequences = input.split('&'); | |
if (isindex && sequences[0].indexOf('=') === -1) | |
sequences[0] = '=' + sequences[0]; | |
var pairs = []; | |
sequences.forEach(function (bytes) { | |
if (bytes.length === 0) return; | |
var index = bytes.indexOf('='); | |
if (index !== -1) { | |
var name = bytes.substring(0, index); | |
var value = bytes.substring(index + 1); | |
} else { | |
name = bytes; | |
value = ''; | |
} | |
name = name.replace(/\+/g, ' '); | |
value = value.replace(/\+/g, ' '); | |
pairs.push({ name: name, value: value }); | |
}); | |
var output = []; | |
pairs.forEach(function (pair) { | |
output.push({ | |
name: decodeURIComponent(pair.name), | |
value: decodeURIComponent(pair.value) | |
}); | |
}); | |
return output; | |
} | |
function URLUtils(url) { | |
if (nativeURL) | |
return new origURL(url); | |
var anchor = document.createElement('a'); | |
anchor.href = url; | |
return anchor; | |
} | |
function URLSearchParams(init) { | |
var $this = this; | |
this._list = []; | |
if (init === undefined || init === null) { | |
// no-op | |
} else if (init instanceof URLSearchParams) { | |
// In ES6 init would be a sequence, but special case for ES5. | |
this._list = urlencoded_parse(String(init)); | |
} else if (typeof init === 'object' && isSequence(init)) { | |
toArray(init).forEach(function(e) { | |
if (!isSequence(e)) throw TypeError(); | |
var nv = toArray(e); | |
if (nv.length !== 2) throw TypeError(); | |
$this._list.push({name: String(nv[0]), value: String(nv[1])}); | |
}); | |
} else if (typeof init === 'object' && init) { | |
Object.keys(init).forEach(function(key) { | |
$this._list.push({name: String(key), value: String(init[key])}); | |
}); | |
} else { | |
init = String(init); | |
if (init.substring(0, 1) === '?') | |
init = init.substring(1); | |
this._list = urlencoded_parse(init); | |
} | |
this._url_object = null; | |
this._setList = function (list) { if (!updating) $this._list = list; }; | |
var updating = false; | |
this._update_steps = function() { | |
if (updating) return; | |
updating = true; | |
if (!$this._url_object) return; | |
// Partial workaround for IE issue with 'about:' | |
if ($this._url_object.protocol === 'about:' && | |
$this._url_object.pathname.indexOf('?') !== -1) { | |
$this._url_object.pathname = $this._url_object.pathname.split('?')[0]; | |
} | |
$this._url_object.search = urlencoded_serialize($this._list); | |
updating = false; | |
}; | |
} | |
Object.defineProperties(URLSearchParams.prototype, { | |
append: { | |
value: function (name, value) { | |
this._list.push({ name: name, value: value }); | |
this._update_steps(); | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
'delete': { | |
value: function (name) { | |
for (var i = 0; i < this._list.length;) { | |
if (this._list[i].name === name) | |
this._list.splice(i, 1); | |
else | |
++i; | |
} | |
this._update_steps(); | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
get: { | |
value: function (name) { | |
for (var i = 0; i < this._list.length; ++i) { | |
if (this._list[i].name === name) | |
return this._list[i].value; | |
} | |
return null; | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
getAll: { | |
value: function (name) { | |
var result = []; | |
for (var i = 0; i < this._list.length; ++i) { | |
if (this._list[i].name === name) | |
result.push(this._list[i].value); | |
} | |
return result; | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
has: { | |
value: function (name) { | |
for (var i = 0; i < this._list.length; ++i) { | |
if (this._list[i].name === name) | |
return true; | |
} | |
return false; | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
set: { | |
value: function (name, value) { | |
var found = false; | |
for (var i = 0; i < this._list.length;) { | |
if (this._list[i].name === name) { | |
if (!found) { | |
this._list[i].value = value; | |
found = true; | |
++i; | |
} else { | |
this._list.splice(i, 1); | |
} | |
} else { | |
++i; | |
} | |
} | |
if (!found) | |
this._list.push({ name: name, value: value }); | |
this._update_steps(); | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
entries: { | |
value: function() { return new Iterator(this._list, 'key+value'); }, | |
writable: true, enumerable: true, configurable: true | |
}, | |
keys: { | |
value: function() { return new Iterator(this._list, 'key'); }, | |
writable: true, enumerable: true, configurable: true | |
}, | |
values: { | |
value: function() { return new Iterator(this._list, 'value'); }, | |
writable: true, enumerable: true, configurable: true | |
}, | |
forEach: { | |
value: function(callback) { | |
var thisArg = (arguments.length > 1) ? arguments[1] : undefined; | |
this._list.forEach(function(pair, index) { | |
callback.call(thisArg, pair.value, pair.name); | |
}); | |
}, writable: true, enumerable: true, configurable: true | |
}, | |
toString: { | |
value: function () { | |
return urlencoded_serialize(this._list); | |
}, writable: true, enumerable: false, configurable: true | |
} | |
}); | |
function Iterator(source, kind) { | |
var index = 0; | |
this['next'] = function() { | |
if (index >= source.length) | |
return {done: true, value: undefined}; | |
var pair = source[index++]; | |
return {done: false, value: | |
kind === 'key' ? pair.name : | |
kind === 'value' ? pair.value : | |
[pair.name, pair.value]}; | |
}; | |
} | |
if ('Symbol' in global && 'iterator' in global.Symbol) { | |
Object.defineProperty(URLSearchParams.prototype, global.Symbol.iterator, { | |
value: URLSearchParams.prototype.entries, | |
writable: true, enumerable: true, configurable: true}); | |
Object.defineProperty(Iterator.prototype, global.Symbol.iterator, { | |
value: function() { return this; }, | |
writable: true, enumerable: true, configurable: true}); | |
} | |
function URL(url, base) { | |
if (!(this instanceof global.URL)) | |
throw new TypeError("Failed to construct 'URL': Please use the 'new' operator."); | |
if (base) { | |
url = (function () { | |
if (nativeURL) return new origURL(url, base).href; | |
var iframe; | |
try { | |
var doc; | |
// Use another document/base tag/anchor for relative URL resolution, if possible | |
if (Object.prototype.toString.call(window.operamini) === "[object OperaMini]") { | |
iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; | |
document.documentElement.appendChild(iframe); | |
doc = iframe.contentWindow.document; | |
} else if (document.implementation && document.implementation.createHTMLDocument) { | |
doc = document.implementation.createHTMLDocument(''); | |
} else if (document.implementation && document.implementation.createDocument) { | |
doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); | |
doc.documentElement.appendChild(doc.createElement('head')); | |
doc.documentElement.appendChild(doc.createElement('body')); | |
} else if (window.ActiveXObject) { | |
doc = new window.ActiveXObject('htmlfile'); | |
doc.write('<head><\/head><body><\/body>'); | |
doc.close(); | |
} | |
if (!doc) throw Error('base not supported'); | |
var baseTag = doc.createElement('base'); | |
baseTag.href = base; | |
doc.getElementsByTagName('head')[0].appendChild(baseTag); | |
var anchor = doc.createElement('a'); | |
anchor.href = url; | |
return anchor.href; | |
} finally { | |
if (iframe) | |
iframe.parentNode.removeChild(iframe); | |
} | |
}()); | |
} | |
// An inner object implementing URLUtils (either a native URL | |
// object or an HTMLAnchorElement instance) is used to perform the | |
// URL algorithms. With full ES5 getter/setter support, return a | |
// regular object For IE8's limited getter/setter support, a | |
// different HTMLAnchorElement is returned with properties | |
// overridden | |
var instance = URLUtils(url || ''); | |
// Detect for ES5 getter/setter support | |
// (an Object.defineProperties polyfill that doesn't support getters/setters may throw) | |
var ES5_GET_SET = (function() { | |
if (!('defineProperties' in Object)) return false; | |
try { | |
var obj = {}; | |
Object.defineProperties(obj, { prop: { 'get': function () { return true; } } }); | |
return obj.prop; | |
} catch (_) { | |
return false; | |
} | |
})(); | |
var self = ES5_GET_SET ? this : document.createElement('a'); | |
var query_object = new URLSearchParams( | |
instance.search ? instance.search.substring(1) : null); | |
query_object._url_object = self; | |
Object.defineProperties(self, { | |
href: { | |
get: function () { return instance.href; }, | |
set: function (v) { instance.href = v; tidy_instance(); update_steps(); }, | |
enumerable: true, configurable: true | |
}, | |
origin: { | |
get: function () { | |
if ('origin' in instance) return instance.origin; | |
return this.protocol + '//' + this.host; | |
}, | |
enumerable: true, configurable: true | |
}, | |
protocol: { | |
get: function () { return instance.protocol; }, | |
set: function (v) { instance.protocol = v; }, | |
enumerable: true, configurable: true | |
}, | |
username: { | |
get: function () { return instance.username; }, | |
set: function (v) { instance.username = v; }, | |
enumerable: true, configurable: true | |
}, | |
password: { | |
get: function () { return instance.password; }, | |
set: function (v) { instance.password = v; }, | |
enumerable: true, configurable: true | |
}, | |
host: { | |
get: function () { | |
// IE returns default port in |host| | |
var re = {'http:': /:80$/, 'https:': /:443$/, 'ftp:': /:21$/}[instance.protocol]; | |
return re ? instance.host.replace(re, '') : instance.host; | |
}, | |
set: function (v) { instance.host = v; }, | |
enumerable: true, configurable: true | |
}, | |
hostname: { | |
get: function () { return instance.hostname; }, | |
set: function (v) { instance.hostname = v; }, | |
enumerable: true, configurable: true | |
}, | |
port: { | |
get: function () { return instance.port; }, | |
set: function (v) { instance.port = v; }, | |
enumerable: true, configurable: true | |
}, | |
pathname: { | |
get: function () { | |
// IE does not include leading '/' in |pathname| | |
if (instance.pathname.charAt(0) !== '/') return '/' + instance.pathname; | |
return instance.pathname; | |
}, | |
set: function (v) { instance.pathname = v; }, | |
enumerable: true, configurable: true | |
}, | |
search: { | |
get: function () { return instance.search; }, | |
set: function (v) { | |
if (instance.search === v) return; | |
instance.search = v; tidy_instance(); update_steps(); | |
}, | |
enumerable: true, configurable: true | |
}, | |
searchParams: { | |
get: function () { return query_object; }, | |
enumerable: true, configurable: true | |
}, | |
hash: { | |
get: function () { return instance.hash; }, | |
set: function (v) { instance.hash = v; tidy_instance(); }, | |
enumerable: true, configurable: true | |
}, | |
toString: { | |
value: function() { return instance.toString(); }, | |
enumerable: false, configurable: true | |
}, | |
valueOf: { | |
value: function() { return instance.valueOf(); }, | |
enumerable: false, configurable: true | |
} | |
}); | |
function tidy_instance() { | |
var href = instance.href.replace(/#$|\?$|\?(?=#)/g, ''); | |
if (instance.href !== href) | |
instance.href = href; | |
} | |
function update_steps() { | |
query_object._setList(instance.search ? urlencoded_parse(instance.search.substring(1)) : []); | |
query_object._update_steps(); | |
}; | |
return self; | |
} | |
if (origURL) { | |
for (var i in origURL) { | |
if (origURL.hasOwnProperty(i) && typeof origURL[i] === 'function') | |
URL[i] = origURL[i]; | |
} | |
} | |
global.URL = URL; | |
global.URLSearchParams = URLSearchParams; | |
}()); | |
// Patch native URLSearchParams constructor to handle sequences/records | |
// if necessary. | |
(function() { | |
if (new global.URLSearchParams([['a', 1]]).get('a') === '1' && | |
new global.URLSearchParams({a: 1}).get('a') === '1') | |
return; | |
var orig = global.URLSearchParams; | |
global.URLSearchParams = function(init) { | |
if (init && typeof init === 'object' && isSequence(init)) { | |
var o = new orig(); | |
toArray(init).forEach(function(e) { | |
if (!isSequence(e)) throw TypeError(); | |
var nv = toArray(e); | |
if (nv.length !== 2) throw TypeError(); | |
o.append(nv[0], nv[1]); | |
}); | |
return o; | |
} else if (init && typeof init === 'object') { | |
o = new orig(); | |
Object.keys(init).forEach(function(key) { | |
o.set(key, init[key]); | |
}); | |
return o; | |
} else { | |
return new orig(init); | |
} | |
}; | |
}()); | |
}(self)); | |
} | |
if (!('document' in this && 'hidden' in document && 'visibilityState' in document)) { | |
// document.visibilityState | |
// PageVisibility | |
(function () { | |
var prefix = document.webkitVisibilityState ? 'webkit' : document.mozVisibilityState ? 'moz' : null; | |
function normalizeState () { | |
document.hidden = document[prefix + 'Hidden']; | |
document.visibilityState = document[prefix + 'VisibilityState']; | |
} | |
if (!prefix) { | |
return; | |
} | |
normalizeState(); | |
document.addEventListener(prefix + 'visibilitychange', function () { | |
normalizeState(); | |
document.dispatchEvent(new CustomEvent('visibilitychange')); | |
}); | |
}()); | |
} | |
if (!('location' in this && 'origin' in this.location)) { | |
// location.origin | |
try { | |
Object.defineProperty(window.location, 'origin', { | |
enumerable: true, | |
writable: false, | |
value: window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : ''), | |
configurable: false | |
}); | |
} catch(e) { | |
// IE9 is throwing "Object doesn't support this action" when attempting defineProperty on window.location, so provide an alternative | |
window.location.origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); | |
} | |
} | |
if (!('performance' in this && 'now' in this.performance)) { | |
// performance.now | |
(function (global) { | |
var | |
startTime = Date.now(); | |
if (!global.performance) { | |
global.performance = {}; | |
} | |
global.performance.now = function () { | |
return Date.now() - startTime; | |
}; | |
}(this)); | |
} | |
if (!('requestAnimationFrame' in this)) { | |
// requestAnimationFrame | |
(function (global) { | |
var rafPrefix; | |
if ('mozRequestAnimationFrame' in global) { | |
rafPrefix = 'moz'; | |
} else if ('webkitRequestAnimationFrame' in global) { | |
rafPrefix = 'webkit'; | |
} | |
if (rafPrefix) { | |
global.requestAnimationFrame = function (callback) { | |
return global[rafPrefix + 'RequestAnimationFrame'](function () { | |
callback(performance.now()); | |
}); | |
}; | |
global.cancelAnimationFrame = global[rafPrefix + 'CancelAnimationFrame']; | |
} else { | |
var lastTime = Date.now(); | |
global.requestAnimationFrame = function (callback) { | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); | |
} | |
var | |
currentTime = Date.now(), | |
delay = 16 + lastTime - currentTime; | |
if (delay < 0) { | |
delay = 0; | |
} | |
lastTime = currentTime; | |
return setTimeout(function () { | |
lastTime = Date.now(); | |
callback(performance.now()); | |
}, delay); | |
}; | |
global.cancelAnimationFrame = function (id) { | |
clearTimeout(id); | |
}; | |
} | |
}(this)); | |
} | |
if (!(// Primitive detect for HTML5 element support - add a <section> element and check that it acquires block display mode by default | |
(function() { | |
var p = document.createElement('p'); | |
var result = false; | |
p.innerHTML = '<section></section>'; | |
document.documentElement.appendChild(p); | |
if (p.firstChild) { | |
if ('getComputedStyle' in window) { | |
result = (getComputedStyle(p.firstChild).display === 'block'); | |
} else if (p.firstChild.currentStyle) { | |
result = (p.firstChild.currentStyle.display === 'block'); | |
} | |
} | |
document.documentElement.removeChild(p); | |
return result; | |
})())) { | |
// ~html5-elements | |
/** | |
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed | |
*/ | |
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document); | |
} | |
if (!('acosh' in Math)) { | |
// Math.acosh | |
Math.acosh = function (x) { | |
return Math.log(x + Math.sqrt(x * x - 1)); | |
}; | |
} | |
if (!('asinh' in Math)) { | |
// Math.asinh | |
Math.asinh = function asinh(x) { | |
return x === -Infinity ? x : Math.log(x + Math.sqrt(x * x + 1)); | |
}; | |
} | |
if (!('atanh' in Math)) { | |
// Math.atanh | |
Math.atanh = function atanh(x) { | |
return Math.log((1 + x) / (1 - x)) / 2; | |
}; | |
} | |
if (!('cbrt' in Math)) { | |
// Math.cbrt | |
Math.cbrt = function cbrt(x) { | |
var y = Math.pow(Math.abs(x), 1 / 3); | |
return x < 0 ? -y : y; | |
}; | |
} | |
if (!('clz32' in Math)) { | |
// Math.clz32 | |
Math.clz32 = function clz32(x) { | |
var value = Number(x) >>> 0; | |
return value ? 32 - value.toString(2).length : 32; | |
}; | |
} | |
if (!('cosh' in Math)) { | |
// Math.cosh | |
Math.cosh = function cosh(x) { | |
var y = Math.exp(x); | |
return (y + 1 / y) / 2; | |
}; | |
} | |
if (!('expm1' in Math)) { | |
// Math.expm1 | |
Math.expm1 = function expm1(x) { | |
return Math.exp(x) - 1; | |
}; | |
} | |
if (!('hypot' in Math)) { | |
// Math.hypot | |
Math.hypot = function hypot() { | |
var args = arguments, index = -1, y = 0; | |
while (++index in args && Math.abs(y) !== Infinity) { | |
y += args[index] * args[index]; | |
} | |
return Math.abs(y) === Infinity ? Infinity : Math.sqrt(y); | |
}; | |
} | |
if (!('imul' in Math)) { | |
// Math.imul | |
Math.imul = function imul(a, b) { | |
var | |
ah = (a >>> 16) & 0xffff, | |
al = a & 0xffff, | |
bh = (b >>> 16) & 0xffff, | |
bl = b & 0xffff; | |
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0); | |
}; | |
} | |
if (!('log10' in Math)) { | |
// Math.log10 | |
Math.log10 = function log10(x) { | |
return Math.log(x) / Math.LN10; | |
}; | |
} | |
if (!('log1p' in Math)) { | |
// Math.log1p | |
Math.log1p = function log1p(x) { | |
return Math.log(1 + x); | |
}; | |
} | |
if (!('log2' in Math)) { | |
// Math.log2 | |
Math.log2 = function log2(x) { | |
return Math.log(x) / Math.LN2; | |
}; | |
} | |
if (!('sign' in Math)) { | |
// Math.sign | |
Math.sign = function sign(x) { | |
return !(x = Number(x)) ? x : x > 0 ? 1 : -1; | |
}; | |
} | |
if (!('sinh' in Math)) { | |
// Math.sinh | |
Math.sinh = function sinh(x) { | |
var y = Math.exp(x); | |
return (y - 1 / y) / 2; | |
}; | |
} | |
if (!('tanh' in Math)) { | |
// Math.tanh | |
Math.tanh = function tanh(x) { | |
var y; | |
return x === Infinity ? 1 : x === -Infinity ? -1 : (y = Math.exp(2 * x), (y - 1) / (y + 1)); | |
}; | |
} | |
if (!('trunc' in Math)) { | |
// Math.trunc | |
Math.trunc = function trunc(x) { | |
return x < 0 ? Math.ceil(x) : Math.floor(x); | |
}; | |
} | |
if (!('EPSILON' in Number)) { | |
// Number.Epsilon | |
Object.defineProperty(Number, 'EPSILON', { | |
enumerable: false, | |
configurable: false, | |
writable: false, | |
value: Math.pow(2, -52) | |
}); | |
} | |
if (!('MAX_SAFE_INTEGER' in Number)) { | |
// Number.MAX_SAFE_INTEGER | |
Number.MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; | |
} | |
if (!('MIN_SAFE_INTEGER' in Number)) { | |
// Number.MIN_SAFE_INTEGER | |
Number.MIN_SAFE_INTEGER = -(Math.pow(2, 53) - 1); | |
} | |
if (!('isInteger' in Number)) { | |
// Number.isInteger | |
Number.isInteger = Number.isInteger || function (value) { | |
return typeof value === "number" && | |
isFinite(value) && | |
Math.floor(value) === value; | |
}; | |
} | |
if (!('isSafeInteger' in Number)) { | |
// Number.isSafeInteger | |
Object.defineProperty(Number, 'isSafeInteger', { | |
enumerable: false, | |
configurable: true, | |
writable: true, | |
value: function (number) { | |
if (typeof number !== 'number') { | |
return false; | |
} | |
if (isNaN(number) || number === +Infinity || number === -Infinity) { | |
return false; | |
} | |
var integer = parseInt(number, 10); | |
if (integer !== number) return false; | |
if (Math.abs(integer) <= (Math.pow(2, 53) - 1)) { | |
return true; | |
} | |
return false; | |
} | |
}); | |
} | |
if (!('parseFloat' in Number)) { | |
// Number.parseFloat | |
Number.parseFloat = Number.parseFloat || parseFloat; | |
} | |
if (!('parseInt' in Number)) { | |
// Number.parseInt | |
Number.parseInt = Number.parseInt || parseInt; | |
} | |
if (!('is' in Object)) { | |
// Object.is | |
Object.is = function is(a, b) { | |
return (a === b && (a !== 0 || 1 / a === 1 / b)) || (a !== a && b !== b); | |
}; | |
} | |
// _StringIterator | |
// A modification of https://github.com/medikoo/es6-iterator | |
// Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) | |
/* global Iterator */ | |
var StringIterator = (function() { // eslint-disable-line no-unused-vars | |
var StringIterator = function (str) { | |
if (!(this instanceof StringIterator)) return new StringIterator(str); | |
str = String(str); | |
Iterator.call(this, str); | |
Object.defineProperty(this, '__length__', { | |
value: str.length, | |
configurable: false, | |
enumerable: false, | |
writable: false | |
}); | |
}; | |
if (Object.setPrototypeOf) Object.setPrototypeOf(StringIterator, Iterator); | |
StringIterator.prototype = Object.create(Iterator.prototype, { | |
constructor: { | |
value: StringIterator, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_next: { | |
value: function() { | |
if (!this.__list__) return; | |
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++; | |
this._unBind(); | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
_resolve: { | |
value: function (i) { | |
var char = this.__list__[i], code; | |
if (this.__nextIndex__ === this.__length__) return char; | |
code = char.charCodeAt(0); | |
if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++]; | |
return char; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}, | |
toString: { | |
value: function() { | |
return '[object String Iterator]'; | |
}, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
} | |
}); | |
return StringIterator; | |
}()); | |
if (!('Symbol' in this && 'iterator' in this.Symbol && !!String.prototype[Symbol.iterator])) { | |
// String.prototype.@@iterator | |
/* global Symbol, StringIterator */ | |
String.prototype[Symbol.iterator] = function () { | |
return new StringIterator(this); | |
}; | |
} | |
if (!('Symbol' in this && 'unscopables' in this.Symbol)) { | |
// Symbol.unscopables | |
Object.defineProperty(Symbol, 'unscopables', {value: Symbol('unscopables')}); | |
} | |
if (!((function(global) { | |
if (!("WeakMap" in global)) return false; | |
var o = {}; | |
var wm = new WeakMap([[o, 'test']]); | |
return (wm.get(o) === 'test'); | |
}(this)))) { | |
// WeakMap | |
/** | |
* @license | |
* | |
* Portions of this polyfill are a derivative work of the Polymer project, which requires the following licence notice: | |
* | |
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | |
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | |
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | |
* Code distributed by Google as part of the polymer project is also | |
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | |
*/ | |
(function() { | |
var defineProperty = Object.defineProperty; | |
var counter = Date.now() % 1e9; | |
var WeakMap = function WeakMap (data) { | |
this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__'); | |
// If data is iterable (indicated by presence of a forEach method), pre-populate the map | |
data && data.forEach && data.forEach(function (item) { | |
this.set.apply(this, item); | |
}, this); | |
}; | |
WeakMap.prototype["set"] = function(key, value) { | |
if (typeof key !== 'object' && typeof key !== 'function') | |
throw new TypeError('Invalid value used as weak map key'); | |
var entry = key[this.name]; | |
if (entry && entry[0] === key) | |
entry[1] = value; | |
else | |
defineProperty(key, this.name, {value: [key, value], writable: true}); | |
return this; | |
}; | |
WeakMap.prototype["get"] = function(key) { | |
var entry; | |
return (entry = key[this.name]) && entry[0] === key ? | |
entry[1] : undefined; | |
}; | |
WeakMap.prototype["delete"] = function(key) { | |
var entry = key[this.name]; | |
if (!entry || entry[0] !== key) return false; | |
entry[0] = entry[1] = undefined; | |
return true; | |
}; | |
WeakMap.prototype["has"] = function(key) { | |
var entry = key[this.name]; | |
if (!entry) return false; | |
return entry[0] === key; | |
}; | |
WeakMap.prototype.constructor = WeakMap; | |
WeakMap.name = "WeakMap"; | |
this.WeakMap = WeakMap; | |
}()); | |
} | |
if (!((function(global) { | |
if (!("WeakSet" in global)) return false; | |
var o = {}; | |
var ws = new WeakSet([o]); | |
return (!!ws.has(o)); | |
}(this)))) { | |
// WeakSet | |
/** | |
* @license | |
* | |
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | |
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | |
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | |
* Code distributed by Google as part of the polymer project is also | |
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | |
*/ | |
(function(global) { | |
var counter = Date.now() % 1e9; | |
var WeakSet = function WeakSet(data) { | |
this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__'); | |
data && data.forEach && data.forEach(this.add, this); | |
}; | |
WeakSet.prototype["add"] = function(obj) { | |
var name = this.name; | |
if (!obj[name]) Object.defineProperty(obj, name, {value: true, writable: true}); | |
return this; | |
}; | |
WeakSet.prototype["delete"] = function(obj) { | |
if (!obj[this.name]) return false; | |
obj[this.name] = undefined; | |
return true; | |
}; | |
WeakSet.prototype["has"] = function(obj) { | |
return !!obj[this.name]; | |
}; | |
WeakSet.prototype.constructor = WeakSet; | |
WeakSet.name = "WeakSet"; | |
global.WeakSet = WeakSet; | |
}(this)); | |
} | |
}) | |
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {}); | |
/** | |
* Copyright (c) 2014-present, Facebook, Inc. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
var regeneratorRuntime = (function (exports) { | |
"use strict"; | |
var Op = Object.prototype; | |
var hasOwn = Op.hasOwnProperty; | |
var undefined; // More compressible than void 0. | |
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | |
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | |
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | |
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | |
function wrap(innerFn, outerFn, self, tryLocsList) { | |
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | |
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | |
var generator = Object.create(protoGenerator.prototype); | |
var context = new Context(tryLocsList || []); | |
// The ._invoke method unifies the implementations of the .next, | |
// .throw, and .return methods. | |
generator._invoke = makeInvokeMethod(innerFn, self, context); | |
return generator; | |
} | |
exports.wrap = wrap; | |
// Try/catch helper to minimize deoptimizations. Returns a completion | |
// record like context.tryEntries[i].completion. This interface could | |
// have been (and was previously) designed to take a closure to be | |
// invoked without arguments, but in all the cases we care about we | |
// already have an existing method we want to call, so there's no need | |
// to create a new function object. We can even get away with assuming | |
// the method takes exactly one argument, since that happens to be true | |
// in every case, so we don't have to touch the arguments object. The | |
// only additional allocation required is the completion record, which | |
// has a stable shape and so hopefully should be cheap to allocate. | |
function tryCatch(fn, obj, arg) { | |
try { | |
return { type: "normal", arg: fn.call(obj, arg) }; | |
} catch (err) { | |
return { type: "throw", arg: err }; | |
} | |
} | |
var GenStateSuspendedStart = "suspendedStart"; | |
var GenStateSuspendedYield = "suspendedYield"; | |
var GenStateExecuting = "executing"; | |
var GenStateCompleted = "completed"; | |
// Returning this object from the innerFn has the same effect as | |
// breaking out of the dispatch switch statement. | |
var ContinueSentinel = {}; | |
// Dummy constructor functions that we use as the .constructor and | |
// .constructor.prototype properties for functions that return Generator | |
// objects. For full spec compliance, you may wish to configure your | |
// minifier not to mangle the names of these two functions. | |
function Generator() {} | |
function GeneratorFunction() {} | |
function GeneratorFunctionPrototype() {} | |
// This is a polyfill for %IteratorPrototype% for environments that | |
// don't natively support it. | |
var IteratorPrototype = {}; | |
IteratorPrototype[iteratorSymbol] = function () { | |
return this; | |
}; | |
var getProto = Object.getPrototypeOf; | |
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | |
if (NativeIteratorPrototype && | |
NativeIteratorPrototype !== Op && | |
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | |
// This environment has a native %IteratorPrototype%; use it instead | |
// of the polyfill. | |
IteratorPrototype = NativeIteratorPrototype; | |
} | |
var Gp = GeneratorFunctionPrototype.prototype = | |
Generator.prototype = Object.create(IteratorPrototype); | |
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | |
GeneratorFunctionPrototype.constructor = GeneratorFunction; | |
GeneratorFunctionPrototype[toStringTagSymbol] = | |
GeneratorFunction.displayName = "GeneratorFunction"; | |
// Helper for defining the .next, .throw, and .return methods of the | |
// Iterator interface in terms of a single ._invoke method. | |
function defineIteratorMethods(prototype) { | |
["next", "throw", "return"].forEach(function(method) { | |
prototype[method] = function(arg) { | |
return this._invoke(method, arg); | |
}; | |
}); | |
} | |
exports.isGeneratorFunction = function(genFun) { | |
var ctor = typeof genFun === "function" && genFun.constructor; | |
return ctor | |
? ctor === GeneratorFunction || | |
// For the native GeneratorFunction constructor, the best we can | |
// do is to check its .name property. | |
(ctor.displayName || ctor.name) === "GeneratorFunction" | |
: false; | |
}; | |
exports.mark = function(genFun) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | |
} else { | |
genFun.__proto__ = GeneratorFunctionPrototype; | |
if (!(toStringTagSymbol in genFun)) { | |
genFun[toStringTagSymbol] = "GeneratorFunction"; | |
} | |
} | |
genFun.prototype = Object.create(Gp); | |
return genFun; | |
}; | |
// Within the body of any async function, `await x` is transformed to | |
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | |
// `hasOwn.call(value, "__await")` to determine if the yielded value is | |
// meant to be awaited. | |
exports.awrap = function(arg) { | |
return { __await: arg }; | |
}; | |
function AsyncIterator(generator) { | |
function invoke(method, arg, resolve, reject) { | |
var record = tryCatch(generator[method], generator, arg); | |
if (record.type === "throw") { | |
reject(record.arg); | |
} else { | |
var result = record.arg; | |
var value = result.value; | |
if (value && | |
typeof value === "object" && | |
hasOwn.call(value, "__await")) { | |
return Promise.resolve(value.__await).then(function(value) { | |
invoke("next", value, resolve, reject); | |
}, function(err) { | |
invoke("throw", err, resolve, reject); | |
}); | |
} | |
return Promise.resolve(value).then(function(unwrapped) { | |
// When a yielded Promise is resolved, its final value becomes | |
// the .value of the Promise<{value,done}> result for the | |
// current iteration. | |
result.value = unwrapped; | |
resolve(result); | |
}, function(error) { | |
// If a rejected Promise was yielded, throw the rejection back | |
// into the async generator function so it can be handled there. | |
return invoke("throw", error, resolve, reject); | |
}); | |
} | |
} | |
var previousPromise; | |
function enqueue(method, arg) { | |
function callInvokeWithMethodAndArg() { | |
return new Promise(function(resolve, reject) { | |
invoke(method, arg, resolve, reject); | |
}); | |
} | |
return previousPromise = | |
// If enqueue has been called before, then we want to wait until | |
// all previous Promises have been resolved before calling invoke, | |
// so that results are always delivered in the correct order. If | |
// enqueue has not been called before, then it is important to | |
// call invoke immediately, without waiting on a callback to fire, | |
// so that the async generator function has the opportunity to do | |
// any necessary setup in a predictable way. This predictability | |
// is why the Promise constructor synchronously invokes its | |
// executor callback, and why async functions synchronously | |
// execute code before the first await. Since we implement simple | |
// async functions in terms of async generators, it is especially | |
// important to get this right, even though it requires care. | |
previousPromise ? previousPromise.then( | |
callInvokeWithMethodAndArg, | |
// Avoid propagating failures to Promises returned by later | |
// invocations of the iterator. | |
callInvokeWithMethodAndArg | |
) : callInvokeWithMethodAndArg(); | |
} | |
// Define the unified helper method that is used to implement .next, | |
// .throw, and .return (see defineIteratorMethods). | |
this._invoke = enqueue; | |
} | |
defineIteratorMethods(AsyncIterator.prototype); | |
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | |
return this; | |
}; | |
exports.AsyncIterator = AsyncIterator; | |
// Note that simple async functions are implemented on top of | |
// AsyncIterator objects; they just return a Promise for the value of | |
// the final result produced by the iterator. | |
exports.async = function(innerFn, outerFn, self, tryLocsList) { | |
var iter = new AsyncIterator( | |
wrap(innerFn, outerFn, self, tryLocsList) | |
); | |
return exports.isGeneratorFunction(outerFn) | |
? iter // If outerFn is a generator, return the full iterator. | |
: iter.next().then(function(result) { | |
return result.done ? result.value : iter.next(); | |
}); | |
}; | |
function makeInvokeMethod(innerFn, self, context) { | |
var state = GenStateSuspendedStart; | |
return function invoke(method, arg) { | |
if (state === GenStateExecuting) { | |
throw new Error("Generator is already running"); | |
} | |
if (state === GenStateCompleted) { | |
if (method === "throw") { | |
throw arg; | |
} | |
// Be forgiving, per 25.3.3.3.3 of the spec: | |
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | |
return doneResult(); | |
} | |
context.method = method; | |
context.arg = arg; | |
while (true) { | |
var delegate = context.delegate; | |
if (delegate) { | |
var delegateResult = maybeInvokeDelegate(delegate, context); | |
if (delegateResult) { | |
if (delegateResult === ContinueSentinel) continue; | |
return delegateResult; | |
} | |
} | |
if (context.method === "next") { | |
// Setting context._sent for legacy support of Babel's | |
// function.sent implementation. | |
context.sent = context._sent = context.arg; | |
} else if (context.method === "throw") { | |
if (state === GenStateSuspendedStart) { | |
state = GenStateCompleted; | |
throw context.arg; | |
} | |
context.dispatchException(context.arg); | |
} else if (context.method === "return") { | |
context.abrupt("return", context.arg); | |
} | |
state = GenStateExecuting; | |
var record = tryCatch(innerFn, self, context); | |
if (record.type === "normal") { | |
// If an exception is thrown from innerFn, we leave state === | |
// GenStateExecuting and loop back for another invocation. | |
state = context.done | |
? GenStateCompleted | |
: GenStateSuspendedYield; | |
if (record.arg === ContinueSentinel) { | |
continue; | |
} | |
return { | |
value: record.arg, | |
done: context.done | |
}; | |
} else if (record.type === "throw") { | |
state = GenStateCompleted; | |
// Dispatch the exception by looping back around to the | |
// context.dispatchException(context.arg) call above. | |
context.method = "throw"; | |
context.arg = record.arg; | |
} | |
} | |
}; | |
} | |
// Call delegate.iterator[context.method](context.arg) and handle the | |
// result, either by returning a { value, done } result from the | |
// delegate iterator, or by modifying context.method and context.arg, | |
// setting context.delegate to null, and returning the ContinueSentinel. | |
function maybeInvokeDelegate(delegate, context) { | |
var method = delegate.iterator[context.method]; | |
if (method === undefined) { | |
// A .throw or .return when the delegate iterator has no .throw | |
// method always terminates the yield* loop. | |
context.delegate = null; | |
if (context.method === "throw") { | |
// Note: ["return"] must be used for ES3 parsing compatibility. | |
if (delegate.iterator["return"]) { | |
// If the delegate iterator has a return method, give it a | |
// chance to clean up. | |
context.method = "return"; | |
context.arg = undefined; | |
maybeInvokeDelegate(delegate, context); | |
if (context.method === "throw") { | |
// If maybeInvokeDelegate(context) changed context.method from | |
// "return" to "throw", let that override the TypeError below. | |
return ContinueSentinel; | |
} | |
} | |
context.method = "throw"; | |
context.arg = new TypeError( | |
"The iterator does not provide a 'throw' method"); | |
} | |
return ContinueSentinel; | |
} | |
var record = tryCatch(method, delegate.iterator, context.arg); | |
if (record.type === "throw") { | |
context.method = "throw"; | |
context.arg = record.arg; | |
context.delegate = null; | |
return ContinueSentinel; | |
} | |
var info = record.arg; | |
if (! info) { | |
context.method = "throw"; | |
context.arg = new TypeError("iterator result is not an object"); | |
context.delegate = null; | |
return ContinueSentinel; | |
} | |
if (info.done) { | |
// Assign the result of the finished delegate to the temporary | |
// variable specified by delegate.resultName (see delegateYield). | |
context[delegate.resultName] = info.value; | |
// Resume execution at the desired location (see delegateYield). | |
context.next = delegate.nextLoc; | |
// If context.method was "throw" but the delegate handled the | |
// exception, let the outer generator proceed normally. If | |
// context.method was "next", forget context.arg since it has been | |
// "consumed" by the delegate iterator. If context.method was | |
// "return", allow the original .return call to continue in the | |
// outer generator. | |
if (context.method !== "return") { | |
context.method = "next"; | |
context.arg = undefined; | |
} | |
} else { | |
// Re-yield the result returned by the delegate method. | |
return info; | |
} | |
// The delegate iterator is finished, so forget it and continue with | |
// the outer generator. | |
context.delegate = null; | |
return ContinueSentinel; | |
} | |
// Define Generator.prototype.{next,throw,return} in terms of the | |
// unified ._invoke helper method. | |
defineIteratorMethods(Gp); | |
Gp[toStringTagSymbol] = "Generator"; | |
// A Generator should always return itself as the iterator object when the | |
// @@iterator function is called on it. Some browsers' implementations of the | |
// iterator prototype chain incorrectly implement this, causing the Generator | |
// object to not be returned from this call. This ensures that doesn't happen. | |
// See https://github.com/facebook/regenerator/issues/274 for more details. | |
Gp[iteratorSymbol] = function() { | |
return this; | |
}; | |
Gp.toString = function() { | |
return "[object Generator]"; | |
}; | |
function pushTryEntry(locs) { | |
var entry = { tryLoc: locs[0] }; | |
if (1 in locs) { | |
entry.catchLoc = locs[1]; | |
} | |
if (2 in locs) { | |
entry.finallyLoc = locs[2]; | |
entry.afterLoc = locs[3]; | |
} | |
this.tryEntries.push(entry); | |
} | |
function resetTryEntry(entry) { | |
var record = entry.completion || {}; | |
record.type = "normal"; | |
delete record.arg; | |
entry.completion = record; | |
} | |
function Context(tryLocsList) { | |
// The root entry object (effectively a try statement without a catch | |
// or a finally block) gives us a place to store values thrown from | |
// locations where there is no enclosing try statement. | |
this.tryEntries = [{ tryLoc: "root" }]; | |
tryLocsList.forEach(pushTryEntry, this); | |
this.reset(true); | |
} | |
exports.keys = function(object) { | |
var keys = []; | |
for (var key in object) { | |
keys.push(key); | |
} | |
keys.reverse(); | |
// Rather than returning an object with a next method, we keep | |
// things simple and return the next function itself. | |
return function next() { | |
while (keys.length) { | |
var key = keys.pop(); | |
if (key in object) { | |
next.value = key; | |
next.done = false; | |
return next; | |
} | |
} | |
// To avoid creating an additional object, we just hang the .value | |
// and .done properties off the next function object itself. This | |
// also ensures that the minifier will not anonymize the function. | |
next.done = true; | |
return next; | |
}; | |
}; | |
function values(iterable) { | |
if (iterable) { | |
var iteratorMethod = iterable[iteratorSymbol]; | |
if (iteratorMethod) { | |
return iteratorMethod.call(iterable); | |
} | |
if (typeof iterable.next === "function") { | |
return iterable; | |
} | |
if (!isNaN(iterable.length)) { | |
var i = -1, next = function next() { | |
while (++i < iterable.length) { | |
if (hasOwn.call(iterable, i)) { | |
next.value = iterable[i]; | |
next.done = false; | |
return next; | |
} | |
} | |
next.value = undefined; | |
next.done = true; | |
return next; | |
}; | |
return next.next = next; | |
} | |
} | |
// Return an iterator with no values. | |
return { next: doneResult }; | |
} | |
exports.values = values; | |
function doneResult() { | |
return { value: undefined, done: true }; | |
} | |
Context.prototype = { | |
constructor: Context, | |
reset: function(skipTempReset) { | |
this.prev = 0; | |
this.next = 0; | |
// Resetting context._sent for legacy support of Babel's | |
// function.sent implementation. | |
this.sent = this._sent = undefined; | |
this.done = false; | |
this.delegate = null; | |
this.method = "next"; | |
this.arg = undefined; | |
this.tryEntries.forEach(resetTryEntry); | |
if (!skipTempReset) { | |
for (var name in this) { | |
// Not sure about the optimal order of these conditions: | |
if (name.charAt(0) === "t" && | |
hasOwn.call(this, name) && | |
!isNaN(+name.slice(1))) { | |
this[name] = undefined; | |
} | |
} | |
} | |
}, | |
stop: function() { | |
this.done = true; | |
var rootEntry = this.tryEntries[0]; | |
var rootRecord = rootEntry.completion; | |
if (rootRecord.type === "throw") { | |
throw rootRecord.arg; | |
} | |
return this.rval; | |
}, | |
dispatchException: function(exception) { | |
if (this.done) { | |
throw exception; | |
} | |
var context = this; | |
function handle(loc, caught) { | |
record.type = "throw"; | |
record.arg = exception; | |
context.next = loc; | |
if (caught) { | |
// If the dispatched exception was caught by a catch block, | |
// then let that catch block handle the exception normally. | |
context.method = "next"; | |
context.arg = undefined; | |
} | |
return !! caught; | |
} | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
var record = entry.completion; | |
if (entry.tryLoc === "root") { | |
// Exception thrown outside of any try block that could handle | |
// it, so set the completion value of the entire function to | |
// throw the exception. | |
return handle("end"); | |
} | |
if (entry.tryLoc <= this.prev) { | |
var hasCatch = hasOwn.call(entry, "catchLoc"); | |
var hasFinally = hasOwn.call(entry, "finallyLoc"); | |
if (hasCatch && hasFinally) { | |
if (this.prev < entry.catchLoc) { | |
return handle(entry.catchLoc, true); | |
} else if (this.prev < entry.finallyLoc) { | |
return handle(entry.finallyLoc); | |
} | |
} else if (hasCatch) { | |
if (this.prev < entry.catchLoc) { | |
return handle(entry.catchLoc, true); | |
} | |
} else if (hasFinally) { | |
if (this.prev < entry.finallyLoc) { | |
return handle(entry.finallyLoc); | |
} | |
} else { | |
throw new Error("try statement without catch or finally"); | |
} | |
} | |
} | |
}, | |
abrupt: function(type, arg) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.tryLoc <= this.prev && | |
hasOwn.call(entry, "finallyLoc") && | |
this.prev < entry.finallyLoc) { | |
var finallyEntry = entry; | |
break; | |
} | |
} | |
if (finallyEntry && | |
(type === "break" || | |
type === "continue") && | |
finallyEntry.tryLoc <= arg && | |
arg <= finallyEntry.finallyLoc) { | |
// Ignore the finally entry if control is not jumping to a | |
// location outside the try/catch block. | |
finallyEntry = null; | |
} | |
var record = finallyEntry ? finallyEntry.completion : {}; | |
record.type = type; | |
record.arg = arg; | |
if (finallyEntry) { | |
this.method = "next"; | |
this.next = finallyEntry.finallyLoc; | |
return ContinueSentinel; | |
} | |
return this.complete(record); | |
}, | |
complete: function(record, afterLoc) { | |
if (record.type === "throw") { | |
throw record.arg; | |
} | |
if (record.type === "break" || | |
record.type === "continue") { | |
this.next = record.arg; | |
} else if (record.type === "return") { | |
this.rval = this.arg = record.arg; | |
this.method = "return"; | |
this.next = "end"; | |
} else if (record.type === "normal" && afterLoc) { | |
this.next = afterLoc; | |
} | |
return ContinueSentinel; | |
}, | |
finish: function(finallyLoc) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.finallyLoc === finallyLoc) { | |
this.complete(entry.completion, entry.afterLoc); | |
resetTryEntry(entry); | |
return ContinueSentinel; | |
} | |
} | |
}, | |
"catch": function(tryLoc) { | |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | |
var entry = this.tryEntries[i]; | |
if (entry.tryLoc === tryLoc) { | |
var record = entry.completion; | |
if (record.type === "throw") { | |
var thrown = record.arg; | |
resetTryEntry(entry); | |
} | |
return thrown; | |
} | |
} | |
// The context.catch method must only be called with a location | |
// argument that corresponds to a known catch block. | |
throw new Error("illegal catch attempt"); | |
}, | |
delegateYield: function(iterable, resultName, nextLoc) { | |
this.delegate = { | |
iterator: values(iterable), | |
resultName: resultName, | |
nextLoc: nextLoc | |
}; | |
if (this.method === "next") { | |
// Deliberately forget the last sent value so that we don't | |
// accidentally pass it on to the delegate. | |
this.arg = undefined; | |
} | |
return ContinueSentinel; | |
} | |
}; | |
// Regardless of whether this script is executing as a CommonJS module | |
// or not, return the runtime object so that we can declare the variable | |
// regeneratorRuntime in the outer scope, which allows this module to be | |
// injected easily by `bin/regenerator --include-runtime script.js`. | |
return exports; | |
}( | |
// If this script is executing as a CommonJS module, use module.exports | |
// as the regeneratorRuntime namespace. Otherwise create a new empty | |
// object. Either way, the resulting object will be used to initialize | |
// the regeneratorRuntime variable at the top of this file. | |
typeof module === "object" ? module.exports : {} | |
)); | |
(function webpackUniversalModuleDefinition(root, factory) { | |
if(typeof exports === 'object' && typeof module === 'object') | |
module.exports = factory(); | |
else if(typeof define === 'function' && define.amd) | |
define([], factory); | |
else if(typeof exports === 'object') | |
exports["Babel"] = factory(); | |
else | |
root["Babel"] = factory(); | |
})(typeof self !== 'undefined' ? self : this, function() { | |
return /******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; | |
/******/ } | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.l = true; | |
/******/ | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ | |
/******/ | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { | |
/******/ configurable: false, | |
/******/ enumerable: true, | |
/******/ get: getter | |
/******/ }); | |
/******/ } | |
/******/ }; | |
/******/ | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = 571); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;; | |
(function (root) { | |
var freeExports = typeof exports == 'object' && exports; | |
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; | |
var freeGlobal = typeof global == 'object' && global; | |
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { | |
root = freeGlobal; | |
} | |
var ERRORS = { | |
'rangeOrder': "A range\u2019s `stop` value must be greater than or equal " + 'to the `start` value.', | |
'codePointRange': 'Invalid code point value. Code points range from ' + 'U+000000 to U+10FFFF.' | |
}; | |
var HIGH_SURROGATE_MIN = 0xD800; | |
var HIGH_SURROGATE_MAX = 0xDBFF; | |
var LOW_SURROGATE_MIN = 0xDC00; | |
var LOW_SURROGATE_MAX = 0xDFFF; | |
var regexNull = /\\x00([^0123456789]|$)/g; | |
var object = {}; | |
var hasOwnProperty = object.hasOwnProperty; | |
var extend = function extend(destination, source) { | |
var key; | |
for (key in source) { | |
if (hasOwnProperty.call(source, key)) { | |
destination[key] = source[key]; | |
} | |
} | |
return destination; | |
}; | |
var forEach = function forEach(array, callback) { | |
var index = -1; | |
var length = array.length; | |
while (++index < length) { | |
callback(array[index], index); | |
} | |
}; | |
var toString = object.toString; | |
var isArray = function isArray(value) { | |
return toString.call(value) == '[object Array]'; | |
}; | |
var isNumber = function isNumber(value) { | |
return typeof value == 'number' || toString.call(value) == '[object Number]'; | |
}; | |
var zeroes = '0000'; | |
var pad = function pad(number, totalCharacters) { | |
var string = String(number); | |
return string.length < totalCharacters ? (zeroes + string).slice(-totalCharacters) : string; | |
}; | |
var hex = function hex(number) { | |
return Number(number).toString(16).toUpperCase(); | |
}; | |
var slice = [].slice; | |
var dataFromCodePoints = function dataFromCodePoints(codePoints) { | |
var index = -1; | |
var length = codePoints.length; | |
var max = length - 1; | |
var result = []; | |
var isStart = true; | |
var tmp; | |
var previous = 0; | |
while (++index < length) { | |
tmp = codePoints[index]; | |
if (isStart) { | |
result.push(tmp); | |
previous = tmp; | |
isStart = false; | |
} else { | |
if (tmp == previous + 1) { | |
if (index != max) { | |
previous = tmp; | |
continue; | |
} else { | |
isStart = true; | |
result.push(tmp + 1); | |
} | |
} else { | |
result.push(previous + 1, tmp); | |
previous = tmp; | |
} | |
} | |
} | |
if (!isStart) { | |
result.push(tmp + 1); | |
} | |
return result; | |
}; | |
var dataRemove = function dataRemove(data, codePoint) { | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (codePoint >= start && codePoint < end) { | |
if (codePoint == start) { | |
if (end == start + 1) { | |
data.splice(index, 2); | |
return data; | |
} else { | |
data[index] = codePoint + 1; | |
return data; | |
} | |
} else if (codePoint == end - 1) { | |
data[index + 1] = codePoint; | |
return data; | |
} else { | |
data.splice(index, 2, start, codePoint, codePoint + 1, end); | |
return data; | |
} | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataRemoveRange = function dataRemoveRange(data, rangeStart, rangeEnd) { | |
if (rangeEnd < rangeStart) { | |
throw Error(ERRORS.rangeOrder); | |
} | |
var index = 0; | |
var start; | |
var end; | |
while (index < data.length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start > rangeEnd) { | |
return data; | |
} | |
if (rangeStart <= start && rangeEnd >= end) { | |
data.splice(index, 2); | |
continue; | |
} | |
if (rangeStart >= start && rangeEnd < end) { | |
if (rangeStart == start) { | |
data[index] = rangeEnd + 1; | |
data[index + 1] = end + 1; | |
return data; | |
} | |
data.splice(index, 2, start, rangeStart, rangeEnd + 1, end + 1); | |
return data; | |
} | |
if (rangeStart >= start && rangeStart <= end) { | |
data[index + 1] = rangeStart; | |
} else if (rangeEnd >= start && rangeEnd <= end) { | |
data[index] = rangeEnd + 1; | |
return data; | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataAdd = function dataAdd(data, codePoint) { | |
var index = 0; | |
var start; | |
var end; | |
var lastIndex = null; | |
var length = data.length; | |
if (codePoint < 0x0 || codePoint > 0x10FFFF) { | |
throw RangeError(ERRORS.codePointRange); | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (codePoint >= start && codePoint < end) { | |
return data; | |
} | |
if (codePoint == start - 1) { | |
data[index] = codePoint; | |
return data; | |
} | |
if (start > codePoint) { | |
data.splice(lastIndex != null ? lastIndex + 2 : 0, 0, codePoint, codePoint + 1); | |
return data; | |
} | |
if (codePoint == end) { | |
if (codePoint + 1 == data[index + 2]) { | |
data.splice(index, 4, start, data[index + 3]); | |
return data; | |
} | |
data[index + 1] = codePoint + 1; | |
return data; | |
} | |
lastIndex = index; | |
index += 2; | |
} | |
data.push(codePoint, codePoint + 1); | |
return data; | |
}; | |
var dataAddData = function dataAddData(dataA, dataB) { | |
var index = 0; | |
var start; | |
var end; | |
var data = dataA.slice(); | |
var length = dataB.length; | |
while (index < length) { | |
start = dataB[index]; | |
end = dataB[index + 1] - 1; | |
if (start == end) { | |
data = dataAdd(data, start); | |
} else { | |
data = dataAddRange(data, start, end); | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataRemoveData = function dataRemoveData(dataA, dataB) { | |
var index = 0; | |
var start; | |
var end; | |
var data = dataA.slice(); | |
var length = dataB.length; | |
while (index < length) { | |
start = dataB[index]; | |
end = dataB[index + 1] - 1; | |
if (start == end) { | |
data = dataRemove(data, start); | |
} else { | |
data = dataRemoveRange(data, start, end); | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataAddRange = function dataAddRange(data, rangeStart, rangeEnd) { | |
if (rangeEnd < rangeStart) { | |
throw Error(ERRORS.rangeOrder); | |
} | |
if (rangeStart < 0x0 || rangeStart > 0x10FFFF || rangeEnd < 0x0 || rangeEnd > 0x10FFFF) { | |
throw RangeError(ERRORS.codePointRange); | |
} | |
var index = 0; | |
var start; | |
var end; | |
var added = false; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (added) { | |
if (start == rangeEnd + 1) { | |
data.splice(index - 1, 2); | |
return data; | |
} | |
if (start > rangeEnd) { | |
return data; | |
} | |
if (start >= rangeStart && start <= rangeEnd) { | |
if (end > rangeStart && end - 1 <= rangeEnd) { | |
data.splice(index, 2); | |
index -= 2; | |
} else { | |
data.splice(index - 1, 2); | |
index -= 2; | |
} | |
} | |
} else if (start == rangeEnd + 1) { | |
data[index] = rangeStart; | |
return data; | |
} else if (start > rangeEnd) { | |
data.splice(index, 0, rangeStart, rangeEnd + 1); | |
return data; | |
} else if (rangeStart >= start && rangeStart < end && rangeEnd + 1 <= end) { | |
return data; | |
} else if (rangeStart >= start && rangeStart < end || end == rangeStart) { | |
data[index + 1] = rangeEnd + 1; | |
added = true; | |
} else if (rangeStart <= start && rangeEnd + 1 >= end) { | |
data[index] = rangeStart; | |
data[index + 1] = rangeEnd + 1; | |
added = true; | |
} | |
index += 2; | |
} | |
if (!added) { | |
data.push(rangeStart, rangeEnd + 1); | |
} | |
return data; | |
}; | |
var dataContains = function dataContains(data, codePoint) { | |
var index = 0; | |
var length = data.length; | |
var start = data[index]; | |
var end = data[length - 1]; | |
if (length >= 2) { | |
if (codePoint < start || codePoint > end) { | |
return false; | |
} | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (codePoint >= start && codePoint < end) { | |
return true; | |
} | |
index += 2; | |
} | |
return false; | |
}; | |
var dataIntersection = function dataIntersection(data, codePoints) { | |
var index = 0; | |
var length = codePoints.length; | |
var codePoint; | |
var result = []; | |
while (index < length) { | |
codePoint = codePoints[index]; | |
if (dataContains(data, codePoint)) { | |
result.push(codePoint); | |
} | |
++index; | |
} | |
return dataFromCodePoints(result); | |
}; | |
var dataIsEmpty = function dataIsEmpty(data) { | |
return !data.length; | |
}; | |
var dataIsSingleton = function dataIsSingleton(data) { | |
return data.length == 2 && data[0] + 1 == data[1]; | |
}; | |
var dataToArray = function dataToArray(data) { | |
var index = 0; | |
var start; | |
var end; | |
var result = []; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
while (start < end) { | |
result.push(start); | |
++start; | |
} | |
index += 2; | |
} | |
return result; | |
}; | |
var floor = Math.floor; | |
var highSurrogate = function highSurrogate(codePoint) { | |
return parseInt(floor((codePoint - 0x10000) / 0x400) + HIGH_SURROGATE_MIN, 10); | |
}; | |
var lowSurrogate = function lowSurrogate(codePoint) { | |
return parseInt((codePoint - 0x10000) % 0x400 + LOW_SURROGATE_MIN, 10); | |
}; | |
var stringFromCharCode = String.fromCharCode; | |
var codePointToString = function codePointToString(codePoint) { | |
var string; | |
if (codePoint == 0x09) { | |
string = '\\t'; | |
} else if (codePoint == 0x0A) { | |
string = '\\n'; | |
} else if (codePoint == 0x0C) { | |
string = '\\f'; | |
} else if (codePoint == 0x0D) { | |
string = '\\r'; | |
} else if (codePoint == 0x2D) { | |
string = '\\x2D'; | |
} else if (codePoint == 0x5C) { | |
string = '\\\\'; | |
} else if (codePoint == 0x24 || codePoint >= 0x28 && codePoint <= 0x2B || codePoint == 0x2E || codePoint == 0x2F || codePoint == 0x3F || codePoint >= 0x5B && codePoint <= 0x5E || codePoint >= 0x7B && codePoint <= 0x7D) { | |
string = '\\' + stringFromCharCode(codePoint); | |
} else if (codePoint >= 0x20 && codePoint <= 0x7E) { | |
string = stringFromCharCode(codePoint); | |
} else if (codePoint <= 0xFF) { | |
string = '\\x' + pad(hex(codePoint), 2); | |
} else { | |
string = "\\u" + pad(hex(codePoint), 4); | |
} | |
return string; | |
}; | |
var codePointToStringUnicode = function codePointToStringUnicode(codePoint) { | |
if (codePoint <= 0xFFFF) { | |
return codePointToString(codePoint); | |
} | |
return "\\u{" + codePoint.toString(16).toUpperCase() + '}'; | |
}; | |
var symbolToCodePoint = function symbolToCodePoint(symbol) { | |
var length = symbol.length; | |
var first = symbol.charCodeAt(0); | |
var second; | |
if (first >= HIGH_SURROGATE_MIN && first <= HIGH_SURROGATE_MAX && length > 1) { | |
second = symbol.charCodeAt(1); | |
return (first - HIGH_SURROGATE_MIN) * 0x400 + second - LOW_SURROGATE_MIN + 0x10000; | |
} | |
return first; | |
}; | |
var createBMPCharacterClasses = function createBMPCharacterClasses(data) { | |
var result = ''; | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
if (dataIsSingleton(data)) { | |
return codePointToString(data[0]); | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start == end) { | |
result += codePointToString(start); | |
} else if (start + 1 == end) { | |
result += codePointToString(start) + codePointToString(end); | |
} else { | |
result += codePointToString(start) + '-' + codePointToString(end); | |
} | |
index += 2; | |
} | |
return '[' + result + ']'; | |
}; | |
var createUnicodeCharacterClasses = function createUnicodeCharacterClasses(data) { | |
var result = ''; | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
if (dataIsSingleton(data)) { | |
return codePointToStringUnicode(data[0]); | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start == end) { | |
result += codePointToStringUnicode(start); | |
} else if (start + 1 == end) { | |
result += codePointToStringUnicode(start) + codePointToStringUnicode(end); | |
} else { | |
result += codePointToStringUnicode(start) + '-' + codePointToStringUnicode(end); | |
} | |
index += 2; | |
} | |
return '[' + result + ']'; | |
}; | |
var splitAtBMP = function splitAtBMP(data) { | |
var loneHighSurrogates = []; | |
var loneLowSurrogates = []; | |
var bmp = []; | |
var astral = []; | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start < HIGH_SURROGATE_MIN) { | |
if (end < HIGH_SURROGATE_MIN) { | |
bmp.push(start, end + 1); | |
} | |
if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { | |
bmp.push(start, HIGH_SURROGATE_MIN); | |
loneHighSurrogates.push(HIGH_SURROGATE_MIN, end + 1); | |
} | |
if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { | |
bmp.push(start, HIGH_SURROGATE_MIN); | |
loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); | |
} | |
if (end > LOW_SURROGATE_MAX) { | |
bmp.push(start, HIGH_SURROGATE_MIN); | |
loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); | |
if (end <= 0xFFFF) { | |
bmp.push(LOW_SURROGATE_MAX + 1, end + 1); | |
} else { | |
bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} | |
} else if (start >= HIGH_SURROGATE_MIN && start <= HIGH_SURROGATE_MAX) { | |
if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { | |
loneHighSurrogates.push(start, end + 1); | |
} | |
if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { | |
loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); | |
} | |
if (end > LOW_SURROGATE_MAX) { | |
loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); | |
if (end <= 0xFFFF) { | |
bmp.push(LOW_SURROGATE_MAX + 1, end + 1); | |
} else { | |
bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} | |
} else if (start >= LOW_SURROGATE_MIN && start <= LOW_SURROGATE_MAX) { | |
if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { | |
loneLowSurrogates.push(start, end + 1); | |
} | |
if (end > LOW_SURROGATE_MAX) { | |
loneLowSurrogates.push(start, LOW_SURROGATE_MAX + 1); | |
if (end <= 0xFFFF) { | |
bmp.push(LOW_SURROGATE_MAX + 1, end + 1); | |
} else { | |
bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} | |
} else if (start > LOW_SURROGATE_MAX && start <= 0xFFFF) { | |
if (end <= 0xFFFF) { | |
bmp.push(start, end + 1); | |
} else { | |
bmp.push(start, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} else { | |
astral.push(start, end + 1); | |
} | |
index += 2; | |
} | |
return { | |
'loneHighSurrogates': loneHighSurrogates, | |
'loneLowSurrogates': loneLowSurrogates, | |
'bmp': bmp, | |
'astral': astral | |
}; | |
}; | |
var optimizeSurrogateMappings = function optimizeSurrogateMappings(surrogateMappings) { | |
var result = []; | |
var tmpLow = []; | |
var addLow = false; | |
var mapping; | |
var nextMapping; | |
var highSurrogates; | |
var lowSurrogates; | |
var nextHighSurrogates; | |
var nextLowSurrogates; | |
var index = -1; | |
var length = surrogateMappings.length; | |
while (++index < length) { | |
mapping = surrogateMappings[index]; | |
nextMapping = surrogateMappings[index + 1]; | |
if (!nextMapping) { | |
result.push(mapping); | |
continue; | |
} | |
highSurrogates = mapping[0]; | |
lowSurrogates = mapping[1]; | |
nextHighSurrogates = nextMapping[0]; | |
nextLowSurrogates = nextMapping[1]; | |
tmpLow = lowSurrogates; | |
while (nextHighSurrogates && highSurrogates[0] == nextHighSurrogates[0] && highSurrogates[1] == nextHighSurrogates[1]) { | |
if (dataIsSingleton(nextLowSurrogates)) { | |
tmpLow = dataAdd(tmpLow, nextLowSurrogates[0]); | |
} else { | |
tmpLow = dataAddRange(tmpLow, nextLowSurrogates[0], nextLowSurrogates[1] - 1); | |
} | |
++index; | |
mapping = surrogateMappings[index]; | |
highSurrogates = mapping[0]; | |
lowSurrogates = mapping[1]; | |
nextMapping = surrogateMappings[index + 1]; | |
nextHighSurrogates = nextMapping && nextMapping[0]; | |
nextLowSurrogates = nextMapping && nextMapping[1]; | |
addLow = true; | |
} | |
result.push([highSurrogates, addLow ? tmpLow : lowSurrogates]); | |
addLow = false; | |
} | |
return optimizeByLowSurrogates(result); | |
}; | |
var optimizeByLowSurrogates = function optimizeByLowSurrogates(surrogateMappings) { | |
if (surrogateMappings.length == 1) { | |
return surrogateMappings; | |
} | |
var index = -1; | |
var innerIndex = -1; | |
while (++index < surrogateMappings.length) { | |
var mapping = surrogateMappings[index]; | |
var lowSurrogates = mapping[1]; | |
var lowSurrogateStart = lowSurrogates[0]; | |
var lowSurrogateEnd = lowSurrogates[1]; | |
innerIndex = index; | |
while (++innerIndex < surrogateMappings.length) { | |
var otherMapping = surrogateMappings[innerIndex]; | |
var otherLowSurrogates = otherMapping[1]; | |
var otherLowSurrogateStart = otherLowSurrogates[0]; | |
var otherLowSurrogateEnd = otherLowSurrogates[1]; | |
if (lowSurrogateStart == otherLowSurrogateStart && lowSurrogateEnd == otherLowSurrogateEnd) { | |
if (dataIsSingleton(otherMapping[0])) { | |
mapping[0] = dataAdd(mapping[0], otherMapping[0][0]); | |
} else { | |
mapping[0] = dataAddRange(mapping[0], otherMapping[0][0], otherMapping[0][1] - 1); | |
} | |
surrogateMappings.splice(innerIndex, 1); | |
--innerIndex; | |
} | |
} | |
} | |
return surrogateMappings; | |
}; | |
var surrogateSet = function surrogateSet(data) { | |
if (!data.length) { | |
return []; | |
} | |
var index = 0; | |
var start; | |
var end; | |
var startHigh; | |
var startLow; | |
var endHigh; | |
var endLow; | |
var surrogateMappings = []; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
startHigh = highSurrogate(start); | |
startLow = lowSurrogate(start); | |
endHigh = highSurrogate(end); | |
endLow = lowSurrogate(end); | |
var startsWithLowestLowSurrogate = startLow == LOW_SURROGATE_MIN; | |
var endsWithHighestLowSurrogate = endLow == LOW_SURROGATE_MAX; | |
var complete = false; | |
if (startHigh == endHigh || startsWithLowestLowSurrogate && endsWithHighestLowSurrogate) { | |
surrogateMappings.push([[startHigh, endHigh + 1], [startLow, endLow + 1]]); | |
complete = true; | |
} else { | |
surrogateMappings.push([[startHigh, startHigh + 1], [startLow, LOW_SURROGATE_MAX + 1]]); | |
} | |
if (!complete && startHigh + 1 < endHigh) { | |
if (endsWithHighestLowSurrogate) { | |
surrogateMappings.push([[startHigh + 1, endHigh + 1], [LOW_SURROGATE_MIN, endLow + 1]]); | |
complete = true; | |
} else { | |
surrogateMappings.push([[startHigh + 1, endHigh], [LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1]]); | |
} | |
} | |
if (!complete) { | |
surrogateMappings.push([[endHigh, endHigh + 1], [LOW_SURROGATE_MIN, endLow + 1]]); | |
} | |
index += 2; | |
} | |
return optimizeSurrogateMappings(surrogateMappings); | |
}; | |
var createSurrogateCharacterClasses = function createSurrogateCharacterClasses(surrogateMappings) { | |
var result = []; | |
forEach(surrogateMappings, function (surrogateMapping) { | |
var highSurrogates = surrogateMapping[0]; | |
var lowSurrogates = surrogateMapping[1]; | |
result.push(createBMPCharacterClasses(highSurrogates) + createBMPCharacterClasses(lowSurrogates)); | |
}); | |
return result.join('|'); | |
}; | |
var createCharacterClassesFromData = function createCharacterClassesFromData(data, bmpOnly, hasUnicodeFlag) { | |
if (hasUnicodeFlag) { | |
return createUnicodeCharacterClasses(data); | |
} | |
var result = []; | |
var parts = splitAtBMP(data); | |
var loneHighSurrogates = parts.loneHighSurrogates; | |
var loneLowSurrogates = parts.loneLowSurrogates; | |
var bmp = parts.bmp; | |
var astral = parts.astral; | |
var hasLoneHighSurrogates = !dataIsEmpty(loneHighSurrogates); | |
var hasLoneLowSurrogates = !dataIsEmpty(loneLowSurrogates); | |
var surrogateMappings = surrogateSet(astral); | |
if (bmpOnly) { | |
bmp = dataAddData(bmp, loneHighSurrogates); | |
hasLoneHighSurrogates = false; | |
bmp = dataAddData(bmp, loneLowSurrogates); | |
hasLoneLowSurrogates = false; | |
} | |
if (!dataIsEmpty(bmp)) { | |
result.push(createBMPCharacterClasses(bmp)); | |
} | |
if (surrogateMappings.length) { | |
result.push(createSurrogateCharacterClasses(surrogateMappings)); | |
} | |
if (hasLoneHighSurrogates) { | |
result.push(createBMPCharacterClasses(loneHighSurrogates) + "(?![\\uDC00-\\uDFFF])"); | |
} | |
if (hasLoneLowSurrogates) { | |
result.push("(?:[^\\uD800-\\uDBFF]|^)" + createBMPCharacterClasses(loneLowSurrogates)); | |
} | |
return result.join('|'); | |
}; | |
var regenerate = function regenerate(value) { | |
if (arguments.length > 1) { | |
value = slice.call(arguments); | |
} | |
if (this instanceof regenerate) { | |
this.data = []; | |
return value ? this.add(value) : this; | |
} | |
return new regenerate().add(value); | |
}; | |
regenerate.version = '1.3.3'; | |
var proto = regenerate.prototype; | |
extend(proto, { | |
'add': function add(value) { | |
var $this = this; | |
if (value == null) { | |
return $this; | |
} | |
if (value instanceof regenerate) { | |
$this.data = dataAddData($this.data, value.data); | |
return $this; | |
} | |
if (arguments.length > 1) { | |
value = slice.call(arguments); | |
} | |
if (isArray(value)) { | |
forEach(value, function (item) { | |
$this.add(item); | |
}); | |
return $this; | |
} | |
$this.data = dataAdd($this.data, isNumber(value) ? value : symbolToCodePoint(value)); | |
return $this; | |
}, | |
'remove': function remove(value) { | |
var $this = this; | |
if (value == null) { | |
return $this; | |
} | |
if (value instanceof regenerate) { | |
$this.data = dataRemoveData($this.data, value.data); | |
return $this; | |
} | |
if (arguments.length > 1) { | |
value = slice.call(arguments); | |
} | |
if (isArray(value)) { | |
forEach(value, function (item) { | |
$this.remove(item); | |
}); | |
return $this; | |
} | |
$this.data = dataRemove($this.data, isNumber(value) ? value : symbolToCodePoint(value)); | |
return $this; | |
}, | |
'addRange': function addRange(start, end) { | |
var $this = this; | |
$this.data = dataAddRange($this.data, isNumber(start) ? start : symbolToCodePoint(start), isNumber(end) ? end : symbolToCodePoint(end)); | |
return $this; | |
}, | |
'removeRange': function removeRange(start, end) { | |
var $this = this; | |
var startCodePoint = isNumber(start) ? start : symbolToCodePoint(start); | |
var endCodePoint = isNumber(end) ? end : symbolToCodePoint(end); | |
$this.data = dataRemoveRange($this.data, startCodePoint, endCodePoint); | |
return $this; | |
}, | |
'intersection': function intersection(argument) { | |
var $this = this; | |
var array = argument instanceof regenerate ? dataToArray(argument.data) : argument; | |
$this.data = dataIntersection($this.data, array); | |
return $this; | |
}, | |
'contains': function contains(codePoint) { | |
return dataContains(this.data, isNumber(codePoint) ? codePoint : symbolToCodePoint(codePoint)); | |
}, | |
'clone': function clone() { | |
var set = new regenerate(); | |
set.data = this.data.slice(0); | |
return set; | |
}, | |
'toString': function toString(options) { | |
var result = createCharacterClassesFromData(this.data, options ? options.bmpOnly : false, options ? options.hasUnicodeFlag : false); | |
if (!result) { | |
return '[]'; | |
} | |
return result.replace(regexNull, '\\0$1'); | |
}, | |
'toRegExp': function toRegExp(flags) { | |
var pattern = this.toString(flags && flags.indexOf('u') != -1 ? { | |
'hasUnicodeFlag': true | |
} : null); | |
return RegExp(pattern, flags || ''); | |
}, | |
'valueOf': function valueOf() { | |
return dataToArray(this.data); | |
} | |
}); | |
proto.toArray = proto.valueOf; | |
if (true) { | |
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { | |
return regenerate; | |
}).call(exports, __webpack_require__, exports, module), | |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
} else if (freeExports && !freeExports.nodeType) { | |
if (freeModule) { | |
freeModule.exports = regenerate; | |
} else { | |
freeExports.regenerate = regenerate; | |
} | |
} else { | |
root.regenerate = regenerate; | |
} | |
})(this); | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(54)(module), __webpack_require__(23))) | |
/***/ }), | |
/* 1 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;; | |
(function (root) { | |
var freeExports = typeof exports == 'object' && exports; | |
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; | |
var freeGlobal = typeof global == 'object' && global; | |
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { | |
root = freeGlobal; | |
} | |
var ERRORS = { | |
'rangeOrder': "A range\u2019s `stop` value must be greater than or equal " + 'to the `start` value.', | |
'codePointRange': 'Invalid code point value. Code points range from ' + 'U+000000 to U+10FFFF.' | |
}; | |
var HIGH_SURROGATE_MIN = 0xD800; | |
var HIGH_SURROGATE_MAX = 0xDBFF; | |
var LOW_SURROGATE_MIN = 0xDC00; | |
var LOW_SURROGATE_MAX = 0xDFFF; | |
var regexNull = /\\x00([^0123456789]|$)/g; | |
var object = {}; | |
var hasOwnProperty = object.hasOwnProperty; | |
var extend = function extend(destination, source) { | |
var key; | |
for (key in source) { | |
if (hasOwnProperty.call(source, key)) { | |
destination[key] = source[key]; | |
} | |
} | |
return destination; | |
}; | |
var forEach = function forEach(array, callback) { | |
var index = -1; | |
var length = array.length; | |
while (++index < length) { | |
callback(array[index], index); | |
} | |
}; | |
var toString = object.toString; | |
var isArray = function isArray(value) { | |
return toString.call(value) == '[object Array]'; | |
}; | |
var isNumber = function isNumber(value) { | |
return typeof value == 'number' || toString.call(value) == '[object Number]'; | |
}; | |
var zeroes = '0000'; | |
var pad = function pad(number, totalCharacters) { | |
var string = String(number); | |
return string.length < totalCharacters ? (zeroes + string).slice(-totalCharacters) : string; | |
}; | |
var hex = function hex(number) { | |
return Number(number).toString(16).toUpperCase(); | |
}; | |
var slice = [].slice; | |
var dataFromCodePoints = function dataFromCodePoints(codePoints) { | |
var index = -1; | |
var length = codePoints.length; | |
var max = length - 1; | |
var result = []; | |
var isStart = true; | |
var tmp; | |
var previous = 0; | |
while (++index < length) { | |
tmp = codePoints[index]; | |
if (isStart) { | |
result.push(tmp); | |
previous = tmp; | |
isStart = false; | |
} else { | |
if (tmp == previous + 1) { | |
if (index != max) { | |
previous = tmp; | |
continue; | |
} else { | |
isStart = true; | |
result.push(tmp + 1); | |
} | |
} else { | |
result.push(previous + 1, tmp); | |
previous = tmp; | |
} | |
} | |
} | |
if (!isStart) { | |
result.push(tmp + 1); | |
} | |
return result; | |
}; | |
var dataRemove = function dataRemove(data, codePoint) { | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (codePoint >= start && codePoint < end) { | |
if (codePoint == start) { | |
if (end == start + 1) { | |
data.splice(index, 2); | |
return data; | |
} else { | |
data[index] = codePoint + 1; | |
return data; | |
} | |
} else if (codePoint == end - 1) { | |
data[index + 1] = codePoint; | |
return data; | |
} else { | |
data.splice(index, 2, start, codePoint, codePoint + 1, end); | |
return data; | |
} | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataRemoveRange = function dataRemoveRange(data, rangeStart, rangeEnd) { | |
if (rangeEnd < rangeStart) { | |
throw Error(ERRORS.rangeOrder); | |
} | |
var index = 0; | |
var start; | |
var end; | |
while (index < data.length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start > rangeEnd) { | |
return data; | |
} | |
if (rangeStart <= start && rangeEnd >= end) { | |
data.splice(index, 2); | |
continue; | |
} | |
if (rangeStart >= start && rangeEnd < end) { | |
if (rangeStart == start) { | |
data[index] = rangeEnd + 1; | |
data[index + 1] = end + 1; | |
return data; | |
} | |
data.splice(index, 2, start, rangeStart, rangeEnd + 1, end + 1); | |
return data; | |
} | |
if (rangeStart >= start && rangeStart <= end) { | |
data[index + 1] = rangeStart; | |
} else if (rangeEnd >= start && rangeEnd <= end) { | |
data[index] = rangeEnd + 1; | |
return data; | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataAdd = function dataAdd(data, codePoint) { | |
var index = 0; | |
var start; | |
var end; | |
var lastIndex = null; | |
var length = data.length; | |
if (codePoint < 0x0 || codePoint > 0x10FFFF) { | |
throw RangeError(ERRORS.codePointRange); | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (codePoint >= start && codePoint < end) { | |
return data; | |
} | |
if (codePoint == start - 1) { | |
data[index] = codePoint; | |
return data; | |
} | |
if (start > codePoint) { | |
data.splice(lastIndex != null ? lastIndex + 2 : 0, 0, codePoint, codePoint + 1); | |
return data; | |
} | |
if (codePoint == end) { | |
if (codePoint + 1 == data[index + 2]) { | |
data.splice(index, 4, start, data[index + 3]); | |
return data; | |
} | |
data[index + 1] = codePoint + 1; | |
return data; | |
} | |
lastIndex = index; | |
index += 2; | |
} | |
data.push(codePoint, codePoint + 1); | |
return data; | |
}; | |
var dataAddData = function dataAddData(dataA, dataB) { | |
var index = 0; | |
var start; | |
var end; | |
var data = dataA.slice(); | |
var length = dataB.length; | |
while (index < length) { | |
start = dataB[index]; | |
end = dataB[index + 1] - 1; | |
if (start == end) { | |
data = dataAdd(data, start); | |
} else { | |
data = dataAddRange(data, start, end); | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataRemoveData = function dataRemoveData(dataA, dataB) { | |
var index = 0; | |
var start; | |
var end; | |
var data = dataA.slice(); | |
var length = dataB.length; | |
while (index < length) { | |
start = dataB[index]; | |
end = dataB[index + 1] - 1; | |
if (start == end) { | |
data = dataRemove(data, start); | |
} else { | |
data = dataRemoveRange(data, start, end); | |
} | |
index += 2; | |
} | |
return data; | |
}; | |
var dataAddRange = function dataAddRange(data, rangeStart, rangeEnd) { | |
if (rangeEnd < rangeStart) { | |
throw Error(ERRORS.rangeOrder); | |
} | |
if (rangeStart < 0x0 || rangeStart > 0x10FFFF || rangeEnd < 0x0 || rangeEnd > 0x10FFFF) { | |
throw RangeError(ERRORS.codePointRange); | |
} | |
var index = 0; | |
var start; | |
var end; | |
var added = false; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (added) { | |
if (start == rangeEnd + 1) { | |
data.splice(index - 1, 2); | |
return data; | |
} | |
if (start > rangeEnd) { | |
return data; | |
} | |
if (start >= rangeStart && start <= rangeEnd) { | |
if (end > rangeStart && end - 1 <= rangeEnd) { | |
data.splice(index, 2); | |
index -= 2; | |
} else { | |
data.splice(index - 1, 2); | |
index -= 2; | |
} | |
} | |
} else if (start == rangeEnd + 1) { | |
data[index] = rangeStart; | |
return data; | |
} else if (start > rangeEnd) { | |
data.splice(index, 0, rangeStart, rangeEnd + 1); | |
return data; | |
} else if (rangeStart >= start && rangeStart < end && rangeEnd + 1 <= end) { | |
return data; | |
} else if (rangeStart >= start && rangeStart < end || end == rangeStart) { | |
data[index + 1] = rangeEnd + 1; | |
added = true; | |
} else if (rangeStart <= start && rangeEnd + 1 >= end) { | |
data[index] = rangeStart; | |
data[index + 1] = rangeEnd + 1; | |
added = true; | |
} | |
index += 2; | |
} | |
if (!added) { | |
data.push(rangeStart, rangeEnd + 1); | |
} | |
return data; | |
}; | |
var dataContains = function dataContains(data, codePoint) { | |
var index = 0; | |
var length = data.length; | |
var start = data[index]; | |
var end = data[length - 1]; | |
if (length >= 2) { | |
if (codePoint < start || codePoint > end) { | |
return false; | |
} | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
if (codePoint >= start && codePoint < end) { | |
return true; | |
} | |
index += 2; | |
} | |
return false; | |
}; | |
var dataIntersection = function dataIntersection(data, codePoints) { | |
var index = 0; | |
var length = codePoints.length; | |
var codePoint; | |
var result = []; | |
while (index < length) { | |
codePoint = codePoints[index]; | |
if (dataContains(data, codePoint)) { | |
result.push(codePoint); | |
} | |
++index; | |
} | |
return dataFromCodePoints(result); | |
}; | |
var dataIsEmpty = function dataIsEmpty(data) { | |
return !data.length; | |
}; | |
var dataIsSingleton = function dataIsSingleton(data) { | |
return data.length == 2 && data[0] + 1 == data[1]; | |
}; | |
var dataToArray = function dataToArray(data) { | |
var index = 0; | |
var start; | |
var end; | |
var result = []; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1]; | |
while (start < end) { | |
result.push(start); | |
++start; | |
} | |
index += 2; | |
} | |
return result; | |
}; | |
var floor = Math.floor; | |
var highSurrogate = function highSurrogate(codePoint) { | |
return parseInt(floor((codePoint - 0x10000) / 0x400) + HIGH_SURROGATE_MIN, 10); | |
}; | |
var lowSurrogate = function lowSurrogate(codePoint) { | |
return parseInt((codePoint - 0x10000) % 0x400 + LOW_SURROGATE_MIN, 10); | |
}; | |
var stringFromCharCode = String.fromCharCode; | |
var codePointToString = function codePointToString(codePoint) { | |
var string; | |
if (codePoint == 0x09) { | |
string = '\\t'; | |
} else if (codePoint == 0x0A) { | |
string = '\\n'; | |
} else if (codePoint == 0x0C) { | |
string = '\\f'; | |
} else if (codePoint == 0x0D) { | |
string = '\\r'; | |
} else if (codePoint == 0x5C) { | |
string = '\\\\'; | |
} else if (codePoint == 0x24 || codePoint >= 0x28 && codePoint <= 0x2B || codePoint >= 0x2D && codePoint <= 0x2F || codePoint == 0x3F || codePoint >= 0x5B && codePoint <= 0x5E || codePoint >= 0x7B && codePoint <= 0x7D) { | |
string = '\\' + stringFromCharCode(codePoint); | |
} else if (codePoint >= 0x20 && codePoint <= 0x7E) { | |
string = stringFromCharCode(codePoint); | |
} else if (codePoint <= 0xFF) { | |
string = '\\x' + pad(hex(codePoint), 2); | |
} else { | |
string = "\\u" + pad(hex(codePoint), 4); | |
} | |
return string; | |
}; | |
var codePointToStringUnicode = function codePointToStringUnicode(codePoint) { | |
if (codePoint <= 0xFFFF) { | |
return codePointToString(codePoint); | |
} | |
return "\\u{" + codePoint.toString(16).toUpperCase() + '}'; | |
}; | |
var symbolToCodePoint = function symbolToCodePoint(symbol) { | |
var length = symbol.length; | |
var first = symbol.charCodeAt(0); | |
var second; | |
if (first >= HIGH_SURROGATE_MIN && first <= HIGH_SURROGATE_MAX && length > 1) { | |
second = symbol.charCodeAt(1); | |
return (first - HIGH_SURROGATE_MIN) * 0x400 + second - LOW_SURROGATE_MIN + 0x10000; | |
} | |
return first; | |
}; | |
var createBMPCharacterClasses = function createBMPCharacterClasses(data) { | |
var result = ''; | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
if (dataIsSingleton(data)) { | |
return codePointToString(data[0]); | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start == end) { | |
result += codePointToString(start); | |
} else if (start + 1 == end) { | |
result += codePointToString(start) + codePointToString(end); | |
} else { | |
result += codePointToString(start) + '-' + codePointToString(end); | |
} | |
index += 2; | |
} | |
return '[' + result + ']'; | |
}; | |
var createUnicodeCharacterClasses = function createUnicodeCharacterClasses(data) { | |
var result = ''; | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
if (dataIsSingleton(data)) { | |
return codePointToStringUnicode(data[0]); | |
} | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start == end) { | |
result += codePointToStringUnicode(start); | |
} else if (start + 1 == end) { | |
result += codePointToStringUnicode(start) + codePointToStringUnicode(end); | |
} else { | |
result += codePointToStringUnicode(start) + '-' + codePointToStringUnicode(end); | |
} | |
index += 2; | |
} | |
return '[' + result + ']'; | |
}; | |
var splitAtBMP = function splitAtBMP(data) { | |
var loneHighSurrogates = []; | |
var loneLowSurrogates = []; | |
var bmp = []; | |
var astral = []; | |
var index = 0; | |
var start; | |
var end; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
if (start < HIGH_SURROGATE_MIN) { | |
if (end < HIGH_SURROGATE_MIN) { | |
bmp.push(start, end + 1); | |
} | |
if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { | |
bmp.push(start, HIGH_SURROGATE_MIN); | |
loneHighSurrogates.push(HIGH_SURROGATE_MIN, end + 1); | |
} | |
if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { | |
bmp.push(start, HIGH_SURROGATE_MIN); | |
loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); | |
} | |
if (end > LOW_SURROGATE_MAX) { | |
bmp.push(start, HIGH_SURROGATE_MIN); | |
loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); | |
if (end <= 0xFFFF) { | |
bmp.push(LOW_SURROGATE_MAX + 1, end + 1); | |
} else { | |
bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} | |
} else if (start >= HIGH_SURROGATE_MIN && start <= HIGH_SURROGATE_MAX) { | |
if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) { | |
loneHighSurrogates.push(start, end + 1); | |
} | |
if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { | |
loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1); | |
} | |
if (end > LOW_SURROGATE_MAX) { | |
loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1); | |
loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1); | |
if (end <= 0xFFFF) { | |
bmp.push(LOW_SURROGATE_MAX + 1, end + 1); | |
} else { | |
bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} | |
} else if (start >= LOW_SURROGATE_MIN && start <= LOW_SURROGATE_MAX) { | |
if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) { | |
loneLowSurrogates.push(start, end + 1); | |
} | |
if (end > LOW_SURROGATE_MAX) { | |
loneLowSurrogates.push(start, LOW_SURROGATE_MAX + 1); | |
if (end <= 0xFFFF) { | |
bmp.push(LOW_SURROGATE_MAX + 1, end + 1); | |
} else { | |
bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} | |
} else if (start > LOW_SURROGATE_MAX && start <= 0xFFFF) { | |
if (end <= 0xFFFF) { | |
bmp.push(start, end + 1); | |
} else { | |
bmp.push(start, 0xFFFF + 1); | |
astral.push(0xFFFF + 1, end + 1); | |
} | |
} else { | |
astral.push(start, end + 1); | |
} | |
index += 2; | |
} | |
return { | |
'loneHighSurrogates': loneHighSurrogates, | |
'loneLowSurrogates': loneLowSurrogates, | |
'bmp': bmp, | |
'astral': astral | |
}; | |
}; | |
var optimizeSurrogateMappings = function optimizeSurrogateMappings(surrogateMappings) { | |
var result = []; | |
var tmpLow = []; | |
var addLow = false; | |
var mapping; | |
var nextMapping; | |
var highSurrogates; | |
var lowSurrogates; | |
var nextHighSurrogates; | |
var nextLowSurrogates; | |
var index = -1; | |
var length = surrogateMappings.length; | |
while (++index < length) { | |
mapping = surrogateMappings[index]; | |
nextMapping = surrogateMappings[index + 1]; | |
if (!nextMapping) { | |
result.push(mapping); | |
continue; | |
} | |
highSurrogates = mapping[0]; | |
lowSurrogates = mapping[1]; | |
nextHighSurrogates = nextMapping[0]; | |
nextLowSurrogates = nextMapping[1]; | |
tmpLow = lowSurrogates; | |
while (nextHighSurrogates && highSurrogates[0] == nextHighSurrogates[0] && highSurrogates[1] == nextHighSurrogates[1]) { | |
if (dataIsSingleton(nextLowSurrogates)) { | |
tmpLow = dataAdd(tmpLow, nextLowSurrogates[0]); | |
} else { | |
tmpLow = dataAddRange(tmpLow, nextLowSurrogates[0], nextLowSurrogates[1] - 1); | |
} | |
++index; | |
mapping = surrogateMappings[index]; | |
highSurrogates = mapping[0]; | |
lowSurrogates = mapping[1]; | |
nextMapping = surrogateMappings[index + 1]; | |
nextHighSurrogates = nextMapping && nextMapping[0]; | |
nextLowSurrogates = nextMapping && nextMapping[1]; | |
addLow = true; | |
} | |
result.push([highSurrogates, addLow ? tmpLow : lowSurrogates]); | |
addLow = false; | |
} | |
return optimizeByLowSurrogates(result); | |
}; | |
var optimizeByLowSurrogates = function optimizeByLowSurrogates(surrogateMappings) { | |
if (surrogateMappings.length == 1) { | |
return surrogateMappings; | |
} | |
var index = -1; | |
var innerIndex = -1; | |
while (++index < surrogateMappings.length) { | |
var mapping = surrogateMappings[index]; | |
var lowSurrogates = mapping[1]; | |
var lowSurrogateStart = lowSurrogates[0]; | |
var lowSurrogateEnd = lowSurrogates[1]; | |
innerIndex = index; | |
while (++innerIndex < surrogateMappings.length) { | |
var otherMapping = surrogateMappings[innerIndex]; | |
var otherLowSurrogates = otherMapping[1]; | |
var otherLowSurrogateStart = otherLowSurrogates[0]; | |
var otherLowSurrogateEnd = otherLowSurrogates[1]; | |
if (lowSurrogateStart == otherLowSurrogateStart && lowSurrogateEnd == otherLowSurrogateEnd) { | |
if (dataIsSingleton(otherMapping[0])) { | |
mapping[0] = dataAdd(mapping[0], otherMapping[0][0]); | |
} else { | |
mapping[0] = dataAddRange(mapping[0], otherMapping[0][0], otherMapping[0][1] - 1); | |
} | |
surrogateMappings.splice(innerIndex, 1); | |
--innerIndex; | |
} | |
} | |
} | |
return surrogateMappings; | |
}; | |
var surrogateSet = function surrogateSet(data) { | |
if (!data.length) { | |
return []; | |
} | |
var index = 0; | |
var start; | |
var end; | |
var startHigh; | |
var startLow; | |
var endHigh; | |
var endLow; | |
var surrogateMappings = []; | |
var length = data.length; | |
while (index < length) { | |
start = data[index]; | |
end = data[index + 1] - 1; | |
startHigh = highSurrogate(start); | |
startLow = lowSurrogate(start); | |
endHigh = highSurrogate(end); | |
endLow = lowSurrogate(end); | |
var startsWithLowestLowSurrogate = startLow == LOW_SURROGATE_MIN; | |
var endsWithHighestLowSurrogate = endLow == LOW_SURROGATE_MAX; | |
var complete = false; | |
if (startHigh == endHigh || startsWithLowestLowSurrogate && endsWithHighestLowSurrogate) { | |
surrogateMappings.push([[startHigh, endHigh + 1], [startLow, endLow + 1]]); | |
complete = true; | |
} else { | |
surrogateMappings.push([[startHigh, startHigh + 1], [startLow, LOW_SURROGATE_MAX + 1]]); | |
} | |
if (!complete && startHigh + 1 < endHigh) { | |
if (endsWithHighestLowSurrogate) { | |
surrogateMappings.push([[startHigh + 1, endHigh + 1], [LOW_SURROGATE_MIN, endLow + 1]]); | |
complete = true; | |
} else { | |
surrogateMappings.push([[startHigh + 1, endHigh], [LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1]]); | |
} | |
} | |
if (!complete) { | |
surrogateMappings.push([[endHigh, endHigh + 1], [LOW_SURROGATE_MIN, endLow + 1]]); | |
} | |
index += 2; | |
} | |
return optimizeSurrogateMappings(surrogateMappings); | |
}; | |
var createSurrogateCharacterClasses = function createSurrogateCharacterClasses(surrogateMappings) { | |
var result = []; | |
forEach(surrogateMappings, function (surrogateMapping) { | |
var highSurrogates = surrogateMapping[0]; | |
var lowSurrogates = surrogateMapping[1]; | |
result.push(createBMPCharacterClasses(highSurrogates) + createBMPCharacterClasses(lowSurrogates)); | |
}); | |
return result.join('|'); | |
}; | |
var createCharacterClassesFromData = function createCharacterClassesFromData(data, bmpOnly, hasUnicodeFlag) { | |
if (hasUnicodeFlag) { | |
return createUnicodeCharacterClasses(data); | |
} | |
var result = []; | |
var parts = splitAtBMP(data); | |
var loneHighSurrogates = parts.loneHighSurrogates; | |
var loneLowSurrogates = parts.loneLowSurrogates; | |
var bmp = parts.bmp; | |
var astral = parts.astral; | |
var hasLoneHighSurrogates = !dataIsEmpty(loneHighSurrogates); | |
var hasLoneLowSurrogates = !dataIsEmpty(loneLowSurrogates); | |
var surrogateMappings = surrogateSet(astral); | |
if (bmpOnly) { | |
bmp = dataAddData(bmp, loneHighSurrogates); | |
hasLoneHighSurrogates = false; | |
bmp = dataAddData(bmp, loneLowSurrogates); | |
hasLoneLowSurrogates = false; | |
} | |
if (!dataIsEmpty(bmp)) { | |
result.push(createBMPCharacterClasses(bmp)); | |
} | |
if (surrogateMappings.length) { | |
result.push(createSurrogateCharacterClasses(surrogateMappings)); | |
} | |
if (hasLoneHighSurrogates) { | |
result.push(createBMPCharacterClasses(loneHighSurrogates) + "(?![\\uDC00-\\uDFFF])"); | |
} | |
if (hasLoneLowSurrogates) { | |
result.push("(?:[^\\uD800-\\uDBFF]|^)" + createBMPCharacterClasses(loneLowSurrogates)); | |
} | |
return result.join('|'); | |
}; | |
var regenerate = function regenerate(value) { | |
if (arguments.length > 1) { | |
value = slice.call(arguments); | |
} | |
if (this instanceof regenerate) { | |
this.data = []; | |
return value ? this.add(value) : this; | |
} | |
return new regenerate().add(value); | |
}; | |
regenerate.version = '1.3.3'; | |
var proto = regenerate.prototype; | |
extend(proto, { | |
'add': function add(value) { | |
var $this = this; | |
if (value == null) { | |
return $this; | |
} | |
if (value instanceof regenerate) { | |
$this.data = dataAddData($this.data, value.data); | |
return $this; | |
} | |
if (arguments.length > 1) { | |
value = slice.call(arguments); | |
} | |
if (isArray(value)) { | |
forEach(value, function (item) { | |
$this.add(item); | |
}); | |
return $this; | |
} | |
$this.data = dataAdd($this.data, isNumber(value) ? value : symbolToCodePoint(value)); | |
return $this; | |
}, | |
'remove': function remove(value) { | |
var $this = this; | |
if (value == null) { | |
return $this; | |
} | |
if (value instanceof regenerate) { | |
$this.data = dataRemoveData($this.data, value.data); | |
return $this; | |
} | |
if (arguments.length > 1) { | |
value = slice.call(arguments); | |
} | |
if (isArray(value)) { | |
forEach(value, function (item) { | |
$this.remove(item); | |
}); | |
return $this; | |
} | |
$this.data = dataRemove($this.data, isNumber(value) ? value : symbolToCodePoint(value)); | |
return $this; | |
}, | |
'addRange': function addRange(start, end) { | |
var $this = this; | |
$this.data = dataAddRange($this.data, isNumber(start) ? start : symbolToCodePoint(start), isNumber(end) ? end : symbolToCodePoint(end)); | |
return $this; | |
}, | |
'removeRange': function removeRange(start, end) { | |
var $this = this; | |
var startCodePoint = isNumber(start) ? start : symbolToCodePoint(start); | |
var endCodePoint = isNumber(end) ? end : symbolToCodePoint(end); | |
$this.data = dataRemoveRange($this.data, startCodePoint, endCodePoint); | |
return $this; | |
}, | |
'intersection': function intersection(argument) { | |
var $this = this; | |
var array = argument instanceof regenerate ? dataToArray(argument.data) : argument; | |
$this.data = dataIntersection($this.data, array); | |
return $this; | |
}, | |
'contains': function contains(codePoint) { | |
return dataContains(this.data, isNumber(codePoint) ? codePoint : symbolToCodePoint(codePoint)); | |
}, | |
'clone': function clone() { | |
var set = new regenerate(); | |
set.data = this.data.slice(0); | |
return set; | |
}, | |
'toString': function toString(options) { | |
var result = createCharacterClassesFromData(this.data, options ? options.bmpOnly : false, options ? options.hasUnicodeFlag : false); | |
if (!result) { | |
return '[]'; | |
} | |
return result.replace(regexNull, '\\0$1'); | |
}, | |
'toRegExp': function toRegExp(flags) { | |
var pattern = this.toString(flags && flags.indexOf('u') != -1 ? { | |
'hasUnicodeFlag': true | |
} : null); | |
return RegExp(pattern, flags || ''); | |
}, | |
'valueOf': function valueOf() { | |
return dataToArray(this.data); | |
} | |
}); | |
proto.toArray = proto.valueOf; | |
if (true) { | |
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { | |
return regenerate; | |
}).call(exports, __webpack_require__, exports, module), | |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
} else if (freeExports && !freeExports.nodeType) { | |
if (freeModule) { | |
freeModule.exports = regenerate; | |
} else { | |
freeExports.regenerate = regenerate; | |
} | |
} else { | |
root.regenerate = regenerate; | |
} | |
})(this); | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(54)(module), __webpack_require__(23))) | |
/***/ }), | |
/* 2 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.declare = declare; | |
function declare(builder) { | |
return function (api, options, dirname) { | |
if (!api.assertVersion) { | |
api = Object.assign(copyApiObject(api), { | |
assertVersion: function assertVersion(range) { | |
throwVersionError(range, api.version); | |
} | |
}); | |
} | |
return builder(api, options || {}, dirname); | |
}; | |
} | |
function copyApiObject(api) { | |
var proto = null; | |
if (typeof api.version === "string" && /^7\./.test(api.version)) { | |
proto = Object.getPrototypeOf(api); | |
if (proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types"))) { | |
proto = null; | |
} | |
} | |
return Object.assign({}, proto, api); | |
} | |
function has(obj, key) { | |
return Object.prototype.hasOwnProperty.call(obj, key); | |
} | |
function throwVersionError(range, version) { | |
if (typeof range === "number") { | |
if (!Number.isInteger(range)) { | |
throw new Error("Expected string or integer value."); | |
} | |
range = "^" + range + ".0.0-0"; | |
} | |
if (typeof range !== "string") { | |
throw new Error("Expected string or integer value."); | |
} | |
var limit = Error.stackTraceLimit; | |
if (typeof limit === "number" && limit < 25) { | |
Error.stackTraceLimit = 25; | |
} | |
var err; | |
if (version.slice(0, 2) === "7.") { | |
err = new Error("Requires Babel \"^7.0.0-beta.41\", but was loaded with \"" + version + "\". " + "You'll need to update your @babel/core version."); | |
} else { | |
err = new Error("Requires Babel \"" + range + "\", but was loaded with \"" + version + "\". " + "If you are sure you have a compatible version of @babel/core, " + "it is likely that something in your build process is loading the " + "wrong version. Inspect the stack trace of this error to look for " + "the first entry that doesn't mention \"@babel/core\" or \"babel-core\" " + "to see what is calling Babel."); | |
} | |
if (typeof limit === "number") { | |
Error.stackTraceLimit = limit; | |
} | |
throw Object.assign(err, { | |
code: "BABEL_VERSION_UNSUPPORTED", | |
version: version, | |
range: range | |
}); | |
} | |
/***/ }), | |
/* 3 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.Plugin = Plugin; | |
Object.defineProperty(exports, "File", { | |
enumerable: true, | |
get: function get() { | |
return _file.default; | |
} | |
}); | |
Object.defineProperty(exports, "buildExternalHelpers", { | |
enumerable: true, | |
get: function get() { | |
return _buildExternalHelpers.default; | |
} | |
}); | |
Object.defineProperty(exports, "resolvePlugin", { | |
enumerable: true, | |
get: function get() { | |
return _files.resolvePlugin; | |
} | |
}); | |
Object.defineProperty(exports, "resolvePreset", { | |
enumerable: true, | |
get: function get() { | |
return _files.resolvePreset; | |
} | |
}); | |
Object.defineProperty(exports, "version", { | |
enumerable: true, | |
get: function get() { | |
return _package.version; | |
} | |
}); | |
Object.defineProperty(exports, "getEnv", { | |
enumerable: true, | |
get: function get() { | |
return _environment.getEnv; | |
} | |
}); | |
Object.defineProperty(exports, "tokTypes", { | |
enumerable: true, | |
get: function get() { | |
return _parser().tokTypes; | |
} | |
}); | |
Object.defineProperty(exports, "traverse", { | |
enumerable: true, | |
get: function get() { | |
return _traverse().default; | |
} | |
}); | |
Object.defineProperty(exports, "template", { | |
enumerable: true, | |
get: function get() { | |
return _template().default; | |
} | |
}); | |
Object.defineProperty(exports, "createConfigItem", { | |
enumerable: true, | |
get: function get() { | |
return _item.createConfigItem; | |
} | |
}); | |
Object.defineProperty(exports, "loadPartialConfig", { | |
enumerable: true, | |
get: function get() { | |
return _config.loadPartialConfig; | |
} | |
}); | |
Object.defineProperty(exports, "loadOptions", { | |
enumerable: true, | |
get: function get() { | |
return _config.loadOptions; | |
} | |
}); | |
Object.defineProperty(exports, "transform", { | |
enumerable: true, | |
get: function get() { | |
return _transform.transform; | |
} | |
}); | |
Object.defineProperty(exports, "transformSync", { | |
enumerable: true, | |
get: function get() { | |
return _transform.transformSync; | |
} | |
}); | |
Object.defineProperty(exports, "transformAsync", { | |
enumerable: true, | |
get: function get() { | |
return _transform.transformAsync; | |
} | |
}); | |
Object.defineProperty(exports, "transformFile", { | |
enumerable: true, | |
get: function get() { | |
return _transformFile.transformFile; | |
} | |
}); | |
Object.defineProperty(exports, "transformFileSync", { | |
enumerable: true, | |
get: function get() { | |
return _transformFile.transformFileSync; | |
} | |
}); | |
Object.defineProperty(exports, "transformFileAsync", { | |
enumerable: true, | |
get: function get() { | |
return _transformFile.transformFileAsync; | |
} | |
}); | |
Object.defineProperty(exports, "transformFromAst", { | |
enumerable: true, | |
get: function get() { | |
return _transformAst.transformFromAst; | |
} | |
}); | |
Object.defineProperty(exports, "transformFromAstSync", { | |
enumerable: true, | |
get: function get() { | |
return _transformAst.transformFromAstSync; | |
} | |
}); | |
Object.defineProperty(exports, "transformFromAstAsync", { | |
enumerable: true, | |
get: function get() { | |
return _transformAst.transformFromAstAsync; | |
} | |
}); | |
Object.defineProperty(exports, "parse", { | |
enumerable: true, | |
get: function get() { | |
return _parse.parse; | |
} | |
}); | |
Object.defineProperty(exports, "parseSync", { | |
enumerable: true, | |
get: function get() { | |
return _parse.parseSync; | |
} | |
}); | |
Object.defineProperty(exports, "parseAsync", { | |
enumerable: true, | |
get: function get() { | |
return _parse.parseAsync; | |
} | |
}); | |
exports.types = exports.OptionManager = exports.DEFAULT_EXTENSIONS = void 0; | |
var _file = _interopRequireDefault(__webpack_require__(255)); | |
var _buildExternalHelpers = _interopRequireDefault(__webpack_require__(760)); | |
var _files = __webpack_require__(138); | |
var _package = __webpack_require__(761); | |
var _environment = __webpack_require__(308); | |
function _types() { | |
var data = _interopRequireWildcard(__webpack_require__(4)); | |
_types = function _types() { | |
return data; | |
}; | |
return data; | |
} | |
Object.defineProperty(exports, "types", { | |
enumerable: true, | |
get: function get() { | |
return _types(); | |
} | |
}); | |
function _parser() { | |
var data = __webpack_require__(136); | |
_parser = function _parser() { | |
return data; | |
}; | |
return data; | |
} | |
function _traverse() { | |
var data = _interopRequireDefault(__webpack_require__(34)); | |
_traverse = function _traverse() { | |
return data; | |
}; | |
return data; | |
} | |
function _template() { | |
var data = _interopRequireDefault(__webpack_require__(69)); | |
_template = function _template() { | |
return data; | |
}; | |
return data; | |
} | |
var _item = __webpack_require__(139); | |
var _config = __webpack_require__(96); | |
var _transform = __webpack_require__(769); | |
var _transformFile = __webpack_require__(806); | |
var _transformAst = __webpack_require__(807); | |
var _parse = __webpack_require__(808); | |
function _interopRequireWildcard(obj) { | |
if (obj && obj.__esModule) { | |
return obj; | |
} else { | |
var newObj = {}; | |
if (obj != null) { | |
for (var key in obj) { | |
if (Object.prototype.hasOwnProperty.call(obj, key)) { | |
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; | |
if (desc.get || desc.set) { | |
Object.defineProperty(newObj, key, desc); | |
} else { | |
newObj[key] = obj[key]; | |
} | |
} | |
} | |
} | |
newObj.default = obj; | |
return newObj; | |
} | |
} | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
var DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]); | |
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; | |
var OptionManager = function () { | |
function OptionManager() {} | |
var _proto = OptionManager.prototype; | |
_proto.init = function init(opts) { | |
return (0, _config.loadOptions)(opts); | |
}; | |
return OptionManager; | |
}(); | |
exports.OptionManager = OptionManager; | |
function Plugin(alias) { | |
throw new Error("The (" + alias + ") Babel 5 plugin is being run with an unsupported Babel version."); | |
} | |
/***/ }), | |
/* 4 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _exportNames = { | |
react: true, | |
assertNode: true, | |
createTypeAnnotationBasedOnTypeof: true, | |
createUnionTypeAnnotation: true, | |
cloneNode: true, | |
clone: true, | |
cloneDeep: true, | |
cloneWithoutLoc: true, | |
addComment: true, | |
addComments: true, | |
inheritInnerComments: true, | |
inheritLeadingComments: true, | |
inheritsComments: true, | |
inheritTrailingComments: true, | |
removeComments: true, | |
ensureBlock: true, | |
toBindingIdentifierName: true, | |
toBlock: true, | |
toComputedKey: true, | |
toExpression: true, | |
toIdentifier: true, | |
toKeyAlias: true, | |
toSequenceExpression: true, | |
toStatement: true, | |
valueToNode: true, | |
appendToMemberExpression: true, | |
inherits: true, | |
prependToMemberExpression: true, | |
removeProperties: true, | |
removePropertiesDeep: true, | |
removeTypeDuplicates: true, | |
getBindingIdentifiers: true, | |
getOuterBindingIdentifiers: true, | |
traverse: true, | |
traverseFast: true, | |
shallowEqual: true, | |
is: true, | |
isBinding: true, | |
isBlockScoped: true, | |
isImmutable: true, | |
isLet: true, | |
isNode: true, | |
isNodesEquivalent: true, | |
isReferenced: true, | |
isScope: true, | |
isSpecifierDefault: true, | |
isType: true, | |
isValidES3Identifier: true, | |
isValidIdentifier: true, | |
isVar: true, | |
matchesPattern: true, | |
validate: true, | |
buildMatchMemberExpression: true | |
}; | |
Object.defineProperty(exports, "assertNode", { | |
enumerable: true, | |
get: function get() { | |
return _assertNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { | |
enumerable: true, | |
get: function get() { | |
return _createTypeAnnotationBasedOnTypeof.default; | |
} | |
}); | |
Object.defineProperty(exports, "createUnionTypeAnnotation", { | |
enumerable: true, | |
get: function get() { | |
return _createUnionTypeAnnotation.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneNode", { | |
enumerable: true, | |
get: function get() { | |
return _cloneNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "clone", { | |
enumerable: true, | |
get: function get() { | |
return _clone.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneDeep", { | |
enumerable: true, | |
get: function get() { | |
return _cloneDeep.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneWithoutLoc", { | |
enumerable: true, | |
get: function get() { | |
return _cloneWithoutLoc.default; | |
} | |
}); | |
Object.defineProperty(exports, "addComment", { | |
enumerable: true, | |
get: function get() { | |
return _addComment.default; | |
} | |
}); | |
Object.defineProperty(exports, "addComments", { | |
enumerable: true, | |
get: function get() { | |
return _addComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritInnerComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritInnerComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritLeadingComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritLeadingComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritsComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritsComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritTrailingComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritTrailingComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeComments", { | |
enumerable: true, | |
get: function get() { | |
return _removeComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "ensureBlock", { | |
enumerable: true, | |
get: function get() { | |
return _ensureBlock.default; | |
} | |
}); | |
Object.defineProperty(exports, "toBindingIdentifierName", { | |
enumerable: true, | |
get: function get() { | |
return _toBindingIdentifierName.default; | |
} | |
}); | |
Object.defineProperty(exports, "toBlock", { | |
enumerable: true, | |
get: function get() { | |
return _toBlock.default; | |
} | |
}); | |
Object.defineProperty(exports, "toComputedKey", { | |
enumerable: true, | |
get: function get() { | |
return _toComputedKey.default; | |
} | |
}); | |
Object.defineProperty(exports, "toExpression", { | |
enumerable: true, | |
get: function get() { | |
return _toExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "toIdentifier", { | |
enumerable: true, | |
get: function get() { | |
return _toIdentifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "toKeyAlias", { | |
enumerable: true, | |
get: function get() { | |
return _toKeyAlias.default; | |
} | |
}); | |
Object.defineProperty(exports, "toSequenceExpression", { | |
enumerable: true, | |
get: function get() { | |
return _toSequenceExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "toStatement", { | |
enumerable: true, | |
get: function get() { | |
return _toStatement.default; | |
} | |
}); | |
Object.defineProperty(exports, "valueToNode", { | |
enumerable: true, | |
get: function get() { | |
return _valueToNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "appendToMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _appendToMemberExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "inherits", { | |
enumerable: true, | |
get: function get() { | |
return _inherits.default; | |
} | |
}); | |
Object.defineProperty(exports, "prependToMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _prependToMemberExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeProperties", { | |
enumerable: true, | |
get: function get() { | |
return _removeProperties.default; | |
} | |
}); | |
Object.defineProperty(exports, "removePropertiesDeep", { | |
enumerable: true, | |
get: function get() { | |
return _removePropertiesDeep.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeTypeDuplicates", { | |
enumerable: true, | |
get: function get() { | |
return _removeTypeDuplicates.default; | |
} | |
}); | |
Object.defineProperty(exports, "getBindingIdentifiers", { | |
enumerable: true, | |
get: function get() { | |
return _getBindingIdentifiers.default; | |
} | |
}); | |
Object.defineProperty(exports, "getOuterBindingIdentifiers", { | |
enumerable: true, | |
get: function get() { | |
return _getOuterBindingIdentifiers.default; | |
} | |
}); | |
Object.defineProperty(exports, "traverse", { | |
enumerable: true, | |
get: function get() { | |
return _traverse.default; | |
} | |
}); | |
Object.defineProperty(exports, "traverseFast", { | |
enumerable: true, | |
get: function get() { | |
return _traverseFast.default; | |
} | |
}); | |
Object.defineProperty(exports, "shallowEqual", { | |
enumerable: true, | |
get: function get() { | |
return _shallowEqual.default; | |
} | |
}); | |
Object.defineProperty(exports, "is", { | |
enumerable: true, | |
get: function get() { | |
return _is.default; | |
} | |
}); | |
Object.defineProperty(exports, "isBinding", { | |
enumerable: true, | |
get: function get() { | |
return _isBinding.default; | |
} | |
}); | |
Object.defineProperty(exports, "isBlockScoped", { | |
enumerable: true, | |
get: function get() { | |
return _isBlockScoped.default; | |
} | |
}); | |
Object.defineProperty(exports, "isImmutable", { | |
enumerable: true, | |
get: function get() { | |
return _isImmutable.default; | |
} | |
}); | |
Object.defineProperty(exports, "isLet", { | |
enumerable: true, | |
get: function get() { | |
return _isLet.default; | |
} | |
}); | |
Object.defineProperty(exports, "isNode", { | |
enumerable: true, | |
get: function get() { | |
return _isNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "isNodesEquivalent", { | |
enumerable: true, | |
get: function get() { | |
return _isNodesEquivalent.default; | |
} | |
}); | |
Object.defineProperty(exports, "isReferenced", { | |
enumerable: true, | |
get: function get() { | |
return _isReferenced.default; | |
} | |
}); | |
Object.defineProperty(exports, "isScope", { | |
enumerable: true, | |
get: function get() { | |
return _isScope.default; | |
} | |
}); | |
Object.defineProperty(exports, "isSpecifierDefault", { | |
enumerable: true, | |
get: function get() { | |
return _isSpecifierDefault.default; | |
} | |
}); | |
Object.defineProperty(exports, "isType", { | |
enumerable: true, | |
get: function get() { | |
return _isType.default; | |
} | |
}); | |
Object.defineProperty(exports, "isValidES3Identifier", { | |
enumerable: true, | |
get: function get() { | |
return _isValidES3Identifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "isValidIdentifier", { | |
enumerable: true, | |
get: function get() { | |
return _isValidIdentifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "isVar", { | |
enumerable: true, | |
get: function get() { | |
return _isVar.default; | |
} | |
}); | |
Object.defineProperty(exports, "matchesPattern", { | |
enumerable: true, | |
get: function get() { | |
return _matchesPattern.default; | |
} | |
}); | |
Object.defineProperty(exports, "validate", { | |
enumerable: true, | |
get: function get() { | |
return _validate.default; | |
} | |
}); | |
Object.defineProperty(exports, "buildMatchMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _buildMatchMemberExpression.default; | |
} | |
}); | |
exports.react = void 0; | |
var _isReactComponent = _interopRequireDefault(__webpack_require__(573)); | |
var _isCompatTag = _interopRequireDefault(__webpack_require__(574)); | |
var _buildChildren = _interopRequireDefault(__webpack_require__(575)); | |
var _assertNode = _interopRequireDefault(__webpack_require__(644)); | |
var _generated = __webpack_require__(645); | |
Object.keys(_generated).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated[key]; | |
} | |
}); | |
}); | |
var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(__webpack_require__(646)); | |
var _createUnionTypeAnnotation = _interopRequireDefault(__webpack_require__(647)); | |
var _generated2 = __webpack_require__(22); | |
Object.keys(_generated2).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated2[key]; | |
} | |
}); | |
}); | |
var _cloneNode = _interopRequireDefault(__webpack_require__(92)); | |
var _clone = _interopRequireDefault(__webpack_require__(281)); | |
var _cloneDeep = _interopRequireDefault(__webpack_require__(648)); | |
var _cloneWithoutLoc = _interopRequireDefault(__webpack_require__(649)); | |
var _addComment = _interopRequireDefault(__webpack_require__(650)); | |
var _addComments = _interopRequireDefault(__webpack_require__(282)); | |
var _inheritInnerComments = _interopRequireDefault(__webpack_require__(283)); | |
var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(286)); | |
var _inheritsComments = _interopRequireDefault(__webpack_require__(287)); | |
var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(288)); | |
var _removeComments = _interopRequireDefault(__webpack_require__(661)); | |
var _generated3 = __webpack_require__(662); | |
Object.keys(_generated3).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated3[key]; | |
} | |
}); | |
}); | |
var _constants = __webpack_require__(66); | |
Object.keys(_constants).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _constants[key]; | |
} | |
}); | |
}); | |
var _ensureBlock = _interopRequireDefault(__webpack_require__(663)); | |
var _toBindingIdentifierName = _interopRequireDefault(__webpack_require__(664)); | |
var _toBlock = _interopRequireDefault(__webpack_require__(289)); | |
var _toComputedKey = _interopRequireDefault(__webpack_require__(665)); | |
var _toExpression = _interopRequireDefault(__webpack_require__(666)); | |
var _toIdentifier = _interopRequireDefault(__webpack_require__(290)); | |
var _toKeyAlias = _interopRequireDefault(__webpack_require__(667)); | |
var _toSequenceExpression = _interopRequireDefault(__webpack_require__(668)); | |
var _toStatement = _interopRequireDefault(__webpack_require__(670)); | |
var _valueToNode = _interopRequireDefault(__webpack_require__(671)); | |
var _definitions = __webpack_require__(37); | |
Object.keys(_definitions).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _definitions[key]; | |
} | |
}); | |
}); | |
var _appendToMemberExpression = _interopRequireDefault(__webpack_require__(673)); | |
var _inherits = _interopRequireDefault(__webpack_require__(674)); | |
var _prependToMemberExpression = _interopRequireDefault(__webpack_require__(675)); | |
var _removeProperties = _interopRequireDefault(__webpack_require__(293)); | |
var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(291)); | |
var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(280)); | |
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(124)); | |
var _getOuterBindingIdentifiers = _interopRequireDefault(__webpack_require__(676)); | |
var _traverse = _interopRequireDefault(__webpack_require__(677)); | |
var _traverseFast = _interopRequireDefault(__webpack_require__(292)); | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(157)); | |
var _is = _interopRequireDefault(__webpack_require__(171)); | |
var _isBinding = _interopRequireDefault(__webpack_require__(678)); | |
var _isBlockScoped = _interopRequireDefault(__webpack_require__(679)); | |
var _isImmutable = _interopRequireDefault(__webpack_require__(680)); | |
var _isLet = _interopRequireDefault(__webpack_require__(294)); | |
var _isNode = _interopRequireDefault(__webpack_require__(279)); | |
var _isNodesEquivalent = _interopRequireDefault(__webpack_require__(681)); | |
var _isReferenced = _interopRequireDefault(__webpack_require__(682)); | |
var _isScope = _interopRequireDefault(__webpack_require__(683)); | |
var _isSpecifierDefault = _interopRequireDefault(__webpack_require__(684)); | |
var _isType = _interopRequireDefault(__webpack_require__(172)); | |
var _isValidES3Identifier = _interopRequireDefault(__webpack_require__(685)); | |
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(91)); | |
var _isVar = _interopRequireDefault(__webpack_require__(686)); | |
var _matchesPattern = _interopRequireDefault(__webpack_require__(259)); | |
var _validate = _interopRequireDefault(__webpack_require__(278)); | |
var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(258)); | |
var _generated4 = __webpack_require__(9); | |
Object.keys(_generated4).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated4[key]; | |
} | |
}); | |
}); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
var react = { | |
isReactComponent: _isReactComponent.default, | |
isCompatTag: _isCompatTag.default, | |
buildChildren: _buildChildren.default | |
}; | |
exports.react = react; | |
/***/ }), | |
/* 5 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _exportNames = { | |
react: true, | |
assertNode: true, | |
createTypeAnnotationBasedOnTypeof: true, | |
createUnionTypeAnnotation: true, | |
cloneNode: true, | |
clone: true, | |
cloneDeep: true, | |
cloneWithoutLoc: true, | |
addComment: true, | |
addComments: true, | |
inheritInnerComments: true, | |
inheritLeadingComments: true, | |
inheritsComments: true, | |
inheritTrailingComments: true, | |
removeComments: true, | |
ensureBlock: true, | |
toBindingIdentifierName: true, | |
toBlock: true, | |
toComputedKey: true, | |
toExpression: true, | |
toIdentifier: true, | |
toKeyAlias: true, | |
toSequenceExpression: true, | |
toStatement: true, | |
valueToNode: true, | |
appendToMemberExpression: true, | |
inherits: true, | |
prependToMemberExpression: true, | |
removeProperties: true, | |
removePropertiesDeep: true, | |
removeTypeDuplicates: true, | |
getBindingIdentifiers: true, | |
getOuterBindingIdentifiers: true, | |
traverse: true, | |
traverseFast: true, | |
shallowEqual: true, | |
is: true, | |
isBinding: true, | |
isBlockScoped: true, | |
isImmutable: true, | |
isLet: true, | |
isNode: true, | |
isNodesEquivalent: true, | |
isReferenced: true, | |
isScope: true, | |
isSpecifierDefault: true, | |
isType: true, | |
isValidES3Identifier: true, | |
isValidIdentifier: true, | |
isVar: true, | |
matchesPattern: true, | |
validate: true, | |
buildMatchMemberExpression: true | |
}; | |
Object.defineProperty(exports, "assertNode", { | |
enumerable: true, | |
get: function get() { | |
return _assertNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { | |
enumerable: true, | |
get: function get() { | |
return _createTypeAnnotationBasedOnTypeof.default; | |
} | |
}); | |
Object.defineProperty(exports, "createUnionTypeAnnotation", { | |
enumerable: true, | |
get: function get() { | |
return _createUnionTypeAnnotation.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneNode", { | |
enumerable: true, | |
get: function get() { | |
return _cloneNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "clone", { | |
enumerable: true, | |
get: function get() { | |
return _clone.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneDeep", { | |
enumerable: true, | |
get: function get() { | |
return _cloneDeep.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneWithoutLoc", { | |
enumerable: true, | |
get: function get() { | |
return _cloneWithoutLoc.default; | |
} | |
}); | |
Object.defineProperty(exports, "addComment", { | |
enumerable: true, | |
get: function get() { | |
return _addComment.default; | |
} | |
}); | |
Object.defineProperty(exports, "addComments", { | |
enumerable: true, | |
get: function get() { | |
return _addComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritInnerComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritInnerComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritLeadingComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritLeadingComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritsComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritsComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritTrailingComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritTrailingComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeComments", { | |
enumerable: true, | |
get: function get() { | |
return _removeComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "ensureBlock", { | |
enumerable: true, | |
get: function get() { | |
return _ensureBlock.default; | |
} | |
}); | |
Object.defineProperty(exports, "toBindingIdentifierName", { | |
enumerable: true, | |
get: function get() { | |
return _toBindingIdentifierName.default; | |
} | |
}); | |
Object.defineProperty(exports, "toBlock", { | |
enumerable: true, | |
get: function get() { | |
return _toBlock.default; | |
} | |
}); | |
Object.defineProperty(exports, "toComputedKey", { | |
enumerable: true, | |
get: function get() { | |
return _toComputedKey.default; | |
} | |
}); | |
Object.defineProperty(exports, "toExpression", { | |
enumerable: true, | |
get: function get() { | |
return _toExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "toIdentifier", { | |
enumerable: true, | |
get: function get() { | |
return _toIdentifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "toKeyAlias", { | |
enumerable: true, | |
get: function get() { | |
return _toKeyAlias.default; | |
} | |
}); | |
Object.defineProperty(exports, "toSequenceExpression", { | |
enumerable: true, | |
get: function get() { | |
return _toSequenceExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "toStatement", { | |
enumerable: true, | |
get: function get() { | |
return _toStatement.default; | |
} | |
}); | |
Object.defineProperty(exports, "valueToNode", { | |
enumerable: true, | |
get: function get() { | |
return _valueToNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "appendToMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _appendToMemberExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "inherits", { | |
enumerable: true, | |
get: function get() { | |
return _inherits.default; | |
} | |
}); | |
Object.defineProperty(exports, "prependToMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _prependToMemberExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeProperties", { | |
enumerable: true, | |
get: function get() { | |
return _removeProperties.default; | |
} | |
}); | |
Object.defineProperty(exports, "removePropertiesDeep", { | |
enumerable: true, | |
get: function get() { | |
return _removePropertiesDeep.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeTypeDuplicates", { | |
enumerable: true, | |
get: function get() { | |
return _removeTypeDuplicates.default; | |
} | |
}); | |
Object.defineProperty(exports, "getBindingIdentifiers", { | |
enumerable: true, | |
get: function get() { | |
return _getBindingIdentifiers.default; | |
} | |
}); | |
Object.defineProperty(exports, "getOuterBindingIdentifiers", { | |
enumerable: true, | |
get: function get() { | |
return _getOuterBindingIdentifiers.default; | |
} | |
}); | |
Object.defineProperty(exports, "traverse", { | |
enumerable: true, | |
get: function get() { | |
return _traverse.default; | |
} | |
}); | |
Object.defineProperty(exports, "traverseFast", { | |
enumerable: true, | |
get: function get() { | |
return _traverseFast.default; | |
} | |
}); | |
Object.defineProperty(exports, "shallowEqual", { | |
enumerable: true, | |
get: function get() { | |
return _shallowEqual.default; | |
} | |
}); | |
Object.defineProperty(exports, "is", { | |
enumerable: true, | |
get: function get() { | |
return _is.default; | |
} | |
}); | |
Object.defineProperty(exports, "isBinding", { | |
enumerable: true, | |
get: function get() { | |
return _isBinding.default; | |
} | |
}); | |
Object.defineProperty(exports, "isBlockScoped", { | |
enumerable: true, | |
get: function get() { | |
return _isBlockScoped.default; | |
} | |
}); | |
Object.defineProperty(exports, "isImmutable", { | |
enumerable: true, | |
get: function get() { | |
return _isImmutable.default; | |
} | |
}); | |
Object.defineProperty(exports, "isLet", { | |
enumerable: true, | |
get: function get() { | |
return _isLet.default; | |
} | |
}); | |
Object.defineProperty(exports, "isNode", { | |
enumerable: true, | |
get: function get() { | |
return _isNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "isNodesEquivalent", { | |
enumerable: true, | |
get: function get() { | |
return _isNodesEquivalent.default; | |
} | |
}); | |
Object.defineProperty(exports, "isReferenced", { | |
enumerable: true, | |
get: function get() { | |
return _isReferenced.default; | |
} | |
}); | |
Object.defineProperty(exports, "isScope", { | |
enumerable: true, | |
get: function get() { | |
return _isScope.default; | |
} | |
}); | |
Object.defineProperty(exports, "isSpecifierDefault", { | |
enumerable: true, | |
get: function get() { | |
return _isSpecifierDefault.default; | |
} | |
}); | |
Object.defineProperty(exports, "isType", { | |
enumerable: true, | |
get: function get() { | |
return _isType.default; | |
} | |
}); | |
Object.defineProperty(exports, "isValidES3Identifier", { | |
enumerable: true, | |
get: function get() { | |
return _isValidES3Identifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "isValidIdentifier", { | |
enumerable: true, | |
get: function get() { | |
return _isValidIdentifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "isVar", { | |
enumerable: true, | |
get: function get() { | |
return _isVar.default; | |
} | |
}); | |
Object.defineProperty(exports, "matchesPattern", { | |
enumerable: true, | |
get: function get() { | |
return _matchesPattern.default; | |
} | |
}); | |
Object.defineProperty(exports, "validate", { | |
enumerable: true, | |
get: function get() { | |
return _validate.default; | |
} | |
}); | |
Object.defineProperty(exports, "buildMatchMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _buildMatchMemberExpression.default; | |
} | |
}); | |
exports.react = void 0; | |
var _isReactComponent = _interopRequireDefault(__webpack_require__(1935)); | |
var _isCompatTag = _interopRequireDefault(__webpack_require__(1936)); | |
var _buildChildren = _interopRequireDefault(__webpack_require__(1937)); | |
var _assertNode = _interopRequireDefault(__webpack_require__(1945)); | |
var _generated = __webpack_require__(1946); | |
Object.keys(_generated).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated[key]; | |
} | |
}); | |
}); | |
var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(__webpack_require__(1947)); | |
var _createUnionTypeAnnotation = _interopRequireDefault(__webpack_require__(1948)); | |
var _generated2 = __webpack_require__(31); | |
Object.keys(_generated2).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated2[key]; | |
} | |
}); | |
}); | |
var _cloneNode = _interopRequireDefault(__webpack_require__(111)); | |
var _clone = _interopRequireDefault(__webpack_require__(504)); | |
var _cloneDeep = _interopRequireDefault(__webpack_require__(1949)); | |
var _cloneWithoutLoc = _interopRequireDefault(__webpack_require__(1950)); | |
var _addComment = _interopRequireDefault(__webpack_require__(1951)); | |
var _addComments = _interopRequireDefault(__webpack_require__(505)); | |
var _inheritInnerComments = _interopRequireDefault(__webpack_require__(506)); | |
var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(507)); | |
var _inheritsComments = _interopRequireDefault(__webpack_require__(508)); | |
var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(509)); | |
var _removeComments = _interopRequireDefault(__webpack_require__(1952)); | |
var _generated3 = __webpack_require__(1953); | |
Object.keys(_generated3).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated3[key]; | |
} | |
}); | |
}); | |
var _constants = __webpack_require__(76); | |
Object.keys(_constants).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _constants[key]; | |
} | |
}); | |
}); | |
var _ensureBlock = _interopRequireDefault(__webpack_require__(1954)); | |
var _toBindingIdentifierName = _interopRequireDefault(__webpack_require__(1955)); | |
var _toBlock = _interopRequireDefault(__webpack_require__(510)); | |
var _toComputedKey = _interopRequireDefault(__webpack_require__(1956)); | |
var _toExpression = _interopRequireDefault(__webpack_require__(1957)); | |
var _toIdentifier = _interopRequireDefault(__webpack_require__(511)); | |
var _toKeyAlias = _interopRequireDefault(__webpack_require__(1958)); | |
var _toSequenceExpression = _interopRequireDefault(__webpack_require__(1959)); | |
var _toStatement = _interopRequireDefault(__webpack_require__(1961)); | |
var _valueToNode = _interopRequireDefault(__webpack_require__(1962)); | |
var _definitions = __webpack_require__(43); | |
Object.keys(_definitions).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _definitions[key]; | |
} | |
}); | |
}); | |
var _appendToMemberExpression = _interopRequireDefault(__webpack_require__(1963)); | |
var _inherits = _interopRequireDefault(__webpack_require__(1964)); | |
var _prependToMemberExpression = _interopRequireDefault(__webpack_require__(1965)); | |
var _removeProperties = _interopRequireDefault(__webpack_require__(514)); | |
var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(512)); | |
var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(503)); | |
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(150)); | |
var _getOuterBindingIdentifiers = _interopRequireDefault(__webpack_require__(1966)); | |
var _traverse = _interopRequireDefault(__webpack_require__(1967)); | |
var _traverseFast = _interopRequireDefault(__webpack_require__(513)); | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(231)); | |
var _is = _interopRequireDefault(__webpack_require__(233)); | |
var _isBinding = _interopRequireDefault(__webpack_require__(1968)); | |
var _isBlockScoped = _interopRequireDefault(__webpack_require__(1969)); | |
var _isImmutable = _interopRequireDefault(__webpack_require__(1970)); | |
var _isLet = _interopRequireDefault(__webpack_require__(515)); | |
var _isNode = _interopRequireDefault(__webpack_require__(502)); | |
var _isNodesEquivalent = _interopRequireDefault(__webpack_require__(1971)); | |
var _isReferenced = _interopRequireDefault(__webpack_require__(1972)); | |
var _isScope = _interopRequireDefault(__webpack_require__(1973)); | |
var _isSpecifierDefault = _interopRequireDefault(__webpack_require__(1974)); | |
var _isType = _interopRequireDefault(__webpack_require__(234)); | |
var _isValidES3Identifier = _interopRequireDefault(__webpack_require__(1975)); | |
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(110)); | |
var _isVar = _interopRequireDefault(__webpack_require__(1976)); | |
var _matchesPattern = _interopRequireDefault(__webpack_require__(500)); | |
var _validate = _interopRequireDefault(__webpack_require__(501)); | |
var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(499)); | |
var _generated4 = __webpack_require__(15); | |
Object.keys(_generated4).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated4[key]; | |
} | |
}); | |
}); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
var react = { | |
isReactComponent: _isReactComponent.default, | |
isCompatTag: _isCompatTag.default, | |
buildChildren: _buildChildren.default | |
}; | |
exports.react = react; | |
/***/ }), | |
/* 6 */ | |
/***/ (function(module, exports) { | |
var process = module.exports = {}; | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
function defaultSetTimout() { | |
throw new Error('setTimeout has not been defined'); | |
} | |
function defaultClearTimeout() { | |
throw new Error('clearTimeout has not been defined'); | |
} | |
(function () { | |
try { | |
if (typeof setTimeout === 'function') { | |
cachedSetTimeout = setTimeout; | |
} else { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
} catch (e) { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
if (typeof clearTimeout === 'function') { | |
cachedClearTimeout = clearTimeout; | |
} else { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} catch (e) { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
})(); | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
return setTimeout(fun, 0); | |
} | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
cachedSetTimeout = setTimeout; | |
return setTimeout(fun, 0); | |
} | |
try { | |
return cachedSetTimeout(fun, 0); | |
} catch (e) { | |
try { | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch (e) { | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
return clearTimeout(marker); | |
} | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
cachedClearTimeout = clearTimeout; | |
return clearTimeout(marker); | |
} | |
try { | |
return cachedClearTimeout(marker); | |
} catch (e) { | |
try { | |
return cachedClearTimeout.call(null, marker); | |
} catch (e) { | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
var queue = []; | |
var draining = false; | |
var currentQueue; | |
var queueIndex = -1; | |
function cleanUpNextTick() { | |
if (!draining || !currentQueue) { | |
return; | |
} | |
draining = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
function drainQueue() { | |
if (draining) { | |
return; | |
} | |
var timeout = runTimeout(cleanUpNextTick); | |
draining = true; | |
var len = queue.length; | |
while (len) { | |
currentQueue = queue; | |
queue = []; | |
while (++queueIndex < len) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
queueIndex = -1; | |
len = queue.length; | |
} | |
currentQueue = null; | |
draining = false; | |
runClearTimeout(timeout); | |
} | |
process.nextTick = function (fun) { | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
for (var i = 1; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (queue.length === 1 && !draining) { | |
runTimeout(drainQueue); | |
} | |
}; | |
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 = ''; | |
process.versions = {}; | |
function noop() {} | |
process.on = noop; | |
process.addListener = noop; | |
process.once = noop; | |
process.off = noop; | |
process.removeListener = noop; | |
process.removeAllListeners = noop; | |
process.emit = noop; | |
process.prependListener = noop; | |
process.prependOnceListener = noop; | |
process.listeners = function (name) { | |
return []; | |
}; | |
process.binding = function (name) { | |
throw new Error('process.binding is not supported'); | |
}; | |
process.cwd = function () { | |
return '/'; | |
}; | |
process.chdir = function (dir) { | |
throw new Error('process.chdir is not supported'); | |
}; | |
process.umask = function () { | |
return 0; | |
}; | |
/***/ }), | |
/* 7 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {function normalizeArray(parts, allowAboveRoot) { | |
var up = 0; | |
for (var i = parts.length - 1; i >= 0; i--) { | |
var last = parts[i]; | |
if (last === '.') { | |
parts.splice(i, 1); | |
} else if (last === '..') { | |
parts.splice(i, 1); | |
up++; | |
} else if (up) { | |
parts.splice(i, 1); | |
up--; | |
} | |
} | |
if (allowAboveRoot) { | |
for (; up--; up) { | |
parts.unshift('..'); | |
} | |
} | |
return parts; | |
} | |
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; | |
var splitPath = function splitPath(filename) { | |
return splitPathRe.exec(filename).slice(1); | |
}; | |
exports.resolve = function () { | |
var resolvedPath = '', | |
resolvedAbsolute = false; | |
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { | |
var path = i >= 0 ? arguments[i] : process.cwd(); | |
if (typeof path !== 'string') { | |
throw new TypeError('Arguments to path.resolve must be strings'); | |
} else if (!path) { | |
continue; | |
} | |
resolvedPath = path + '/' + resolvedPath; | |
resolvedAbsolute = path.charAt(0) === '/'; | |
} | |
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) { | |
return !!p; | |
}), !resolvedAbsolute).join('/'); | |
return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; | |
}; | |
exports.normalize = function (path) { | |
var isAbsolute = exports.isAbsolute(path), | |
trailingSlash = substr(path, -1) === '/'; | |
path = normalizeArray(filter(path.split('/'), function (p) { | |
return !!p; | |
}), !isAbsolute).join('/'); | |
if (!path && !isAbsolute) { | |
path = '.'; | |
} | |
if (path && trailingSlash) { | |
path += '/'; | |
} | |
return (isAbsolute ? '/' : '') + path; | |
}; | |
exports.isAbsolute = function (path) { | |
return path.charAt(0) === '/'; | |
}; | |
exports.join = function () { | |
var paths = Array.prototype.slice.call(arguments, 0); | |
return exports.normalize(filter(paths, function (p, index) { | |
if (typeof p !== 'string') { | |
throw new TypeError('Arguments to path.join must be strings'); | |
} | |
return p; | |
}).join('/')); | |
}; | |
exports.relative = function (from, to) { | |
from = exports.resolve(from).substr(1); | |
to = exports.resolve(to).substr(1); | |
function trim(arr) { | |
var start = 0; | |
for (; start < arr.length; start++) { | |
if (arr[start] !== '') break; | |
} | |
var end = arr.length - 1; | |
for (; end >= 0; end--) { | |
if (arr[end] !== '') break; | |
} | |
if (start > end) return []; | |
return arr.slice(start, end - start + 1); | |
} | |
var fromParts = trim(from.split('/')); | |
var toParts = trim(to.split('/')); | |
var length = Math.min(fromParts.length, toParts.length); | |
var samePartsLength = length; | |
for (var i = 0; i < length; i++) { | |
if (fromParts[i] !== toParts[i]) { | |
samePartsLength = i; | |
break; | |
} | |
} | |
var outputParts = []; | |
for (var i = samePartsLength; i < fromParts.length; i++) { | |
outputParts.push('..'); | |
} | |
outputParts = outputParts.concat(toParts.slice(samePartsLength)); | |
return outputParts.join('/'); | |
}; | |
exports.sep = '/'; | |
exports.delimiter = ':'; | |
exports.dirname = function (path) { | |
var result = splitPath(path), | |
root = result[0], | |
dir = result[1]; | |
if (!root && !dir) { | |
return '.'; | |
} | |
if (dir) { | |
dir = dir.substr(0, dir.length - 1); | |
} | |
return root + dir; | |
}; | |
exports.basename = function (path, ext) { | |
var f = splitPath(path)[2]; | |
if (ext && f.substr(-1 * ext.length) === ext) { | |
f = f.substr(0, f.length - ext.length); | |
} | |
return f; | |
}; | |
exports.extname = function (path) { | |
return splitPath(path)[3]; | |
}; | |
function filter(xs, f) { | |
if (xs.filter) return xs.filter(f); | |
var res = []; | |
for (var i = 0; i < xs.length; i++) { | |
if (f(xs[i], i, xs)) res.push(xs[i]); | |
} | |
return res; | |
} | |
var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) { | |
return str.substr(start, len); | |
} : function (str, start, len) { | |
if (start < 0) start = str.length + start; | |
return str.substr(start, len); | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | |
/***/ }), | |
/* 8 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _exportNames = { | |
react: true, | |
assertNode: true, | |
createTypeAnnotationBasedOnTypeof: true, | |
createUnionTypeAnnotation: true, | |
cloneNode: true, | |
clone: true, | |
cloneDeep: true, | |
cloneWithoutLoc: true, | |
addComment: true, | |
addComments: true, | |
inheritInnerComments: true, | |
inheritLeadingComments: true, | |
inheritsComments: true, | |
inheritTrailingComments: true, | |
removeComments: true, | |
ensureBlock: true, | |
toBindingIdentifierName: true, | |
toBlock: true, | |
toComputedKey: true, | |
toExpression: true, | |
toIdentifier: true, | |
toKeyAlias: true, | |
toSequenceExpression: true, | |
toStatement: true, | |
valueToNode: true, | |
appendToMemberExpression: true, | |
inherits: true, | |
prependToMemberExpression: true, | |
removeProperties: true, | |
removePropertiesDeep: true, | |
removeTypeDuplicates: true, | |
getBindingIdentifiers: true, | |
getOuterBindingIdentifiers: true, | |
traverse: true, | |
traverseFast: true, | |
shallowEqual: true, | |
is: true, | |
isBinding: true, | |
isBlockScoped: true, | |
isImmutable: true, | |
isLet: true, | |
isNode: true, | |
isNodesEquivalent: true, | |
isReferenced: true, | |
isScope: true, | |
isSpecifierDefault: true, | |
isType: true, | |
isValidES3Identifier: true, | |
isValidIdentifier: true, | |
isVar: true, | |
matchesPattern: true, | |
validate: true, | |
buildMatchMemberExpression: true | |
}; | |
Object.defineProperty(exports, "assertNode", { | |
enumerable: true, | |
get: function get() { | |
return _assertNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { | |
enumerable: true, | |
get: function get() { | |
return _createTypeAnnotationBasedOnTypeof.default; | |
} | |
}); | |
Object.defineProperty(exports, "createUnionTypeAnnotation", { | |
enumerable: true, | |
get: function get() { | |
return _createUnionTypeAnnotation.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneNode", { | |
enumerable: true, | |
get: function get() { | |
return _cloneNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "clone", { | |
enumerable: true, | |
get: function get() { | |
return _clone.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneDeep", { | |
enumerable: true, | |
get: function get() { | |
return _cloneDeep.default; | |
} | |
}); | |
Object.defineProperty(exports, "cloneWithoutLoc", { | |
enumerable: true, | |
get: function get() { | |
return _cloneWithoutLoc.default; | |
} | |
}); | |
Object.defineProperty(exports, "addComment", { | |
enumerable: true, | |
get: function get() { | |
return _addComment.default; | |
} | |
}); | |
Object.defineProperty(exports, "addComments", { | |
enumerable: true, | |
get: function get() { | |
return _addComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritInnerComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritInnerComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritLeadingComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritLeadingComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritsComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritsComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "inheritTrailingComments", { | |
enumerable: true, | |
get: function get() { | |
return _inheritTrailingComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeComments", { | |
enumerable: true, | |
get: function get() { | |
return _removeComments.default; | |
} | |
}); | |
Object.defineProperty(exports, "ensureBlock", { | |
enumerable: true, | |
get: function get() { | |
return _ensureBlock.default; | |
} | |
}); | |
Object.defineProperty(exports, "toBindingIdentifierName", { | |
enumerable: true, | |
get: function get() { | |
return _toBindingIdentifierName.default; | |
} | |
}); | |
Object.defineProperty(exports, "toBlock", { | |
enumerable: true, | |
get: function get() { | |
return _toBlock.default; | |
} | |
}); | |
Object.defineProperty(exports, "toComputedKey", { | |
enumerable: true, | |
get: function get() { | |
return _toComputedKey.default; | |
} | |
}); | |
Object.defineProperty(exports, "toExpression", { | |
enumerable: true, | |
get: function get() { | |
return _toExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "toIdentifier", { | |
enumerable: true, | |
get: function get() { | |
return _toIdentifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "toKeyAlias", { | |
enumerable: true, | |
get: function get() { | |
return _toKeyAlias.default; | |
} | |
}); | |
Object.defineProperty(exports, "toSequenceExpression", { | |
enumerable: true, | |
get: function get() { | |
return _toSequenceExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "toStatement", { | |
enumerable: true, | |
get: function get() { | |
return _toStatement.default; | |
} | |
}); | |
Object.defineProperty(exports, "valueToNode", { | |
enumerable: true, | |
get: function get() { | |
return _valueToNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "appendToMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _appendToMemberExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "inherits", { | |
enumerable: true, | |
get: function get() { | |
return _inherits.default; | |
} | |
}); | |
Object.defineProperty(exports, "prependToMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _prependToMemberExpression.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeProperties", { | |
enumerable: true, | |
get: function get() { | |
return _removeProperties.default; | |
} | |
}); | |
Object.defineProperty(exports, "removePropertiesDeep", { | |
enumerable: true, | |
get: function get() { | |
return _removePropertiesDeep.default; | |
} | |
}); | |
Object.defineProperty(exports, "removeTypeDuplicates", { | |
enumerable: true, | |
get: function get() { | |
return _removeTypeDuplicates.default; | |
} | |
}); | |
Object.defineProperty(exports, "getBindingIdentifiers", { | |
enumerable: true, | |
get: function get() { | |
return _getBindingIdentifiers.default; | |
} | |
}); | |
Object.defineProperty(exports, "getOuterBindingIdentifiers", { | |
enumerable: true, | |
get: function get() { | |
return _getOuterBindingIdentifiers.default; | |
} | |
}); | |
Object.defineProperty(exports, "traverse", { | |
enumerable: true, | |
get: function get() { | |
return _traverse.default; | |
} | |
}); | |
Object.defineProperty(exports, "traverseFast", { | |
enumerable: true, | |
get: function get() { | |
return _traverseFast.default; | |
} | |
}); | |
Object.defineProperty(exports, "shallowEqual", { | |
enumerable: true, | |
get: function get() { | |
return _shallowEqual.default; | |
} | |
}); | |
Object.defineProperty(exports, "is", { | |
enumerable: true, | |
get: function get() { | |
return _is.default; | |
} | |
}); | |
Object.defineProperty(exports, "isBinding", { | |
enumerable: true, | |
get: function get() { | |
return _isBinding.default; | |
} | |
}); | |
Object.defineProperty(exports, "isBlockScoped", { | |
enumerable: true, | |
get: function get() { | |
return _isBlockScoped.default; | |
} | |
}); | |
Object.defineProperty(exports, "isImmutable", { | |
enumerable: true, | |
get: function get() { | |
return _isImmutable.default; | |
} | |
}); | |
Object.defineProperty(exports, "isLet", { | |
enumerable: true, | |
get: function get() { | |
return _isLet.default; | |
} | |
}); | |
Object.defineProperty(exports, "isNode", { | |
enumerable: true, | |
get: function get() { | |
return _isNode.default; | |
} | |
}); | |
Object.defineProperty(exports, "isNodesEquivalent", { | |
enumerable: true, | |
get: function get() { | |
return _isNodesEquivalent.default; | |
} | |
}); | |
Object.defineProperty(exports, "isReferenced", { | |
enumerable: true, | |
get: function get() { | |
return _isReferenced.default; | |
} | |
}); | |
Object.defineProperty(exports, "isScope", { | |
enumerable: true, | |
get: function get() { | |
return _isScope.default; | |
} | |
}); | |
Object.defineProperty(exports, "isSpecifierDefault", { | |
enumerable: true, | |
get: function get() { | |
return _isSpecifierDefault.default; | |
} | |
}); | |
Object.defineProperty(exports, "isType", { | |
enumerable: true, | |
get: function get() { | |
return _isType.default; | |
} | |
}); | |
Object.defineProperty(exports, "isValidES3Identifier", { | |
enumerable: true, | |
get: function get() { | |
return _isValidES3Identifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "isValidIdentifier", { | |
enumerable: true, | |
get: function get() { | |
return _isValidIdentifier.default; | |
} | |
}); | |
Object.defineProperty(exports, "isVar", { | |
enumerable: true, | |
get: function get() { | |
return _isVar.default; | |
} | |
}); | |
Object.defineProperty(exports, "matchesPattern", { | |
enumerable: true, | |
get: function get() { | |
return _matchesPattern.default; | |
} | |
}); | |
Object.defineProperty(exports, "validate", { | |
enumerable: true, | |
get: function get() { | |
return _validate.default; | |
} | |
}); | |
Object.defineProperty(exports, "buildMatchMemberExpression", { | |
enumerable: true, | |
get: function get() { | |
return _buildMatchMemberExpression.default; | |
} | |
}); | |
exports.react = void 0; | |
var _isReactComponent = _interopRequireDefault(__webpack_require__(1711)); | |
var _isCompatTag = _interopRequireDefault(__webpack_require__(1712)); | |
var _buildChildren = _interopRequireDefault(__webpack_require__(1713)); | |
var _assertNode = _interopRequireDefault(__webpack_require__(1721)); | |
var _generated = __webpack_require__(1722); | |
Object.keys(_generated).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated[key]; | |
} | |
}); | |
}); | |
var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(__webpack_require__(1723)); | |
var _createUnionTypeAnnotation = _interopRequireDefault(__webpack_require__(1724)); | |
var _generated2 = __webpack_require__(26); | |
Object.keys(_generated2).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated2[key]; | |
} | |
}); | |
}); | |
var _cloneNode = _interopRequireDefault(__webpack_require__(103)); | |
var _clone = _interopRequireDefault(__webpack_require__(425)); | |
var _cloneDeep = _interopRequireDefault(__webpack_require__(1725)); | |
var _cloneWithoutLoc = _interopRequireDefault(__webpack_require__(1726)); | |
var _addComment = _interopRequireDefault(__webpack_require__(1727)); | |
var _addComments = _interopRequireDefault(__webpack_require__(426)); | |
var _inheritInnerComments = _interopRequireDefault(__webpack_require__(427)); | |
var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(428)); | |
var _inheritsComments = _interopRequireDefault(__webpack_require__(429)); | |
var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(430)); | |
var _removeComments = _interopRequireDefault(__webpack_require__(1728)); | |
var _generated3 = __webpack_require__(1729); | |
Object.keys(_generated3).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated3[key]; | |
} | |
}); | |
}); | |
var _constants = __webpack_require__(71); | |
Object.keys(_constants).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _constants[key]; | |
} | |
}); | |
}); | |
var _ensureBlock = _interopRequireDefault(__webpack_require__(1730)); | |
var _toBindingIdentifierName = _interopRequireDefault(__webpack_require__(1731)); | |
var _toBlock = _interopRequireDefault(__webpack_require__(431)); | |
var _toComputedKey = _interopRequireDefault(__webpack_require__(1732)); | |
var _toExpression = _interopRequireDefault(__webpack_require__(1733)); | |
var _toIdentifier = _interopRequireDefault(__webpack_require__(432)); | |
var _toKeyAlias = _interopRequireDefault(__webpack_require__(1734)); | |
var _toSequenceExpression = _interopRequireDefault(__webpack_require__(1735)); | |
var _toStatement = _interopRequireDefault(__webpack_require__(1737)); | |
var _valueToNode = _interopRequireDefault(__webpack_require__(1738)); | |
var _definitions = __webpack_require__(39); | |
Object.keys(_definitions).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _definitions[key]; | |
} | |
}); | |
}); | |
var _appendToMemberExpression = _interopRequireDefault(__webpack_require__(1739)); | |
var _inherits = _interopRequireDefault(__webpack_require__(1740)); | |
var _prependToMemberExpression = _interopRequireDefault(__webpack_require__(1741)); | |
var _removeProperties = _interopRequireDefault(__webpack_require__(435)); | |
var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(433)); | |
var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(424)); | |
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(145)); | |
var _getOuterBindingIdentifiers = _interopRequireDefault(__webpack_require__(1742)); | |
var _traverse = _interopRequireDefault(__webpack_require__(1743)); | |
var _traverseFast = _interopRequireDefault(__webpack_require__(434)); | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(204)); | |
var _is = _interopRequireDefault(__webpack_require__(206)); | |
var _isBinding = _interopRequireDefault(__webpack_require__(1744)); | |
var _isBlockScoped = _interopRequireDefault(__webpack_require__(1745)); | |
var _isImmutable = _interopRequireDefault(__webpack_require__(1746)); | |
var _isLet = _interopRequireDefault(__webpack_require__(436)); | |
var _isNode = _interopRequireDefault(__webpack_require__(423)); | |
var _isNodesEquivalent = _interopRequireDefault(__webpack_require__(1747)); | |
var _isReferenced = _interopRequireDefault(__webpack_require__(1748)); | |
var _isScope = _interopRequireDefault(__webpack_require__(1749)); | |
var _isSpecifierDefault = _interopRequireDefault(__webpack_require__(1750)); | |
var _isType = _interopRequireDefault(__webpack_require__(207)); | |
var _isValidES3Identifier = _interopRequireDefault(__webpack_require__(1751)); | |
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(102)); | |
var _isVar = _interopRequireDefault(__webpack_require__(1752)); | |
var _matchesPattern = _interopRequireDefault(__webpack_require__(421)); | |
var _validate = _interopRequireDefault(__webpack_require__(422)); | |
var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(420)); | |
var _generated4 = __webpack_require__(11); | |
Object.keys(_generated4).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | |
Object.defineProperty(exports, key, { | |
enumerable: true, | |
get: function get() { | |
return _generated4[key]; | |
} | |
}); | |
}); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
var react = { | |
isReactComponent: _isReactComponent.default, | |
isCompatTag: _isCompatTag.default, | |
buildChildren: _buildChildren.default | |
}; | |
exports.react = react; | |
/***/ }), | |
/* 9 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.isArrayExpression = isArrayExpression; | |
exports.isAssignmentExpression = isAssignmentExpression; | |
exports.isBinaryExpression = isBinaryExpression; | |
exports.isInterpreterDirective = isInterpreterDirective; | |
exports.isDirective = isDirective; | |
exports.isDirectiveLiteral = isDirectiveLiteral; | |
exports.isBlockStatement = isBlockStatement; | |
exports.isBreakStatement = isBreakStatement; | |
exports.isCallExpression = isCallExpression; | |
exports.isCatchClause = isCatchClause; | |
exports.isConditionalExpression = isConditionalExpression; | |
exports.isContinueStatement = isContinueStatement; | |
exports.isDebuggerStatement = isDebuggerStatement; | |
exports.isDoWhileStatement = isDoWhileStatement; | |
exports.isEmptyStatement = isEmptyStatement; | |
exports.isExpressionStatement = isExpressionStatement; | |
exports.isFile = isFile; | |
exports.isForInStatement = isForInStatement; | |
exports.isForStatement = isForStatement; | |
exports.isFunctionDeclaration = isFunctionDeclaration; | |
exports.isFunctionExpression = isFunctionExpression; | |
exports.isIdentifier = isIdentifier; | |
exports.isIfStatement = isIfStatement; | |
exports.isLabeledStatement = isLabeledStatement; | |
exports.isStringLiteral = isStringLiteral; | |
exports.isNumericLiteral = isNumericLiteral; | |
exports.isNullLiteral = isNullLiteral; | |
exports.isBooleanLiteral = isBooleanLiteral; | |
exports.isRegExpLiteral = isRegExpLiteral; | |
exports.isLogicalExpression = isLogicalExpression; | |
exports.isMemberExpression = isMemberExpression; | |
exports.isNewExpression = isNewExpression; | |
exports.isProgram = isProgram; | |
exports.isObjectExpression = isObjectExpression; | |
exports.isObjectMethod = isObjectMethod; | |
exports.isObjectProperty = isObjectProperty; | |
exports.isRestElement = isRestElement; | |
exports.isReturnStatement = isReturnStatement; | |
exports.isSequenceExpression = isSequenceExpression; | |
exports.isSwitchCase = isSwitchCase; | |
exports.isSwitchStatement = isSwitchStatement; | |
exports.isThisExpression = isThisExpression; | |
exports.isThrowStatement = isThrowStatement; | |
exports.isTryStatement = isTryStatement; | |
exports.isUnaryExpression = isUnaryExpression; | |
exports.isUpdateExpression = isUpdateExpression; | |
exports.isVariableDeclaration = isVariableDeclaration; | |
exports.isVariableDeclarator = isVariableDeclarator; | |
exports.isWhileStatement = isWhileStatement; | |
exports.isWithStatement = isWithStatement; | |
exports.isAssignmentPattern = isAssignmentPattern; | |
exports.isArrayPattern = isArrayPattern; | |
exports.isArrowFunctionExpression = isArrowFunctionExpression; | |
exports.isClassBody = isClassBody; | |
exports.isClassDeclaration = isClassDeclaration; | |
exports.isClassExpression = isClassExpression; | |
exports.isExportAllDeclaration = isExportAllDeclaration; | |
exports.isExportDefaultDeclaration = isExportDefaultDeclaration; | |
exports.isExportNamedDeclaration = isExportNamedDeclaration; | |
exports.isExportSpecifier = isExportSpecifier; | |
exports.isForOfStatement = isForOfStatement; | |
exports.isImportDeclaration = isImportDeclaration; | |
exports.isImportDefaultSpecifier = isImportDefaultSpecifier; | |
exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier; | |
exports.isImportSpecifier = isImportSpecifier; | |
exports.isMetaProperty = isMetaProperty; | |
exports.isClassMethod = isClassMethod; | |
exports.isObjectPattern = isObjectPattern; | |
exports.isSpreadElement = isSpreadElement; | |
exports.isSuper = isSuper; | |
exports.isTaggedTemplateExpression = isTaggedTemplateExpression; | |
exports.isTemplateElement = isTemplateElement; | |
exports.isTemplateLiteral = isTemplateLiteral; | |
exports.isYieldExpression = isYieldExpression; | |
exports.isAnyTypeAnnotation = isAnyTypeAnnotation; | |
exports.isArrayTypeAnnotation = isArrayTypeAnnotation; | |
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation; | |
exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation; | |
exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation; | |
exports.isClassImplements = isClassImplements; | |
exports.isDeclareClass = isDeclareClass; | |
exports.isDeclareFunction = isDeclareFunction; | |
exports.isDeclareInterface = isDeclareInterface; | |
exports.isDeclareModule = isDeclareModule; | |
exports.isDeclareModuleExports = isDeclareModuleExports; | |
exports.isDeclareTypeAlias = isDeclareTypeAlias; | |
exports.isDeclareOpaqueType = isDeclareOpaqueType; | |
exports.isDeclareVariable = isDeclareVariable; | |
exports.isDeclareExportDeclaration = isDeclareExportDeclaration; | |
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration; | |
exports.isDeclaredPredicate = isDeclaredPredicate; | |
exports.isExistsTypeAnnotation = isExistsTypeAnnotation; | |
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; | |
exports.isFunctionTypeParam = isFunctionTypeParam; | |
exports.isGenericTypeAnnotation = isGenericTypeAnnotation; | |
exports.isInferredPredicate = isInferredPredicate; | |
exports.isInterfaceExtends = isInterfaceExtends; | |
exports.isInterfaceDeclaration = isInterfaceDeclaration; | |
exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; | |
exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; | |
exports.isMixedTypeAnnotation = isMixedTypeAnnotation; | |
exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; | |
exports.isNullableTypeAnnotation = isNullableTypeAnnotation; | |
exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; | |
exports.isNumberTypeAnnotation = isNumberTypeAnnotation; | |
exports.isObjectTypeAnnotation = isObjectTypeAnnotation; | |
exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; | |
exports.isObjectTypeCallProperty = isObjectTypeCallProperty; | |
exports.isObjectTypeIndexer = isObjectTypeIndexer; | |
exports.isObjectTypeProperty = isObjectTypeProperty; | |
exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty; | |
exports.isOpaqueType = isOpaqueType; | |
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier; | |
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation; | |
exports.isStringTypeAnnotation = isStringTypeAnnotation; | |
exports.isThisTypeAnnotation = isThisTypeAnnotation; | |
exports.isTupleTypeAnnotation = isTupleTypeAnnotation; | |
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation; | |
exports.isTypeAlias = isTypeAlias; | |
exports.isTypeAnnotation = isTypeAnnotation; | |
exports.isTypeCastExpression = isTypeCastExpression; | |
exports.isTypeParameter = isTypeParameter; | |
exports.isTypeParameterDeclaration = isTypeParameterDeclaration; | |
exports.isTypeParameterInstantiation = isTypeParameterInstantiation; | |
exports.isUnionTypeAnnotation = isUnionTypeAnnotation; | |
exports.isVariance = isVariance; | |
exports.isVoidTypeAnnotation = isVoidTypeAnnotation; | |
exports.isJSXAttribute = isJSXAttribute; | |
exports.isJSXClosingElement = isJSXClosingElement; | |
exports.isJSXElement = isJSXElement; | |
exports.isJSXEmptyExpression = isJSXEmptyExpression; | |
exports.isJSXExpressionContainer = isJSXExpressionContainer; | |
exports.isJSXSpreadChild = isJSXSpreadChild; | |
exports.isJSXIdentifier = isJSXIdentifier; | |
exports.isJSXMemberExpression = isJSXMemberExpression; | |
exports.isJSXNamespacedName = isJSXNamespacedName; | |
exports.isJSXOpeningElement = isJSXOpeningElement; | |
exports.isJSXSpreadAttribute = isJSXSpreadAttribute; | |
exports.isJSXText = isJSXText; | |
exports.isJSXFragment = isJSXFragment; | |
exports.isJSXOpeningFragment = isJSXOpeningFragment; | |
exports.isJSXClosingFragment = isJSXClosingFragment; | |
exports.isNoop = isNoop; | |
exports.isParenthesizedExpression = isParenthesizedExpression; | |
exports.isAwaitExpression = isAwaitExpression; | |
exports.isBindExpression = isBindExpression; | |
exports.isClassProperty = isClassProperty; | |
exports.isOptionalMemberExpression = isOptionalMemberExpression; | |
exports.isPipelineTopicExpression = isPipelineTopicExpression; | |
exports.isPipelineBareFunction = isPipelineBareFunction; | |
exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference; | |
exports.isOptionalCallExpression = isOptionalCallExpression; | |
exports.isClassPrivateProperty = isClassPrivateProperty; | |
exports.isClassPrivateMethod = isClassPrivateMethod; | |
exports.isImport = isImport; | |
exports.isDecorator = isDecorator; | |
exports.isDoExpression = isDoExpression; | |
exports.isExportDefaultSpecifier = isExportDefaultSpecifier; | |
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; | |
exports.isPrivateName = isPrivateName; | |
exports.isBigIntLiteral = isBigIntLiteral; | |
exports.isTSParameterProperty = isTSParameterProperty; | |
exports.isTSDeclareFunction = isTSDeclareFunction; | |
exports.isTSDeclareMethod = isTSDeclareMethod; | |
exports.isTSQualifiedName = isTSQualifiedName; | |
exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration; | |
exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration; | |
exports.isTSPropertySignature = isTSPropertySignature; | |
exports.isTSMethodSignature = isTSMethodSignature; | |
exports.isTSIndexSignature = isTSIndexSignature; | |
exports.isTSAnyKeyword = isTSAnyKeyword; | |
exports.isTSUnknownKeyword = isTSUnknownKeyword; | |
exports.isTSNumberKeyword = isTSNumberKeyword; | |
exports.isTSObjectKeyword = isTSObjectKeyword; | |
exports.isTSBooleanKeyword = isTSBooleanKeyword; | |
exports.isTSStringKeyword = isTSStringKeyword; | |
exports.isTSSymbolKeyword = isTSSymbolKeyword; | |
exports.isTSVoidKeyword = isTSVoidKeyword; | |
exports.isTSUndefinedKeyword = isTSUndefinedKeyword; | |
exports.isTSNullKeyword = isTSNullKeyword; | |
exports.isTSNeverKeyword = isTSNeverKeyword; | |
exports.isTSThisType = isTSThisType; | |
exports.isTSFunctionType = isTSFunctionType; | |
exports.isTSConstructorType = isTSConstructorType; | |
exports.isTSTypeReference = isTSTypeReference; | |
exports.isTSTypePredicate = isTSTypePredicate; | |
exports.isTSTypeQuery = isTSTypeQuery; | |
exports.isTSTypeLiteral = isTSTypeLiteral; | |
exports.isTSArrayType = isTSArrayType; | |
exports.isTSTupleType = isTSTupleType; | |
exports.isTSOptionalType = isTSOptionalType; | |
exports.isTSRestType = isTSRestType; | |
exports.isTSUnionType = isTSUnionType; | |
exports.isTSIntersectionType = isTSIntersectionType; | |
exports.isTSConditionalType = isTSConditionalType; | |
exports.isTSInferType = isTSInferType; | |
exports.isTSParenthesizedType = isTSParenthesizedType; | |
exports.isTSTypeOperator = isTSTypeOperator; | |
exports.isTSIndexedAccessType = isTSIndexedAccessType; | |
exports.isTSMappedType = isTSMappedType; | |
exports.isTSLiteralType = isTSLiteralType; | |
exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments; | |
exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration; | |
exports.isTSInterfaceBody = isTSInterfaceBody; | |
exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration; | |
exports.isTSAsExpression = isTSAsExpression; | |
exports.isTSTypeAssertion = isTSTypeAssertion; | |
exports.isTSEnumDeclaration = isTSEnumDeclaration; | |
exports.isTSEnumMember = isTSEnumMember; | |
exports.isTSModuleDeclaration = isTSModuleDeclaration; | |
exports.isTSModuleBlock = isTSModuleBlock; | |
exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; | |
exports.isTSExternalModuleReference = isTSExternalModuleReference; | |
exports.isTSNonNullExpression = isTSNonNullExpression; | |
exports.isTSExportAssignment = isTSExportAssignment; | |
exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration; | |
exports.isTSTypeAnnotation = isTSTypeAnnotation; | |
exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation; | |
exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration; | |
exports.isTSTypeParameter = isTSTypeParameter; | |
exports.isExpression = isExpression; | |
exports.isBinary = isBinary; | |
exports.isScopable = isScopable; | |
exports.isBlockParent = isBlockParent; | |
exports.isBlock = isBlock; | |
exports.isStatement = isStatement; | |
exports.isTerminatorless = isTerminatorless; | |
exports.isCompletionStatement = isCompletionStatement; | |
exports.isConditional = isConditional; | |
exports.isLoop = isLoop; | |
exports.isWhile = isWhile; | |
exports.isExpressionWrapper = isExpressionWrapper; | |
exports.isFor = isFor; | |
exports.isForXStatement = isForXStatement; | |
exports.isFunction = isFunction; | |
exports.isFunctionParent = isFunctionParent; | |
exports.isPureish = isPureish; | |
exports.isDeclaration = isDeclaration; | |
exports.isPatternLike = isPatternLike; | |
exports.isLVal = isLVal; | |
exports.isTSEntityName = isTSEntityName; | |
exports.isLiteral = isLiteral; | |
exports.isImmutable = isImmutable; | |
exports.isUserWhitespacable = isUserWhitespacable; | |
exports.isMethod = isMethod; | |
exports.isObjectMember = isObjectMember; | |
exports.isProperty = isProperty; | |
exports.isUnaryLike = isUnaryLike; | |
exports.isPattern = isPattern; | |
exports.isClass = isClass; | |
exports.isModuleDeclaration = isModuleDeclaration; | |
exports.isExportDeclaration = isExportDeclaration; | |
exports.isModuleSpecifier = isModuleSpecifier; | |
exports.isFlow = isFlow; | |
exports.isFlowType = isFlowType; | |
exports.isFlowBaseAnnotation = isFlowBaseAnnotation; | |
exports.isFlowDeclaration = isFlowDeclaration; | |
exports.isFlowPredicate = isFlowPredicate; | |
exports.isJSX = isJSX; | |
exports.isPrivate = isPrivate; | |
exports.isTSTypeElement = isTSTypeElement; | |
exports.isTSType = isTSType; | |
exports.isNumberLiteral = isNumberLiteral; | |
exports.isRegexLiteral = isRegexLiteral; | |
exports.isRestProperty = isRestProperty; | |
exports.isSpreadProperty = isSpreadProperty; | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(157)); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
function isArrayExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BinaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterpreterDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterpreterDirective") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Directive") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirectiveLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DirectiveLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBreakStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BreakStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCatchClause(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CatchClause") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditionalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ConditionalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isContinueStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ContinueStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDebuggerStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DebuggerStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoWhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "File") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForInStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForInStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Identifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLabeledStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LabeledStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumericLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumericLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegExpLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegExpLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLogicalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LogicalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNewExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NewExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProgram(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Program") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isReturnStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ReturnStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSequenceExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SequenceExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchCase(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchCase") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThrowStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThrowStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTryStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TryStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUpdateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UpdateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclarator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclarator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWithStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WithStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrowFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrowFunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamedDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamedDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForOfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForOfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMetaProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MetaProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSuper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Super") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTaggedTemplateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TaggedTemplateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isYieldExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "YieldExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAnyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AnyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassImplements(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassImplements") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareClass") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareInterface(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareInterface") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModule(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModule") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModuleExports(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModuleExports") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareTypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareOpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareVariable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareVariable") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclaredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExistsTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExistsTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeParam(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeParam") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isGenericTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "GenericTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInferredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InferredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceExtends(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceExtends") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIntersectionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IntersectionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMixedTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MixedTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullableTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullableTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeInternalSlot(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeInternalSlot") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeCallProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeCallProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeIndexer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeIndexer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeSpreadProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeSpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isQualifiedTypeIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "QualifiedTypeIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTupleTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TupleTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeofTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeofTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeCastExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeCastExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariance(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Variance") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVoidTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VoidTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXEmptyExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXEmptyExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXExpressionContainer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXExpressionContainer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadChild(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadChild") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXNamespacedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXNamespacedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXText(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXText") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Noop") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isParenthesizedExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ParenthesizedExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAwaitExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AwaitExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBindExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BindExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPipelineTopicExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PipelineTopicExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPipelineBareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PipelineBareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPipelinePrimaryTopicReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PipelinePrimaryTopicReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalCallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassPrivateProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassPrivateProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassPrivateMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassPrivateMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImport(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Import") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDecorator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Decorator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivateName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PrivateName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBigIntLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BigIntLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParameterProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParameterProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSQualifiedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSQualifiedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSCallSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSCallSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSPropertySignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSPropertySignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMethodSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMethodSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAnyKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAnyKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnknownKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnknownKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNumberKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNumberKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSObjectKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSObjectKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSBooleanKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSBooleanKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSStringKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSStringKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSSymbolKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSSymbolKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSVoidKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSVoidKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUndefinedKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUndefinedKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNullKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNullKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNeverKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNeverKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSThisType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSThisType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSFunctionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSFunctionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructorType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructorType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypePredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypePredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeQuery(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeQuery") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSArrayType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSArrayType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTupleType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTupleType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSOptionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSOptionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSRestType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSRestType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIntersectionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIntersectionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConditionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConditionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInferType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInferType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParenthesizedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParenthesizedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeOperator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeOperator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexedAccessType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexedAccessType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMappedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMappedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSLiteralType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSLiteralType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExpressionWithTypeArguments(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExpressionWithTypeArguments") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAliasDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAliasDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAsExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAsExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAssertion(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAssertion") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumMember") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleBlock") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSImportEqualsDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSImportEqualsDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExternalModuleReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExternalModuleReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNonNullExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNonNullExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExportAssignment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExportAssignment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNamespaceExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNamespaceExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "ParenthesizedExpression" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinary(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isScopable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTerminatorless(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCompletionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditional(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionWrapper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "TypeCastExpression" === nodeType || "ParenthesizedExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFor(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForXStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPureish(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPatternLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLVal(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEntityName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImmutable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUserWhitespacable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlow(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowBaseAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSX(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteral(node, opts) { | |
console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegexLiteral(node, opts) { | |
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegexLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestProperty(node, opts) { | |
console.trace("The node type RestProperty has been renamed to RestElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadProperty(node, opts) { | |
console.trace("The node type SpreadProperty has been renamed to SpreadElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
/***/ }), | |
/* 10 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.isArrayExpression = isArrayExpression; | |
exports.isAssignmentExpression = isAssignmentExpression; | |
exports.isBinaryExpression = isBinaryExpression; | |
exports.isInterpreterDirective = isInterpreterDirective; | |
exports.isDirective = isDirective; | |
exports.isDirectiveLiteral = isDirectiveLiteral; | |
exports.isBlockStatement = isBlockStatement; | |
exports.isBreakStatement = isBreakStatement; | |
exports.isCallExpression = isCallExpression; | |
exports.isCatchClause = isCatchClause; | |
exports.isConditionalExpression = isConditionalExpression; | |
exports.isContinueStatement = isContinueStatement; | |
exports.isDebuggerStatement = isDebuggerStatement; | |
exports.isDoWhileStatement = isDoWhileStatement; | |
exports.isEmptyStatement = isEmptyStatement; | |
exports.isExpressionStatement = isExpressionStatement; | |
exports.isFile = isFile; | |
exports.isForInStatement = isForInStatement; | |
exports.isForStatement = isForStatement; | |
exports.isFunctionDeclaration = isFunctionDeclaration; | |
exports.isFunctionExpression = isFunctionExpression; | |
exports.isIdentifier = isIdentifier; | |
exports.isIfStatement = isIfStatement; | |
exports.isLabeledStatement = isLabeledStatement; | |
exports.isStringLiteral = isStringLiteral; | |
exports.isNumericLiteral = isNumericLiteral; | |
exports.isNullLiteral = isNullLiteral; | |
exports.isBooleanLiteral = isBooleanLiteral; | |
exports.isRegExpLiteral = isRegExpLiteral; | |
exports.isLogicalExpression = isLogicalExpression; | |
exports.isMemberExpression = isMemberExpression; | |
exports.isNewExpression = isNewExpression; | |
exports.isProgram = isProgram; | |
exports.isObjectExpression = isObjectExpression; | |
exports.isObjectMethod = isObjectMethod; | |
exports.isObjectProperty = isObjectProperty; | |
exports.isRestElement = isRestElement; | |
exports.isReturnStatement = isReturnStatement; | |
exports.isSequenceExpression = isSequenceExpression; | |
exports.isSwitchCase = isSwitchCase; | |
exports.isSwitchStatement = isSwitchStatement; | |
exports.isThisExpression = isThisExpression; | |
exports.isThrowStatement = isThrowStatement; | |
exports.isTryStatement = isTryStatement; | |
exports.isUnaryExpression = isUnaryExpression; | |
exports.isUpdateExpression = isUpdateExpression; | |
exports.isVariableDeclaration = isVariableDeclaration; | |
exports.isVariableDeclarator = isVariableDeclarator; | |
exports.isWhileStatement = isWhileStatement; | |
exports.isWithStatement = isWithStatement; | |
exports.isAssignmentPattern = isAssignmentPattern; | |
exports.isArrayPattern = isArrayPattern; | |
exports.isArrowFunctionExpression = isArrowFunctionExpression; | |
exports.isClassBody = isClassBody; | |
exports.isClassDeclaration = isClassDeclaration; | |
exports.isClassExpression = isClassExpression; | |
exports.isExportAllDeclaration = isExportAllDeclaration; | |
exports.isExportDefaultDeclaration = isExportDefaultDeclaration; | |
exports.isExportNamedDeclaration = isExportNamedDeclaration; | |
exports.isExportSpecifier = isExportSpecifier; | |
exports.isForOfStatement = isForOfStatement; | |
exports.isImportDeclaration = isImportDeclaration; | |
exports.isImportDefaultSpecifier = isImportDefaultSpecifier; | |
exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier; | |
exports.isImportSpecifier = isImportSpecifier; | |
exports.isMetaProperty = isMetaProperty; | |
exports.isClassMethod = isClassMethod; | |
exports.isObjectPattern = isObjectPattern; | |
exports.isSpreadElement = isSpreadElement; | |
exports.isSuper = isSuper; | |
exports.isTaggedTemplateExpression = isTaggedTemplateExpression; | |
exports.isTemplateElement = isTemplateElement; | |
exports.isTemplateLiteral = isTemplateLiteral; | |
exports.isYieldExpression = isYieldExpression; | |
exports.isAnyTypeAnnotation = isAnyTypeAnnotation; | |
exports.isArrayTypeAnnotation = isArrayTypeAnnotation; | |
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation; | |
exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation; | |
exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation; | |
exports.isClassImplements = isClassImplements; | |
exports.isDeclareClass = isDeclareClass; | |
exports.isDeclareFunction = isDeclareFunction; | |
exports.isDeclareInterface = isDeclareInterface; | |
exports.isDeclareModule = isDeclareModule; | |
exports.isDeclareModuleExports = isDeclareModuleExports; | |
exports.isDeclareTypeAlias = isDeclareTypeAlias; | |
exports.isDeclareOpaqueType = isDeclareOpaqueType; | |
exports.isDeclareVariable = isDeclareVariable; | |
exports.isDeclareExportDeclaration = isDeclareExportDeclaration; | |
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration; | |
exports.isDeclaredPredicate = isDeclaredPredicate; | |
exports.isExistsTypeAnnotation = isExistsTypeAnnotation; | |
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; | |
exports.isFunctionTypeParam = isFunctionTypeParam; | |
exports.isGenericTypeAnnotation = isGenericTypeAnnotation; | |
exports.isInferredPredicate = isInferredPredicate; | |
exports.isInterfaceExtends = isInterfaceExtends; | |
exports.isInterfaceDeclaration = isInterfaceDeclaration; | |
exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; | |
exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; | |
exports.isMixedTypeAnnotation = isMixedTypeAnnotation; | |
exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; | |
exports.isNullableTypeAnnotation = isNullableTypeAnnotation; | |
exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; | |
exports.isNumberTypeAnnotation = isNumberTypeAnnotation; | |
exports.isObjectTypeAnnotation = isObjectTypeAnnotation; | |
exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; | |
exports.isObjectTypeCallProperty = isObjectTypeCallProperty; | |
exports.isObjectTypeIndexer = isObjectTypeIndexer; | |
exports.isObjectTypeProperty = isObjectTypeProperty; | |
exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty; | |
exports.isOpaqueType = isOpaqueType; | |
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier; | |
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation; | |
exports.isStringTypeAnnotation = isStringTypeAnnotation; | |
exports.isThisTypeAnnotation = isThisTypeAnnotation; | |
exports.isTupleTypeAnnotation = isTupleTypeAnnotation; | |
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation; | |
exports.isTypeAlias = isTypeAlias; | |
exports.isTypeAnnotation = isTypeAnnotation; | |
exports.isTypeCastExpression = isTypeCastExpression; | |
exports.isTypeParameter = isTypeParameter; | |
exports.isTypeParameterDeclaration = isTypeParameterDeclaration; | |
exports.isTypeParameterInstantiation = isTypeParameterInstantiation; | |
exports.isUnionTypeAnnotation = isUnionTypeAnnotation; | |
exports.isVariance = isVariance; | |
exports.isVoidTypeAnnotation = isVoidTypeAnnotation; | |
exports.isJSXAttribute = isJSXAttribute; | |
exports.isJSXClosingElement = isJSXClosingElement; | |
exports.isJSXElement = isJSXElement; | |
exports.isJSXEmptyExpression = isJSXEmptyExpression; | |
exports.isJSXExpressionContainer = isJSXExpressionContainer; | |
exports.isJSXSpreadChild = isJSXSpreadChild; | |
exports.isJSXIdentifier = isJSXIdentifier; | |
exports.isJSXMemberExpression = isJSXMemberExpression; | |
exports.isJSXNamespacedName = isJSXNamespacedName; | |
exports.isJSXOpeningElement = isJSXOpeningElement; | |
exports.isJSXSpreadAttribute = isJSXSpreadAttribute; | |
exports.isJSXText = isJSXText; | |
exports.isJSXFragment = isJSXFragment; | |
exports.isJSXOpeningFragment = isJSXOpeningFragment; | |
exports.isJSXClosingFragment = isJSXClosingFragment; | |
exports.isNoop = isNoop; | |
exports.isParenthesizedExpression = isParenthesizedExpression; | |
exports.isAwaitExpression = isAwaitExpression; | |
exports.isBindExpression = isBindExpression; | |
exports.isClassProperty = isClassProperty; | |
exports.isOptionalMemberExpression = isOptionalMemberExpression; | |
exports.isOptionalCallExpression = isOptionalCallExpression; | |
exports.isClassPrivateProperty = isClassPrivateProperty; | |
exports.isImport = isImport; | |
exports.isDecorator = isDecorator; | |
exports.isDoExpression = isDoExpression; | |
exports.isExportDefaultSpecifier = isExportDefaultSpecifier; | |
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; | |
exports.isPrivateName = isPrivateName; | |
exports.isBigIntLiteral = isBigIntLiteral; | |
exports.isTSParameterProperty = isTSParameterProperty; | |
exports.isTSDeclareFunction = isTSDeclareFunction; | |
exports.isTSDeclareMethod = isTSDeclareMethod; | |
exports.isTSQualifiedName = isTSQualifiedName; | |
exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration; | |
exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration; | |
exports.isTSPropertySignature = isTSPropertySignature; | |
exports.isTSMethodSignature = isTSMethodSignature; | |
exports.isTSIndexSignature = isTSIndexSignature; | |
exports.isTSAnyKeyword = isTSAnyKeyword; | |
exports.isTSNumberKeyword = isTSNumberKeyword; | |
exports.isTSObjectKeyword = isTSObjectKeyword; | |
exports.isTSBooleanKeyword = isTSBooleanKeyword; | |
exports.isTSStringKeyword = isTSStringKeyword; | |
exports.isTSSymbolKeyword = isTSSymbolKeyword; | |
exports.isTSVoidKeyword = isTSVoidKeyword; | |
exports.isTSUndefinedKeyword = isTSUndefinedKeyword; | |
exports.isTSNullKeyword = isTSNullKeyword; | |
exports.isTSNeverKeyword = isTSNeverKeyword; | |
exports.isTSThisType = isTSThisType; | |
exports.isTSFunctionType = isTSFunctionType; | |
exports.isTSConstructorType = isTSConstructorType; | |
exports.isTSTypeReference = isTSTypeReference; | |
exports.isTSTypePredicate = isTSTypePredicate; | |
exports.isTSTypeQuery = isTSTypeQuery; | |
exports.isTSTypeLiteral = isTSTypeLiteral; | |
exports.isTSArrayType = isTSArrayType; | |
exports.isTSTupleType = isTSTupleType; | |
exports.isTSUnionType = isTSUnionType; | |
exports.isTSIntersectionType = isTSIntersectionType; | |
exports.isTSConditionalType = isTSConditionalType; | |
exports.isTSInferType = isTSInferType; | |
exports.isTSParenthesizedType = isTSParenthesizedType; | |
exports.isTSTypeOperator = isTSTypeOperator; | |
exports.isTSIndexedAccessType = isTSIndexedAccessType; | |
exports.isTSMappedType = isTSMappedType; | |
exports.isTSLiteralType = isTSLiteralType; | |
exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments; | |
exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration; | |
exports.isTSInterfaceBody = isTSInterfaceBody; | |
exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration; | |
exports.isTSAsExpression = isTSAsExpression; | |
exports.isTSTypeAssertion = isTSTypeAssertion; | |
exports.isTSEnumDeclaration = isTSEnumDeclaration; | |
exports.isTSEnumMember = isTSEnumMember; | |
exports.isTSModuleDeclaration = isTSModuleDeclaration; | |
exports.isTSModuleBlock = isTSModuleBlock; | |
exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; | |
exports.isTSExternalModuleReference = isTSExternalModuleReference; | |
exports.isTSNonNullExpression = isTSNonNullExpression; | |
exports.isTSExportAssignment = isTSExportAssignment; | |
exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration; | |
exports.isTSTypeAnnotation = isTSTypeAnnotation; | |
exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation; | |
exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration; | |
exports.isTSTypeParameter = isTSTypeParameter; | |
exports.isExpression = isExpression; | |
exports.isBinary = isBinary; | |
exports.isScopable = isScopable; | |
exports.isBlockParent = isBlockParent; | |
exports.isBlock = isBlock; | |
exports.isStatement = isStatement; | |
exports.isTerminatorless = isTerminatorless; | |
exports.isCompletionStatement = isCompletionStatement; | |
exports.isConditional = isConditional; | |
exports.isLoop = isLoop; | |
exports.isWhile = isWhile; | |
exports.isExpressionWrapper = isExpressionWrapper; | |
exports.isFor = isFor; | |
exports.isForXStatement = isForXStatement; | |
exports.isFunction = isFunction; | |
exports.isFunctionParent = isFunctionParent; | |
exports.isPureish = isPureish; | |
exports.isDeclaration = isDeclaration; | |
exports.isPatternLike = isPatternLike; | |
exports.isLVal = isLVal; | |
exports.isTSEntityName = isTSEntityName; | |
exports.isLiteral = isLiteral; | |
exports.isImmutable = isImmutable; | |
exports.isUserWhitespacable = isUserWhitespacable; | |
exports.isMethod = isMethod; | |
exports.isObjectMember = isObjectMember; | |
exports.isProperty = isProperty; | |
exports.isUnaryLike = isUnaryLike; | |
exports.isPattern = isPattern; | |
exports.isClass = isClass; | |
exports.isModuleDeclaration = isModuleDeclaration; | |
exports.isExportDeclaration = isExportDeclaration; | |
exports.isModuleSpecifier = isModuleSpecifier; | |
exports.isFlow = isFlow; | |
exports.isFlowType = isFlowType; | |
exports.isFlowBaseAnnotation = isFlowBaseAnnotation; | |
exports.isFlowDeclaration = isFlowDeclaration; | |
exports.isFlowPredicate = isFlowPredicate; | |
exports.isJSX = isJSX; | |
exports.isPrivate = isPrivate; | |
exports.isTSTypeElement = isTSTypeElement; | |
exports.isTSType = isTSType; | |
exports.isNumberLiteral = isNumberLiteral; | |
exports.isRegexLiteral = isRegexLiteral; | |
exports.isRestProperty = isRestProperty; | |
exports.isSpreadProperty = isSpreadProperty; | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(192)); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
function isArrayExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BinaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterpreterDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterpreterDirective") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Directive") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirectiveLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DirectiveLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBreakStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BreakStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCatchClause(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CatchClause") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditionalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ConditionalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isContinueStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ContinueStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDebuggerStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DebuggerStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoWhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "File") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForInStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForInStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Identifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLabeledStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LabeledStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumericLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumericLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegExpLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegExpLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLogicalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LogicalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNewExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NewExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProgram(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Program") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isReturnStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ReturnStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSequenceExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SequenceExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchCase(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchCase") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThrowStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThrowStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTryStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TryStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUpdateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UpdateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclarator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclarator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWithStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WithStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrowFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrowFunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamedDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamedDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForOfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForOfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMetaProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MetaProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSuper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Super") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTaggedTemplateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TaggedTemplateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isYieldExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "YieldExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAnyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AnyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassImplements(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassImplements") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareClass") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareInterface(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareInterface") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModule(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModule") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModuleExports(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModuleExports") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareTypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareOpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareVariable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareVariable") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclaredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExistsTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExistsTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeParam(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeParam") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isGenericTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "GenericTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInferredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InferredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceExtends(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceExtends") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIntersectionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IntersectionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMixedTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MixedTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullableTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullableTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeInternalSlot(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeInternalSlot") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeCallProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeCallProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeIndexer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeIndexer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeSpreadProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeSpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isQualifiedTypeIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "QualifiedTypeIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTupleTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TupleTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeofTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeofTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeCastExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeCastExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariance(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Variance") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVoidTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VoidTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXEmptyExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXEmptyExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXExpressionContainer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXExpressionContainer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadChild(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadChild") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXNamespacedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXNamespacedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXText(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXText") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Noop") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isParenthesizedExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ParenthesizedExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAwaitExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AwaitExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBindExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BindExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalCallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassPrivateProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassPrivateProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImport(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Import") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDecorator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Decorator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivateName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PrivateName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBigIntLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BigIntLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParameterProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParameterProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSQualifiedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSQualifiedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSCallSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSCallSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSPropertySignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSPropertySignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMethodSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMethodSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAnyKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAnyKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNumberKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNumberKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSObjectKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSObjectKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSBooleanKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSBooleanKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSStringKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSStringKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSSymbolKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSSymbolKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSVoidKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSVoidKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUndefinedKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUndefinedKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNullKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNullKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNeverKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNeverKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSThisType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSThisType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSFunctionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSFunctionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructorType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructorType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypePredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypePredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeQuery(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeQuery") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSArrayType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSArrayType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTupleType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTupleType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIntersectionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIntersectionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConditionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConditionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInferType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInferType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParenthesizedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParenthesizedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeOperator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeOperator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexedAccessType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexedAccessType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMappedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMappedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSLiteralType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSLiteralType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExpressionWithTypeArguments(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExpressionWithTypeArguments") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAliasDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAliasDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAsExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAsExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAssertion(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAssertion") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumMember") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleBlock") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSImportEqualsDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSImportEqualsDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExternalModuleReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExternalModuleReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNonNullExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNonNullExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExportAssignment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExportAssignment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNamespaceExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNamespaceExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "ParenthesizedExpression" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinary(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isScopable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTerminatorless(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCompletionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditional(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionWrapper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "TypeCastExpression" === nodeType || "ParenthesizedExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFor(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForXStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPureish(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPatternLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLVal(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEntityName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImmutable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUserWhitespacable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlow(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowBaseAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSX(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "PrivateName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteral(node, opts) { | |
console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegexLiteral(node, opts) { | |
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegexLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestProperty(node, opts) { | |
console.trace("The node type RestProperty has been renamed to RestElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadProperty(node, opts) { | |
console.trace("The node type SpreadProperty has been renamed to SpreadElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
/***/ }), | |
/* 11 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.isArrayExpression = isArrayExpression; | |
exports.isAssignmentExpression = isAssignmentExpression; | |
exports.isBinaryExpression = isBinaryExpression; | |
exports.isInterpreterDirective = isInterpreterDirective; | |
exports.isDirective = isDirective; | |
exports.isDirectiveLiteral = isDirectiveLiteral; | |
exports.isBlockStatement = isBlockStatement; | |
exports.isBreakStatement = isBreakStatement; | |
exports.isCallExpression = isCallExpression; | |
exports.isCatchClause = isCatchClause; | |
exports.isConditionalExpression = isConditionalExpression; | |
exports.isContinueStatement = isContinueStatement; | |
exports.isDebuggerStatement = isDebuggerStatement; | |
exports.isDoWhileStatement = isDoWhileStatement; | |
exports.isEmptyStatement = isEmptyStatement; | |
exports.isExpressionStatement = isExpressionStatement; | |
exports.isFile = isFile; | |
exports.isForInStatement = isForInStatement; | |
exports.isForStatement = isForStatement; | |
exports.isFunctionDeclaration = isFunctionDeclaration; | |
exports.isFunctionExpression = isFunctionExpression; | |
exports.isIdentifier = isIdentifier; | |
exports.isIfStatement = isIfStatement; | |
exports.isLabeledStatement = isLabeledStatement; | |
exports.isStringLiteral = isStringLiteral; | |
exports.isNumericLiteral = isNumericLiteral; | |
exports.isNullLiteral = isNullLiteral; | |
exports.isBooleanLiteral = isBooleanLiteral; | |
exports.isRegExpLiteral = isRegExpLiteral; | |
exports.isLogicalExpression = isLogicalExpression; | |
exports.isMemberExpression = isMemberExpression; | |
exports.isNewExpression = isNewExpression; | |
exports.isProgram = isProgram; | |
exports.isObjectExpression = isObjectExpression; | |
exports.isObjectMethod = isObjectMethod; | |
exports.isObjectProperty = isObjectProperty; | |
exports.isRestElement = isRestElement; | |
exports.isReturnStatement = isReturnStatement; | |
exports.isSequenceExpression = isSequenceExpression; | |
exports.isSwitchCase = isSwitchCase; | |
exports.isSwitchStatement = isSwitchStatement; | |
exports.isThisExpression = isThisExpression; | |
exports.isThrowStatement = isThrowStatement; | |
exports.isTryStatement = isTryStatement; | |
exports.isUnaryExpression = isUnaryExpression; | |
exports.isUpdateExpression = isUpdateExpression; | |
exports.isVariableDeclaration = isVariableDeclaration; | |
exports.isVariableDeclarator = isVariableDeclarator; | |
exports.isWhileStatement = isWhileStatement; | |
exports.isWithStatement = isWithStatement; | |
exports.isAssignmentPattern = isAssignmentPattern; | |
exports.isArrayPattern = isArrayPattern; | |
exports.isArrowFunctionExpression = isArrowFunctionExpression; | |
exports.isClassBody = isClassBody; | |
exports.isClassDeclaration = isClassDeclaration; | |
exports.isClassExpression = isClassExpression; | |
exports.isExportAllDeclaration = isExportAllDeclaration; | |
exports.isExportDefaultDeclaration = isExportDefaultDeclaration; | |
exports.isExportNamedDeclaration = isExportNamedDeclaration; | |
exports.isExportSpecifier = isExportSpecifier; | |
exports.isForOfStatement = isForOfStatement; | |
exports.isImportDeclaration = isImportDeclaration; | |
exports.isImportDefaultSpecifier = isImportDefaultSpecifier; | |
exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier; | |
exports.isImportSpecifier = isImportSpecifier; | |
exports.isMetaProperty = isMetaProperty; | |
exports.isClassMethod = isClassMethod; | |
exports.isObjectPattern = isObjectPattern; | |
exports.isSpreadElement = isSpreadElement; | |
exports.isSuper = isSuper; | |
exports.isTaggedTemplateExpression = isTaggedTemplateExpression; | |
exports.isTemplateElement = isTemplateElement; | |
exports.isTemplateLiteral = isTemplateLiteral; | |
exports.isYieldExpression = isYieldExpression; | |
exports.isAnyTypeAnnotation = isAnyTypeAnnotation; | |
exports.isArrayTypeAnnotation = isArrayTypeAnnotation; | |
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation; | |
exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation; | |
exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation; | |
exports.isClassImplements = isClassImplements; | |
exports.isDeclareClass = isDeclareClass; | |
exports.isDeclareFunction = isDeclareFunction; | |
exports.isDeclareInterface = isDeclareInterface; | |
exports.isDeclareModule = isDeclareModule; | |
exports.isDeclareModuleExports = isDeclareModuleExports; | |
exports.isDeclareTypeAlias = isDeclareTypeAlias; | |
exports.isDeclareOpaqueType = isDeclareOpaqueType; | |
exports.isDeclareVariable = isDeclareVariable; | |
exports.isDeclareExportDeclaration = isDeclareExportDeclaration; | |
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration; | |
exports.isDeclaredPredicate = isDeclaredPredicate; | |
exports.isExistsTypeAnnotation = isExistsTypeAnnotation; | |
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; | |
exports.isFunctionTypeParam = isFunctionTypeParam; | |
exports.isGenericTypeAnnotation = isGenericTypeAnnotation; | |
exports.isInferredPredicate = isInferredPredicate; | |
exports.isInterfaceExtends = isInterfaceExtends; | |
exports.isInterfaceDeclaration = isInterfaceDeclaration; | |
exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; | |
exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; | |
exports.isMixedTypeAnnotation = isMixedTypeAnnotation; | |
exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; | |
exports.isNullableTypeAnnotation = isNullableTypeAnnotation; | |
exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; | |
exports.isNumberTypeAnnotation = isNumberTypeAnnotation; | |
exports.isObjectTypeAnnotation = isObjectTypeAnnotation; | |
exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; | |
exports.isObjectTypeCallProperty = isObjectTypeCallProperty; | |
exports.isObjectTypeIndexer = isObjectTypeIndexer; | |
exports.isObjectTypeProperty = isObjectTypeProperty; | |
exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty; | |
exports.isOpaqueType = isOpaqueType; | |
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier; | |
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation; | |
exports.isStringTypeAnnotation = isStringTypeAnnotation; | |
exports.isThisTypeAnnotation = isThisTypeAnnotation; | |
exports.isTupleTypeAnnotation = isTupleTypeAnnotation; | |
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation; | |
exports.isTypeAlias = isTypeAlias; | |
exports.isTypeAnnotation = isTypeAnnotation; | |
exports.isTypeCastExpression = isTypeCastExpression; | |
exports.isTypeParameter = isTypeParameter; | |
exports.isTypeParameterDeclaration = isTypeParameterDeclaration; | |
exports.isTypeParameterInstantiation = isTypeParameterInstantiation; | |
exports.isUnionTypeAnnotation = isUnionTypeAnnotation; | |
exports.isVariance = isVariance; | |
exports.isVoidTypeAnnotation = isVoidTypeAnnotation; | |
exports.isJSXAttribute = isJSXAttribute; | |
exports.isJSXClosingElement = isJSXClosingElement; | |
exports.isJSXElement = isJSXElement; | |
exports.isJSXEmptyExpression = isJSXEmptyExpression; | |
exports.isJSXExpressionContainer = isJSXExpressionContainer; | |
exports.isJSXSpreadChild = isJSXSpreadChild; | |
exports.isJSXIdentifier = isJSXIdentifier; | |
exports.isJSXMemberExpression = isJSXMemberExpression; | |
exports.isJSXNamespacedName = isJSXNamespacedName; | |
exports.isJSXOpeningElement = isJSXOpeningElement; | |
exports.isJSXSpreadAttribute = isJSXSpreadAttribute; | |
exports.isJSXText = isJSXText; | |
exports.isJSXFragment = isJSXFragment; | |
exports.isJSXOpeningFragment = isJSXOpeningFragment; | |
exports.isJSXClosingFragment = isJSXClosingFragment; | |
exports.isNoop = isNoop; | |
exports.isParenthesizedExpression = isParenthesizedExpression; | |
exports.isAwaitExpression = isAwaitExpression; | |
exports.isBindExpression = isBindExpression; | |
exports.isClassProperty = isClassProperty; | |
exports.isOptionalMemberExpression = isOptionalMemberExpression; | |
exports.isOptionalCallExpression = isOptionalCallExpression; | |
exports.isClassPrivateProperty = isClassPrivateProperty; | |
exports.isImport = isImport; | |
exports.isDecorator = isDecorator; | |
exports.isDoExpression = isDoExpression; | |
exports.isExportDefaultSpecifier = isExportDefaultSpecifier; | |
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; | |
exports.isPrivateName = isPrivateName; | |
exports.isBigIntLiteral = isBigIntLiteral; | |
exports.isTSParameterProperty = isTSParameterProperty; | |
exports.isTSDeclareFunction = isTSDeclareFunction; | |
exports.isTSDeclareMethod = isTSDeclareMethod; | |
exports.isTSQualifiedName = isTSQualifiedName; | |
exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration; | |
exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration; | |
exports.isTSPropertySignature = isTSPropertySignature; | |
exports.isTSMethodSignature = isTSMethodSignature; | |
exports.isTSIndexSignature = isTSIndexSignature; | |
exports.isTSAnyKeyword = isTSAnyKeyword; | |
exports.isTSUnknownKeyword = isTSUnknownKeyword; | |
exports.isTSNumberKeyword = isTSNumberKeyword; | |
exports.isTSObjectKeyword = isTSObjectKeyword; | |
exports.isTSBooleanKeyword = isTSBooleanKeyword; | |
exports.isTSStringKeyword = isTSStringKeyword; | |
exports.isTSSymbolKeyword = isTSSymbolKeyword; | |
exports.isTSVoidKeyword = isTSVoidKeyword; | |
exports.isTSUndefinedKeyword = isTSUndefinedKeyword; | |
exports.isTSNullKeyword = isTSNullKeyword; | |
exports.isTSNeverKeyword = isTSNeverKeyword; | |
exports.isTSThisType = isTSThisType; | |
exports.isTSFunctionType = isTSFunctionType; | |
exports.isTSConstructorType = isTSConstructorType; | |
exports.isTSTypeReference = isTSTypeReference; | |
exports.isTSTypePredicate = isTSTypePredicate; | |
exports.isTSTypeQuery = isTSTypeQuery; | |
exports.isTSTypeLiteral = isTSTypeLiteral; | |
exports.isTSArrayType = isTSArrayType; | |
exports.isTSTupleType = isTSTupleType; | |
exports.isTSOptionalType = isTSOptionalType; | |
exports.isTSRestType = isTSRestType; | |
exports.isTSUnionType = isTSUnionType; | |
exports.isTSIntersectionType = isTSIntersectionType; | |
exports.isTSConditionalType = isTSConditionalType; | |
exports.isTSInferType = isTSInferType; | |
exports.isTSParenthesizedType = isTSParenthesizedType; | |
exports.isTSTypeOperator = isTSTypeOperator; | |
exports.isTSIndexedAccessType = isTSIndexedAccessType; | |
exports.isTSMappedType = isTSMappedType; | |
exports.isTSLiteralType = isTSLiteralType; | |
exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments; | |
exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration; | |
exports.isTSInterfaceBody = isTSInterfaceBody; | |
exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration; | |
exports.isTSAsExpression = isTSAsExpression; | |
exports.isTSTypeAssertion = isTSTypeAssertion; | |
exports.isTSEnumDeclaration = isTSEnumDeclaration; | |
exports.isTSEnumMember = isTSEnumMember; | |
exports.isTSModuleDeclaration = isTSModuleDeclaration; | |
exports.isTSModuleBlock = isTSModuleBlock; | |
exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; | |
exports.isTSExternalModuleReference = isTSExternalModuleReference; | |
exports.isTSNonNullExpression = isTSNonNullExpression; | |
exports.isTSExportAssignment = isTSExportAssignment; | |
exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration; | |
exports.isTSTypeAnnotation = isTSTypeAnnotation; | |
exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation; | |
exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration; | |
exports.isTSTypeParameter = isTSTypeParameter; | |
exports.isExpression = isExpression; | |
exports.isBinary = isBinary; | |
exports.isScopable = isScopable; | |
exports.isBlockParent = isBlockParent; | |
exports.isBlock = isBlock; | |
exports.isStatement = isStatement; | |
exports.isTerminatorless = isTerminatorless; | |
exports.isCompletionStatement = isCompletionStatement; | |
exports.isConditional = isConditional; | |
exports.isLoop = isLoop; | |
exports.isWhile = isWhile; | |
exports.isExpressionWrapper = isExpressionWrapper; | |
exports.isFor = isFor; | |
exports.isForXStatement = isForXStatement; | |
exports.isFunction = isFunction; | |
exports.isFunctionParent = isFunctionParent; | |
exports.isPureish = isPureish; | |
exports.isDeclaration = isDeclaration; | |
exports.isPatternLike = isPatternLike; | |
exports.isLVal = isLVal; | |
exports.isTSEntityName = isTSEntityName; | |
exports.isLiteral = isLiteral; | |
exports.isImmutable = isImmutable; | |
exports.isUserWhitespacable = isUserWhitespacable; | |
exports.isMethod = isMethod; | |
exports.isObjectMember = isObjectMember; | |
exports.isProperty = isProperty; | |
exports.isUnaryLike = isUnaryLike; | |
exports.isPattern = isPattern; | |
exports.isClass = isClass; | |
exports.isModuleDeclaration = isModuleDeclaration; | |
exports.isExportDeclaration = isExportDeclaration; | |
exports.isModuleSpecifier = isModuleSpecifier; | |
exports.isFlow = isFlow; | |
exports.isFlowType = isFlowType; | |
exports.isFlowBaseAnnotation = isFlowBaseAnnotation; | |
exports.isFlowDeclaration = isFlowDeclaration; | |
exports.isFlowPredicate = isFlowPredicate; | |
exports.isJSX = isJSX; | |
exports.isPrivate = isPrivate; | |
exports.isTSTypeElement = isTSTypeElement; | |
exports.isTSType = isTSType; | |
exports.isNumberLiteral = isNumberLiteral; | |
exports.isRegexLiteral = isRegexLiteral; | |
exports.isRestProperty = isRestProperty; | |
exports.isSpreadProperty = isSpreadProperty; | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(204)); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
function isArrayExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BinaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterpreterDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterpreterDirective") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Directive") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirectiveLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DirectiveLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBreakStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BreakStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCatchClause(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CatchClause") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditionalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ConditionalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isContinueStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ContinueStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDebuggerStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DebuggerStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoWhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "File") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForInStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForInStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Identifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLabeledStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LabeledStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumericLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumericLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegExpLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegExpLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLogicalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LogicalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNewExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NewExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProgram(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Program") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isReturnStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ReturnStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSequenceExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SequenceExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchCase(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchCase") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThrowStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThrowStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTryStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TryStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUpdateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UpdateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclarator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclarator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWithStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WithStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrowFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrowFunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamedDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamedDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForOfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForOfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMetaProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MetaProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSuper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Super") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTaggedTemplateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TaggedTemplateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isYieldExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "YieldExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAnyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AnyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassImplements(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassImplements") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareClass") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareInterface(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareInterface") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModule(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModule") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModuleExports(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModuleExports") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareTypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareOpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareVariable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareVariable") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclaredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExistsTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExistsTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeParam(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeParam") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isGenericTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "GenericTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInferredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InferredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceExtends(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceExtends") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIntersectionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IntersectionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMixedTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MixedTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullableTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullableTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeInternalSlot(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeInternalSlot") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeCallProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeCallProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeIndexer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeIndexer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeSpreadProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeSpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isQualifiedTypeIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "QualifiedTypeIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTupleTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TupleTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeofTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeofTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeCastExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeCastExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariance(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Variance") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVoidTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VoidTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXEmptyExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXEmptyExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXExpressionContainer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXExpressionContainer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadChild(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadChild") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXNamespacedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXNamespacedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXText(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXText") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Noop") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isParenthesizedExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ParenthesizedExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAwaitExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AwaitExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBindExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BindExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalCallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassPrivateProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassPrivateProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImport(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Import") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDecorator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Decorator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivateName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PrivateName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBigIntLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BigIntLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParameterProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParameterProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSQualifiedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSQualifiedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSCallSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSCallSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSPropertySignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSPropertySignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMethodSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMethodSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAnyKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAnyKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnknownKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnknownKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNumberKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNumberKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSObjectKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSObjectKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSBooleanKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSBooleanKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSStringKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSStringKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSSymbolKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSSymbolKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSVoidKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSVoidKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUndefinedKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUndefinedKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNullKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNullKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNeverKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNeverKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSThisType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSThisType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSFunctionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSFunctionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructorType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructorType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypePredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypePredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeQuery(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeQuery") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSArrayType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSArrayType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTupleType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTupleType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSOptionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSOptionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSRestType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSRestType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIntersectionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIntersectionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConditionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConditionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInferType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInferType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParenthesizedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParenthesizedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeOperator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeOperator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexedAccessType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexedAccessType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMappedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMappedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSLiteralType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSLiteralType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExpressionWithTypeArguments(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExpressionWithTypeArguments") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAliasDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAliasDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAsExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAsExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAssertion(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAssertion") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumMember") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleBlock") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSImportEqualsDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSImportEqualsDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExternalModuleReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExternalModuleReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNonNullExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNonNullExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExportAssignment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExportAssignment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNamespaceExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNamespaceExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "ParenthesizedExpression" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinary(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isScopable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTerminatorless(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCompletionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditional(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionWrapper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "TypeCastExpression" === nodeType || "ParenthesizedExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFor(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForXStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPureish(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPatternLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLVal(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEntityName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImmutable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUserWhitespacable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlow(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowBaseAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSX(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "PrivateName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteral(node, opts) { | |
console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegexLiteral(node, opts) { | |
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegexLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestProperty(node, opts) { | |
console.trace("The node type RestProperty has been renamed to RestElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadProperty(node, opts) { | |
console.trace("The node type SpreadProperty has been renamed to SpreadElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
/***/ }), | |
/* 12 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.isArrayExpression = isArrayExpression; | |
exports.isAssignmentExpression = isAssignmentExpression; | |
exports.isBinaryExpression = isBinaryExpression; | |
exports.isInterpreterDirective = isInterpreterDirective; | |
exports.isDirective = isDirective; | |
exports.isDirectiveLiteral = isDirectiveLiteral; | |
exports.isBlockStatement = isBlockStatement; | |
exports.isBreakStatement = isBreakStatement; | |
exports.isCallExpression = isCallExpression; | |
exports.isCatchClause = isCatchClause; | |
exports.isConditionalExpression = isConditionalExpression; | |
exports.isContinueStatement = isContinueStatement; | |
exports.isDebuggerStatement = isDebuggerStatement; | |
exports.isDoWhileStatement = isDoWhileStatement; | |
exports.isEmptyStatement = isEmptyStatement; | |
exports.isExpressionStatement = isExpressionStatement; | |
exports.isFile = isFile; | |
exports.isForInStatement = isForInStatement; | |
exports.isForStatement = isForStatement; | |
exports.isFunctionDeclaration = isFunctionDeclaration; | |
exports.isFunctionExpression = isFunctionExpression; | |
exports.isIdentifier = isIdentifier; | |
exports.isIfStatement = isIfStatement; | |
exports.isLabeledStatement = isLabeledStatement; | |
exports.isStringLiteral = isStringLiteral; | |
exports.isNumericLiteral = isNumericLiteral; | |
exports.isNullLiteral = isNullLiteral; | |
exports.isBooleanLiteral = isBooleanLiteral; | |
exports.isRegExpLiteral = isRegExpLiteral; | |
exports.isLogicalExpression = isLogicalExpression; | |
exports.isMemberExpression = isMemberExpression; | |
exports.isNewExpression = isNewExpression; | |
exports.isProgram = isProgram; | |
exports.isObjectExpression = isObjectExpression; | |
exports.isObjectMethod = isObjectMethod; | |
exports.isObjectProperty = isObjectProperty; | |
exports.isRestElement = isRestElement; | |
exports.isReturnStatement = isReturnStatement; | |
exports.isSequenceExpression = isSequenceExpression; | |
exports.isSwitchCase = isSwitchCase; | |
exports.isSwitchStatement = isSwitchStatement; | |
exports.isThisExpression = isThisExpression; | |
exports.isThrowStatement = isThrowStatement; | |
exports.isTryStatement = isTryStatement; | |
exports.isUnaryExpression = isUnaryExpression; | |
exports.isUpdateExpression = isUpdateExpression; | |
exports.isVariableDeclaration = isVariableDeclaration; | |
exports.isVariableDeclarator = isVariableDeclarator; | |
exports.isWhileStatement = isWhileStatement; | |
exports.isWithStatement = isWithStatement; | |
exports.isAssignmentPattern = isAssignmentPattern; | |
exports.isArrayPattern = isArrayPattern; | |
exports.isArrowFunctionExpression = isArrowFunctionExpression; | |
exports.isClassBody = isClassBody; | |
exports.isClassDeclaration = isClassDeclaration; | |
exports.isClassExpression = isClassExpression; | |
exports.isExportAllDeclaration = isExportAllDeclaration; | |
exports.isExportDefaultDeclaration = isExportDefaultDeclaration; | |
exports.isExportNamedDeclaration = isExportNamedDeclaration; | |
exports.isExportSpecifier = isExportSpecifier; | |
exports.isForOfStatement = isForOfStatement; | |
exports.isImportDeclaration = isImportDeclaration; | |
exports.isImportDefaultSpecifier = isImportDefaultSpecifier; | |
exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier; | |
exports.isImportSpecifier = isImportSpecifier; | |
exports.isMetaProperty = isMetaProperty; | |
exports.isClassMethod = isClassMethod; | |
exports.isObjectPattern = isObjectPattern; | |
exports.isSpreadElement = isSpreadElement; | |
exports.isSuper = isSuper; | |
exports.isTaggedTemplateExpression = isTaggedTemplateExpression; | |
exports.isTemplateElement = isTemplateElement; | |
exports.isTemplateLiteral = isTemplateLiteral; | |
exports.isYieldExpression = isYieldExpression; | |
exports.isAnyTypeAnnotation = isAnyTypeAnnotation; | |
exports.isArrayTypeAnnotation = isArrayTypeAnnotation; | |
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation; | |
exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation; | |
exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation; | |
exports.isClassImplements = isClassImplements; | |
exports.isDeclareClass = isDeclareClass; | |
exports.isDeclareFunction = isDeclareFunction; | |
exports.isDeclareInterface = isDeclareInterface; | |
exports.isDeclareModule = isDeclareModule; | |
exports.isDeclareModuleExports = isDeclareModuleExports; | |
exports.isDeclareTypeAlias = isDeclareTypeAlias; | |
exports.isDeclareOpaqueType = isDeclareOpaqueType; | |
exports.isDeclareVariable = isDeclareVariable; | |
exports.isDeclareExportDeclaration = isDeclareExportDeclaration; | |
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration; | |
exports.isDeclaredPredicate = isDeclaredPredicate; | |
exports.isExistsTypeAnnotation = isExistsTypeAnnotation; | |
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; | |
exports.isFunctionTypeParam = isFunctionTypeParam; | |
exports.isGenericTypeAnnotation = isGenericTypeAnnotation; | |
exports.isInferredPredicate = isInferredPredicate; | |
exports.isInterfaceExtends = isInterfaceExtends; | |
exports.isInterfaceDeclaration = isInterfaceDeclaration; | |
exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; | |
exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; | |
exports.isMixedTypeAnnotation = isMixedTypeAnnotation; | |
exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; | |
exports.isNullableTypeAnnotation = isNullableTypeAnnotation; | |
exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; | |
exports.isNumberTypeAnnotation = isNumberTypeAnnotation; | |
exports.isObjectTypeAnnotation = isObjectTypeAnnotation; | |
exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; | |
exports.isObjectTypeCallProperty = isObjectTypeCallProperty; | |
exports.isObjectTypeIndexer = isObjectTypeIndexer; | |
exports.isObjectTypeProperty = isObjectTypeProperty; | |
exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty; | |
exports.isOpaqueType = isOpaqueType; | |
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier; | |
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation; | |
exports.isStringTypeAnnotation = isStringTypeAnnotation; | |
exports.isThisTypeAnnotation = isThisTypeAnnotation; | |
exports.isTupleTypeAnnotation = isTupleTypeAnnotation; | |
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation; | |
exports.isTypeAlias = isTypeAlias; | |
exports.isTypeAnnotation = isTypeAnnotation; | |
exports.isTypeCastExpression = isTypeCastExpression; | |
exports.isTypeParameter = isTypeParameter; | |
exports.isTypeParameterDeclaration = isTypeParameterDeclaration; | |
exports.isTypeParameterInstantiation = isTypeParameterInstantiation; | |
exports.isUnionTypeAnnotation = isUnionTypeAnnotation; | |
exports.isVariance = isVariance; | |
exports.isVoidTypeAnnotation = isVoidTypeAnnotation; | |
exports.isJSXAttribute = isJSXAttribute; | |
exports.isJSXClosingElement = isJSXClosingElement; | |
exports.isJSXElement = isJSXElement; | |
exports.isJSXEmptyExpression = isJSXEmptyExpression; | |
exports.isJSXExpressionContainer = isJSXExpressionContainer; | |
exports.isJSXSpreadChild = isJSXSpreadChild; | |
exports.isJSXIdentifier = isJSXIdentifier; | |
exports.isJSXMemberExpression = isJSXMemberExpression; | |
exports.isJSXNamespacedName = isJSXNamespacedName; | |
exports.isJSXOpeningElement = isJSXOpeningElement; | |
exports.isJSXSpreadAttribute = isJSXSpreadAttribute; | |
exports.isJSXText = isJSXText; | |
exports.isJSXFragment = isJSXFragment; | |
exports.isJSXOpeningFragment = isJSXOpeningFragment; | |
exports.isJSXClosingFragment = isJSXClosingFragment; | |
exports.isNoop = isNoop; | |
exports.isParenthesizedExpression = isParenthesizedExpression; | |
exports.isAwaitExpression = isAwaitExpression; | |
exports.isBindExpression = isBindExpression; | |
exports.isClassProperty = isClassProperty; | |
exports.isOptionalMemberExpression = isOptionalMemberExpression; | |
exports.isOptionalCallExpression = isOptionalCallExpression; | |
exports.isClassPrivateProperty = isClassPrivateProperty; | |
exports.isImport = isImport; | |
exports.isDecorator = isDecorator; | |
exports.isDoExpression = isDoExpression; | |
exports.isExportDefaultSpecifier = isExportDefaultSpecifier; | |
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; | |
exports.isPrivateName = isPrivateName; | |
exports.isBigIntLiteral = isBigIntLiteral; | |
exports.isTSParameterProperty = isTSParameterProperty; | |
exports.isTSDeclareFunction = isTSDeclareFunction; | |
exports.isTSDeclareMethod = isTSDeclareMethod; | |
exports.isTSQualifiedName = isTSQualifiedName; | |
exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration; | |
exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration; | |
exports.isTSPropertySignature = isTSPropertySignature; | |
exports.isTSMethodSignature = isTSMethodSignature; | |
exports.isTSIndexSignature = isTSIndexSignature; | |
exports.isTSAnyKeyword = isTSAnyKeyword; | |
exports.isTSUnknownKeyword = isTSUnknownKeyword; | |
exports.isTSNumberKeyword = isTSNumberKeyword; | |
exports.isTSObjectKeyword = isTSObjectKeyword; | |
exports.isTSBooleanKeyword = isTSBooleanKeyword; | |
exports.isTSStringKeyword = isTSStringKeyword; | |
exports.isTSSymbolKeyword = isTSSymbolKeyword; | |
exports.isTSVoidKeyword = isTSVoidKeyword; | |
exports.isTSUndefinedKeyword = isTSUndefinedKeyword; | |
exports.isTSNullKeyword = isTSNullKeyword; | |
exports.isTSNeverKeyword = isTSNeverKeyword; | |
exports.isTSThisType = isTSThisType; | |
exports.isTSFunctionType = isTSFunctionType; | |
exports.isTSConstructorType = isTSConstructorType; | |
exports.isTSTypeReference = isTSTypeReference; | |
exports.isTSTypePredicate = isTSTypePredicate; | |
exports.isTSTypeQuery = isTSTypeQuery; | |
exports.isTSTypeLiteral = isTSTypeLiteral; | |
exports.isTSArrayType = isTSArrayType; | |
exports.isTSTupleType = isTSTupleType; | |
exports.isTSOptionalType = isTSOptionalType; | |
exports.isTSRestType = isTSRestType; | |
exports.isTSUnionType = isTSUnionType; | |
exports.isTSIntersectionType = isTSIntersectionType; | |
exports.isTSConditionalType = isTSConditionalType; | |
exports.isTSInferType = isTSInferType; | |
exports.isTSParenthesizedType = isTSParenthesizedType; | |
exports.isTSTypeOperator = isTSTypeOperator; | |
exports.isTSIndexedAccessType = isTSIndexedAccessType; | |
exports.isTSMappedType = isTSMappedType; | |
exports.isTSLiteralType = isTSLiteralType; | |
exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments; | |
exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration; | |
exports.isTSInterfaceBody = isTSInterfaceBody; | |
exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration; | |
exports.isTSAsExpression = isTSAsExpression; | |
exports.isTSTypeAssertion = isTSTypeAssertion; | |
exports.isTSEnumDeclaration = isTSEnumDeclaration; | |
exports.isTSEnumMember = isTSEnumMember; | |
exports.isTSModuleDeclaration = isTSModuleDeclaration; | |
exports.isTSModuleBlock = isTSModuleBlock; | |
exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; | |
exports.isTSExternalModuleReference = isTSExternalModuleReference; | |
exports.isTSNonNullExpression = isTSNonNullExpression; | |
exports.isTSExportAssignment = isTSExportAssignment; | |
exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration; | |
exports.isTSTypeAnnotation = isTSTypeAnnotation; | |
exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation; | |
exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration; | |
exports.isTSTypeParameter = isTSTypeParameter; | |
exports.isExpression = isExpression; | |
exports.isBinary = isBinary; | |
exports.isScopable = isScopable; | |
exports.isBlockParent = isBlockParent; | |
exports.isBlock = isBlock; | |
exports.isStatement = isStatement; | |
exports.isTerminatorless = isTerminatorless; | |
exports.isCompletionStatement = isCompletionStatement; | |
exports.isConditional = isConditional; | |
exports.isLoop = isLoop; | |
exports.isWhile = isWhile; | |
exports.isExpressionWrapper = isExpressionWrapper; | |
exports.isFor = isFor; | |
exports.isForXStatement = isForXStatement; | |
exports.isFunction = isFunction; | |
exports.isFunctionParent = isFunctionParent; | |
exports.isPureish = isPureish; | |
exports.isDeclaration = isDeclaration; | |
exports.isPatternLike = isPatternLike; | |
exports.isLVal = isLVal; | |
exports.isTSEntityName = isTSEntityName; | |
exports.isLiteral = isLiteral; | |
exports.isImmutable = isImmutable; | |
exports.isUserWhitespacable = isUserWhitespacable; | |
exports.isMethod = isMethod; | |
exports.isObjectMember = isObjectMember; | |
exports.isProperty = isProperty; | |
exports.isUnaryLike = isUnaryLike; | |
exports.isPattern = isPattern; | |
exports.isClass = isClass; | |
exports.isModuleDeclaration = isModuleDeclaration; | |
exports.isExportDeclaration = isExportDeclaration; | |
exports.isModuleSpecifier = isModuleSpecifier; | |
exports.isFlow = isFlow; | |
exports.isFlowType = isFlowType; | |
exports.isFlowBaseAnnotation = isFlowBaseAnnotation; | |
exports.isFlowDeclaration = isFlowDeclaration; | |
exports.isFlowPredicate = isFlowPredicate; | |
exports.isJSX = isJSX; | |
exports.isPrivate = isPrivate; | |
exports.isTSTypeElement = isTSTypeElement; | |
exports.isTSType = isTSType; | |
exports.isNumberLiteral = isNumberLiteral; | |
exports.isRegexLiteral = isRegexLiteral; | |
exports.isRestProperty = isRestProperty; | |
exports.isSpreadProperty = isSpreadProperty; | |
var _shallowEqual = _interopRequireDefault(__webpack_require__(210)); | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default: obj | |
}; | |
} | |
function isArrayExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BinaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterpreterDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterpreterDirective") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirective(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Directive") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDirectiveLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DirectiveLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBreakStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BreakStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCatchClause(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CatchClause") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditionalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ConditionalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isContinueStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ContinueStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDebuggerStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DebuggerStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoWhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "File") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForInStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForInStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Identifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLabeledStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LabeledStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumericLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumericLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegExpLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegExpLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLogicalExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LogicalExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNewExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NewExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProgram(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Program") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isReturnStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ReturnStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSequenceExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SequenceExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchCase(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchCase") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSwitchStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SwitchStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThrowStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThrowStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTryStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TryStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUpdateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UpdateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariableDeclarator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VariableDeclarator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhileStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WhileStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWithStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "WithStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAssignmentPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AssignmentPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrowFunctionExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrowFunctionExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamedDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamedDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForOfStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForOfStatement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImportSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ImportSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMetaProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MetaProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectPattern") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSuper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Super") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTaggedTemplateExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TaggedTemplateExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTemplateLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TemplateLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isYieldExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "YieldExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAnyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AnyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isArrayTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ArrayTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBooleanLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BooleanLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassImplements(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassImplements") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareClass") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareInterface(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareInterface") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModule(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModule") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareModuleExports(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareModuleExports") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareTypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareOpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareVariable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareVariable") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclareExportAllDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclareExportAllDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DeclaredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExistsTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExistsTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionTypeParam(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionTypeParam") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isGenericTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "GenericTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInferredPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InferredPredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceExtends(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceExtends") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isInterfaceTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "InterfaceTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isIntersectionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "IntersectionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMixedTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "MixedTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isEmptyTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "EmptyTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNullableTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NullableTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeInternalSlot(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeInternalSlot") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeCallProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeCallProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeIndexer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeIndexer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectTypeSpreadProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectTypeSpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOpaqueType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OpaqueType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isQualifiedTypeIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "QualifiedTypeIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringLiteralTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringLiteralTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStringTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "StringTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isThisTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ThisTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTupleTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TupleTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeofTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeofTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAlias(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAlias") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeCastExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeCastExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnionTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnionTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVariance(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Variance") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isVoidTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "VoidTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXEmptyExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXEmptyExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXExpressionContainer(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXExpressionContainer") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadChild(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadChild") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXIdentifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXIdentifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXNamespacedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXNamespacedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningElement") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXSpreadAttribute(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXSpreadAttribute") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXText(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXText") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXOpeningFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXOpeningFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSXClosingFragment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSXClosingFragment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Noop") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isParenthesizedExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ParenthesizedExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isAwaitExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "AwaitExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBindExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BindExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalMemberExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalMemberExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isOptionalCallExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "OptionalCallExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClassPrivateProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ClassPrivateProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImport(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Import") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDecorator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Decorator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDoExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "DoExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDefaultSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDefaultSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportNamespaceSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportNamespaceSpecifier") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivateName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PrivateName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBigIntLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BigIntLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParameterProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParameterProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareFunction") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSDeclareMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSDeclareMethod") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSQualifiedName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSQualifiedName") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSCallSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSCallSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructSignatureDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructSignatureDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSPropertySignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSPropertySignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMethodSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMethodSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexSignature(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexSignature") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAnyKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAnyKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnknownKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnknownKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNumberKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNumberKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSObjectKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSObjectKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSBooleanKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSBooleanKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSStringKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSStringKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSSymbolKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSSymbolKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSVoidKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSVoidKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUndefinedKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUndefinedKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNullKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNullKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNeverKeyword(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNeverKeyword") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSThisType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSThisType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSFunctionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSFunctionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConstructorType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConstructorType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypePredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypePredicate") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeQuery(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeQuery") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSArrayType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSArrayType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTupleType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTupleType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSOptionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSOptionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSRestType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSRestType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSUnionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSUnionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIntersectionType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIntersectionType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSConditionalType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSConditionalType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInferType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInferType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSParenthesizedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSParenthesizedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeOperator(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeOperator") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSIndexedAccessType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSIndexedAccessType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSMappedType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSMappedType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSLiteralType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSLiteralType") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExpressionWithTypeArguments(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExpressionWithTypeArguments") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSInterfaceBody(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSInterfaceBody") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAliasDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAliasDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSAsExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSAsExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAssertion(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAssertion") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEnumMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEnumMember") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSModuleBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSModuleBlock") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSImportEqualsDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSImportEqualsDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExternalModuleReference(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExternalModuleReference") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNonNullExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNonNullExpression") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSExportAssignment(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSExportAssignment") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSNamespaceExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSNamespaceExportDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeAnnotation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterInstantiation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterInstantiation") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameterDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameterDeclaration") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeParameter(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeParameter") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpression(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "ParenthesizedExpression" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBinary(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isScopable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlockParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isBlock(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTerminatorless(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isCompletionStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isConditional(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLoop(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isWhile(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExpressionWrapper(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "TypeCastExpression" === nodeType || "ParenthesizedExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFor(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isForXStatement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunction(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFunctionParent(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPureish(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPatternLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLVal(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSEntityName(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isLiteral(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isImmutable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUserWhitespacable(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isMethod(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isObjectMember(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isProperty(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isUnaryLike(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPattern(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isClass(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isExportDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isModuleSpecifier(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlow(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowBaseAnnotation(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowDeclaration(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isFlowPredicate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isJSX(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isPrivate(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "PrivateName" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSTypeElement(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isTSType(node, opts) { | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType) { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isNumberLiteral(node, opts) { | |
console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "NumberLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRegexLiteral(node, opts) { | |
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RegexLiteral") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isRestProperty(node, opts) { | |
console.trace("The node type RestProperty has been renamed to RestElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "RestProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
function isSpreadProperty(node, opts) { | |
console.trace("The node type SpreadProperty has been renamed to SpreadElement"); | |
if (!node) return false; | |
var nodeType = node.type; | |
if (nodeType === "SpreadProperty") { | |
if (typeof opts === "undefined") { | |
return true; | |
} else { | |
return (0, _shallowEqual.default)(node, opts); | |
} | |
} | |
return false; | |
} | |
/***/ }), | |
/* 13 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.isArrayExpression = isArrayExpression; | |
exports.isAssignmentExpression = isAssignmentExpression; | |
exports.isBinaryExpression = isBinaryExpression; | |
exports.isInterpreterDirective = isInterpreterDirective; | |
exports.isDirective = isDirective; | |
exports.isDirectiveLiteral = isDirectiveLiteral; | |
exports.isBlockStatement = isBlockStatement; | |
exports.isBreakStatement = isBreakStatement; | |
exports.isCallExpression = isCallExpression; | |
exports.isCatchClause = isCatchClause; | |
exports.isConditionalExpression = isConditionalExpression; | |
exports.isContinueStatement = isContinueStatement; | |
exports.isDebuggerStatement = isDebuggerStatement; | |
exports.isDoWhileStatement = isDoWhileStatement; | |
exports.isEmptyStatement = isEmptyStatement; | |
exports.isExpressionStatement = isExpressionStatement; | |
exports.isFile = isFile; | |
exports.isForInStatement = isForInStatement; | |
exports.isForStatement = isForStatement; | |
exports.isFunctionDeclaration = isFunctionDeclaration; | |
exports.isFunctionExpression = isFunctionExpression; | |
exports.isIdentifier = isIdentifier; | |
exports.isIfStatement = isIfStatement; | |
exports.isLabeledStatement = isLabeledStatement; | |
exports.isStringLiteral = isStringLiteral; | |
exports.isNumericLiteral = isNumericLiteral; | |
exports.isNullLiteral = isNullLiteral; | |
exports.isBooleanLiteral = isBooleanLiteral; | |
exports.isRegExpLiteral = isRegExpLiteral; | |
exports.isLogicalExpression = isLogicalExpression; | |
exports.isMemberExpression = isMemberExpression; | |
exports.isNewExpression = isNewExpression; | |
exports.isProgram = isProgram; | |
exports.isObjectExpression = isObjectExpression; | |
exports.isObjectMethod = isObjectMethod; | |
exports.isObjectProperty = isObjectProperty; | |
exports.isRestElement = isRestElement; | |
exports.isReturnStatement = isReturnStatement; | |
exports.isSequenceExpression = isSequenceExpression; | |
exports.isSwitchCase = isSwitchCase; | |
exports.isSwitchStatement = isSwitchStatement; | |
exports.isThisExpression = isThisExpression; | |
exports.isThrowStatement = isThrowStatement; | |
exports.isTryStatement = isTryStatement; | |
exports.isUnaryExpression = isUnaryExpression; | |
exports.isUpdateExpression = isUpdateExpression; | |
exports.isVariableDeclaration = isVariableDeclaration; | |
exports.isVariableDeclarator = isVariableDeclarator; | |
exports.isWhileStatement = isWhileStatement; | |
exports.isWithStatement = isWithStatement; | |
exports.isAssignmentPattern = isAssignmentPattern; | |
exports.isArrayPattern = isArrayPattern; | |
exports.isArrowFunctionExpression = isArrowFunctionExpression; | |
exports.isClassBody = isClassBody; | |
exports.isClassDeclaration = isClassDeclaration; | |
exports.isClassExpression = isClassExpression; | |
exports.isExportAllDeclaration = isExportAllDeclaration; | |
exports.isExportDefaultDeclaration = isExportDefaultDeclaration; | |
exports.isExportNamedDeclaration = isExportNamedDeclaration; | |
exports.isExportSpecifier = isExportSpecifier; | |
exports.isForOfStatement = isForOfStatement; | |
exports.isImportDeclaration = isImportDeclaration; | |
exports.isImportDefaultSpecifier = isImportDefaultSpecifier; | |
exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier; | |
exports.isImportSpecifier = isImportSpecifier; | |
exports.isMetaProperty = isMetaProperty; | |
exports.isClassMethod = isClassMethod; | |
exports.isObjectPattern = isObjectPattern; | |
exports.isSpreadElement = isSpreadElement; | |
exports.isSuper = isSuper; | |
exports.isTaggedTemplateExpression = isTaggedTemplateExpression; | |
exports.isTemplateElement = isTemplateElement; | |
exports.isTemplateLiteral = isTemplateLiteral; | |
exports.isYieldExpression = isYieldExpression; | |
exports.isAnyTypeAnnotation = isAnyTypeAnnotation; | |
exports.isArrayTypeAnnotation = isArrayTypeAnnotation; | |
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation; | |
exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation; | |
exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation; | |
exports.isClassImplements = isClassImplements; | |
exports.isDeclareClass = isDeclareClass; | |
exports.isDeclareFunction = isDeclareFunction; | |
exports.isDeclareInterface = isDeclareInterface; | |
exports.isDeclareModule = isDeclareModule; | |
exports.isDeclareModuleExports = isDeclareModuleExports; | |
exports.isDeclareTypeAlias = isDeclareTypeAlias; | |
exports.isDeclareOpaqueType = isDeclareOpaqueType; | |
exports.isDeclareVariable = isDeclareVariable; | |
exports.isDeclareExportDeclaration = isDeclareExportDeclaration; | |
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration; | |
exports.isDeclaredPredicate = isDeclaredPredicate; | |
exports.isExistsTypeAnnotation = isExistsTypeAnnotation; | |
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; | |
exports.isFunctionTypeParam = isFunctionTypeParam; | |
exports.isGenericTypeAnnotation = isGenericTypeAnnotation; | |
exports.isInferredPredicate = isInferredPredicate; | |
exports.isInterfaceExtends = isInterfaceExtends; | |
exports.isInterfaceDeclaration = isInterfaceDeclaration; | |
exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; | |
exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; | |
exports.isMixedTypeAnnotation = isMixedTypeAnnotation; | |
exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; | |
exports.isNullableTypeAnnotation = isNullableTypeAnnotation; | |
exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; | |
exports.isNumberTypeAnnotation = isNumberTypeAnnotation; | |
exports.isObjectTypeAnnotation = isObjectTypeAnnotation; | |
exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; | |
exports.isObjectTypeCallProperty = isObjectTypeCallProperty; | |
exports.isObjectTypeIndexer = isObjectTypeIndexer; | |
exports.isObjectTypeProperty = isObjectTypeProperty; | |
exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty; | |
exports.isOpaqueType = isOpaqueType; | |
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier; | |
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation; | |
exports.isStringTypeAnnotation = isStringTypeAnnotation; | |
exports.isThisTypeAnnotation = isThisTypeAnnotation; | |
exports.isTupleTypeAnnotation = isTupleTypeAnnotation; | |
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation; | |
exports.isTypeAlias = isTypeAlias; | |
exports.isTypeAnnotation = isTypeAnnotation; | |
exports.isTypeCastExpression = isTypeCastExpression; | |
exports.isTypeParameter = isTypeParameter; | |
exports.isTypeParameterDeclaration = isTypeParameterDeclaration; | |
exports.isTypeParameterInstantiation = isTypeParameterInstantiation; | |
exports.isUnionTypeAnnotation = isUnionTypeAnnotation; | |
exports.isVariance = isVariance; | |
exports.isVoidTypeAnnotation = isVoidTypeAnnotation; | |
exports.isJSXAttribute = isJSXAttribute; | |
exports.isJSXClosingElement = isJSXClosingElement; | |
exports.isJSXElement = isJSXElement; | |
exports.isJSXEmptyExpression = isJSXEmptyExpression; | |
exports.isJSXExpressionContainer = isJSXExpressionContainer; | |
exports.isJSXSpreadChild = isJSXSpreadChild; | |
exports.isJSXIdentifier = isJSXIdentifier; | |
exports.isJSXMemberExpression = isJSXMemberExpression; | |
exports.isJSXNamespacedName = isJSXNamespacedName; | |
exports.isJSXOpeningElement = isJSXOpeningElement; | |
exports.isJSXSpreadAttribute = isJSXSpreadAttribute; | |
exports.isJSXText = isJSXText; | |
exports.isJSXFragment = isJSXFragment; | |
exports.isJSXOpeningFragment = isJSXOpeningFragment; | |
exports.isJSXClosingFragment = isJSXClosingFragment; | |
exports.isNoop = isNoop; | |
exports.isParenthesizedExpression = isParenthesizedExpression; | |
exports.isAwaitExpression = isAwaitExpression; | |
exports.isBindExpression = isBindExpression; | |
exports.isClassProperty = isClassProperty; | |
exports.isOptionalMemberExpression = isOptionalMemberExpression; | |
exports.isOptionalCallExpression = isOptionalCallExpression; | |
exports.isClassPrivateProperty = isClassPrivateProperty; | |
exports.isClassPrivateMethod = isClassPrivateMethod; | |
exports.isImport = isImport; | |
exports.isDecorator = isDecorator; | |
exports.isDoExpression = isDoExpression; | |
exports.isExportDefaultSpecifier = isExportDefaultSpecifier; | |
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; | |
exports.isPrivateName = isPrivateName; | |
exports.isBigIntLiteral = isBigIntLiteral; | |
exports.isTSParameterProperty = isTSParameterProperty; | |
exports.isTSDeclareFunction = isTSDeclareFunction; | |
exports.isTSDeclareMethod = isTSDeclareMethod; | |
exports.isTSQualifiedName = isTSQualifiedName; | |
exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration; | |
exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration; | |
exports.isTSPropertySignature = isTSPropertySignature; | |
exports.isTSMethodSignature = isTSMethodSignature; | |
exports.isTSIndexSignature = isTSIndexSignature; | |
exports.isTSAnyKeyword = isTSAnyKeyword; | |
exports.isTSUnknownKeyword = isTSUnknownKeyword; | |
exports.isTSNumberKeyword = isTSNumberKeyword; | |
exports.isTSObjectKeyword = isTSObjectKeyword; | |
exports.isTSBooleanKeyword = isTSBooleanKeyword; | |
exports.isTSStringKeyword = isTSStringKeyword; | |
exports.isTSSymbolKeyword = isTSSymbolKeyword; | |
exports.isTSVoidKeyword = isTSVoidKeyword; | |
exports.isTSUndefinedKeyword = isTSUndefinedKeyword; | |
exports.isTSNullKeyword = isTSNullKeyword; | |
exports.isTSNeverKeyword = isTSNeverKeyword; | |
exports.isTSThisType = isTSThisType; | |
exports.isTSFunctionType = isTSFunctionType; | |
exports.isTSConstructorType = isTSConstructorType; | |
exports.isTSTypeReference = isTSTypeReference; | |
exports.isTSTypePredicate = isTSTypePredicate; | |
exports.isTSTypeQuery = isTSTypeQuery; | |
exports.isTSTypeLiteral = isTSTypeLiteral; | |
exports.isTSArrayType = isTSArrayType; | |
exports.isTSTupleType = isTSTupleType; | |
exports.isTSOptionalType = isTSOptionalType; | |
exports.isTSRestType = isTSRestType; | |
exports.isTSUnionType = isTSUnionType; | |
exports.isTSIntersectionType = isTSIntersectionType; | |
exports.isTSConditionalType = isTSConditionalType; | |
exports.isTSInferType = isTSInferType; | |
exports.isTSParenthesizedType = isTSParenthesizedType; | |
exports.isTSTypeOperator = isTSTypeOperator; | |
exports.isTSIndexedAccessType = isTSIndexedAccessType; | |
exports.isTSMappedType = isTSMappedType; | |
exports.isTSLiteralType = isTSLiteralType; | |
exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments; | |
exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration; | |
exports.isTSInterfaceBody = isTSInterfaceBody; | |
exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration; | |
exports.isTSAsExpression = isTSAsExpression; | |
exports.isTSTypeAssertion = isTSTypeAssertion; | |
exports.isTSEnumDeclaration = isTSEnumDeclaration; | |
exports.isTSEnumMember = isTSEnumMember; | |
exports.isTSModuleDeclaration = isTSModuleDeclaration; | |
exports.isTSModuleBlock = isTSModuleBlock; | |
exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; | |
exports.isTSExternalModuleReference = isTSExternalModuleReference; | |
exports.isTSNonNullExpression = isTSNonNullExpression; | |
exports.isTSExportAssignment = isTSExportAssignment; | |
exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration; | |
exports.isTSTypeAnnotation = isTSTypeAnnotation; | |
exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation; | |
exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration; | |
exports.isTSTypeParameter = isTSTypeParameter; | |
exports.isExpression = isExpression; | |
exports.isBinary = isBinary; | |
exports.isScopable = isScopable; | |
exports.isBlockParent = isBlockParent; | |
exports.isBlock = isBlock; | |
exports.isStatement = isStatement; | |
exports.isTerminatorless = isTerminatorless; | |
exports.isCompletionStatement = isCompletionStatement; | |
exports.isConditional = isConditional; | |
exports.isLoop = isLoop; | |
exports.isWhile = isWhile; | |
exports.isExpressionWrapper = isExpressionWrapper; | |
exports.isFor = isFor; | |
exports.isForXStatement = isForXStatement; | |
exports.isFunction = isFunction; | |
exports.isFunctionParent = isFunctionParent; | |
exports.isPureish = isPureish; | |
exports.isDeclaration = isDeclaration; | |
exports.isPatternLike = isPatternLike; | |
exports.isLVal = isLVal; | |
exports.isTSEntityName = isTSEntityName; | |
exports.isLiteral = isLiteral; | |
exports.isImmutable = isImmutable; | |
exports.isUserWhitespacable = isUserWhitespacable; | |
exports.isMethod = isMethod; | |
exports.isObjectMember = isObjectMember; | |
exports.isProperty = isProperty; | |
exports.isUnaryLike = isUnaryLike; | |
exports.isPattern = isPattern; | |
exports.isClass = isClass; | |
exports.isModuleDeclaration = isModuleDeclaration; | |
exports.isExportDeclaration = isExportDeclaration; | |
exports.isModuleSpecifier = isModuleSpecifier; | |
exports.isFlow = isFlow; | |
exports.isFlowType = isFlowType; | |
exports.isFlowBaseAnnotation = isFlowBaseAnnotation; | |
exports.isFlowDeclaration = isFlowDeclaration; | |
exports.isFlowPredicate = isFlowPredicate; | |
exports.isJSX = isJSX; | |
exports.isPrivate = isPrivate; | |
exports.isTSTypeElement = isTSTypeElement; | |
exports.isTSType = is |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment