Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An example inlined sourcemap
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyIvVXNlcnMvYWlycG9ydHloL0hvbWUvQ29kZS9yb3Zlci9jb250ZW50c2NyaXB0L2luZGV4LmpzIiwiL1VzZXJzL2FpcnBvcnR5aC9Ib21lL0NvZGUvcm92ZXIvY29udGVudHNjcmlwdC9vZmZzZXRzLmpzIiwiL1VzZXJzL2FpcnBvcnR5aC9Ib21lL0NvZGUvcm92ZXIvY29udGVudHNjcmlwdC91bmlxdWVfc2VsZWN0b3IuanMiLCIvVXNlcnMvYWlycG9ydHloL0hvbWUvQ29kZS9yb3Zlci9jb250ZW50c2NyaXB0L2Nocm9tZWV4dC5qcyIsIi91c3IvbG9jYWwvbGliL25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9pbnNlcnQtbW9kdWxlLWdsb2JhbHMvbm9kZV9tb2R1bGVzL3Byb2Nlc3MvYnJvd3Nlci5qcyIsIi91c3IvbG9jYWwvbGliL25vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXJlc29sdmUvYnVpbHRpbi9ldmVudHMuanMiLCIvVXNlcnMvYWlycG9ydHloL0hvbWUvQ29kZS9yb3Zlci9jb250ZW50c2NyaXB0L2ZyaWVuZGx5X3RhZy5qcyIsIi9Vc2Vycy9haXJwb3J0eWgvSG9tZS9Db2RlL3JvdmVyL2NvbnRlbnRzY3JpcHQvaW50ZXJhY3RpdmVfbW9kZS5qcyIsIi9Vc2Vycy9haXJwb3J0eWgvSG9tZS9Db2RlL3JvdmVyL2NvbnRlbnRzY3JpcHQvZGltZW5zaW9ucy5qcyIsIi9Vc2Vycy9haXJwb3J0eWgvSG9tZS9Db2RlL3JvdmVyL2NvbnRlbnRzY3JpcHQ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biAoKSB7XG4gICAgdmFyIGNhblNldEltbWVkaWF0ZSA9IHR5cGVvZiB3aW5kb3cgIT09ICd1bmRlZmluZWQnXG4gICAgJiYgd2luZG93LnNldEltbWVkaWF0ZTtcbiAgICB2YXIgY2FuUG9zdCA9IHR5cGVvZiB3aW5kb3cgIT09ICd1bmRlZmluZWQnXG4gICAgJiYgd2luZG93LnBvc3RNZXNzYWdlICYmIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyXG4gICAgO1xuXG4gICAgaWYgKGNhblNldEltbWVkaWF0ZSkge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGYpIHsgcmV0dXJuIHdpbmRvdy5zZXRJbW1lZGlhdGUoZikgfTtcbiAgICB9XG5cbiAgICBpZiAoY2FuUG9zdCkge1xuICAgICAgICB2YXIgcXVldWUgPSBbXTtcbiAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBmdW5jdGlvbiAoZXYpIHtcbiAgICAgICAgICAgIGlmIChldi5zb3VyY2UgPT09IHdpbmRvdyAmJiBldi5kYXRhID09PSAncHJvY2Vzcy10aWNrJykge1xuICAgICAgICAgICAgICAgIGV2LnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICAgICAgICAgIGlmIChxdWV1ZS5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBmbiA9IHF1ZXVlLnNoaWZ0KCk7XG4gICAgICAgICAgICAgICAgICAgIGZuKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LCB0cnVlKTtcblxuICAgICAgICByZXR1cm4gZnVuY3Rpb24gbmV4dFRpY2soZm4pIHtcbiAgICAgICAgICAgIHF1ZXVlLnB1c2goZm4pO1xuICAgICAgICAgICAgd2luZG93LnBvc3RNZXNzYWdlKCdwcm9jZXNzLXRpY2snLCAnKicpO1xuICAgICAgICB9O1xuICAgIH1cblxuICAgIHJldHVybiBmdW5jdG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W5lcihcbiAgICAgICAgZXZ0LnRvTG93ZXJDYXNlKCksXG4gICAgICAgIHRoaXMuX19ib3VuZExpc3RlbmVyc1tldnRdKVxuICAgIH0sIHRoaXMpXG4gIH0sXG5cbiAgdW5iaW5kTGlzdGVuZXJzOiBmdW5jdGlvbigpe1xuICAgIGlmICghdGhpcy5iaW5kRXZlbnRzIHx8ICF0aGlzLl9fYm91bmRMaXN0ZW5lcnMpIHJldHVyblxuICAgIHRoaXMuYmluZEV2ZW50cy5mb3JFYWNoKGZ1bmN0aW9uKGV2dCl7XG4gICAgICB0aGlzLmRvYy5yZW1vdmVFdmVudExpc3RlbmVyKFxuICAgICAgICBldnQudG9Mb3dlckNhc2UoKSwgXG4gICAgICAgIHRoaXMuX19ib3VuZExpc3RlbmVyc1tldnRdKVxuICAgIH0sIHRoaXMpXG4gIH1cbn1cbiIsIlxubW9kdWxlLmV4cG9ydHMgPSBjYXBpdGFsaXplXG5mdW5jdGlvbiBjYXBpdGFsaXplKHN0cil7XG4gIHJldHVybiBzdHIuc3Vic3RyaW5nKDAsIDEpLnRvVXBwZXJDYXNlKCkgKyBzdHIuc3Vic3RyaW5nKDEpXG59Il19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.