From 9308795b8b258b3619d438bb2ecfed03926de433 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Thu, 26 Mar 2020 15:37:35 +0100 Subject: [PATCH] update --- README.md | 1 - action.yml | 4 - main.js | 40 +- node_modules/.bin/pino | 1 + node_modules/atomic-sleep/.travis.yml | 11 + node_modules/atomic-sleep/LICENSE | 22 + node_modules/atomic-sleep/index.js | 38 + node_modules/atomic-sleep/package.json | 65 + node_modules/atomic-sleep/readme.md | 58 + node_modules/atomic-sleep/test.js | 47 + node_modules/axios/CHANGELOG.md | 413 + node_modules/axios/LICENSE | 19 + node_modules/axios/README.md | 709 ++ node_modules/axios/UPGRADE_GUIDE.md | 162 + node_modules/axios/dist/axios.js | 1715 +++ node_modules/axios/dist/axios.map | 1 + node_modules/axios/dist/axios.min.js | 3 + node_modules/axios/dist/axios.min.map | 1 + node_modules/axios/index.d.ts | 157 + node_modules/axios/index.js | 1 + node_modules/axios/lib/adapters/README.md | 37 + node_modules/axios/lib/adapters/http.js | 279 + node_modules/axios/lib/adapters/xhr.js | 180 + node_modules/axios/lib/axios.js | 53 + node_modules/axios/lib/cancel/Cancel.js | 19 + node_modules/axios/lib/cancel/CancelToken.js | 57 + node_modules/axios/lib/cancel/isCancel.js | 5 + node_modules/axios/lib/core/Axios.js | 94 + .../axios/lib/core/InterceptorManager.js | 52 + node_modules/axios/lib/core/README.md | 7 + node_modules/axios/lib/core/buildFullPath.js | 20 + node_modules/axios/lib/core/createError.js | 18 + .../axios/lib/core/dispatchRequest.js | 79 + node_modules/axios/lib/core/enhanceError.js | 42 + node_modules/axios/lib/core/mergeConfig.js | 73 + node_modules/axios/lib/core/settle.js | 25 + node_modules/axios/lib/core/transformData.js | 20 + node_modules/axios/lib/defaults.js | 97 + node_modules/axios/lib/helpers/README.md | 7 + node_modules/axios/lib/helpers/bind.js | 11 + node_modules/axios/lib/helpers/buildURL.js | 71 + node_modules/axios/lib/helpers/combineURLs.js | 14 + node_modules/axios/lib/helpers/cookies.js | 53 + .../axios/lib/helpers/deprecatedMethod.js | 24 + .../axios/lib/helpers/isAbsoluteURL.js | 14 + .../axios/lib/helpers/isURLSameOrigin.js | 68 + .../axios/lib/helpers/normalizeHeaderName.js | 12 + .../axios/lib/helpers/parseHeaders.js | 53 + node_modules/axios/lib/helpers/spread.js | 27 + node_modules/axios/lib/utils.js | 344 + node_modules/axios/package.json | 111 + node_modules/camelcase-keys/index.d.ts | 103 + node_modules/camelcase-keys/index.js | 73 + node_modules/camelcase-keys/license | 9 + node_modules/camelcase-keys/package.json | 105 + node_modules/camelcase-keys/readme.md | 125 + node_modules/camelcase/index.d.ts | 63 + node_modules/camelcase/index.js | 76 + node_modules/camelcase/license | 9 + node_modules/camelcase/package.json | 75 + node_modules/camelcase/readme.md | 99 + node_modules/debug/.coveralls.yml | 1 + node_modules/debug/.eslintrc | 14 + node_modules/debug/.npmignore | 9 + node_modules/debug/.travis.yml | 20 + node_modules/debug/CHANGELOG.md | 395 + node_modules/debug/LICENSE | 19 + node_modules/debug/Makefile | 58 + node_modules/debug/README.md | 368 + node_modules/debug/karma.conf.js | 70 + node_modules/debug/node.js | 1 + node_modules/debug/package.json | 82 + node_modules/debug/src/browser.js | 195 + node_modules/debug/src/debug.js | 225 + node_modules/debug/src/index.js | 10 + node_modules/debug/src/node.js | 186 + node_modules/docker-hub-utils/README.md | 50 + .../dist/docker-hub-utils.cjs.development.js | 272 + .../docker-hub-utils.cjs.development.js.map | 1 + .../docker-hub-utils.cjs.production.min.js | 2 + ...docker-hub-utils.cjs.production.min.js.map | 1 + .../dist/docker-hub-utils.esm.js | 262 + .../dist/docker-hub-utils.esm.js.map | 1 + node_modules/docker-hub-utils/dist/index.d.ts | 6 + node_modules/docker-hub-utils/dist/index.js | 8 + .../dist/services/DockerHubAPI.d.ts | 49 + .../dist/types/DockerHubRepo.d.ts | 123 + .../dist/utils/constants.d.ts | 3 + .../docker-hub-utils/dist/utils/log.d.ts | 3 + node_modules/docker-hub-utils/package.json | 114 + node_modules/fast-redact/.travis.yml | 9 + node_modules/fast-redact/LICENSE | 21 + node_modules/fast-redact/benchmark/index.js | 148 + .../fast-redact/example/default-usage.js | 14 + .../example/intermediate-wildcard-array.js | 11 + .../fast-redact/example/serialize-false.js | 11 + .../fast-redact/example/serialize-function.js | 4 + .../example/top-wildcard-object.js | 9 + node_modules/fast-redact/index.js | 55 + node_modules/fast-redact/lib/modifiers.js | 96 + node_modules/fast-redact/lib/parse.js | 45 + node_modules/fast-redact/lib/redactor.js | 94 + node_modules/fast-redact/lib/restorer.js | 71 + node_modules/fast-redact/lib/rx.js | 3 + node_modules/fast-redact/lib/state.js | 22 + node_modules/fast-redact/lib/validator.js | 38 + node_modules/fast-redact/package.json | 78 + node_modules/fast-redact/readme.md | 280 + node_modules/fast-redact/test/index.js | 964 ++ node_modules/fast-safe-stringify/.travis.yml | 8 + node_modules/fast-safe-stringify/CHANGELOG.md | 17 + node_modules/fast-safe-stringify/LICENSE | 23 + node_modules/fast-safe-stringify/benchmark.js | 137 + node_modules/fast-safe-stringify/index.d.ts | 8 + node_modules/fast-safe-stringify/index.js | 161 + node_modules/fast-safe-stringify/package.json | 87 + node_modules/fast-safe-stringify/readme.md | 154 + .../fast-safe-stringify/test-stable.js | 311 + node_modules/fast-safe-stringify/test.js | 304 + node_modules/flatstr/LICENSE | 21 + node_modules/flatstr/alt-benchmark.js | 234 + node_modules/flatstr/benchmark.js | 61 + node_modules/flatstr/index.js | 15 + node_modules/flatstr/package.json | 58 + node_modules/flatstr/readme.md | 82 + node_modules/flatstr/test.js | 26 + node_modules/follow-redirects/LICENSE | 18 + node_modules/follow-redirects/README.md | 155 + node_modules/follow-redirects/http.js | 1 + node_modules/follow-redirects/https.js | 1 + node_modules/follow-redirects/index.js | 322 + node_modules/follow-redirects/package.json | 96 + node_modules/luxon/README.md | 54 + node_modules/luxon/build/amd/luxon.js | 8349 ++++++++++++++ node_modules/luxon/build/amd/luxon.js.map | 1 + node_modules/luxon/build/cjs-browser/luxon.js | 8347 ++++++++++++++ .../luxon/build/cjs-browser/luxon.js.map | 1 + node_modules/luxon/build/global/luxon.js | 8350 ++++++++++++++ node_modules/luxon/build/global/luxon.js.map | 1 + node_modules/luxon/build/global/luxon.min.js | 1 + .../luxon/build/global/luxon.min.js.map | 1 + node_modules/luxon/build/node/luxon.js | 7305 +++++++++++++ node_modules/luxon/build/node/luxon.js.map | 1 + node_modules/luxon/build/readme.md | 1 + node_modules/luxon/changelog.md | 482 + node_modules/luxon/license.md | 7 + node_modules/luxon/package.json | 129 + node_modules/luxon/src/datetime.js | 2114 ++++ node_modules/luxon/src/duration.js | 788 ++ node_modules/luxon/src/errors.js | 61 + node_modules/luxon/src/impl/conversions.js | 157 + node_modules/luxon/src/impl/diff.js | 79 + node_modules/luxon/src/impl/digits.js | 76 + node_modules/luxon/src/impl/english.js | 231 + node_modules/luxon/src/impl/formats.js | 184 + node_modules/luxon/src/impl/formatter.js | 386 + node_modules/luxon/src/impl/invalid.js | 14 + node_modules/luxon/src/impl/locale.js | 469 + node_modules/luxon/src/impl/regexParser.js | 315 + node_modules/luxon/src/impl/tokenParser.js | 416 + node_modules/luxon/src/impl/util.js | 287 + node_modules/luxon/src/impl/zoneUtil.js | 36 + node_modules/luxon/src/info.js | 186 + node_modules/luxon/src/interval.js | 588 + node_modules/luxon/src/luxon.js | 23 + node_modules/luxon/src/luxonFilled.js | 13 + node_modules/luxon/src/settings.js | 137 + node_modules/luxon/src/zone.js | 88 + node_modules/luxon/src/zones/IANAZone.js | 188 + .../luxon/src/zones/fixedOffsetZone.js | 94 + node_modules/luxon/src/zones/invalidZone.js | 53 + node_modules/luxon/src/zones/localZone.js | 63 + node_modules/map-obj/index.d.ts | 106 + node_modules/map-obj/index.js | 54 + node_modules/map-obj/license | 9 + node_modules/map-obj/package.json | 74 + node_modules/map-obj/readme.md | 76 + node_modules/ms/index.js | 152 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 69 + node_modules/ms/readme.md | 51 + .../pino-std-serializers/.editorconfig | 13 + node_modules/pino-std-serializers/.travis.yml | 22 + node_modules/pino-std-serializers/LICENSE | 7 + node_modules/pino-std-serializers/Readme.md | 107 + node_modules/pino-std-serializers/index.js | 34 + node_modules/pino-std-serializers/lib/err.js | 64 + node_modules/pino-std-serializers/lib/req.js | 80 + node_modules/pino-std-serializers/lib/res.js | 47 + .../pino-std-serializers/package.json | 64 + .../pino-std-serializers/test/err.test.js | 106 + .../pino-std-serializers/test/req.test.js | 298 + .../pino-std-serializers/test/res.test.js | 89 + node_modules/pino/LICENSE | 24 + node_modules/pino/README.md | 152 + node_modules/pino/bin.js | 6 + node_modules/pino/browser.js | 325 + node_modules/pino/docs/api.md | 868 ++ node_modules/pino/docs/benchmarks.md | 58 + node_modules/pino/docs/browser.md | 199 + node_modules/pino/docs/child-loggers.md | 95 + node_modules/pino/docs/ecosystem.md | 72 + node_modules/pino/docs/extreme.md | 95 + node_modules/pino/docs/help.md | 215 + node_modules/pino/docs/legacy.md | 167 + node_modules/pino/docs/pretty.md | 93 + node_modules/pino/docs/redaction.md | 133 + node_modules/pino/docs/transports.md | 387 + node_modules/pino/docs/web.md | 230 + node_modules/pino/example.js | 35 + node_modules/pino/lib/levels.js | 183 + node_modules/pino/lib/meta.js | 7 + node_modules/pino/lib/proto.js | 167 + node_modules/pino/lib/redaction.js | 104 + node_modules/pino/lib/symbols.js | 64 + node_modules/pino/lib/time.js | 11 + node_modules/pino/lib/tools.js | 386 + node_modules/pino/package.json | 135 + node_modules/pino/pino.js | 144 + node_modules/pino/test/basic.test.js | 702 ++ node_modules/pino/test/broken-pipe.test.js | 42 + node_modules/pino/test/browser-levels.test.js | 218 + .../pino/test/browser-serializers.test.js | 327 + .../pino/test/browser-transmit.test.js | 349 + node_modules/pino/test/browser.test.js | 553 + node_modules/pino/test/crlf.test.js | 32 + node_modules/pino/test/custom-levels.test.js | 308 + node_modules/pino/test/error.test.js | 179 + node_modules/pino/test/escaping.test.js | 93 + node_modules/pino/test/exit.test.js | 53 + node_modules/pino/test/extreme.test.js | 125 + node_modules/pino/test/final.test.js | 182 + .../pino/test/fixtures/broken-pipe/basic.js | 9 + .../test/fixtures/broken-pipe/destination.js | 10 + .../pino/test/fixtures/broken-pipe/extreme.js | 12 + .../pino/test/fixtures/destination-exit.js | 8 + .../pino/test/fixtures/extreme-child.js | 6 + .../pino/test/fixtures/extreme-exit.js | 9 + .../pino/test/fixtures/extreme-flush-exit.js | 10 + node_modules/pino/test/fixtures/extreme.js | 6 + .../pino/test/fixtures/pretty/basic.js | 6 + .../pino/test/fixtures/pretty/child.js | 8 + .../test/fixtures/pretty/custom-time-label.js | 9 + .../pino/test/fixtures/pretty/custom-time.js | 9 + .../pino/test/fixtures/pretty/dateformat.js | 10 + .../pino/test/fixtures/pretty/error-props.js | 9 + .../pino/test/fixtures/pretty/error.js | 7 + .../fixtures/pretty/final-no-log-before.js | 8 + .../pino/test/fixtures/pretty/final-return.js | 7 + .../pino/test/fixtures/pretty/final.js | 9 + .../pino/test/fixtures/pretty/level-first.js | 6 + .../pino/test/fixtures/pretty/no-time.js | 9 + .../pino/test/fixtures/pretty/obj-msg-prop.js | 6 + .../test/fixtures/pretty/pretty-factory.js | 6 + .../pino/test/fixtures/pretty/redact.js | 9 + .../pino/test/fixtures/pretty/serializers.js | 17 + .../test/fixtures/pretty/skipped-output.js | 13 + .../test/fixtures/stdout-hack-protection.js | 11 + node_modules/pino/test/helper.js | 55 + node_modules/pino/test/http.test.js | 247 + .../pino/test/is-level-enabled.test.js | 43 + node_modules/pino/test/levels.test.js | 441 + node_modules/pino/test/metadata.test.js | 110 + node_modules/pino/test/mixin.test.js | 106 + node_modules/pino/test/pretty.test.js | 312 + node_modules/pino/test/redact.test.js | 713 ++ node_modules/pino/test/serializers.test.js | 245 + .../pino/test/stdout-protection.test.js | 19 + node_modules/pino/test/timestamp.test.js | 121 + .../quick-format-unescaped/.travis.yml | 9 + node_modules/quick-format-unescaped/LICENSE | 21 + .../quick-format-unescaped/benchmark.js | 24 + node_modules/quick-format-unescaped/index.js | 105 + .../quick-format-unescaped/package.json | 54 + node_modules/quick-format-unescaped/readme.md | 66 + .../quick-format-unescaped/test/index.js | 78 + node_modules/quick-lru/index.d.ts | 90 + node_modules/quick-lru/index.js | 115 + node_modules/quick-lru/license | 9 + node_modules/quick-lru/package.json | 74 + node_modules/quick-lru/readme.md | 93 + node_modules/ramda/CHANGELOG.md | 6 + node_modules/ramda/LICENSE.txt | 21 + node_modules/ramda/README.md | 248 + node_modules/ramda/dist/ramda.js | 9716 +++++++++++++++++ node_modules/ramda/dist/ramda.min.js | 1 + node_modules/ramda/es/F.js | 20 + node_modules/ramda/es/T.js | 20 + node_modules/ramda/es/__.js | 30 + node_modules/ramda/es/add.js | 26 + node_modules/ramda/es/addIndex.js | 48 + node_modules/ramda/es/adjust.js | 46 + node_modules/ramda/es/all.js | 47 + node_modules/ramda/es/allPass.js | 51 + node_modules/ramda/es/always.js | 30 + node_modules/ramda/es/and.js | 28 + node_modules/ramda/es/andThen.js | 38 + node_modules/ramda/es/any.js | 48 + node_modules/ramda/es/anyPass.js | 52 + node_modules/ramda/es/ap.js | 42 + node_modules/ramda/es/aperture.js | 33 + node_modules/ramda/es/append.js | 30 + node_modules/ramda/es/apply.js | 29 + node_modules/ramda/es/applySpec.js | 58 + node_modules/ramda/es/applyTo.js | 28 + node_modules/ramda/es/ascend.js | 36 + node_modules/ramda/es/assoc.js | 36 + node_modules/ramda/es/assocPath.js | 55 + node_modules/ramda/es/binary.js | 38 + node_modules/ramda/es/bind.js | 34 + node_modules/ramda/es/both.js | 45 + node_modules/ramda/es/call.js | 40 + node_modules/ramda/es/chain.js | 47 + node_modules/ramda/es/clamp.js | 33 + node_modules/ramda/es/clone.js | 31 + node_modules/ramda/es/comparator.js | 34 + node_modules/ramda/es/complement.js | 29 + node_modules/ramda/es/compose.js | 34 + node_modules/ramda/es/composeK.js | 44 + node_modules/ramda/es/composeP.js | 45 + node_modules/ramda/es/composeWith.js | 35 + node_modules/ramda/es/concat.js | 65 + node_modules/ramda/es/cond.js | 53 + node_modules/ramda/es/construct.js | 42 + node_modules/ramda/es/constructN.js | 88 + node_modules/ramda/es/contains.js | 31 + node_modules/ramda/es/converge.js | 48 + node_modules/ramda/es/countBy.js | 32 + node_modules/ramda/es/curry.js | 51 + node_modules/ramda/es/curryN.js | 58 + node_modules/ramda/es/dec.js | 21 + node_modules/ramda/es/defaultTo.js | 32 + node_modules/ramda/es/descend.js | 36 + node_modules/ramda/es/difference.js | 48 + node_modules/ramda/es/differenceWith.js | 44 + node_modules/ramda/es/dissoc.js | 32 + node_modules/ramda/es/dissocPath.js | 53 + node_modules/ramda/es/divide.js | 31 + node_modules/ramda/es/drop.js | 38 + node_modules/ramda/es/dropLast.js | 35 + node_modules/ramda/es/dropLastWhile.js | 39 + node_modules/ramda/es/dropRepeats.js | 35 + node_modules/ramda/es/dropRepeatsWith.js | 51 + node_modules/ramda/es/dropWhile.js | 49 + node_modules/ramda/es/either.js | 44 + node_modules/ramda/es/empty.js | 39 + node_modules/ramda/es/endsWith.js | 33 + node_modules/ramda/es/eqBy.js | 27 + node_modules/ramda/es/eqProps.js | 31 + node_modules/ramda/es/equals.js | 35 + node_modules/ramda/es/evolve.js | 45 + node_modules/ramda/es/filter.js | 51 + node_modules/ramda/es/find.js | 46 + node_modules/ramda/es/findIndex.js | 46 + node_modules/ramda/es/findLast.js | 43 + node_modules/ramda/es/findLastIndex.js | 45 + node_modules/ramda/es/flatten.js | 27 + node_modules/ramda/es/flip.js | 35 + node_modules/ramda/es/forEach.js | 54 + node_modules/ramda/es/forEachObjIndexed.js | 41 + node_modules/ramda/es/fromPairs.js | 33 + node_modules/ramda/es/groupBy.js | 60 + node_modules/ramda/es/groupWith.js | 54 + node_modules/ramda/es/gt.js | 30 + node_modules/ramda/es/gte.js | 30 + node_modules/ramda/es/has.js | 34 + node_modules/ramda/es/hasIn.js | 35 + node_modules/ramda/es/hasPath.js | 48 + node_modules/ramda/es/head.js | 27 + node_modules/ramda/es/identical.js | 33 + node_modules/ramda/es/identity.js | 27 + node_modules/ramda/es/ifElse.js | 37 + node_modules/ramda/es/inc.js | 21 + node_modules/ramda/es/includes.js | 30 + node_modules/ramda/es/index.js | 257 + node_modules/ramda/es/indexBy.js | 30 + node_modules/ramda/es/indexOf.js | 30 + node_modules/ramda/es/init.js | 30 + node_modules/ramda/es/innerJoin.js | 48 + node_modules/ramda/es/insert.js | 31 + node_modules/ramda/es/insertAll.js | 28 + node_modules/ramda/es/internal/_Set.js | 201 + node_modules/ramda/es/internal/_aperture.js | 12 + node_modules/ramda/es/internal/_arity.js | 62 + .../ramda/es/internal/_arrayFromIterator.js | 10 + .../ramda/es/internal/_assertPromise.js | 7 + .../ramda/es/internal/_checkForMethod.js | 24 + node_modules/ramda/es/internal/_clone.js | 53 + .../ramda/es/internal/_cloneRegExp.js | 3 + node_modules/ramda/es/internal/_complement.js | 5 + node_modules/ramda/es/internal/_concat.js | 34 + .../es/internal/_createPartialApplicator.js | 9 + node_modules/ramda/es/internal/_curry1.js | 19 + node_modules/ramda/es/internal/_curry2.js | 31 + node_modules/ramda/es/internal/_curry3.js | 49 + node_modules/ramda/es/internal/_curryN.js | 42 + .../ramda/es/internal/_dispatchable.js | 46 + node_modules/ramda/es/internal/_dropLast.js | 4 + .../ramda/es/internal/_dropLastWhile.js | 10 + node_modules/ramda/es/internal/_equals.js | 166 + node_modules/ramda/es/internal/_filter.js | 15 + node_modules/ramda/es/internal/_flatCat.js | 32 + .../ramda/es/internal/_forceReduced.js | 6 + .../ramda/es/internal/_functionName.js | 5 + .../ramda/es/internal/_functionsWith.js | 14 + node_modules/ramda/es/internal/_has.js | 3 + node_modules/ramda/es/internal/_identity.js | 3 + node_modules/ramda/es/internal/_includes.js | 4 + .../ramda/es/internal/_includesWith.js | 14 + node_modules/ramda/es/internal/_indexOf.js | 67 + .../ramda/es/internal/_isArguments.js | 14 + node_modules/ramda/es/internal/_isArray.js | 15 + .../ramda/es/internal/_isArrayLike.js | 56 + node_modules/ramda/es/internal/_isFunction.js | 4 + node_modules/ramda/es/internal/_isInteger.js | 11 + node_modules/ramda/es/internal/_isNumber.js | 3 + node_modules/ramda/es/internal/_isObject.js | 3 + .../ramda/es/internal/_isPlaceholder.js | 3 + node_modules/ramda/es/internal/_isRegExp.js | 3 + node_modules/ramda/es/internal/_isString.js | 3 + .../ramda/es/internal/_isTransformer.js | 3 + node_modules/ramda/es/internal/_makeFlat.js | 35 + node_modules/ramda/es/internal/_map.js | 12 + .../ramda/es/internal/_objectAssign.js | 29 + node_modules/ramda/es/internal/_objectIs.js | 14 + node_modules/ramda/es/internal/_of.js | 3 + node_modules/ramda/es/internal/_pipe.js | 5 + node_modules/ramda/es/internal/_pipeP.js | 8 + node_modules/ramda/es/internal/_quote.js | 5 + node_modules/ramda/es/internal/_reduce.js | 71 + node_modules/ramda/es/internal/_reduced.js | 6 + node_modules/ramda/es/internal/_stepCat.js | 46 + .../ramda/es/internal/_toISOString.js | 14 + node_modules/ramda/es/internal/_toString.js | 58 + node_modules/ramda/es/internal/_xall.js | 42 + node_modules/ramda/es/internal/_xany.js | 42 + node_modules/ramda/es/internal/_xaperture.js | 50 + node_modules/ramda/es/internal/_xchain.js | 11 + node_modules/ramda/es/internal/_xdrop.js | 33 + node_modules/ramda/es/internal/_xdropLast.js | 49 + .../ramda/es/internal/_xdropLastWhile.js | 45 + .../ramda/es/internal/_xdropRepeatsWith.js | 39 + node_modules/ramda/es/internal/_xdropWhile.js | 36 + node_modules/ramda/es/internal/_xfBase.js | 8 + node_modules/ramda/es/internal/_xfilter.js | 28 + node_modules/ramda/es/internal/_xfind.js | 42 + node_modules/ramda/es/internal/_xfindIndex.js | 45 + node_modules/ramda/es/internal/_xfindLast.js | 35 + .../ramda/es/internal/_xfindLastIndex.js | 39 + node_modules/ramda/es/internal/_xmap.js | 28 + node_modules/ramda/es/internal/_xreduceBy.js | 52 + node_modules/ramda/es/internal/_xtake.js | 32 + node_modules/ramda/es/internal/_xtakeWhile.js | 29 + node_modules/ramda/es/internal/_xtap.js | 29 + node_modules/ramda/es/internal/_xwrap.js | 25 + node_modules/ramda/es/intersection.js | 40 + node_modules/ramda/es/intersperse.js | 43 + node_modules/ramda/es/into.js | 52 + node_modules/ramda/es/invert.js | 46 + node_modules/ramda/es/invertObj.js | 48 + node_modules/ramda/es/invoker.js | 54 + node_modules/ramda/es/is.js | 32 + node_modules/ramda/es/isEmpty.js | 32 + node_modules/ramda/es/isNil.js | 26 + node_modules/ramda/es/join.js | 25 + node_modules/ramda/es/juxt.js | 29 + node_modules/ramda/es/keys.js | 91 + node_modules/ramda/es/keysIn.js | 37 + node_modules/ramda/es/last.js | 26 + node_modules/ramda/es/lastIndexOf.js | 44 + node_modules/ramda/es/length.js | 25 + node_modules/ramda/es/lens.js | 39 + node_modules/ramda/es/lensIndex.js | 32 + node_modules/ramda/es/lensPath.js | 36 + node_modules/ramda/es/lensProp.js | 32 + node_modules/ramda/es/lift.js | 32 + node_modules/ramda/es/liftN.js | 33 + node_modules/ramda/es/lt.js | 30 + node_modules/ramda/es/lte.js | 30 + node_modules/ramda/es/map.js | 66 + node_modules/ramda/es/mapAccum.js | 54 + node_modules/ramda/es/mapAccumRight.js | 56 + node_modules/ramda/es/mapObjIndexed.js | 35 + node_modules/ramda/es/match.js | 30 + node_modules/ramda/es/mathMod.js | 51 + node_modules/ramda/es/max.js | 26 + node_modules/ramda/es/maxBy.js | 33 + node_modules/ramda/es/mean.js | 26 + node_modules/ramda/es/median.js | 37 + node_modules/ramda/es/memoizeWith.js | 48 + node_modules/ramda/es/merge.js | 34 + node_modules/ramda/es/mergeAll.js | 27 + node_modules/ramda/es/mergeDeepLeft.js | 33 + node_modules/ramda/es/mergeDeepRight.js | 33 + node_modules/ramda/es/mergeDeepWith.js | 39 + node_modules/ramda/es/mergeDeepWithKey.js | 45 + node_modules/ramda/es/mergeLeft.js | 33 + node_modules/ramda/es/mergeRight.js | 33 + node_modules/ramda/es/mergeWith.js | 35 + node_modules/ramda/es/mergeWithKey.js | 50 + node_modules/ramda/es/min.js | 26 + node_modules/ramda/es/minBy.js | 33 + node_modules/ramda/es/modulo.js | 34 + node_modules/ramda/es/move.js | 32 + node_modules/ramda/es/multiply.js | 29 + node_modules/ramda/es/nAry.js | 97 + node_modules/ramda/es/negate.js | 23 + node_modules/ramda/es/none.js | 36 + node_modules/ramda/es/not.js | 28 + node_modules/ramda/es/nth.js | 37 + node_modules/ramda/es/nthArg.js | 32 + node_modules/ramda/es/o.js | 36 + node_modules/ramda/es/objOf.js | 31 + node_modules/ramda/es/of.js | 26 + node_modules/ramda/es/omit.js | 41 + node_modules/ramda/es/once.js | 39 + node_modules/ramda/es/or.js | 29 + node_modules/ramda/es/otherwise.js | 40 + node_modules/ramda/es/over.js | 47 + node_modules/ramda/es/pair.js | 25 + node_modules/ramda/es/partial.js | 36 + node_modules/ramda/es/partialRight.js | 35 + node_modules/ramda/es/partition.js | 32 + node_modules/ramda/es/path.js | 30 + node_modules/ramda/es/pathEq.js | 35 + node_modules/ramda/es/pathOr.js | 30 + node_modules/ramda/es/pathSatisfies.js | 30 + node_modules/ramda/es/paths.js | 45 + node_modules/ramda/es/pick.js | 38 + node_modules/ramda/es/pickAll.js | 37 + node_modules/ramda/es/pickBy.js | 37 + node_modules/ramda/es/pipe.js | 35 + node_modules/ramda/es/pipeK.js | 45 + node_modules/ramda/es/pipeP.js | 31 + node_modules/ramda/es/pipeWith.js | 47 + node_modules/ramda/es/pluck.js | 38 + node_modules/ramda/es/prepend.js | 27 + node_modules/ramda/es/product.js | 22 + node_modules/ramda/es/project.js | 29 + node_modules/ramda/es/prop.js | 31 + node_modules/ramda/es/propEq.js | 35 + node_modules/ramda/es/propIs.js | 30 + node_modules/ramda/es/propOr.js | 36 + node_modules/ramda/es/propSatisfies.js | 28 + node_modules/ramda/es/props.js | 32 + node_modules/ramda/es/range.js | 38 + node_modules/ramda/es/reduce.js | 54 + node_modules/ramda/es/reduceBy.js | 61 + node_modules/ramda/es/reduceRight.js | 58 + node_modules/ramda/es/reduceWhile.js | 42 + node_modules/ramda/es/reduced.js | 33 + node_modules/ramda/es/reject.js | 35 + node_modules/ramda/es/remove.js | 31 + node_modules/ramda/es/repeat.js | 34 + node_modules/ramda/es/replace.js | 33 + node_modules/ramda/es/reverse.js | 34 + node_modules/ramda/es/scan.js | 40 + node_modules/ramda/es/sequence.js | 39 + node_modules/ramda/es/set.js | 33 + node_modules/ramda/es/slice.js | 36 + node_modules/ramda/es/sort.js | 29 + node_modules/ramda/es/sortBy.js | 46 + node_modules/ramda/es/sortWith.js | 51 + node_modules/ramda/es/split.js | 26 + node_modules/ramda/es/splitAt.js | 29 + node_modules/ramda/es/splitEvery.js | 38 + node_modules/ramda/es/splitWhen.js | 37 + node_modules/ramda/es/startsWith.js | 33 + node_modules/ramda/es/subtract.js | 32 + node_modules/ramda/es/sum.js | 22 + node_modules/ramda/es/symmetricDifference.js | 29 + .../ramda/es/symmetricDifferenceWith.js | 33 + node_modules/ramda/es/tail.js | 40 + node_modules/ramda/es/take.js | 57 + node_modules/ramda/es/takeLast.js | 32 + node_modules/ramda/es/takeLastWhile.js | 41 + node_modules/ramda/es/takeWhile.js | 50 + node_modules/ramda/es/tap.js | 34 + node_modules/ramda/es/test.js | 33 + node_modules/ramda/es/thunkify.js | 33 + node_modules/ramda/es/times.js | 47 + node_modules/ramda/es/toLower.js | 21 + node_modules/ramda/es/toPairs.js | 36 + node_modules/ramda/es/toPairsIn.js | 36 + node_modules/ramda/es/toString.js | 46 + node_modules/ramda/es/toUpper.js | 21 + node_modules/ramda/es/transduce.js | 57 + node_modules/ramda/es/transpose.js | 52 + node_modules/ramda/es/traverse.js | 37 + node_modules/ramda/es/trim.js | 36 + node_modules/ramda/es/tryCatch.js | 40 + node_modules/ramda/es/type.js | 34 + node_modules/ramda/es/unapply.js | 35 + node_modules/ramda/es/unary.js | 38 + node_modules/ramda/es/uncurryN.js | 43 + node_modules/ramda/es/unfold.js | 42 + node_modules/ramda/es/union.js | 29 + node_modules/ramda/es/unionWith.js | 33 + node_modules/ramda/es/uniq.js | 24 + node_modules/ramda/es/uniqBy.js | 44 + node_modules/ramda/es/uniqWith.js | 47 + node_modules/ramda/es/unless.js | 33 + node_modules/ramda/es/unnest.js | 24 + node_modules/ramda/es/until.js | 34 + node_modules/ramda/es/update.js | 33 + node_modules/ramda/es/useWith.js | 49 + node_modules/ramda/es/values.js | 37 + node_modules/ramda/es/valuesIn.js | 37 + node_modules/ramda/es/view.js | 42 + node_modules/ramda/es/when.js | 37 + node_modules/ramda/es/where.js | 51 + node_modules/ramda/es/whereEq.js | 40 + node_modules/ramda/es/without.js | 31 + node_modules/ramda/es/xor.js | 30 + node_modules/ramda/es/xprod.js | 45 + node_modules/ramda/es/zip.js | 37 + node_modules/ramda/es/zipObj.js | 35 + node_modules/ramda/es/zipWith.js | 42 + node_modules/ramda/package.json | 137 + node_modules/ramda/src/F.js | 20 + node_modules/ramda/src/T.js | 20 + node_modules/ramda/src/__.js | 30 + node_modules/ramda/src/add.js | 29 + node_modules/ramda/src/addIndex.js | 57 + node_modules/ramda/src/adjust.js | 52 + node_modules/ramda/src/all.js | 56 + node_modules/ramda/src/allPass.js | 66 + node_modules/ramda/src/always.js | 33 + node_modules/ramda/src/and.js | 31 + node_modules/ramda/src/andThen.js | 44 + node_modules/ramda/src/any.js | 57 + node_modules/ramda/src/anyPass.js | 67 + node_modules/ramda/src/ap.js | 54 + node_modules/ramda/src/aperture.js | 45 + node_modules/ramda/src/append.js | 36 + node_modules/ramda/src/apply.js | 32 + node_modules/ramda/src/applySpec.js | 82 + node_modules/ramda/src/applyTo.js | 31 + node_modules/ramda/src/ascend.js | 39 + node_modules/ramda/src/assoc.js | 39 + node_modules/ramda/src/assocPath.js | 73 + node_modules/ramda/src/binary.js | 44 + node_modules/ramda/src/bind.js | 40 + node_modules/ramda/src/both.js | 57 + node_modules/ramda/src/call.js | 43 + node_modules/ramda/src/chain.js | 62 + node_modules/ramda/src/clamp.js | 36 + node_modules/ramda/src/clone.js | 37 + node_modules/ramda/src/comparator.js | 37 + node_modules/ramda/src/complement.js | 35 + node_modules/ramda/src/compose.js | 42 + node_modules/ramda/src/composeK.js | 55 + node_modules/ramda/src/composeP.js | 53 + node_modules/ramda/src/composeWith.js | 44 + node_modules/ramda/src/concat.js | 80 + node_modules/ramda/src/cond.js | 68 + node_modules/ramda/src/construct.js | 48 + node_modules/ramda/src/constructN.js | 97 + node_modules/ramda/src/contains.js | 37 + node_modules/ramda/src/converge.js | 66 + node_modules/ramda/src/countBy.js | 35 + node_modules/ramda/src/curry.js | 57 + node_modules/ramda/src/curryN.js | 70 + node_modules/ramda/src/dec.js | 24 + node_modules/ramda/src/defaultTo.js | 35 + node_modules/ramda/src/descend.js | 39 + node_modules/ramda/src/difference.js | 54 + node_modules/ramda/src/differenceWith.js | 50 + node_modules/ramda/src/dissoc.js | 35 + node_modules/ramda/src/dissocPath.js | 74 + node_modules/ramda/src/divide.js | 34 + node_modules/ramda/src/drop.js | 50 + node_modules/ramda/src/dropLast.js | 47 + node_modules/ramda/src/dropLastWhile.js | 51 + node_modules/ramda/src/dropRepeats.js | 50 + node_modules/ramda/src/dropRepeatsWith.js | 63 + node_modules/ramda/src/dropWhile.js | 61 + node_modules/ramda/src/either.js | 56 + node_modules/ramda/src/empty.js | 54 + node_modules/ramda/src/endsWith.js | 42 + node_modules/ramda/src/eqBy.js | 33 + node_modules/ramda/src/eqProps.js | 37 + node_modules/ramda/src/equals.js | 41 + node_modules/ramda/src/evolve.js | 48 + node_modules/ramda/src/filter.js | 72 + node_modules/ramda/src/find.js | 55 + node_modules/ramda/src/findIndex.js | 55 + node_modules/ramda/src/findLast.js | 52 + node_modules/ramda/src/findLastIndex.js | 54 + node_modules/ramda/src/flatten.js | 33 + node_modules/ramda/src/flip.js | 41 + node_modules/ramda/src/forEach.js | 60 + node_modules/ramda/src/forEachObjIndexed.js | 47 + node_modules/ramda/src/fromPairs.js | 36 + node_modules/ramda/src/groupBy.js | 69 + node_modules/ramda/src/groupWith.js | 57 + node_modules/ramda/src/gt.js | 33 + node_modules/ramda/src/gte.js | 33 + node_modules/ramda/src/has.js | 40 + node_modules/ramda/src/hasIn.js | 38 + node_modules/ramda/src/hasPath.js | 57 + node_modules/ramda/src/head.js | 30 + node_modules/ramda/src/identical.js | 39 + node_modules/ramda/src/identity.js | 33 + node_modules/ramda/src/ifElse.js | 43 + node_modules/ramda/src/inc.js | 24 + node_modules/ramda/src/includes.js | 36 + node_modules/ramda/src/index.js | 772 ++ node_modules/ramda/src/index.mjs | 257 + node_modules/ramda/src/indexBy.js | 33 + node_modules/ramda/src/indexOf.js | 39 + node_modules/ramda/src/init.js | 33 + node_modules/ramda/src/innerJoin.js | 57 + node_modules/ramda/src/insert.js | 34 + node_modules/ramda/src/insertAll.js | 31 + node_modules/ramda/src/internal/_Set.js | 203 + node_modules/ramda/src/internal/_aperture.js | 14 + node_modules/ramda/src/internal/_arity.js | 64 + .../ramda/src/internal/_arrayFromIterator.js | 12 + .../ramda/src/internal/_assertPromise.js | 15 + .../ramda/src/internal/_checkForMethod.js | 29 + node_modules/ramda/src/internal/_clone.js | 61 + .../ramda/src/internal/_cloneRegExp.js | 5 + .../ramda/src/internal/_complement.js | 7 + node_modules/ramda/src/internal/_concat.js | 36 + .../src/internal/_createPartialApplicator.js | 17 + node_modules/ramda/src/internal/_curry1.js | 24 + node_modules/ramda/src/internal/_curry2.js | 39 + node_modules/ramda/src/internal/_curry3.js | 60 + node_modules/ramda/src/internal/_curryN.js | 50 + .../ramda/src/internal/_dispatchable.js | 54 + node_modules/ramda/src/internal/_dropLast.js | 9 + .../ramda/src/internal/_dropLastWhile.js | 15 + node_modules/ramda/src/internal/_equals.js | 189 + node_modules/ramda/src/internal/_filter.js | 17 + node_modules/ramda/src/internal/_flatCat.js | 43 + .../ramda/src/internal/_forceReduced.js | 8 + .../ramda/src/internal/_functionName.js | 7 + .../ramda/src/internal/_functionsWith.js | 19 + node_modules/ramda/src/internal/_has.js | 5 + node_modules/ramda/src/internal/_identity.js | 5 + node_modules/ramda/src/internal/_includes.js | 9 + .../ramda/src/internal/_includesWith.js | 16 + node_modules/ramda/src/internal/_indexOf.js | 72 + .../ramda/src/internal/_isArguments.js | 17 + node_modules/ramda/src/internal/_isArray.js | 15 + .../ramda/src/internal/_isArrayLike.js | 65 + .../ramda/src/internal/_isFunction.js | 6 + node_modules/ramda/src/internal/_isInteger.js | 11 + node_modules/ramda/src/internal/_isNumber.js | 5 + node_modules/ramda/src/internal/_isObject.js | 5 + .../ramda/src/internal/_isPlaceholder.js | 5 + node_modules/ramda/src/internal/_isRegExp.js | 5 + node_modules/ramda/src/internal/_isString.js | 5 + .../ramda/src/internal/_isTransformer.js | 5 + node_modules/ramda/src/internal/_makeFlat.js | 40 + node_modules/ramda/src/internal/_map.js | 14 + .../ramda/src/internal/_objectAssign.js | 32 + node_modules/ramda/src/internal/_objectIs.js | 14 + node_modules/ramda/src/internal/_of.js | 5 + node_modules/ramda/src/internal/_pipe.js | 7 + node_modules/ramda/src/internal/_pipeP.js | 10 + node_modules/ramda/src/internal/_quote.js | 7 + node_modules/ramda/src/internal/_reduce.js | 82 + node_modules/ramda/src/internal/_reduced.js | 8 + node_modules/ramda/src/internal/_stepCat.js | 64 + .../ramda/src/internal/_toISOString.js | 14 + node_modules/ramda/src/internal/_toString.js | 78 + node_modules/ramda/src/internal/_xall.js | 50 + node_modules/ramda/src/internal/_xany.js | 50 + node_modules/ramda/src/internal/_xaperture.js | 58 + node_modules/ramda/src/internal/_xchain.js | 19 + node_modules/ramda/src/internal/_xdrop.js | 38 + node_modules/ramda/src/internal/_xdropLast.js | 54 + .../ramda/src/internal/_xdropLastWhile.js | 53 + .../ramda/src/internal/_xdropRepeatsWith.js | 44 + .../ramda/src/internal/_xdropWhile.js | 41 + node_modules/ramda/src/internal/_xfBase.js | 8 + node_modules/ramda/src/internal/_xfilter.js | 33 + node_modules/ramda/src/internal/_xfind.js | 50 + .../ramda/src/internal/_xfindIndex.js | 53 + node_modules/ramda/src/internal/_xfindLast.js | 40 + .../ramda/src/internal/_xfindLastIndex.js | 44 + node_modules/ramda/src/internal/_xmap.js | 33 + node_modules/ramda/src/internal/_xreduceBy.js | 60 + node_modules/ramda/src/internal/_xtake.js | 40 + .../ramda/src/internal/_xtakeWhile.js | 37 + node_modules/ramda/src/internal/_xtap.js | 34 + node_modules/ramda/src/internal/_xwrap.js | 27 + node_modules/ramda/src/intersection.js | 55 + node_modules/ramda/src/intersperse.js | 49 + node_modules/ramda/src/into.js | 67 + node_modules/ramda/src/invert.js | 55 + node_modules/ramda/src/invertObj.js | 54 + node_modules/ramda/src/invoker.js | 66 + node_modules/ramda/src/is.js | 35 + node_modules/ramda/src/isEmpty.js | 41 + node_modules/ramda/src/isNil.js | 29 + node_modules/ramda/src/join.js | 28 + node_modules/ramda/src/juxt.js | 35 + node_modules/ramda/src/keys.js | 100 + node_modules/ramda/src/keysIn.js | 40 + node_modules/ramda/src/last.js | 29 + node_modules/ramda/src/lastIndexOf.js | 53 + node_modules/ramda/src/length.js | 31 + node_modules/ramda/src/lens.js | 45 + node_modules/ramda/src/lensIndex.js | 44 + node_modules/ramda/src/lensPath.js | 48 + node_modules/ramda/src/lensProp.js | 44 + node_modules/ramda/src/lift.js | 38 + node_modules/ramda/src/liftN.js | 48 + node_modules/ramda/src/lt.js | 33 + node_modules/ramda/src/lte.js | 33 + node_modules/ramda/src/map.js | 87 + node_modules/ramda/src/mapAccum.js | 57 + node_modules/ramda/src/mapAccumRight.js | 59 + node_modules/ramda/src/mapObjIndexed.js | 44 + node_modules/ramda/src/match.js | 33 + node_modules/ramda/src/mathMod.js | 57 + node_modules/ramda/src/max.js | 29 + node_modules/ramda/src/maxBy.js | 36 + node_modules/ramda/src/mean.js | 32 + node_modules/ramda/src/median.js | 43 + node_modules/ramda/src/memoizeWith.js | 57 + node_modules/ramda/src/merge.js | 40 + node_modules/ramda/src/mergeAll.js | 33 + node_modules/ramda/src/mergeDeepLeft.js | 39 + node_modules/ramda/src/mergeDeepRight.js | 39 + node_modules/ramda/src/mergeDeepWith.js | 45 + node_modules/ramda/src/mergeDeepWithKey.js | 54 + node_modules/ramda/src/mergeLeft.js | 39 + node_modules/ramda/src/mergeRight.js | 39 + node_modules/ramda/src/mergeWith.js | 41 + node_modules/ramda/src/mergeWithKey.js | 56 + node_modules/ramda/src/min.js | 29 + node_modules/ramda/src/minBy.js | 36 + node_modules/ramda/src/modulo.js | 37 + node_modules/ramda/src/move.js | 35 + node_modules/ramda/src/multiply.js | 32 + node_modules/ramda/src/nAry.js | 100 + node_modules/ramda/src/negate.js | 26 + node_modules/ramda/src/none.js | 45 + node_modules/ramda/src/not.js | 31 + node_modules/ramda/src/nth.js | 43 + node_modules/ramda/src/nthArg.js | 41 + node_modules/ramda/src/o.js | 39 + node_modules/ramda/src/objOf.js | 34 + node_modules/ramda/src/of.js | 32 + node_modules/ramda/src/omit.js | 44 + node_modules/ramda/src/once.js | 45 + node_modules/ramda/src/or.js | 32 + node_modules/ramda/src/otherwise.js | 46 + node_modules/ramda/src/over.js | 50 + node_modules/ramda/src/pair.js | 28 + node_modules/ramda/src/partial.js | 42 + node_modules/ramda/src/partialRight.js | 44 + node_modules/ramda/src/partition.js | 41 + node_modules/ramda/src/path.js | 36 + node_modules/ramda/src/pathEq.js | 44 + node_modules/ramda/src/pathOr.js | 39 + node_modules/ramda/src/pathSatisfies.js | 36 + node_modules/ramda/src/paths.js | 54 + node_modules/ramda/src/pick.js | 41 + node_modules/ramda/src/pickAll.js | 40 + node_modules/ramda/src/pickBy.js | 40 + node_modules/ramda/src/pipe.js | 49 + node_modules/ramda/src/pipeK.js | 53 + node_modules/ramda/src/pipeP.js | 45 + node_modules/ramda/src/pipeWith.js | 65 + node_modules/ramda/src/pluck.js | 47 + node_modules/ramda/src/prepend.js | 33 + node_modules/ramda/src/product.js | 28 + node_modules/ramda/src/project.js | 41 + node_modules/ramda/src/prop.js | 37 + node_modules/ramda/src/propEq.js | 41 + node_modules/ramda/src/propIs.js | 36 + node_modules/ramda/src/propOr.js | 42 + node_modules/ramda/src/propSatisfies.js | 31 + node_modules/ramda/src/props.js | 38 + node_modules/ramda/src/range.js | 44 + node_modules/ramda/src/reduce.js | 60 + node_modules/ramda/src/reduceBy.js | 79 + node_modules/ramda/src/reduceRight.js | 61 + node_modules/ramda/src/reduceWhile.js | 51 + node_modules/ramda/src/reduced.js | 39 + node_modules/ramda/src/reject.js | 44 + node_modules/ramda/src/remove.js | 34 + node_modules/ramda/src/repeat.js | 43 + node_modules/ramda/src/replace.js | 36 + node_modules/ramda/src/reverse.js | 40 + node_modules/ramda/src/scan.js | 43 + node_modules/ramda/src/sequence.js | 54 + node_modules/ramda/src/set.js | 42 + node_modules/ramda/src/slice.js | 42 + node_modules/ramda/src/sort.js | 32 + node_modules/ramda/src/sortBy.js | 49 + node_modules/ramda/src/sortWith.js | 54 + node_modules/ramda/src/split.js | 29 + node_modules/ramda/src/splitAt.js | 38 + node_modules/ramda/src/splitEvery.js | 44 + node_modules/ramda/src/splitWhen.js | 40 + node_modules/ramda/src/startsWith.js | 42 + node_modules/ramda/src/subtract.js | 35 + node_modules/ramda/src/sum.js | 28 + node_modules/ramda/src/symmetricDifference.js | 38 + .../ramda/src/symmetricDifferenceWith.js | 42 + node_modules/ramda/src/tail.js | 49 + node_modules/ramda/src/take.js | 69 + node_modules/ramda/src/takeLast.js | 38 + node_modules/ramda/src/takeLastWhile.js | 47 + node_modules/ramda/src/takeWhile.js | 62 + node_modules/ramda/src/tap.js | 43 + node_modules/ramda/src/test.js | 45 + node_modules/ramda/src/thunkify.js | 39 + node_modules/ramda/src/times.js | 50 + node_modules/ramda/src/toLower.js | 24 + node_modules/ramda/src/toPairs.js | 42 + node_modules/ramda/src/toPairsIn.js | 39 + node_modules/ramda/src/toString.js | 52 + node_modules/ramda/src/toUpper.js | 24 + node_modules/ramda/src/transduce.js | 66 + node_modules/ramda/src/transpose.js | 55 + node_modules/ramda/src/traverse.js | 46 + node_modules/ramda/src/trim.js | 39 + node_modules/ramda/src/tryCatch.js | 49 + node_modules/ramda/src/type.js | 37 + node_modules/ramda/src/unapply.js | 38 + node_modules/ramda/src/unary.js | 44 + node_modules/ramda/src/uncurryN.js | 49 + node_modules/ramda/src/unfold.js | 45 + node_modules/ramda/src/union.js | 41 + node_modules/ramda/src/unionWith.js | 42 + node_modules/ramda/src/uniq.js | 30 + node_modules/ramda/src/uniqBy.js | 50 + node_modules/ramda/src/uniqWith.js | 53 + node_modules/ramda/src/unless.js | 36 + node_modules/ramda/src/unnest.js | 30 + node_modules/ramda/src/until.js | 37 + node_modules/ramda/src/update.js | 42 + node_modules/ramda/src/useWith.js | 55 + node_modules/ramda/src/values.js | 43 + node_modules/ramda/src/valuesIn.js | 40 + node_modules/ramda/src/view.js | 45 + node_modules/ramda/src/when.js | 40 + node_modules/ramda/src/where.js | 57 + node_modules/ramda/src/whereEq.js | 52 + node_modules/ramda/src/without.js | 43 + node_modules/ramda/src/xor.js | 33 + node_modules/ramda/src/xprod.js | 48 + node_modules/ramda/src/zip.js | 40 + node_modules/ramda/src/zipObj.js | 38 + node_modules/ramda/src/zipWith.js | 45 + node_modules/sonic-boom/.travis.yml | 9 + node_modules/sonic-boom/LICENSE | 21 + node_modules/sonic-boom/README.md | 100 + node_modules/sonic-boom/bench.js | 63 + node_modules/sonic-boom/check.js | 18 + node_modules/sonic-boom/example.js | 8 + node_modules/sonic-boom/fixtures/firehose.js | 22 + node_modules/sonic-boom/index.js | 317 + node_modules/sonic-boom/package.json | 67 + node_modules/sonic-boom/test.js | 762 ++ package-lock.json | 128 + package.json | 1 + 964 files changed, 104265 insertions(+), 16 deletions(-) create mode 120000 node_modules/.bin/pino create mode 100644 node_modules/atomic-sleep/.travis.yml create mode 100644 node_modules/atomic-sleep/LICENSE create mode 100644 node_modules/atomic-sleep/index.js create mode 100644 node_modules/atomic-sleep/package.json create mode 100644 node_modules/atomic-sleep/readme.md create mode 100644 node_modules/atomic-sleep/test.js create mode 100644 node_modules/axios/CHANGELOG.md create mode 100644 node_modules/axios/LICENSE create mode 100755 node_modules/axios/README.md create mode 100644 node_modules/axios/UPGRADE_GUIDE.md create mode 100644 node_modules/axios/dist/axios.js create mode 100644 node_modules/axios/dist/axios.map create mode 100644 node_modules/axios/dist/axios.min.js create mode 100644 node_modules/axios/dist/axios.min.map create mode 100644 node_modules/axios/index.d.ts create mode 100644 node_modules/axios/index.js create mode 100644 node_modules/axios/lib/adapters/README.md create mode 100755 node_modules/axios/lib/adapters/http.js create mode 100644 node_modules/axios/lib/adapters/xhr.js create mode 100644 node_modules/axios/lib/axios.js create mode 100644 node_modules/axios/lib/cancel/Cancel.js create mode 100644 node_modules/axios/lib/cancel/CancelToken.js create mode 100644 node_modules/axios/lib/cancel/isCancel.js create mode 100644 node_modules/axios/lib/core/Axios.js create mode 100644 node_modules/axios/lib/core/InterceptorManager.js create mode 100644 node_modules/axios/lib/core/README.md create mode 100644 node_modules/axios/lib/core/buildFullPath.js create mode 100644 node_modules/axios/lib/core/createError.js create mode 100644 node_modules/axios/lib/core/dispatchRequest.js create mode 100644 node_modules/axios/lib/core/enhanceError.js create mode 100644 node_modules/axios/lib/core/mergeConfig.js create mode 100644 node_modules/axios/lib/core/settle.js create mode 100644 node_modules/axios/lib/core/transformData.js create mode 100644 node_modules/axios/lib/defaults.js create mode 100644 node_modules/axios/lib/helpers/README.md create mode 100644 node_modules/axios/lib/helpers/bind.js create mode 100644 node_modules/axios/lib/helpers/buildURL.js create mode 100644 node_modules/axios/lib/helpers/combineURLs.js create mode 100644 node_modules/axios/lib/helpers/cookies.js create mode 100644 node_modules/axios/lib/helpers/deprecatedMethod.js create mode 100644 node_modules/axios/lib/helpers/isAbsoluteURL.js create mode 100644 node_modules/axios/lib/helpers/isURLSameOrigin.js create mode 100644 node_modules/axios/lib/helpers/normalizeHeaderName.js create mode 100644 node_modules/axios/lib/helpers/parseHeaders.js create mode 100644 node_modules/axios/lib/helpers/spread.js create mode 100644 node_modules/axios/lib/utils.js create mode 100644 node_modules/axios/package.json create mode 100644 node_modules/camelcase-keys/index.d.ts create mode 100644 node_modules/camelcase-keys/index.js create mode 100644 node_modules/camelcase-keys/license create mode 100644 node_modules/camelcase-keys/package.json create mode 100644 node_modules/camelcase-keys/readme.md create mode 100644 node_modules/camelcase/index.d.ts create mode 100644 node_modules/camelcase/index.js create mode 100644 node_modules/camelcase/license create mode 100644 node_modules/camelcase/package.json create mode 100644 node_modules/camelcase/readme.md create mode 100644 node_modules/debug/.coveralls.yml create mode 100644 node_modules/debug/.eslintrc create mode 100644 node_modules/debug/.npmignore create mode 100644 node_modules/debug/.travis.yml create mode 100644 node_modules/debug/CHANGELOG.md create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/Makefile create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/karma.conf.js create mode 100644 node_modules/debug/node.js create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/debug.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/docker-hub-utils/README.md create mode 100644 node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js create mode 100644 node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js.map create mode 100644 node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js create mode 100644 node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js.map create mode 100644 node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js create mode 100644 node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js.map create mode 100644 node_modules/docker-hub-utils/dist/index.d.ts create mode 100644 node_modules/docker-hub-utils/dist/index.js create mode 100644 node_modules/docker-hub-utils/dist/services/DockerHubAPI.d.ts create mode 100644 node_modules/docker-hub-utils/dist/types/DockerHubRepo.d.ts create mode 100644 node_modules/docker-hub-utils/dist/utils/constants.d.ts create mode 100644 node_modules/docker-hub-utils/dist/utils/log.d.ts create mode 100644 node_modules/docker-hub-utils/package.json create mode 100644 node_modules/fast-redact/.travis.yml create mode 100644 node_modules/fast-redact/LICENSE create mode 100644 node_modules/fast-redact/benchmark/index.js create mode 100644 node_modules/fast-redact/example/default-usage.js create mode 100644 node_modules/fast-redact/example/intermediate-wildcard-array.js create mode 100644 node_modules/fast-redact/example/serialize-false.js create mode 100644 node_modules/fast-redact/example/serialize-function.js create mode 100644 node_modules/fast-redact/example/top-wildcard-object.js create mode 100644 node_modules/fast-redact/index.js create mode 100644 node_modules/fast-redact/lib/modifiers.js create mode 100644 node_modules/fast-redact/lib/parse.js create mode 100644 node_modules/fast-redact/lib/redactor.js create mode 100644 node_modules/fast-redact/lib/restorer.js create mode 100644 node_modules/fast-redact/lib/rx.js create mode 100644 node_modules/fast-redact/lib/state.js create mode 100644 node_modules/fast-redact/lib/validator.js create mode 100644 node_modules/fast-redact/package.json create mode 100644 node_modules/fast-redact/readme.md create mode 100644 node_modules/fast-redact/test/index.js create mode 100644 node_modules/fast-safe-stringify/.travis.yml create mode 100644 node_modules/fast-safe-stringify/CHANGELOG.md create mode 100644 node_modules/fast-safe-stringify/LICENSE create mode 100644 node_modules/fast-safe-stringify/benchmark.js create mode 100644 node_modules/fast-safe-stringify/index.d.ts create mode 100644 node_modules/fast-safe-stringify/index.js create mode 100644 node_modules/fast-safe-stringify/package.json create mode 100644 node_modules/fast-safe-stringify/readme.md create mode 100644 node_modules/fast-safe-stringify/test-stable.js create mode 100644 node_modules/fast-safe-stringify/test.js create mode 100644 node_modules/flatstr/LICENSE create mode 100644 node_modules/flatstr/alt-benchmark.js create mode 100644 node_modules/flatstr/benchmark.js create mode 100644 node_modules/flatstr/index.js create mode 100644 node_modules/flatstr/package.json create mode 100644 node_modules/flatstr/readme.md create mode 100644 node_modules/flatstr/test.js create mode 100644 node_modules/follow-redirects/LICENSE create mode 100644 node_modules/follow-redirects/README.md create mode 100644 node_modules/follow-redirects/http.js create mode 100644 node_modules/follow-redirects/https.js create mode 100644 node_modules/follow-redirects/index.js create mode 100644 node_modules/follow-redirects/package.json create mode 100644 node_modules/luxon/README.md create mode 100644 node_modules/luxon/build/amd/luxon.js create mode 100644 node_modules/luxon/build/amd/luxon.js.map create mode 100644 node_modules/luxon/build/cjs-browser/luxon.js create mode 100644 node_modules/luxon/build/cjs-browser/luxon.js.map create mode 100644 node_modules/luxon/build/global/luxon.js create mode 100644 node_modules/luxon/build/global/luxon.js.map create mode 100644 node_modules/luxon/build/global/luxon.min.js create mode 100644 node_modules/luxon/build/global/luxon.min.js.map create mode 100644 node_modules/luxon/build/node/luxon.js create mode 100644 node_modules/luxon/build/node/luxon.js.map create mode 100644 node_modules/luxon/build/readme.md create mode 100644 node_modules/luxon/changelog.md create mode 100644 node_modules/luxon/license.md create mode 100644 node_modules/luxon/package.json create mode 100644 node_modules/luxon/src/datetime.js create mode 100644 node_modules/luxon/src/duration.js create mode 100644 node_modules/luxon/src/errors.js create mode 100644 node_modules/luxon/src/impl/conversions.js create mode 100644 node_modules/luxon/src/impl/diff.js create mode 100644 node_modules/luxon/src/impl/digits.js create mode 100644 node_modules/luxon/src/impl/english.js create mode 100644 node_modules/luxon/src/impl/formats.js create mode 100644 node_modules/luxon/src/impl/formatter.js create mode 100644 node_modules/luxon/src/impl/invalid.js create mode 100644 node_modules/luxon/src/impl/locale.js create mode 100644 node_modules/luxon/src/impl/regexParser.js create mode 100644 node_modules/luxon/src/impl/tokenParser.js create mode 100644 node_modules/luxon/src/impl/util.js create mode 100644 node_modules/luxon/src/impl/zoneUtil.js create mode 100644 node_modules/luxon/src/info.js create mode 100644 node_modules/luxon/src/interval.js create mode 100644 node_modules/luxon/src/luxon.js create mode 100644 node_modules/luxon/src/luxonFilled.js create mode 100644 node_modules/luxon/src/settings.js create mode 100644 node_modules/luxon/src/zone.js create mode 100644 node_modules/luxon/src/zones/IANAZone.js create mode 100644 node_modules/luxon/src/zones/fixedOffsetZone.js create mode 100644 node_modules/luxon/src/zones/invalidZone.js create mode 100644 node_modules/luxon/src/zones/localZone.js create mode 100644 node_modules/map-obj/index.d.ts create mode 100644 node_modules/map-obj/index.js create mode 100644 node_modules/map-obj/license create mode 100644 node_modules/map-obj/package.json create mode 100644 node_modules/map-obj/readme.md create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/pino-std-serializers/.editorconfig create mode 100644 node_modules/pino-std-serializers/.travis.yml create mode 100644 node_modules/pino-std-serializers/LICENSE create mode 100644 node_modules/pino-std-serializers/Readme.md create mode 100644 node_modules/pino-std-serializers/index.js create mode 100644 node_modules/pino-std-serializers/lib/err.js create mode 100644 node_modules/pino-std-serializers/lib/req.js create mode 100644 node_modules/pino-std-serializers/lib/res.js create mode 100644 node_modules/pino-std-serializers/package.json create mode 100644 node_modules/pino-std-serializers/test/err.test.js create mode 100644 node_modules/pino-std-serializers/test/req.test.js create mode 100644 node_modules/pino-std-serializers/test/res.test.js create mode 100644 node_modules/pino/LICENSE create mode 100644 node_modules/pino/README.md create mode 100755 node_modules/pino/bin.js create mode 100644 node_modules/pino/browser.js create mode 100644 node_modules/pino/docs/api.md create mode 100644 node_modules/pino/docs/benchmarks.md create mode 100644 node_modules/pino/docs/browser.md create mode 100644 node_modules/pino/docs/child-loggers.md create mode 100644 node_modules/pino/docs/ecosystem.md create mode 100644 node_modules/pino/docs/extreme.md create mode 100644 node_modules/pino/docs/help.md create mode 100644 node_modules/pino/docs/legacy.md create mode 100644 node_modules/pino/docs/pretty.md create mode 100644 node_modules/pino/docs/redaction.md create mode 100644 node_modules/pino/docs/transports.md create mode 100644 node_modules/pino/docs/web.md create mode 100644 node_modules/pino/example.js create mode 100644 node_modules/pino/lib/levels.js create mode 100644 node_modules/pino/lib/meta.js create mode 100644 node_modules/pino/lib/proto.js create mode 100644 node_modules/pino/lib/redaction.js create mode 100644 node_modules/pino/lib/symbols.js create mode 100644 node_modules/pino/lib/time.js create mode 100644 node_modules/pino/lib/tools.js create mode 100644 node_modules/pino/package.json create mode 100644 node_modules/pino/pino.js create mode 100644 node_modules/pino/test/basic.test.js create mode 100644 node_modules/pino/test/broken-pipe.test.js create mode 100644 node_modules/pino/test/browser-levels.test.js create mode 100644 node_modules/pino/test/browser-serializers.test.js create mode 100644 node_modules/pino/test/browser-transmit.test.js create mode 100644 node_modules/pino/test/browser.test.js create mode 100644 node_modules/pino/test/crlf.test.js create mode 100644 node_modules/pino/test/custom-levels.test.js create mode 100644 node_modules/pino/test/error.test.js create mode 100644 node_modules/pino/test/escaping.test.js create mode 100644 node_modules/pino/test/exit.test.js create mode 100644 node_modules/pino/test/extreme.test.js create mode 100644 node_modules/pino/test/final.test.js create mode 100644 node_modules/pino/test/fixtures/broken-pipe/basic.js create mode 100644 node_modules/pino/test/fixtures/broken-pipe/destination.js create mode 100644 node_modules/pino/test/fixtures/broken-pipe/extreme.js create mode 100644 node_modules/pino/test/fixtures/destination-exit.js create mode 100644 node_modules/pino/test/fixtures/extreme-child.js create mode 100644 node_modules/pino/test/fixtures/extreme-exit.js create mode 100644 node_modules/pino/test/fixtures/extreme-flush-exit.js create mode 100644 node_modules/pino/test/fixtures/extreme.js create mode 100644 node_modules/pino/test/fixtures/pretty/basic.js create mode 100644 node_modules/pino/test/fixtures/pretty/child.js create mode 100644 node_modules/pino/test/fixtures/pretty/custom-time-label.js create mode 100644 node_modules/pino/test/fixtures/pretty/custom-time.js create mode 100644 node_modules/pino/test/fixtures/pretty/dateformat.js create mode 100644 node_modules/pino/test/fixtures/pretty/error-props.js create mode 100644 node_modules/pino/test/fixtures/pretty/error.js create mode 100644 node_modules/pino/test/fixtures/pretty/final-no-log-before.js create mode 100644 node_modules/pino/test/fixtures/pretty/final-return.js create mode 100644 node_modules/pino/test/fixtures/pretty/final.js create mode 100644 node_modules/pino/test/fixtures/pretty/level-first.js create mode 100644 node_modules/pino/test/fixtures/pretty/no-time.js create mode 100644 node_modules/pino/test/fixtures/pretty/obj-msg-prop.js create mode 100644 node_modules/pino/test/fixtures/pretty/pretty-factory.js create mode 100644 node_modules/pino/test/fixtures/pretty/redact.js create mode 100644 node_modules/pino/test/fixtures/pretty/serializers.js create mode 100644 node_modules/pino/test/fixtures/pretty/skipped-output.js create mode 100644 node_modules/pino/test/fixtures/stdout-hack-protection.js create mode 100644 node_modules/pino/test/helper.js create mode 100644 node_modules/pino/test/http.test.js create mode 100644 node_modules/pino/test/is-level-enabled.test.js create mode 100644 node_modules/pino/test/levels.test.js create mode 100644 node_modules/pino/test/metadata.test.js create mode 100644 node_modules/pino/test/mixin.test.js create mode 100644 node_modules/pino/test/pretty.test.js create mode 100644 node_modules/pino/test/redact.test.js create mode 100644 node_modules/pino/test/serializers.test.js create mode 100644 node_modules/pino/test/stdout-protection.test.js create mode 100644 node_modules/pino/test/timestamp.test.js create mode 100644 node_modules/quick-format-unescaped/.travis.yml create mode 100644 node_modules/quick-format-unescaped/LICENSE create mode 100644 node_modules/quick-format-unescaped/benchmark.js create mode 100644 node_modules/quick-format-unescaped/index.js create mode 100644 node_modules/quick-format-unescaped/package.json create mode 100644 node_modules/quick-format-unescaped/readme.md create mode 100644 node_modules/quick-format-unescaped/test/index.js create mode 100644 node_modules/quick-lru/index.d.ts create mode 100644 node_modules/quick-lru/index.js create mode 100644 node_modules/quick-lru/license create mode 100644 node_modules/quick-lru/package.json create mode 100644 node_modules/quick-lru/readme.md create mode 100644 node_modules/ramda/CHANGELOG.md create mode 100644 node_modules/ramda/LICENSE.txt create mode 100644 node_modules/ramda/README.md create mode 100644 node_modules/ramda/dist/ramda.js create mode 100644 node_modules/ramda/dist/ramda.min.js create mode 100644 node_modules/ramda/es/F.js create mode 100644 node_modules/ramda/es/T.js create mode 100644 node_modules/ramda/es/__.js create mode 100644 node_modules/ramda/es/add.js create mode 100644 node_modules/ramda/es/addIndex.js create mode 100644 node_modules/ramda/es/adjust.js create mode 100644 node_modules/ramda/es/all.js create mode 100644 node_modules/ramda/es/allPass.js create mode 100644 node_modules/ramda/es/always.js create mode 100644 node_modules/ramda/es/and.js create mode 100644 node_modules/ramda/es/andThen.js create mode 100644 node_modules/ramda/es/any.js create mode 100644 node_modules/ramda/es/anyPass.js create mode 100644 node_modules/ramda/es/ap.js create mode 100644 node_modules/ramda/es/aperture.js create mode 100644 node_modules/ramda/es/append.js create mode 100644 node_modules/ramda/es/apply.js create mode 100644 node_modules/ramda/es/applySpec.js create mode 100644 node_modules/ramda/es/applyTo.js create mode 100644 node_modules/ramda/es/ascend.js create mode 100644 node_modules/ramda/es/assoc.js create mode 100644 node_modules/ramda/es/assocPath.js create mode 100644 node_modules/ramda/es/binary.js create mode 100644 node_modules/ramda/es/bind.js create mode 100644 node_modules/ramda/es/both.js create mode 100644 node_modules/ramda/es/call.js create mode 100644 node_modules/ramda/es/chain.js create mode 100644 node_modules/ramda/es/clamp.js create mode 100644 node_modules/ramda/es/clone.js create mode 100644 node_modules/ramda/es/comparator.js create mode 100644 node_modules/ramda/es/complement.js create mode 100644 node_modules/ramda/es/compose.js create mode 100644 node_modules/ramda/es/composeK.js create mode 100644 node_modules/ramda/es/composeP.js create mode 100644 node_modules/ramda/es/composeWith.js create mode 100644 node_modules/ramda/es/concat.js create mode 100644 node_modules/ramda/es/cond.js create mode 100644 node_modules/ramda/es/construct.js create mode 100644 node_modules/ramda/es/constructN.js create mode 100644 node_modules/ramda/es/contains.js create mode 100644 node_modules/ramda/es/converge.js create mode 100644 node_modules/ramda/es/countBy.js create mode 100644 node_modules/ramda/es/curry.js create mode 100644 node_modules/ramda/es/curryN.js create mode 100644 node_modules/ramda/es/dec.js create mode 100644 node_modules/ramda/es/defaultTo.js create mode 100644 node_modules/ramda/es/descend.js create mode 100644 node_modules/ramda/es/difference.js create mode 100644 node_modules/ramda/es/differenceWith.js create mode 100644 node_modules/ramda/es/dissoc.js create mode 100644 node_modules/ramda/es/dissocPath.js create mode 100644 node_modules/ramda/es/divide.js create mode 100644 node_modules/ramda/es/drop.js create mode 100644 node_modules/ramda/es/dropLast.js create mode 100644 node_modules/ramda/es/dropLastWhile.js create mode 100644 node_modules/ramda/es/dropRepeats.js create mode 100644 node_modules/ramda/es/dropRepeatsWith.js create mode 100644 node_modules/ramda/es/dropWhile.js create mode 100644 node_modules/ramda/es/either.js create mode 100644 node_modules/ramda/es/empty.js create mode 100644 node_modules/ramda/es/endsWith.js create mode 100644 node_modules/ramda/es/eqBy.js create mode 100644 node_modules/ramda/es/eqProps.js create mode 100644 node_modules/ramda/es/equals.js create mode 100644 node_modules/ramda/es/evolve.js create mode 100644 node_modules/ramda/es/filter.js create mode 100644 node_modules/ramda/es/find.js create mode 100644 node_modules/ramda/es/findIndex.js create mode 100644 node_modules/ramda/es/findLast.js create mode 100644 node_modules/ramda/es/findLastIndex.js create mode 100644 node_modules/ramda/es/flatten.js create mode 100644 node_modules/ramda/es/flip.js create mode 100644 node_modules/ramda/es/forEach.js create mode 100644 node_modules/ramda/es/forEachObjIndexed.js create mode 100644 node_modules/ramda/es/fromPairs.js create mode 100644 node_modules/ramda/es/groupBy.js create mode 100644 node_modules/ramda/es/groupWith.js create mode 100644 node_modules/ramda/es/gt.js create mode 100644 node_modules/ramda/es/gte.js create mode 100644 node_modules/ramda/es/has.js create mode 100644 node_modules/ramda/es/hasIn.js create mode 100644 node_modules/ramda/es/hasPath.js create mode 100644 node_modules/ramda/es/head.js create mode 100644 node_modules/ramda/es/identical.js create mode 100644 node_modules/ramda/es/identity.js create mode 100644 node_modules/ramda/es/ifElse.js create mode 100644 node_modules/ramda/es/inc.js create mode 100644 node_modules/ramda/es/includes.js create mode 100644 node_modules/ramda/es/index.js create mode 100644 node_modules/ramda/es/indexBy.js create mode 100644 node_modules/ramda/es/indexOf.js create mode 100644 node_modules/ramda/es/init.js create mode 100644 node_modules/ramda/es/innerJoin.js create mode 100644 node_modules/ramda/es/insert.js create mode 100644 node_modules/ramda/es/insertAll.js create mode 100644 node_modules/ramda/es/internal/_Set.js create mode 100644 node_modules/ramda/es/internal/_aperture.js create mode 100644 node_modules/ramda/es/internal/_arity.js create mode 100644 node_modules/ramda/es/internal/_arrayFromIterator.js create mode 100644 node_modules/ramda/es/internal/_assertPromise.js create mode 100644 node_modules/ramda/es/internal/_checkForMethod.js create mode 100644 node_modules/ramda/es/internal/_clone.js create mode 100644 node_modules/ramda/es/internal/_cloneRegExp.js create mode 100644 node_modules/ramda/es/internal/_complement.js create mode 100644 node_modules/ramda/es/internal/_concat.js create mode 100644 node_modules/ramda/es/internal/_createPartialApplicator.js create mode 100644 node_modules/ramda/es/internal/_curry1.js create mode 100644 node_modules/ramda/es/internal/_curry2.js create mode 100644 node_modules/ramda/es/internal/_curry3.js create mode 100644 node_modules/ramda/es/internal/_curryN.js create mode 100644 node_modules/ramda/es/internal/_dispatchable.js create mode 100644 node_modules/ramda/es/internal/_dropLast.js create mode 100644 node_modules/ramda/es/internal/_dropLastWhile.js create mode 100644 node_modules/ramda/es/internal/_equals.js create mode 100644 node_modules/ramda/es/internal/_filter.js create mode 100644 node_modules/ramda/es/internal/_flatCat.js create mode 100644 node_modules/ramda/es/internal/_forceReduced.js create mode 100644 node_modules/ramda/es/internal/_functionName.js create mode 100644 node_modules/ramda/es/internal/_functionsWith.js create mode 100644 node_modules/ramda/es/internal/_has.js create mode 100644 node_modules/ramda/es/internal/_identity.js create mode 100644 node_modules/ramda/es/internal/_includes.js create mode 100644 node_modules/ramda/es/internal/_includesWith.js create mode 100644 node_modules/ramda/es/internal/_indexOf.js create mode 100644 node_modules/ramda/es/internal/_isArguments.js create mode 100644 node_modules/ramda/es/internal/_isArray.js create mode 100644 node_modules/ramda/es/internal/_isArrayLike.js create mode 100644 node_modules/ramda/es/internal/_isFunction.js create mode 100644 node_modules/ramda/es/internal/_isInteger.js create mode 100644 node_modules/ramda/es/internal/_isNumber.js create mode 100644 node_modules/ramda/es/internal/_isObject.js create mode 100644 node_modules/ramda/es/internal/_isPlaceholder.js create mode 100644 node_modules/ramda/es/internal/_isRegExp.js create mode 100644 node_modules/ramda/es/internal/_isString.js create mode 100644 node_modules/ramda/es/internal/_isTransformer.js create mode 100644 node_modules/ramda/es/internal/_makeFlat.js create mode 100644 node_modules/ramda/es/internal/_map.js create mode 100644 node_modules/ramda/es/internal/_objectAssign.js create mode 100644 node_modules/ramda/es/internal/_objectIs.js create mode 100644 node_modules/ramda/es/internal/_of.js create mode 100644 node_modules/ramda/es/internal/_pipe.js create mode 100644 node_modules/ramda/es/internal/_pipeP.js create mode 100644 node_modules/ramda/es/internal/_quote.js create mode 100644 node_modules/ramda/es/internal/_reduce.js create mode 100644 node_modules/ramda/es/internal/_reduced.js create mode 100644 node_modules/ramda/es/internal/_stepCat.js create mode 100644 node_modules/ramda/es/internal/_toISOString.js create mode 100644 node_modules/ramda/es/internal/_toString.js create mode 100644 node_modules/ramda/es/internal/_xall.js create mode 100644 node_modules/ramda/es/internal/_xany.js create mode 100644 node_modules/ramda/es/internal/_xaperture.js create mode 100644 node_modules/ramda/es/internal/_xchain.js create mode 100644 node_modules/ramda/es/internal/_xdrop.js create mode 100644 node_modules/ramda/es/internal/_xdropLast.js create mode 100644 node_modules/ramda/es/internal/_xdropLastWhile.js create mode 100644 node_modules/ramda/es/internal/_xdropRepeatsWith.js create mode 100644 node_modules/ramda/es/internal/_xdropWhile.js create mode 100644 node_modules/ramda/es/internal/_xfBase.js create mode 100644 node_modules/ramda/es/internal/_xfilter.js create mode 100644 node_modules/ramda/es/internal/_xfind.js create mode 100644 node_modules/ramda/es/internal/_xfindIndex.js create mode 100644 node_modules/ramda/es/internal/_xfindLast.js create mode 100644 node_modules/ramda/es/internal/_xfindLastIndex.js create mode 100644 node_modules/ramda/es/internal/_xmap.js create mode 100644 node_modules/ramda/es/internal/_xreduceBy.js create mode 100644 node_modules/ramda/es/internal/_xtake.js create mode 100644 node_modules/ramda/es/internal/_xtakeWhile.js create mode 100644 node_modules/ramda/es/internal/_xtap.js create mode 100644 node_modules/ramda/es/internal/_xwrap.js create mode 100644 node_modules/ramda/es/intersection.js create mode 100644 node_modules/ramda/es/intersperse.js create mode 100644 node_modules/ramda/es/into.js create mode 100644 node_modules/ramda/es/invert.js create mode 100644 node_modules/ramda/es/invertObj.js create mode 100644 node_modules/ramda/es/invoker.js create mode 100644 node_modules/ramda/es/is.js create mode 100644 node_modules/ramda/es/isEmpty.js create mode 100644 node_modules/ramda/es/isNil.js create mode 100644 node_modules/ramda/es/join.js create mode 100644 node_modules/ramda/es/juxt.js create mode 100644 node_modules/ramda/es/keys.js create mode 100644 node_modules/ramda/es/keysIn.js create mode 100644 node_modules/ramda/es/last.js create mode 100644 node_modules/ramda/es/lastIndexOf.js create mode 100644 node_modules/ramda/es/length.js create mode 100644 node_modules/ramda/es/lens.js create mode 100644 node_modules/ramda/es/lensIndex.js create mode 100644 node_modules/ramda/es/lensPath.js create mode 100644 node_modules/ramda/es/lensProp.js create mode 100644 node_modules/ramda/es/lift.js create mode 100644 node_modules/ramda/es/liftN.js create mode 100644 node_modules/ramda/es/lt.js create mode 100644 node_modules/ramda/es/lte.js create mode 100644 node_modules/ramda/es/map.js create mode 100644 node_modules/ramda/es/mapAccum.js create mode 100644 node_modules/ramda/es/mapAccumRight.js create mode 100644 node_modules/ramda/es/mapObjIndexed.js create mode 100644 node_modules/ramda/es/match.js create mode 100644 node_modules/ramda/es/mathMod.js create mode 100644 node_modules/ramda/es/max.js create mode 100644 node_modules/ramda/es/maxBy.js create mode 100644 node_modules/ramda/es/mean.js create mode 100644 node_modules/ramda/es/median.js create mode 100644 node_modules/ramda/es/memoizeWith.js create mode 100644 node_modules/ramda/es/merge.js create mode 100644 node_modules/ramda/es/mergeAll.js create mode 100644 node_modules/ramda/es/mergeDeepLeft.js create mode 100644 node_modules/ramda/es/mergeDeepRight.js create mode 100644 node_modules/ramda/es/mergeDeepWith.js create mode 100644 node_modules/ramda/es/mergeDeepWithKey.js create mode 100644 node_modules/ramda/es/mergeLeft.js create mode 100644 node_modules/ramda/es/mergeRight.js create mode 100644 node_modules/ramda/es/mergeWith.js create mode 100644 node_modules/ramda/es/mergeWithKey.js create mode 100644 node_modules/ramda/es/min.js create mode 100644 node_modules/ramda/es/minBy.js create mode 100644 node_modules/ramda/es/modulo.js create mode 100644 node_modules/ramda/es/move.js create mode 100644 node_modules/ramda/es/multiply.js create mode 100644 node_modules/ramda/es/nAry.js create mode 100644 node_modules/ramda/es/negate.js create mode 100644 node_modules/ramda/es/none.js create mode 100644 node_modules/ramda/es/not.js create mode 100644 node_modules/ramda/es/nth.js create mode 100644 node_modules/ramda/es/nthArg.js create mode 100644 node_modules/ramda/es/o.js create mode 100644 node_modules/ramda/es/objOf.js create mode 100644 node_modules/ramda/es/of.js create mode 100644 node_modules/ramda/es/omit.js create mode 100644 node_modules/ramda/es/once.js create mode 100644 node_modules/ramda/es/or.js create mode 100644 node_modules/ramda/es/otherwise.js create mode 100644 node_modules/ramda/es/over.js create mode 100644 node_modules/ramda/es/pair.js create mode 100644 node_modules/ramda/es/partial.js create mode 100644 node_modules/ramda/es/partialRight.js create mode 100644 node_modules/ramda/es/partition.js create mode 100644 node_modules/ramda/es/path.js create mode 100644 node_modules/ramda/es/pathEq.js create mode 100644 node_modules/ramda/es/pathOr.js create mode 100644 node_modules/ramda/es/pathSatisfies.js create mode 100644 node_modules/ramda/es/paths.js create mode 100644 node_modules/ramda/es/pick.js create mode 100644 node_modules/ramda/es/pickAll.js create mode 100644 node_modules/ramda/es/pickBy.js create mode 100644 node_modules/ramda/es/pipe.js create mode 100644 node_modules/ramda/es/pipeK.js create mode 100644 node_modules/ramda/es/pipeP.js create mode 100644 node_modules/ramda/es/pipeWith.js create mode 100644 node_modules/ramda/es/pluck.js create mode 100644 node_modules/ramda/es/prepend.js create mode 100644 node_modules/ramda/es/product.js create mode 100644 node_modules/ramda/es/project.js create mode 100644 node_modules/ramda/es/prop.js create mode 100644 node_modules/ramda/es/propEq.js create mode 100644 node_modules/ramda/es/propIs.js create mode 100644 node_modules/ramda/es/propOr.js create mode 100644 node_modules/ramda/es/propSatisfies.js create mode 100644 node_modules/ramda/es/props.js create mode 100644 node_modules/ramda/es/range.js create mode 100644 node_modules/ramda/es/reduce.js create mode 100644 node_modules/ramda/es/reduceBy.js create mode 100644 node_modules/ramda/es/reduceRight.js create mode 100644 node_modules/ramda/es/reduceWhile.js create mode 100644 node_modules/ramda/es/reduced.js create mode 100644 node_modules/ramda/es/reject.js create mode 100644 node_modules/ramda/es/remove.js create mode 100644 node_modules/ramda/es/repeat.js create mode 100644 node_modules/ramda/es/replace.js create mode 100644 node_modules/ramda/es/reverse.js create mode 100644 node_modules/ramda/es/scan.js create mode 100644 node_modules/ramda/es/sequence.js create mode 100644 node_modules/ramda/es/set.js create mode 100644 node_modules/ramda/es/slice.js create mode 100644 node_modules/ramda/es/sort.js create mode 100644 node_modules/ramda/es/sortBy.js create mode 100644 node_modules/ramda/es/sortWith.js create mode 100644 node_modules/ramda/es/split.js create mode 100644 node_modules/ramda/es/splitAt.js create mode 100644 node_modules/ramda/es/splitEvery.js create mode 100644 node_modules/ramda/es/splitWhen.js create mode 100644 node_modules/ramda/es/startsWith.js create mode 100644 node_modules/ramda/es/subtract.js create mode 100644 node_modules/ramda/es/sum.js create mode 100644 node_modules/ramda/es/symmetricDifference.js create mode 100644 node_modules/ramda/es/symmetricDifferenceWith.js create mode 100644 node_modules/ramda/es/tail.js create mode 100644 node_modules/ramda/es/take.js create mode 100644 node_modules/ramda/es/takeLast.js create mode 100644 node_modules/ramda/es/takeLastWhile.js create mode 100644 node_modules/ramda/es/takeWhile.js create mode 100644 node_modules/ramda/es/tap.js create mode 100644 node_modules/ramda/es/test.js create mode 100644 node_modules/ramda/es/thunkify.js create mode 100644 node_modules/ramda/es/times.js create mode 100644 node_modules/ramda/es/toLower.js create mode 100644 node_modules/ramda/es/toPairs.js create mode 100644 node_modules/ramda/es/toPairsIn.js create mode 100644 node_modules/ramda/es/toString.js create mode 100644 node_modules/ramda/es/toUpper.js create mode 100644 node_modules/ramda/es/transduce.js create mode 100644 node_modules/ramda/es/transpose.js create mode 100644 node_modules/ramda/es/traverse.js create mode 100644 node_modules/ramda/es/trim.js create mode 100644 node_modules/ramda/es/tryCatch.js create mode 100644 node_modules/ramda/es/type.js create mode 100644 node_modules/ramda/es/unapply.js create mode 100644 node_modules/ramda/es/unary.js create mode 100644 node_modules/ramda/es/uncurryN.js create mode 100644 node_modules/ramda/es/unfold.js create mode 100644 node_modules/ramda/es/union.js create mode 100644 node_modules/ramda/es/unionWith.js create mode 100644 node_modules/ramda/es/uniq.js create mode 100644 node_modules/ramda/es/uniqBy.js create mode 100644 node_modules/ramda/es/uniqWith.js create mode 100644 node_modules/ramda/es/unless.js create mode 100644 node_modules/ramda/es/unnest.js create mode 100644 node_modules/ramda/es/until.js create mode 100644 node_modules/ramda/es/update.js create mode 100644 node_modules/ramda/es/useWith.js create mode 100644 node_modules/ramda/es/values.js create mode 100644 node_modules/ramda/es/valuesIn.js create mode 100644 node_modules/ramda/es/view.js create mode 100644 node_modules/ramda/es/when.js create mode 100644 node_modules/ramda/es/where.js create mode 100644 node_modules/ramda/es/whereEq.js create mode 100644 node_modules/ramda/es/without.js create mode 100644 node_modules/ramda/es/xor.js create mode 100644 node_modules/ramda/es/xprod.js create mode 100644 node_modules/ramda/es/zip.js create mode 100644 node_modules/ramda/es/zipObj.js create mode 100644 node_modules/ramda/es/zipWith.js create mode 100644 node_modules/ramda/package.json create mode 100644 node_modules/ramda/src/F.js create mode 100644 node_modules/ramda/src/T.js create mode 100644 node_modules/ramda/src/__.js create mode 100644 node_modules/ramda/src/add.js create mode 100644 node_modules/ramda/src/addIndex.js create mode 100644 node_modules/ramda/src/adjust.js create mode 100644 node_modules/ramda/src/all.js create mode 100644 node_modules/ramda/src/allPass.js create mode 100644 node_modules/ramda/src/always.js create mode 100644 node_modules/ramda/src/and.js create mode 100644 node_modules/ramda/src/andThen.js create mode 100644 node_modules/ramda/src/any.js create mode 100644 node_modules/ramda/src/anyPass.js create mode 100644 node_modules/ramda/src/ap.js create mode 100644 node_modules/ramda/src/aperture.js create mode 100644 node_modules/ramda/src/append.js create mode 100644 node_modules/ramda/src/apply.js create mode 100644 node_modules/ramda/src/applySpec.js create mode 100644 node_modules/ramda/src/applyTo.js create mode 100644 node_modules/ramda/src/ascend.js create mode 100644 node_modules/ramda/src/assoc.js create mode 100644 node_modules/ramda/src/assocPath.js create mode 100644 node_modules/ramda/src/binary.js create mode 100644 node_modules/ramda/src/bind.js create mode 100644 node_modules/ramda/src/both.js create mode 100644 node_modules/ramda/src/call.js create mode 100644 node_modules/ramda/src/chain.js create mode 100644 node_modules/ramda/src/clamp.js create mode 100644 node_modules/ramda/src/clone.js create mode 100644 node_modules/ramda/src/comparator.js create mode 100644 node_modules/ramda/src/complement.js create mode 100644 node_modules/ramda/src/compose.js create mode 100644 node_modules/ramda/src/composeK.js create mode 100644 node_modules/ramda/src/composeP.js create mode 100644 node_modules/ramda/src/composeWith.js create mode 100644 node_modules/ramda/src/concat.js create mode 100644 node_modules/ramda/src/cond.js create mode 100644 node_modules/ramda/src/construct.js create mode 100644 node_modules/ramda/src/constructN.js create mode 100644 node_modules/ramda/src/contains.js create mode 100644 node_modules/ramda/src/converge.js create mode 100644 node_modules/ramda/src/countBy.js create mode 100644 node_modules/ramda/src/curry.js create mode 100644 node_modules/ramda/src/curryN.js create mode 100644 node_modules/ramda/src/dec.js create mode 100644 node_modules/ramda/src/defaultTo.js create mode 100644 node_modules/ramda/src/descend.js create mode 100644 node_modules/ramda/src/difference.js create mode 100644 node_modules/ramda/src/differenceWith.js create mode 100644 node_modules/ramda/src/dissoc.js create mode 100644 node_modules/ramda/src/dissocPath.js create mode 100644 node_modules/ramda/src/divide.js create mode 100644 node_modules/ramda/src/drop.js create mode 100644 node_modules/ramda/src/dropLast.js create mode 100644 node_modules/ramda/src/dropLastWhile.js create mode 100644 node_modules/ramda/src/dropRepeats.js create mode 100644 node_modules/ramda/src/dropRepeatsWith.js create mode 100644 node_modules/ramda/src/dropWhile.js create mode 100644 node_modules/ramda/src/either.js create mode 100644 node_modules/ramda/src/empty.js create mode 100644 node_modules/ramda/src/endsWith.js create mode 100644 node_modules/ramda/src/eqBy.js create mode 100644 node_modules/ramda/src/eqProps.js create mode 100644 node_modules/ramda/src/equals.js create mode 100644 node_modules/ramda/src/evolve.js create mode 100644 node_modules/ramda/src/filter.js create mode 100644 node_modules/ramda/src/find.js create mode 100644 node_modules/ramda/src/findIndex.js create mode 100644 node_modules/ramda/src/findLast.js create mode 100644 node_modules/ramda/src/findLastIndex.js create mode 100644 node_modules/ramda/src/flatten.js create mode 100644 node_modules/ramda/src/flip.js create mode 100644 node_modules/ramda/src/forEach.js create mode 100644 node_modules/ramda/src/forEachObjIndexed.js create mode 100644 node_modules/ramda/src/fromPairs.js create mode 100644 node_modules/ramda/src/groupBy.js create mode 100644 node_modules/ramda/src/groupWith.js create mode 100644 node_modules/ramda/src/gt.js create mode 100644 node_modules/ramda/src/gte.js create mode 100644 node_modules/ramda/src/has.js create mode 100644 node_modules/ramda/src/hasIn.js create mode 100644 node_modules/ramda/src/hasPath.js create mode 100644 node_modules/ramda/src/head.js create mode 100644 node_modules/ramda/src/identical.js create mode 100644 node_modules/ramda/src/identity.js create mode 100644 node_modules/ramda/src/ifElse.js create mode 100644 node_modules/ramda/src/inc.js create mode 100644 node_modules/ramda/src/includes.js create mode 100644 node_modules/ramda/src/index.js create mode 100644 node_modules/ramda/src/index.mjs create mode 100644 node_modules/ramda/src/indexBy.js create mode 100644 node_modules/ramda/src/indexOf.js create mode 100644 node_modules/ramda/src/init.js create mode 100644 node_modules/ramda/src/innerJoin.js create mode 100644 node_modules/ramda/src/insert.js create mode 100644 node_modules/ramda/src/insertAll.js create mode 100644 node_modules/ramda/src/internal/_Set.js create mode 100644 node_modules/ramda/src/internal/_aperture.js create mode 100644 node_modules/ramda/src/internal/_arity.js create mode 100644 node_modules/ramda/src/internal/_arrayFromIterator.js create mode 100644 node_modules/ramda/src/internal/_assertPromise.js create mode 100644 node_modules/ramda/src/internal/_checkForMethod.js create mode 100644 node_modules/ramda/src/internal/_clone.js create mode 100644 node_modules/ramda/src/internal/_cloneRegExp.js create mode 100644 node_modules/ramda/src/internal/_complement.js create mode 100644 node_modules/ramda/src/internal/_concat.js create mode 100644 node_modules/ramda/src/internal/_createPartialApplicator.js create mode 100644 node_modules/ramda/src/internal/_curry1.js create mode 100644 node_modules/ramda/src/internal/_curry2.js create mode 100644 node_modules/ramda/src/internal/_curry3.js create mode 100644 node_modules/ramda/src/internal/_curryN.js create mode 100644 node_modules/ramda/src/internal/_dispatchable.js create mode 100644 node_modules/ramda/src/internal/_dropLast.js create mode 100644 node_modules/ramda/src/internal/_dropLastWhile.js create mode 100644 node_modules/ramda/src/internal/_equals.js create mode 100644 node_modules/ramda/src/internal/_filter.js create mode 100644 node_modules/ramda/src/internal/_flatCat.js create mode 100644 node_modules/ramda/src/internal/_forceReduced.js create mode 100644 node_modules/ramda/src/internal/_functionName.js create mode 100644 node_modules/ramda/src/internal/_functionsWith.js create mode 100644 node_modules/ramda/src/internal/_has.js create mode 100644 node_modules/ramda/src/internal/_identity.js create mode 100644 node_modules/ramda/src/internal/_includes.js create mode 100644 node_modules/ramda/src/internal/_includesWith.js create mode 100644 node_modules/ramda/src/internal/_indexOf.js create mode 100644 node_modules/ramda/src/internal/_isArguments.js create mode 100644 node_modules/ramda/src/internal/_isArray.js create mode 100644 node_modules/ramda/src/internal/_isArrayLike.js create mode 100644 node_modules/ramda/src/internal/_isFunction.js create mode 100644 node_modules/ramda/src/internal/_isInteger.js create mode 100644 node_modules/ramda/src/internal/_isNumber.js create mode 100644 node_modules/ramda/src/internal/_isObject.js create mode 100644 node_modules/ramda/src/internal/_isPlaceholder.js create mode 100644 node_modules/ramda/src/internal/_isRegExp.js create mode 100644 node_modules/ramda/src/internal/_isString.js create mode 100644 node_modules/ramda/src/internal/_isTransformer.js create mode 100644 node_modules/ramda/src/internal/_makeFlat.js create mode 100644 node_modules/ramda/src/internal/_map.js create mode 100644 node_modules/ramda/src/internal/_objectAssign.js create mode 100644 node_modules/ramda/src/internal/_objectIs.js create mode 100644 node_modules/ramda/src/internal/_of.js create mode 100644 node_modules/ramda/src/internal/_pipe.js create mode 100644 node_modules/ramda/src/internal/_pipeP.js create mode 100644 node_modules/ramda/src/internal/_quote.js create mode 100644 node_modules/ramda/src/internal/_reduce.js create mode 100644 node_modules/ramda/src/internal/_reduced.js create mode 100644 node_modules/ramda/src/internal/_stepCat.js create mode 100644 node_modules/ramda/src/internal/_toISOString.js create mode 100644 node_modules/ramda/src/internal/_toString.js create mode 100644 node_modules/ramda/src/internal/_xall.js create mode 100644 node_modules/ramda/src/internal/_xany.js create mode 100644 node_modules/ramda/src/internal/_xaperture.js create mode 100644 node_modules/ramda/src/internal/_xchain.js create mode 100644 node_modules/ramda/src/internal/_xdrop.js create mode 100644 node_modules/ramda/src/internal/_xdropLast.js create mode 100644 node_modules/ramda/src/internal/_xdropLastWhile.js create mode 100644 node_modules/ramda/src/internal/_xdropRepeatsWith.js create mode 100644 node_modules/ramda/src/internal/_xdropWhile.js create mode 100644 node_modules/ramda/src/internal/_xfBase.js create mode 100644 node_modules/ramda/src/internal/_xfilter.js create mode 100644 node_modules/ramda/src/internal/_xfind.js create mode 100644 node_modules/ramda/src/internal/_xfindIndex.js create mode 100644 node_modules/ramda/src/internal/_xfindLast.js create mode 100644 node_modules/ramda/src/internal/_xfindLastIndex.js create mode 100644 node_modules/ramda/src/internal/_xmap.js create mode 100644 node_modules/ramda/src/internal/_xreduceBy.js create mode 100644 node_modules/ramda/src/internal/_xtake.js create mode 100644 node_modules/ramda/src/internal/_xtakeWhile.js create mode 100644 node_modules/ramda/src/internal/_xtap.js create mode 100644 node_modules/ramda/src/internal/_xwrap.js create mode 100644 node_modules/ramda/src/intersection.js create mode 100644 node_modules/ramda/src/intersperse.js create mode 100644 node_modules/ramda/src/into.js create mode 100644 node_modules/ramda/src/invert.js create mode 100644 node_modules/ramda/src/invertObj.js create mode 100644 node_modules/ramda/src/invoker.js create mode 100644 node_modules/ramda/src/is.js create mode 100644 node_modules/ramda/src/isEmpty.js create mode 100644 node_modules/ramda/src/isNil.js create mode 100644 node_modules/ramda/src/join.js create mode 100644 node_modules/ramda/src/juxt.js create mode 100644 node_modules/ramda/src/keys.js create mode 100644 node_modules/ramda/src/keysIn.js create mode 100644 node_modules/ramda/src/last.js create mode 100644 node_modules/ramda/src/lastIndexOf.js create mode 100644 node_modules/ramda/src/length.js create mode 100644 node_modules/ramda/src/lens.js create mode 100644 node_modules/ramda/src/lensIndex.js create mode 100644 node_modules/ramda/src/lensPath.js create mode 100644 node_modules/ramda/src/lensProp.js create mode 100644 node_modules/ramda/src/lift.js create mode 100644 node_modules/ramda/src/liftN.js create mode 100644 node_modules/ramda/src/lt.js create mode 100644 node_modules/ramda/src/lte.js create mode 100644 node_modules/ramda/src/map.js create mode 100644 node_modules/ramda/src/mapAccum.js create mode 100644 node_modules/ramda/src/mapAccumRight.js create mode 100644 node_modules/ramda/src/mapObjIndexed.js create mode 100644 node_modules/ramda/src/match.js create mode 100644 node_modules/ramda/src/mathMod.js create mode 100644 node_modules/ramda/src/max.js create mode 100644 node_modules/ramda/src/maxBy.js create mode 100644 node_modules/ramda/src/mean.js create mode 100644 node_modules/ramda/src/median.js create mode 100644 node_modules/ramda/src/memoizeWith.js create mode 100644 node_modules/ramda/src/merge.js create mode 100644 node_modules/ramda/src/mergeAll.js create mode 100644 node_modules/ramda/src/mergeDeepLeft.js create mode 100644 node_modules/ramda/src/mergeDeepRight.js create mode 100644 node_modules/ramda/src/mergeDeepWith.js create mode 100644 node_modules/ramda/src/mergeDeepWithKey.js create mode 100644 node_modules/ramda/src/mergeLeft.js create mode 100644 node_modules/ramda/src/mergeRight.js create mode 100644 node_modules/ramda/src/mergeWith.js create mode 100644 node_modules/ramda/src/mergeWithKey.js create mode 100644 node_modules/ramda/src/min.js create mode 100644 node_modules/ramda/src/minBy.js create mode 100644 node_modules/ramda/src/modulo.js create mode 100644 node_modules/ramda/src/move.js create mode 100644 node_modules/ramda/src/multiply.js create mode 100644 node_modules/ramda/src/nAry.js create mode 100644 node_modules/ramda/src/negate.js create mode 100644 node_modules/ramda/src/none.js create mode 100644 node_modules/ramda/src/not.js create mode 100644 node_modules/ramda/src/nth.js create mode 100644 node_modules/ramda/src/nthArg.js create mode 100644 node_modules/ramda/src/o.js create mode 100644 node_modules/ramda/src/objOf.js create mode 100644 node_modules/ramda/src/of.js create mode 100644 node_modules/ramda/src/omit.js create mode 100644 node_modules/ramda/src/once.js create mode 100644 node_modules/ramda/src/or.js create mode 100644 node_modules/ramda/src/otherwise.js create mode 100644 node_modules/ramda/src/over.js create mode 100644 node_modules/ramda/src/pair.js create mode 100644 node_modules/ramda/src/partial.js create mode 100644 node_modules/ramda/src/partialRight.js create mode 100644 node_modules/ramda/src/partition.js create mode 100644 node_modules/ramda/src/path.js create mode 100644 node_modules/ramda/src/pathEq.js create mode 100644 node_modules/ramda/src/pathOr.js create mode 100644 node_modules/ramda/src/pathSatisfies.js create mode 100644 node_modules/ramda/src/paths.js create mode 100644 node_modules/ramda/src/pick.js create mode 100644 node_modules/ramda/src/pickAll.js create mode 100644 node_modules/ramda/src/pickBy.js create mode 100644 node_modules/ramda/src/pipe.js create mode 100644 node_modules/ramda/src/pipeK.js create mode 100644 node_modules/ramda/src/pipeP.js create mode 100644 node_modules/ramda/src/pipeWith.js create mode 100644 node_modules/ramda/src/pluck.js create mode 100644 node_modules/ramda/src/prepend.js create mode 100644 node_modules/ramda/src/product.js create mode 100644 node_modules/ramda/src/project.js create mode 100644 node_modules/ramda/src/prop.js create mode 100644 node_modules/ramda/src/propEq.js create mode 100644 node_modules/ramda/src/propIs.js create mode 100644 node_modules/ramda/src/propOr.js create mode 100644 node_modules/ramda/src/propSatisfies.js create mode 100644 node_modules/ramda/src/props.js create mode 100644 node_modules/ramda/src/range.js create mode 100644 node_modules/ramda/src/reduce.js create mode 100644 node_modules/ramda/src/reduceBy.js create mode 100644 node_modules/ramda/src/reduceRight.js create mode 100644 node_modules/ramda/src/reduceWhile.js create mode 100644 node_modules/ramda/src/reduced.js create mode 100644 node_modules/ramda/src/reject.js create mode 100644 node_modules/ramda/src/remove.js create mode 100644 node_modules/ramda/src/repeat.js create mode 100644 node_modules/ramda/src/replace.js create mode 100644 node_modules/ramda/src/reverse.js create mode 100644 node_modules/ramda/src/scan.js create mode 100644 node_modules/ramda/src/sequence.js create mode 100644 node_modules/ramda/src/set.js create mode 100644 node_modules/ramda/src/slice.js create mode 100644 node_modules/ramda/src/sort.js create mode 100644 node_modules/ramda/src/sortBy.js create mode 100644 node_modules/ramda/src/sortWith.js create mode 100644 node_modules/ramda/src/split.js create mode 100644 node_modules/ramda/src/splitAt.js create mode 100644 node_modules/ramda/src/splitEvery.js create mode 100644 node_modules/ramda/src/splitWhen.js create mode 100644 node_modules/ramda/src/startsWith.js create mode 100644 node_modules/ramda/src/subtract.js create mode 100644 node_modules/ramda/src/sum.js create mode 100644 node_modules/ramda/src/symmetricDifference.js create mode 100644 node_modules/ramda/src/symmetricDifferenceWith.js create mode 100644 node_modules/ramda/src/tail.js create mode 100644 node_modules/ramda/src/take.js create mode 100644 node_modules/ramda/src/takeLast.js create mode 100644 node_modules/ramda/src/takeLastWhile.js create mode 100644 node_modules/ramda/src/takeWhile.js create mode 100644 node_modules/ramda/src/tap.js create mode 100644 node_modules/ramda/src/test.js create mode 100644 node_modules/ramda/src/thunkify.js create mode 100644 node_modules/ramda/src/times.js create mode 100644 node_modules/ramda/src/toLower.js create mode 100644 node_modules/ramda/src/toPairs.js create mode 100644 node_modules/ramda/src/toPairsIn.js create mode 100644 node_modules/ramda/src/toString.js create mode 100644 node_modules/ramda/src/toUpper.js create mode 100644 node_modules/ramda/src/transduce.js create mode 100644 node_modules/ramda/src/transpose.js create mode 100644 node_modules/ramda/src/traverse.js create mode 100644 node_modules/ramda/src/trim.js create mode 100644 node_modules/ramda/src/tryCatch.js create mode 100644 node_modules/ramda/src/type.js create mode 100644 node_modules/ramda/src/unapply.js create mode 100644 node_modules/ramda/src/unary.js create mode 100644 node_modules/ramda/src/uncurryN.js create mode 100644 node_modules/ramda/src/unfold.js create mode 100644 node_modules/ramda/src/union.js create mode 100644 node_modules/ramda/src/unionWith.js create mode 100644 node_modules/ramda/src/uniq.js create mode 100644 node_modules/ramda/src/uniqBy.js create mode 100644 node_modules/ramda/src/uniqWith.js create mode 100644 node_modules/ramda/src/unless.js create mode 100644 node_modules/ramda/src/unnest.js create mode 100644 node_modules/ramda/src/until.js create mode 100644 node_modules/ramda/src/update.js create mode 100644 node_modules/ramda/src/useWith.js create mode 100644 node_modules/ramda/src/values.js create mode 100644 node_modules/ramda/src/valuesIn.js create mode 100644 node_modules/ramda/src/view.js create mode 100644 node_modules/ramda/src/when.js create mode 100644 node_modules/ramda/src/where.js create mode 100644 node_modules/ramda/src/whereEq.js create mode 100644 node_modules/ramda/src/without.js create mode 100644 node_modules/ramda/src/xor.js create mode 100644 node_modules/ramda/src/xprod.js create mode 100644 node_modules/ramda/src/zip.js create mode 100644 node_modules/ramda/src/zipObj.js create mode 100644 node_modules/ramda/src/zipWith.js create mode 100644 node_modules/sonic-boom/.travis.yml create mode 100644 node_modules/sonic-boom/LICENSE create mode 100644 node_modules/sonic-boom/README.md create mode 100644 node_modules/sonic-boom/bench.js create mode 100644 node_modules/sonic-boom/check.js create mode 100644 node_modules/sonic-boom/example.js create mode 100644 node_modules/sonic-boom/fixtures/firehose.js create mode 100644 node_modules/sonic-boom/index.js create mode 100644 node_modules/sonic-boom/package.json create mode 100644 node_modules/sonic-boom/test.js diff --git a/README.md b/README.md index 576679f..39a4d84 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,4 @@ An action that builds a Debian package from source. with: source_directory: lolcat # optional, relative to workspace directory artifacts_directory: output # optional, relative to workspace directory - os: debian # or ubuntu, defaults to debian ``` diff --git a/action.yml b/action.yml index 3b8a37b..18533b9 100644 --- a/action.yml +++ b/action.yml @@ -12,10 +12,6 @@ inputs: description: Directory where build artifacts will be placed, relative to workspace required: false default: ./ - os: - description: '"ubuntu" or "debian"' - required: false - default: debian runs: using: node12 main: main.js diff --git a/main.js b/main.js index efd45b1..d34c75a 100644 --- a/main.js +++ b/main.js @@ -1,23 +1,41 @@ const core = require("@actions/core") const exec = require("@actions/exec") const firstline = require("firstline") +const hub = require("docker-hub-utils") const path = require("path") const fs = require("fs") +function getDistribution(distribution) { + return distribution.replace("UNRELEASED", "unstable") +} + +async function getOS(distribution) { + for (const os of ["debian", "ubuntu"]) { + const tags = await hub.queryTags({ user: "library", name: os }) + if (tags.find(tag => tag.name == distribution)) { + return os + } + } +} + async function main() { try { - const sourceDirectory = core.getInput("source_directory", { required: true }) - const artifactsDirectory = core.getInput("artifacts_directory", { required: true }) - const os = core.getInput("os", { required: true }) + const sourceRelativeDirectory = core.getInput("source_directory") + const artifactsRelativeDirectory = core.getInput("artifacts_directory") const workspaceDirectory = process.cwd() - const file = path.join(workspaceDirectory, sourceDirectory, "debian/changelog") + const sourceDirectory = path.join(workspaceDirectory, sourceRelativeDirectory) + const buildDirectory = path.dirname(sourceDirectory) + const artifactsDirectory = path.join(workspaceDirectory, artifactsRelativeDirectory) + + const file = path.join(sourceDirectory, "debian/changelog") const changelog = await firstline(file) - const regex = /^(?.+) \((?[^-]+)-?(?[^-]+)?\) (?.+); (?.+)$/ + const regex = /^(?.+) \((?[^-]+)-?(?[^-]+)?\) (?.+);/ const match = changelog.match(regex) const { package, version, revision, distribution } = match.groups + const os = await getOS(getDistribution(distribution)) const container = package + "_" + version - const image = os + ":" + distribution.replace("UNRELEASED", "unstable") + const image = os + ":" + getDistribution(distribution) fs.mkdirSync(artifactsDirectory, { recursive: true }) @@ -25,8 +43,8 @@ async function main() { await exec.exec("docker", [ "create", "--name", container, - "--volume", workspaceDirectory + ":" + workspaceDirectory, - "--workdir", path.join(workspaceDirectory, sourceDirectory), + "--volume", sourceDirectory + ":" + sourceDirectory, + "--workdir", sourceDirectory, "--tty", image, "sleep", "inf" @@ -49,7 +67,7 @@ async function main() { "--exclude-vcs", "--exclude", "./debian", "--transform", `s/^\./${package}-${version}/`, - "-cvzf", `../${package}_${version}.orig.tar.gz`, + "-cvzf", `${buildDirectory}/${package}_${version}.orig.tar.gz`, "./" ]) core.endGroup() @@ -75,7 +93,7 @@ async function main() { await exec.exec("docker", [ "exec", container, - "apt-get", "build-dep", "-y", "./" + "apt-get", "build-dep", "-y", sourceDirectory ]) core.endGroup() @@ -92,7 +110,7 @@ async function main() { "exec", container, "find", - "..", + buildDirectory, "-maxdepth", "1", "-name", `${package}_${version}*.*`, "-type", "f", diff --git a/node_modules/.bin/pino b/node_modules/.bin/pino new file mode 120000 index 0000000..9855bfc --- /dev/null +++ b/node_modules/.bin/pino @@ -0,0 +1 @@ +../pino/bin.js \ No newline at end of file diff --git a/node_modules/atomic-sleep/.travis.yml b/node_modules/atomic-sleep/.travis.yml new file mode 100644 index 0000000..3bb09da --- /dev/null +++ b/node_modules/atomic-sleep/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +sudo: false +node_js: + - 6 + - 8 + - 10 + - 11 + - 12 + - 13 +script: + - npm run ci \ No newline at end of file diff --git a/node_modules/atomic-sleep/LICENSE b/node_modules/atomic-sleep/LICENSE new file mode 100644 index 0000000..d1d8849 --- /dev/null +++ b/node_modules/atomic-sleep/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) +Copyright (c) 2020 David Mark Clements + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/atomic-sleep/index.js b/node_modules/atomic-sleep/index.js new file mode 100644 index 0000000..fbfc8b2 --- /dev/null +++ b/node_modules/atomic-sleep/index.js @@ -0,0 +1,38 @@ +'use strict' + +/* global SharedArrayBuffer, Atomics */ + +if (typeof SharedArrayBuffer !== 'undefined' && typeof Atomics !== 'undefined') { + const nil = new Int32Array(new SharedArrayBuffer(4)) + + function sleep (ms) { + // also filters out NaN, non-number types, including empty strings, but allows bigints + const valid = ms > 0 && ms < Infinity + if (valid === false) { + if (typeof ms !== 'number' && typeof ms !== 'bigint') { + throw TypeError('sleep: ms must be a number') + } + throw RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity') + } + + Atomics.wait(nil, 0, 0, Number(ms)) + } + module.exports = sleep +} else { + + function sleep (ms) { + // also filters out NaN, non-number types, including empty strings, but allows bigints + const valid = ms > 0 && ms < Infinity + if (valid === false) { + if (typeof ms !== 'number' && typeof ms !== 'bigint') { + throw TypeError('sleep: ms must be a number') + } + throw RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity') + } + const target = Date.now() + Number(ms) + while (target > Date.now()){} + } + + module.exports = sleep + +} diff --git a/node_modules/atomic-sleep/package.json b/node_modules/atomic-sleep/package.json new file mode 100644 index 0000000..6b7f606 --- /dev/null +++ b/node_modules/atomic-sleep/package.json @@ -0,0 +1,65 @@ +{ + "_from": "atomic-sleep@^1.0.0", + "_id": "atomic-sleep@1.0.0", + "_inBundle": false, + "_integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "_location": "/atomic-sleep", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "atomic-sleep@^1.0.0", + "name": "atomic-sleep", + "escapedName": "atomic-sleep", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/sonic-boom" + ], + "_resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "_shasum": "eb85b77a601fc932cfe432c5acd364a9e2c9075b", + "_spec": "atomic-sleep@^1.0.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/sonic-boom", + "author": { + "name": "David Mark Clements", + "url": "@davidmarkclem" + }, + "bugs": { + "url": "https://github.com/davidmarkclements/atomic-sleep/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Zero CPU overhead, zero dependency, true event-loop blocking sleep", + "devDependencies": { + "standard": "^14.3.1", + "tap": "^14.10.6", + "tape": "^4.13.2" + }, + "engines": { + "node": ">=8.0.0" + }, + "homepage": "https://github.com/davidmarkclements/atomic-sleep#readme", + "keywords": [ + "sleep", + "pause", + "wait", + "performance", + "atomics" + ], + "license": "MIT", + "main": "index.js", + "name": "atomic-sleep", + "repository": { + "type": "git", + "url": "git+https://github.com/davidmarkclements/atomic-sleep.git" + }, + "scripts": { + "ci": "npm run lint && npm test", + "lint": "standard", + "test": "tap -R classic- -j1 test" + }, + "version": "1.0.0" +} diff --git a/node_modules/atomic-sleep/readme.md b/node_modules/atomic-sleep/readme.md new file mode 100644 index 0000000..3cdd91b --- /dev/null +++ b/node_modules/atomic-sleep/readme.md @@ -0,0 +1,58 @@ +

Welcome to atomic-sleep ⏱️

+

+ Version + + License: MIT + + + Twitter: davidmarkclem + +

+ +> Zero CPU overhead, zero dependency, true event-loop blocking sleep + +## Usage + +```js +const sleep = require('atomic-sleep') + +console.time('sleep') +setTimeout(() => { console.timeEnd('sleep') }, 100) +sleep(1000) +``` + +The `console.time` will report a time of just over 1000ms despite the `setTimeout` +being 100ms. This is because the event loop is paused for 1000ms and the setTimeout +fires immediately after the event loop is no longer blocked (as more than 100ms have passed). + +## Install + +```sh +npm install +``` + +## Run tests + +```sh +npm test +``` + +## Support + +Node and Browser versions that support both `SharedArrayBuffer` and `Atomics` will have (virtually) zero CPU overhead sleep. + +For Node, Atomic Sleep can provide zero CPU overhead sleep from Node 8 and up. + +For browser support see https://caniuse.com/#feat=sharedarraybuffer and https://caniuse.com/#feat=mdn-javascript_builtins_atomics. + + +For older Node versions and olders browsers we fall back to blocking the event loop in a way that will cause a CPU spike. + + + +## Author + +👤 **David Mark Clements (@davidmarkclem)** + +* Twitter: [@davidmarkclem](https://twitter.com/davidmarkclem) +* Github: [@davidmarkclements](https://github.com/davidmarkclements) diff --git a/node_modules/atomic-sleep/test.js b/node_modules/atomic-sleep/test.js new file mode 100644 index 0000000..0020daa --- /dev/null +++ b/node_modules/atomic-sleep/test.js @@ -0,0 +1,47 @@ +'use strict' +const test = require('tape') +const sleep = require('.') + +test('blocks event loop for given amount of milliseconds', ({ is, end }) => { + const now = Date.now() + setTimeout(() => { + const delta = Date.now() - now + const fuzzyDelta = Math.floor(delta / 10) * 10 // allow up to 10ms of execution lag + is(fuzzyDelta, 1000) + end() + }, 100) + sleep(1000) +}) + +if (typeof BigInt !== 'undefined') { + + test('allows ms to be supplied as a BigInt number', ({ is, end }) => { + const now = Date.now() + setTimeout(() => { + const delta = Date.now() - now + const fuzzyDelta = Math.floor(delta / 10) * 10 // allow up to 10ms of execution lag + is(fuzzyDelta, 1000) + end() + }, 100) + sleep(BigInt(1000)) // avoiding n notation as this will error on legacy node/browsers + }) + +} + +test('throws range error if ms less than 0', ({ throws, end }) => { + throws(() => sleep(-1), RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity')) + end() +}) + +test('throws range error if ms is Infinity', ({ throws, end }) => { + throws(() => sleep(Infinity), RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity')) + end() +}) + +test('throws range error if ms is not a number or bigint', ({ throws, end }) => { + throws(() => sleep('Infinity'), TypeError('sleep: ms must be a number')) + throws(() => sleep('foo'), TypeError('sleep: ms must be a number')) + throws(() => sleep({a: 1}), TypeError('sleep: ms must be a number')) + throws(() => sleep([1,2,3]), TypeError('sleep: ms must be a number')) + end() +}) \ No newline at end of file diff --git a/node_modules/axios/CHANGELOG.md b/node_modules/axios/CHANGELOG.md new file mode 100644 index 0000000..4affca5 --- /dev/null +++ b/node_modules/axios/CHANGELOG.md @@ -0,0 +1,413 @@ +# Changelog + +### 0.19.2 (Jan 20, 2020) + +- Remove unnecessary XSS check ([#2679](https://github.com/axios/axios/pull/2679)) (see ([#2646](https://github.com/axios/axios/issues/2646)) for discussion) + +### 0.19.1 (Jan 7, 2020) + +Fixes and Functionality: + +- Fixing invalid agent issue ([#1904](https://github.com/axios/axios/pull/1904)) +- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582)) +- Delete useless default to hash ([#2458](https://github.com/axios/axios/pull/2458)) +- Fix HTTP/HTTPs agents passing to follow-redirect ([#1904](https://github.com/axios/axios/pull/1904)) +- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582)) +- Fix CI build failure ([#2570](https://github.com/axios/axios/pull/2570)) +- Remove dependency on is-buffer from package.json ([#1816](https://github.com/axios/axios/pull/1816)) +- Adding options typings ([#2341](https://github.com/axios/axios/pull/2341)) +- Adding Typescript HTTP method definition for LINK and UNLINK. ([#2444](https://github.com/axios/axios/pull/2444)) +- Update dist with newest changes, fixes Custom Attributes issue +- Change syntax to see if build passes ([#2488](https://github.com/axios/axios/pull/2488)) +- Update Webpack + deps, remove now unnecessary polyfills ([#2410](https://github.com/axios/axios/pull/2410)) +- Fix to prevent XSS, throw an error when the URL contains a JS script ([#2464](https://github.com/axios/axios/pull/2464)) +- Add custom timeout error copy in config ([#2275](https://github.com/axios/axios/pull/2275)) +- Add error toJSON example ([#2466](https://github.com/axios/axios/pull/2466)) +- Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scrip… ([#2451](https://github.com/axios/axios/pull/2451)) +- Fixing subdomain handling on no_proxy ([#2442](https://github.com/axios/axios/pull/2442)) +- Make redirection from HTTP to HTTPS work ([#2426](https://github.com/axios/axios/pull/2426] and ([#2547](https://github.com/axios/axios/pull/2547)) +- Add toJSON property to AxiosError type ([#2427](https://github.com/axios/axios/pull/2427)) +- Fixing socket hang up error on node side for slow response. ([#1752](https://github.com/axios/axios/pull/1752)) +- Alternative syntax to send data into the body ([#2317](https://github.com/axios/axios/pull/2317)) +- Fixing custom config options ([#2207](https://github.com/axios/axios/pull/2207)) +- Fixing set `config.method` after mergeConfig for Axios.prototype.request ([#2383](https://github.com/axios/axios/pull/2383)) +- Axios create url bug ([#2290](https://github.com/axios/axios/pull/2290)) +- Do not modify config.url when using a relative baseURL (resolves [#1628](https://github.com/axios/axios/issues/1098)) ([#2391](https://github.com/axios/axios/pull/2391)) +- Add typescript HTTP method definition for LINK and UNLINK ([#2444](https://github.com/axios/axios/pull/2444)) + +Internal: + +- Revert "Update Webpack + deps, remove now unnecessary polyfills" ([#2479](https://github.com/axios/axios/pull/2479)) +- Order of if/else blocks is causing unit tests mocking XHR. ([#2201](https://github.com/axios/axios/pull/2201)) +- Add license badge ([#2446](https://github.com/axios/axios/pull/2446)) +- Fix travis CI build [#2386](https://github.com/axios/axios/pull/2386) +- Fix cancellation error on build master. #2290 #2207 ([#2407](https://github.com/axios/axios/pull/2407)) + +Documentation: + +- Fixing typo in CHANGELOG.md: s/Functionallity/Functionality ([#2639](https://github.com/axios/axios/pull/2639)) +- Fix badge, use master branch ([#2538](https://github.com/axios/axios/pull/2538)) +- Fix typo in changelog [#2193](https://github.com/axios/axios/pull/2193) +- Document fix ([#2514](https://github.com/axios/axios/pull/2514)) +- Update docs with no_proxy change, issue #2484 ([#2513](https://github.com/axios/axios/pull/2513)) +- Fixing missing words in docs template ([#2259](https://github.com/axios/axios/pull/2259)) +- 🐛Fix request finally documentation in README ([#2189](https://github.com/axios/axios/pull/2189)) +- updating spelling and adding link to docs ([#2212](https://github.com/axios/axios/pull/2212)) +- docs: minor tweak ([#2404](https://github.com/axios/axios/pull/2404)) +- Update response interceptor docs ([#2399](https://github.com/axios/axios/pull/2399)) +- Update README.md ([#2504](https://github.com/axios/axios/pull/2504)) +- Fix word 'sintaxe' to 'syntax' in README.md ([#2432](https://github.com/axios/axios/pull/2432)) +- upadating README: notes on CommonJS autocomplete ([#2256](https://github.com/axios/axios/pull/2256)) +- Fix grammar in README.md ([#2271](https://github.com/axios/axios/pull/2271)) +- Doc fixes, minor examples cleanup ([#2198](https://github.com/axios/axios/pull/2198)) + +### 0.19.0 (May 30, 2019) + +Fixes and Functionality: + +- Added support for no_proxy env variable ([#1693](https://github.com/axios/axios/pull/1693/files)) - Chance Dickson +- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski +- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issues/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev +- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama +- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester +- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers +- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov +- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#` +- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson +- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi +- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta + +Internal: + +- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel +- Fix failing SauceLabs tests by updating configuration - Emily Morehouse +- Add issue templates - Emily Morehouse + +Documentation: + +- Consistent coding style in README ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez +- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna +- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho +- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan +- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX +- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes +- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty +- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai +- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher +- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe +- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser +- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko +- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan +- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer + +### 0.19.0-beta.1 (Aug 9, 2018) + +**NOTE:** This is a beta version of this release. There may be functionality that is broken in +certain browsers, though we suspect that builds are hanging and not erroring. See +https://saucelabs.com/u/axios for the most up-to-date information. + +New Functionality: + +- Add getUri method ([#1712](https://github.com/axios/axios/issues/1712)) +- Add support for no_proxy env variable ([#1693](https://github.com/axios/axios/issues/1693)) +- Add toJSON to decorated Axios errors to faciliate serialization ([#1625](https://github.com/axios/axios/issues/1625)) +- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623)) +- Typings: allow custom return types +- Add option to specify character set in responses (with http adapter) + +Fixes: + +- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385)) +- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475)) +- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698)) +- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959)) +- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622)) +- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285)) + - Fixing defaults to use httpAdapter if available + - Use a safer, cross-platform method to detect the Node environment +- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537)) +- [Typescript] Fix missing type parameters on delete/head methods +- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript +- Fix missing type parameters on delete/head +- Fix Default method for an instance always overwritten by get +- Fix type error when socketPath option in AxiosRequestConfig +- Capture errors on request data streams +- Decorate resolve and reject to clear timeout in all cases + +Huge thanks to everyone who contributed to this release via code (authors listed +below) or via reviews and triaging on GitHub: + +- Andrew Scott +- Anthony Gauthier +- arpit +- ascott18 +- Benedikt Rötsch +- Chance Dickson +- Dave Stewart +- Deric Cain +- Guillaume Briday +- Jacob Wejendorp +- Jim Lynch +- johntron +- Justin Beckwith +- Justin Beckwith +- Khaled Garbaya +- Lim Jing Rong +- Mark van den Broek +- Martti Laine +- mattridley +- mattridley +- Nicolas Del Valle +- Nilegfx +- pbarbiero +- Rikki Gibson +- Sako Hartounian +- Shane Fitzpatrick +- Stephan Schneider +- Steven +- Tim Garthwaite +- Tim Johns +- Yutaro Miyazaki + +### 0.18.0 (Feb 19, 2018) + +- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070)) +- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)): + - AxiosRequestConfig.proxy: allows type false + - AxiosProxyConfig: added auth field +- Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254)) +- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287)) +- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342)) + +### 0.17.1 (Nov 11, 2017) + +- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160)) +- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080)) +- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131)) + +### 0.17.0 (Oct 21, 2017) + +- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950)) +- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874)) +- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691)) +- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061)) + +### 0.16.2 (Jun 3, 2017) + +- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887)) +- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830)) +- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930)) + +### 0.16.1 (Apr 8, 2017) + +- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828)) +- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829)) +- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773)) + +### 0.16.0 (Mar 31, 2017) + +- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480)) +- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461)) +- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654)) +- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731)) +- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581)) +- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561)) + +### 0.15.3 (Nov 27, 2016) + +- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443)) +- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519)) +- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509)) +- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507)) +- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483)) +- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493)) +- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491)) + +### 0.15.2 (Oct 17, 2016) + +- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482)) + +### 0.15.1 (Oct 14, 2016) + +- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485)) + +### 0.15.0 (Oct 10, 2016) + +- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452)) +- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437)) +- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440)) +- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445)) + +### 0.14.0 (Aug 27, 2016) + +- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419)) +- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387)) +- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423)) +- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366)) +- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397)) +- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406)) + +### 0.13.1 (Jul 16, 2016) + +- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378)) + +### 0.13.0 (Jul 13, 2016) + +- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345)) +- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)) +- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)) +- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343)) +- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352)) +- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341)) +- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217)) + +### 0.12.0 (May 31, 2016) + +- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317)) +- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307)) + +### 0.11.1 (May 17, 2016) + +- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313)) +- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325)) +- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321)) + +### 0.11.0 (Apr 26, 2016) + +- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296)) +- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308)) +- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299)) + +### 0.10.0 (Apr 20, 2016) + +- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250)) +- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252)) +- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227)) +- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249)) +- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251)) +- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275)) +- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279)) +- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200)) + +### 0.9.1 (Jan 24, 2016) + +- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124)) +- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205)) +- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201)) +- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198)) + +### 0.9.0 (Jan 18, 2016) + +- Adding support for custom adapters +- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195)) +- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185)) +- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183)) +- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182)) + +### 0.8.1 (Dec 14, 2015) + +- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168)) +- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173)) +- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174)) + +### 0.8.0 (Dec 11, 2015) + +- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123)) +- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128)) +- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121)) +- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127)) +- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146)) +- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149)) +- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140)) +- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167)) +- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160)) + +### 0.7.0 (Sep 29, 2015) + +- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87)) +- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102)) +- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106)) +- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105)) +- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112)) +- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98)) +- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116)) + +### 0.6.0 (Sep 21, 2015) + +- Removing deprecated success/error aliases +- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49)) +- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69)) +- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56)) +- Removing es6-promise dependency +- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91)) +- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85)) +- Converting build to UMD + +### 0.5.4 (Apr 08, 2015) + +- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53)) + +### 0.5.3 (Apr 07, 2015) + +- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55)) + +### 0.5.2 (Mar 13, 2015) + +- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46)) + +### 0.5.1 (Mar 10, 2015) + +- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45)) +- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47)) + +### 0.5.0 (Jan 23, 2015) + +- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14)) +- Updating es6-promise dependency + +### 0.4.2 (Dec 10, 2014) + +- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22)) +- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25)) +- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29)) +- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30)) + +### 0.4.1 (Oct 15, 2014) + +- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18)) + +### 0.4.0 (Oct 03, 2014) + +- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10)) +- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13)) +- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12)) +- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9)) +- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11)) +- Deprecating `success`/`error` in favor of `then`/`catch` + +### 0.3.1 (Sep 16, 2014) + +- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3)) + +### 0.3.0 (Sep 16, 2014) + +- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8)) +- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6)) +- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7)) + +### 0.2.2 (Sep 14, 2014) + +- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4)) + +### 0.2.1 (Sep 12, 2014) + +- Fixing build problem causing ridiculous file sizes + +### 0.2.0 (Sep 12, 2014) + +- Adding support for `all` and `spread` +- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1)) + +### 0.1.0 (Aug 29, 2014) + +- Initial release diff --git a/node_modules/axios/LICENSE b/node_modules/axios/LICENSE new file mode 100644 index 0000000..d36c80e --- /dev/null +++ b/node_modules/axios/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-present Matt Zabriskie + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/axios/README.md b/node_modules/axios/README.md new file mode 100755 index 0000000..0b09254 --- /dev/null +++ b/node_modules/axios/README.md @@ -0,0 +1,709 @@ +# axios + +[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios) +[![build status](https://img.shields.io/travis/axios/axios/master.svg?style=flat-square)](https://travis-ci.org/axios/axios) +[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios) +[![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios) +[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios) +[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios) +[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios) + +Promise based HTTP client for the browser and node.js + +## Features + +- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser +- Make [http](http://nodejs.org/api/http.html) requests from node.js +- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API +- Intercept request and response +- Transform request and response data +- Cancel requests +- Automatic transforms for JSON data +- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) + +## Browser Support + +![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | +--- | --- | --- | --- | --- | --- | +Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ | + +[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios) + +## Installing + +Using npm: + +```bash +$ npm install axios +``` + +Using bower: + +```bash +$ bower install axios +``` + +Using yarn: + +```bash +$ yarn add axios +``` + +Using cdn: + +```html + +``` + +## Example + +### note: CommonJS usage +In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach: + +```js +const axios = require('axios').default; + +// axios. will now provide autocomplete and parameter typings +``` + +Performing a `GET` request + +```js +const axios = require('axios'); + +// Make a request for a user with a given ID +axios.get('/user?ID=12345') + .then(function (response) { + // handle success + console.log(response); + }) + .catch(function (error) { + // handle error + console.log(error); + }) + .finally(function () { + // always executed + }); + +// Optionally the request above could also be done as +axios.get('/user', { + params: { + ID: 12345 + } + }) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { + console.log(error); + }) + .finally(function () { + // always executed + }); + +// Want to use async/await? Add the `async` keyword to your outer function/method. +async function getUser() { + try { + const response = await axios.get('/user?ID=12345'); + console.log(response); + } catch (error) { + console.error(error); + } +} +``` + +> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet +> Explorer and older browsers, so use with caution. + +Performing a `POST` request + +```js +axios.post('/user', { + firstName: 'Fred', + lastName: 'Flintstone' + }) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { + console.log(error); + }); +``` + +Performing multiple concurrent requests + +```js +function getUserAccount() { + return axios.get('/user/12345'); +} + +function getUserPermissions() { + return axios.get('/user/12345/permissions'); +} + +axios.all([getUserAccount(), getUserPermissions()]) + .then(axios.spread(function (acct, perms) { + // Both requests are now complete + })); +``` + +## axios API + +Requests can be made by passing the relevant config to `axios`. + +##### axios(config) + +```js +// Send a POST request +axios({ + method: 'post', + url: '/user/12345', + data: { + firstName: 'Fred', + lastName: 'Flintstone' + } +}); +``` + +```js +// GET request for remote image +axios({ + method: 'get', + url: 'http://bit.ly/2mTM3nY', + responseType: 'stream' +}) + .then(function (response) { + response.data.pipe(fs.createWriteStream('ada_lovelace.jpg')) + }); +``` + +##### axios(url[, config]) + +```js +// Send a GET request (default method) +axios('/user/12345'); +``` + +### Request method aliases + +For convenience aliases have been provided for all supported request methods. + +##### axios.request(config) +##### axios.get(url[, config]) +##### axios.delete(url[, config]) +##### axios.head(url[, config]) +##### axios.options(url[, config]) +##### axios.post(url[, data[, config]]) +##### axios.put(url[, data[, config]]) +##### axios.patch(url[, data[, config]]) + +###### NOTE +When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config. + +### Concurrency + +Helper functions for dealing with concurrent requests. + +##### axios.all(iterable) +##### axios.spread(callback) + +### Creating an instance + +You can create a new instance of axios with a custom config. + +##### axios.create([config]) + +```js +const instance = axios.create({ + baseURL: 'https://some-domain.com/api/', + timeout: 1000, + headers: {'X-Custom-Header': 'foobar'} +}); +``` + +### Instance methods + +The available instance methods are listed below. The specified config will be merged with the instance config. + +##### axios#request(config) +##### axios#get(url[, config]) +##### axios#delete(url[, config]) +##### axios#head(url[, config]) +##### axios#options(url[, config]) +##### axios#post(url[, data[, config]]) +##### axios#put(url[, data[, config]]) +##### axios#patch(url[, data[, config]]) +##### axios#getUri([config]) + +## Request Config + +These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified. + +```js +{ + // `url` is the server URL that will be used for the request + url: '/user', + + // `method` is the request method to be used when making the request + method: 'get', // default + + // `baseURL` will be prepended to `url` unless `url` is absolute. + // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs + // to methods of that instance. + baseURL: 'https://some-domain.com/api/', + + // `transformRequest` allows changes to the request data before it is sent to the server + // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE' + // The last function in the array must return a string or an instance of Buffer, ArrayBuffer, + // FormData or Stream + // You may modify the headers object. + transformRequest: [function (data, headers) { + // Do whatever you want to transform the data + + return data; + }], + + // `transformResponse` allows changes to the response data to be made before + // it is passed to then/catch + transformResponse: [function (data) { + // Do whatever you want to transform the data + + return data; + }], + + // `headers` are custom headers to be sent + headers: {'X-Requested-With': 'XMLHttpRequest'}, + + // `params` are the URL parameters to be sent with the request + // Must be a plain object or a URLSearchParams object + params: { + ID: 12345 + }, + + // `paramsSerializer` is an optional function in charge of serializing `params` + // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/) + paramsSerializer: function (params) { + return Qs.stringify(params, {arrayFormat: 'brackets'}) + }, + + // `data` is the data to be sent as the request body + // Only applicable for request methods 'PUT', 'POST', and 'PATCH' + // When no `transformRequest` is set, must be of one of the following types: + // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams + // - Browser only: FormData, File, Blob + // - Node only: Stream, Buffer + data: { + firstName: 'Fred' + }, + + // syntax alternative to send data into the body + // method post + // only the value is sent, not the key + data: 'Country=Brasil&City=Belo Horizonte', + + // `timeout` specifies the number of milliseconds before the request times out. + // If the request takes longer than `timeout`, the request will be aborted. + timeout: 1000, // default is `0` (no timeout) + + // `withCredentials` indicates whether or not cross-site Access-Control requests + // should be made using credentials + withCredentials: false, // default + + // `adapter` allows custom handling of requests which makes testing easier. + // Return a promise and supply a valid response (see lib/adapters/README.md). + adapter: function (config) { + /* ... */ + }, + + // `auth` indicates that HTTP Basic auth should be used, and supplies credentials. + // This will set an `Authorization` header, overwriting any existing + // `Authorization` custom headers you have set using `headers`. + // Please note that only HTTP Basic auth is configurable through this parameter. + // For Bearer tokens and such, use `Authorization` custom headers instead. + auth: { + username: 'janedoe', + password: 's00pers3cret' + }, + + // `responseType` indicates the type of data that the server will respond with + // options are: 'arraybuffer', 'document', 'json', 'text', 'stream' + // browser only: 'blob' + responseType: 'json', // default + + // `responseEncoding` indicates encoding to use for decoding responses + // Note: Ignored for `responseType` of 'stream' or client-side requests + responseEncoding: 'utf8', // default + + // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token + xsrfCookieName: 'XSRF-TOKEN', // default + + // `xsrfHeaderName` is the name of the http header that carries the xsrf token value + xsrfHeaderName: 'X-XSRF-TOKEN', // default + + // `onUploadProgress` allows handling of progress events for uploads + onUploadProgress: function (progressEvent) { + // Do whatever you want with the native progress event + }, + + // `onDownloadProgress` allows handling of progress events for downloads + onDownloadProgress: function (progressEvent) { + // Do whatever you want with the native progress event + }, + + // `maxContentLength` defines the max size of the http response content in bytes allowed + maxContentLength: 2000, + + // `validateStatus` defines whether to resolve or reject the promise for a given + // HTTP response status code. If `validateStatus` returns `true` (or is set to `null` + // or `undefined`), the promise will be resolved; otherwise, the promise will be + // rejected. + validateStatus: function (status) { + return status >= 200 && status < 300; // default + }, + + // `maxRedirects` defines the maximum number of redirects to follow in node.js. + // If set to 0, no redirects will be followed. + maxRedirects: 5, // default + + // `socketPath` defines a UNIX Socket to be used in node.js. + // e.g. '/var/run/docker.sock' to send requests to the docker daemon. + // Only either `socketPath` or `proxy` can be specified. + // If both are specified, `socketPath` is used. + socketPath: null, // default + + // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http + // and https requests, respectively, in node.js. This allows options to be added like + // `keepAlive` that are not enabled by default. + httpAgent: new http.Agent({ keepAlive: true }), + httpsAgent: new https.Agent({ keepAlive: true }), + + // 'proxy' defines the hostname and port of the proxy server. + // You can also define your proxy using the conventional `http_proxy` and + // `https_proxy` environment variables. If you are using environment variables + // for your proxy configuration, you can also define a `no_proxy` environment + // variable as a comma-separated list of domains that should not be proxied. + // Use `false` to disable proxies, ignoring environment variables. + // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and + // supplies credentials. + // This will set an `Proxy-Authorization` header, overwriting any existing + // `Proxy-Authorization` custom headers you have set using `headers`. + proxy: { + host: '127.0.0.1', + port: 9000, + auth: { + username: 'mikeymike', + password: 'rapunz3l' + } + }, + + // `cancelToken` specifies a cancel token that can be used to cancel the request + // (see Cancellation section below for details) + cancelToken: new CancelToken(function (cancel) { + }) +} +``` + +## Response Schema + +The response for a request contains the following information. + +```js +{ + // `data` is the response that was provided by the server + data: {}, + + // `status` is the HTTP status code from the server response + status: 200, + + // `statusText` is the HTTP status message from the server response + statusText: 'OK', + + // `headers` the headers that the server responded with + // All header names are lower cased + headers: {}, + + // `config` is the config that was provided to `axios` for the request + config: {}, + + // `request` is the request that generated this response + // It is the last ClientRequest instance in node.js (in redirects) + // and an XMLHttpRequest instance in the browser + request: {} +} +``` + +When using `then`, you will receive the response as follows: + +```js +axios.get('/user/12345') + .then(function (response) { + console.log(response.data); + console.log(response.status); + console.log(response.statusText); + console.log(response.headers); + console.log(response.config); + }); +``` + +When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section. + +## Config Defaults + +You can specify config defaults that will be applied to every request. + +### Global axios defaults + +```js +axios.defaults.baseURL = 'https://api.example.com'; +axios.defaults.headers.common['Authorization'] = AUTH_TOKEN; +axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; +``` + +### Custom instance defaults + +```js +// Set config defaults when creating the instance +const instance = axios.create({ + baseURL: 'https://api.example.com' +}); + +// Alter defaults after instance has been created +instance.defaults.headers.common['Authorization'] = AUTH_TOKEN; +``` + +### Config order of precedence + +Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example. + +```js +// Create an instance using the config defaults provided by the library +// At this point the timeout config value is `0` as is the default for the library +const instance = axios.create(); + +// Override timeout default for the library +// Now all requests using this instance will wait 2.5 seconds before timing out +instance.defaults.timeout = 2500; + +// Override timeout for this request as it's known to take a long time +instance.get('/longRequest', { + timeout: 5000 +}); +``` + +## Interceptors + +You can intercept requests or responses before they are handled by `then` or `catch`. + +```js +// Add a request interceptor +axios.interceptors.request.use(function (config) { + // Do something before request is sent + return config; + }, function (error) { + // Do something with request error + return Promise.reject(error); + }); + +// Add a response interceptor +axios.interceptors.response.use(function (response) { + // Any status code that lie within the range of 2xx cause this function to trigger + // Do something with response data + return response; + }, function (error) { + // Any status codes that falls outside the range of 2xx cause this function to trigger + // Do something with response error + return Promise.reject(error); + }); +``` + +If you need to remove an interceptor later you can. + +```js +const myInterceptor = axios.interceptors.request.use(function () {/*...*/}); +axios.interceptors.request.eject(myInterceptor); +``` + +You can add interceptors to a custom instance of axios. + +```js +const instance = axios.create(); +instance.interceptors.request.use(function () {/*...*/}); +``` + +## Handling Errors + +```js +axios.get('/user/12345') + .catch(function (error) { + if (error.response) { + // The request was made and the server responded with a status code + // that falls out of the range of 2xx + console.log(error.response.data); + console.log(error.response.status); + console.log(error.response.headers); + } else if (error.request) { + // The request was made but no response was received + // `error.request` is an instance of XMLHttpRequest in the browser and an instance of + // http.ClientRequest in node.js + console.log(error.request); + } else { + // Something happened in setting up the request that triggered an Error + console.log('Error', error.message); + } + console.log(error.config); + }); +``` + +Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error. + +```js +axios.get('/user/12345', { + validateStatus: function (status) { + return status < 500; // Reject only if the status code is greater than or equal to 500 + } +}) +``` + +Using `toJSON` you get an object with more information about the HTTP error. + +```js +axios.get('/user/12345') + .catch(function (error) { + console.log(error.toJSON()); + }); +``` + +## Cancellation + +You can cancel a request using a *cancel token*. + +> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises). + +You can create a cancel token using the `CancelToken.source` factory as shown below: + +```js +const CancelToken = axios.CancelToken; +const source = CancelToken.source(); + +axios.get('/user/12345', { + cancelToken: source.token +}).catch(function (thrown) { + if (axios.isCancel(thrown)) { + console.log('Request canceled', thrown.message); + } else { + // handle error + } +}); + +axios.post('/user/12345', { + name: 'new name' +}, { + cancelToken: source.token +}) + +// cancel the request (the message parameter is optional) +source.cancel('Operation canceled by the user.'); +``` + +You can also create a cancel token by passing an executor function to the `CancelToken` constructor: + +```js +const CancelToken = axios.CancelToken; +let cancel; + +axios.get('/user/12345', { + cancelToken: new CancelToken(function executor(c) { + // An executor function receives a cancel function as a parameter + cancel = c; + }) +}); + +// cancel the request +cancel(); +``` + +> Note: you can cancel several requests with the same cancel token. + +## Using application/x-www-form-urlencoded format + +By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options. + +### Browser + +In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows: + +```js +const params = new URLSearchParams(); +params.append('param1', 'value1'); +params.append('param2', 'value2'); +axios.post('/foo', params); +``` + +> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment). + +Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library: + +```js +const qs = require('qs'); +axios.post('/foo', qs.stringify({ 'bar': 123 })); +``` + +Or in another way (ES6), + +```js +import qs from 'qs'; +const data = { 'bar': 123 }; +const options = { + method: 'POST', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + data: qs.stringify(data), + url, +}; +axios(options); +``` + +### Node.js + +In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows: + +```js +const querystring = require('querystring'); +axios.post('http://something.com/', querystring.stringify({ foo: 'bar' })); +``` + +You can also use the [`qs`](https://github.com/ljharb/qs) library. + +###### NOTE +The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665). + +## Semver + +Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes. + +## Promises + +axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises). +If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise). + +## TypeScript +axios includes [TypeScript](http://typescriptlang.org) definitions. +```typescript +import axios from 'axios'; +axios.get('/user?ID=12345'); +``` + +## Resources + +* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md) +* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md) +* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md) +* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md) +* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md) + +## Credits + +axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular. + +## License + +[MIT](LICENSE) diff --git a/node_modules/axios/UPGRADE_GUIDE.md b/node_modules/axios/UPGRADE_GUIDE.md new file mode 100644 index 0000000..eedb049 --- /dev/null +++ b/node_modules/axios/UPGRADE_GUIDE.md @@ -0,0 +1,162 @@ +# Upgrade Guide + +### 0.15.x -> 0.16.0 + +#### `Promise` Type Declarations + +The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details. + +### 0.13.x -> 0.14.0 + +#### TypeScript Definitions + +The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax. + +Please use the following `import` statement to import axios in TypeScript: + +```typescript +import axios from 'axios'; + +axios.get('/foo') + .then(response => console.log(response)) + .catch(error => console.log(error)); +``` + +#### `agent` Config Option + +The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead. + +```js +{ + // Define a custom agent for HTTP + httpAgent: new http.Agent({ keepAlive: true }), + // Define a custom agent for HTTPS + httpsAgent: new https.Agent({ keepAlive: true }) +} +``` + +#### `progress` Config Option + +The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options. + +```js +{ + // Define a handler for upload progress events + onUploadProgress: function (progressEvent) { + // ... + }, + + // Define a handler for download progress events + onDownloadProgress: function (progressEvent) { + // ... + } +} +``` + +### 0.12.x -> 0.13.0 + +The `0.13.0` release contains several changes to custom adapters and error handling. + +#### Error Handling + +Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response. + +```js +axios.get('/user/12345') + .catch((error) => { + console.log(error.message); + console.log(error.code); // Not always specified + console.log(error.config); // The config that was used to make the request + console.log(error.response); // Only available if response was received from the server + }); +``` + +#### Request Adapters + +This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter. + +1. Response transformer is now called outside of adapter. +2. Request adapter returns a `Promise`. + +This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter. + +Previous code: + +```js +function myAdapter(resolve, reject, config) { + var response = { + data: transformData( + responseData, + responseHeaders, + config.transformResponse + ), + status: request.status, + statusText: request.statusText, + headers: responseHeaders + }; + settle(resolve, reject, response); +} +``` + +New code: + +```js +function myAdapter(config) { + return new Promise(function (resolve, reject) { + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders + }; + settle(resolve, reject, response); + }); +} +``` + +See the related commits for more details: +- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e) +- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a) + +### 0.5.x -> 0.6.0 + +The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading. + +#### ES6 Promise Polyfill + +Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it. + +```js +require('es6-promise').polyfill(); +var axios = require('axios'); +``` + +This will polyfill the global environment, and only needs to be done once. + +#### `axios.success`/`axios.error` + +The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively. + +```js +axios.get('some/url') + .then(function (res) { + /* ... */ + }) + .catch(function (err) { + /* ... */ + }); +``` + +#### UMD + +Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build. + +```js +// AMD +require(['bower_components/axios/dist/axios'], function (axios) { + /* ... */ +}); + +// CommonJS +var axios = require('axios/dist/axios'); +``` diff --git a/node_modules/axios/dist/axios.js b/node_modules/axios/dist/axios.js new file mode 100644 index 0000000..d9c0c71 --- /dev/null +++ b/node_modules/axios/dist/axios.js @@ -0,0 +1,1715 @@ +/* axios v0.19.2 | (c) 2020 by Matt Zabriskie */ +(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["axios"] = factory(); + else + root["axios"] = factory(); +})(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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = 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; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(1); + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + var bind = __webpack_require__(3); + var Axios = __webpack_require__(4); + var mergeConfig = __webpack_require__(22); + var defaults = __webpack_require__(10); + + /** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ + function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + return instance; + } + + // Create the default instance to be exported + var axios = createInstance(defaults); + + // Expose Axios class to allow class inheritance + axios.Axios = Axios; + + // Factory for creating new instances + axios.create = function create(instanceConfig) { + return createInstance(mergeConfig(axios.defaults, instanceConfig)); + }; + + // Expose Cancel & CancelToken + axios.Cancel = __webpack_require__(23); + axios.CancelToken = __webpack_require__(24); + axios.isCancel = __webpack_require__(9); + + // Expose all/spread + axios.all = function all(promises) { + return Promise.all(promises); + }; + axios.spread = __webpack_require__(25); + + module.exports = axios; + + // Allow use of default import syntax in TypeScript + module.exports.default = axios; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var bind = __webpack_require__(3); + + /*global toString:true*/ + + // utils is a library of generic helper functions non-specific to axios + + var toString = Object.prototype.toString; + + /** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ + function isArray(val) { + return toString.call(val) === '[object Array]'; + } + + /** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ + function isUndefined(val) { + return typeof val === 'undefined'; + } + + /** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ + function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); + } + + /** + * Determine if a value is an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ + function isArrayBuffer(val) { + return toString.call(val) === '[object ArrayBuffer]'; + } + + /** + * Determine if a value is a FormData + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ + function isFormData(val) { + return (typeof FormData !== 'undefined') && (val instanceof FormData); + } + + /** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ + function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); + } + return result; + } + + /** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ + function isString(val) { + return typeof val === 'string'; + } + + /** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ + function isNumber(val) { + return typeof val === 'number'; + } + + /** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ + function isObject(val) { + return val !== null && typeof val === 'object'; + } + + /** + * Determine if a value is a Date + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ + function isDate(val) { + return toString.call(val) === '[object Date]'; + } + + /** + * Determine if a value is a File + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ + function isFile(val) { + return toString.call(val) === '[object File]'; + } + + /** + * Determine if a value is a Blob + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ + function isBlob(val) { + return toString.call(val) === '[object Blob]'; + } + + /** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ + function isFunction(val) { + return toString.call(val) === '[object Function]'; + } + + /** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ + function isStream(val) { + return isObject(val) && isFunction(val.pipe); + } + + /** + * Determine if a value is a URLSearchParams object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ + function isURLSearchParams(val) { + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; + } + + /** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ + function trim(str) { + return str.replace(/^\s*/, '').replace(/\s*$/, ''); + } + + /** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ + function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); + } + + /** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ + function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } + } + + /** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ + function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (typeof result[key] === 'object' && typeof val === 'object') { + result[key] = merge(result[key], val); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; + } + + /** + * Function equal to merge with the difference being that no reference + * to original objects is kept. + * + * @see merge + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ + function deepMerge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (typeof result[key] === 'object' && typeof val === 'object') { + result[key] = deepMerge(result[key], val); + } else if (typeof val === 'object') { + result[key] = deepMerge({}, val); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; + } + + /** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ + function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; + } + + module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + deepMerge: deepMerge, + extend: extend, + trim: trim + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; + }; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + var buildURL = __webpack_require__(5); + var InterceptorManager = __webpack_require__(6); + var dispatchRequest = __webpack_require__(7); + var mergeConfig = __webpack_require__(22); + + /** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ + function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; + } + + /** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ + Axios.prototype.request = function request(config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; + } + + config = mergeConfig(this.defaults, config); + + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } + + // Hook up interceptors middleware + var chain = [dispatchRequest, undefined]; + var promise = Promise.resolve(config); + + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + chain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + chain.push(interceptor.fulfilled, interceptor.rejected); + }); + + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } + + return promise; + }; + + Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); + }; + + // Provide aliases for supported request methods + utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(utils.merge(config || {}, { + method: method, + url: url + })); + }; + }); + + utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, data, config) { + return this.request(utils.merge(config || {}, { + method: method, + url: url, + data: data + })); + }; + }); + + module.exports = Axios; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + function encode(val) { + return encodeURIComponent(val). + replace(/%40/gi, '@'). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); + } + + /** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ + module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; + + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } + + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } + + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); + + serializedParams = parts.join('&'); + } + + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; + }; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + function InterceptorManager() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + InterceptorManager.prototype.use = function use(fulfilled, rejected) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected + }); + return this.handlers.length - 1; + }; + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ + InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + }; + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ + InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + }; + + module.exports = InterceptorManager; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + var transformData = __webpack_require__(8); + var isCancel = __webpack_require__(9); + var defaults = __webpack_require__(10); + + /** + * Throws a `Cancel` if cancellation has been requested. + */ + function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + } + + /** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ + module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); + + // Ensure headers exist + config.headers = config.headers || {}; + + // Transform request data + config.data = transformData( + config.data, + config.headers, + config.transformRequest + ); + + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); + + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); + + var adapter = config.adapter || defaults.adapter; + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData( + response.data, + response.headers, + config.transformResponse + ); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData( + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } + + return Promise.reject(reason); + }); + }; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + /** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ + module.exports = function transformData(data, headers, fns) { + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn(data, headers); + }); + + return data; + }; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + 'use strict'; + + module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + var normalizeHeaderName = __webpack_require__(11); + + var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' + }; + + function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } + } + + function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = __webpack_require__(12); + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = __webpack_require__(12); + } + return adapter; + } + + var defaults = { + adapter: getDefaultAdapter(), + + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + if (utils.isObject(data)) { + setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); + return JSON.stringify(data); + } + return data; + }], + + transformResponse: [function transformResponse(data) { + /*eslint no-param-reassign:0*/ + if (typeof data === 'string') { + try { + data = JSON.parse(data); + } catch (e) { /* Ignore */ } + } + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + } + }; + + defaults.headers = { + common: { + 'Accept': 'application/json, text/plain, */*' + } + }; + + utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; + }); + + utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); + }); + + module.exports = defaults; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); + }; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + var settle = __webpack_require__(13); + var buildURL = __webpack_require__(5); + var buildFullPath = __webpack_require__(16); + var parseHeaders = __webpack_require__(19); + var isURLSameOrigin = __webpack_require__(20); + var createError = __webpack_require__(14); + + module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + + if (utils.isFormData(requestData)) { + delete requestHeaders['Content-Type']; // Let the browser set it + } + + var request = new XMLHttpRequest(); + + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password || ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); + } + + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + + // Set the request timeout in MS + request.timeout = config.timeout; + + // Listen for ready state + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(resolve, reject, response); + + // Clean up request + request = null; + }; + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(createError('Request aborted', config, 'ECONNABORTED', request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(createError('Network Error', config, null, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', + request)); + + // Clean up request + request = null; + }; + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + var cookies = __webpack_require__(21); + + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; + + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + + // Add responseType to request if needed + if (config.responseType) { + try { + request.responseType = config.responseType; + } catch (e) { + // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. + // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. + if (config.responseType !== 'json') { + throw e; + } + } + } + + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } + + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } + + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (!request) { + return; + } + + request.abort(); + reject(cancel); + // Clean up request + request = null; + }); + } + + if (requestData === undefined) { + requestData = null; + } + + // Send the request + request.send(requestData); + }); + }; + + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var createError = __webpack_require__(14); + + /** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ + module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + 'Request failed with status code ' + response.status, + response.config, + null, + response.request, + response + )); + } + }; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var enhanceError = __webpack_require__(15); + + /** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ + module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); + }; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** + * Update an Error with the specified config, error code, and response. + * + * @param {Error} error The error to update. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The error. + */ + module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; + } + + error.request = request; + error.response = response; + error.isAxiosError = true; + + error.toJSON = function() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code + }; + }; + return error; + }; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isAbsoluteURL = __webpack_require__(17); + var combineURLs = __webpack_require__(18); + + /** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ + module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; + }; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ + module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); + }; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL + */ + module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; + }; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + // Headers whose duplicates are ignored by node + // c.f. https://nodejs.org/api/http.html#http_message_headers + var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' + ]; + + /** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ + module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; + + if (!headers) { return parsed; } + + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); + + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); + + return parsed; + }; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() + ); + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() + ); + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var utils = __webpack_require__(2); + + /** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ + module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + + var valueFromConfig2Keys = ['url', 'method', 'params', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy']; + var defaultToConfig2Keys = [ + 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', + 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath' + ]; + + utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { + if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } + }); + + utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) { + if (utils.isObject(config2[prop])) { + config[prop] = utils.deepMerge(config1[prop], config2[prop]); + } else if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } else if (utils.isObject(config1[prop])) { + config[prop] = utils.deepMerge(config1[prop]); + } else if (typeof config1[prop] !== 'undefined') { + config[prop] = config1[prop]; + } + }); + + utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { + if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } else if (typeof config1[prop] !== 'undefined') { + config[prop] = config1[prop]; + } + }); + + var axiosKeys = valueFromConfig2Keys + .concat(mergeDeepPropertiesKeys) + .concat(defaultToConfig2Keys); + + var otherKeys = Object + .keys(config2) + .filter(function filterAxiosKeys(key) { + return axiosKeys.indexOf(key) === -1; + }); + + utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) { + if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } else if (typeof config1[prop] !== 'undefined') { + config[prop] = config1[prop]; + } + }); + + return config; + }; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** + * A `Cancel` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ + function Cancel(message) { + this.message = message; + } + + Cancel.prototype.toString = function toString() { + return 'Cancel' + (this.message ? ': ' + this.message : ''); + }; + + Cancel.prototype.__CANCEL__ = true; + + module.exports = Cancel; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var Cancel = __webpack_require__(23); + + /** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ + function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + var token = this; + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `Cancel` if cancellation has been requested. + */ + CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } + }; + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; + }; + + module.exports = CancelToken; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + + 'use strict'; + + /** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ + module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; + }; + + +/***/ }) +/******/ ]) +}); +; +//# sourceMappingURL=axios.map \ No newline at end of file diff --git a/node_modules/axios/dist/axios.map b/node_modules/axios/dist/axios.map new file mode 100644 index 0000000..4370129 --- /dev/null +++ b/node_modules/axios/dist/axios.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 18e5718d1c92e108675b","webpack:///./index.js","webpack:///./lib/axios.js","webpack:///./lib/utils.js","webpack:///./lib/helpers/bind.js","webpack:///./lib/core/Axios.js","webpack:///./lib/helpers/buildURL.js","webpack:///./lib/core/InterceptorManager.js","webpack:///./lib/core/dispatchRequest.js","webpack:///./lib/core/transformData.js","webpack:///./lib/cancel/isCancel.js","webpack:///./lib/defaults.js","webpack:///./lib/helpers/normalizeHeaderName.js","webpack:///./lib/adapters/xhr.js","webpack:///./lib/core/settle.js","webpack:///./lib/core/createError.js","webpack:///./lib/core/enhanceError.js","webpack:///./lib/core/buildFullPath.js","webpack:///./lib/helpers/isAbsoluteURL.js","webpack:///./lib/helpers/combineURLs.js","webpack:///./lib/helpers/parseHeaders.js","webpack:///./lib/helpers/isURLSameOrigin.js","webpack:///./lib/helpers/cookies.js","webpack:///./lib/core/mergeConfig.js","webpack:///./lib/cancel/Cancel.js","webpack:///./lib/cancel/CancelToken.js","webpack:///./lib/helpers/spread.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA,yC;;;;;;ACAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;ACpDA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,SAAS,GAAG,SAAS;AAC5C,4BAA2B;AAC3B;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,iCAAgC;AAChC,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACvVA;;AAEA;AACA;AACA;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;;;;;;;AC7FA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;;;;;;ACnDA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAA+B;AAC/B,wCAAuC;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;;;;;;;AC9EA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,MAAM;AACjB,YAAW,eAAe;AAC1B,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACnBA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE;AACxE;AACA;AACA;AACA,wDAAuD;AACvD;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,QAAO,YAAY;AACnB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA,EAAC;;AAED;;;;;;;AChGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACXA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6CAA4C;AAC5C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;;;;;;ACnLA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxBA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;;;;;;ACjBA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACzCA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnBA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,eAAe;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACpDA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;;;;;;ACnEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2CAA0C;AAC1C,UAAS;;AAET;AACA,6DAA4D,wBAAwB;AACpF;AACA,UAAS;;AAET;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,mCAAkC;AAClC,gCAA+B,aAAa,EAAE;AAC9C;AACA;AACA,MAAK;AACL;;;;;;;ACpDA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACxEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;AClBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxDA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,YAAW,SAAS;AACpB,cAAa;AACb;AACA;AACA;AACA;AACA;AACA","file":"axios.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 18e5718d1c92e108675b","module.exports = require('./lib/axios');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/axios.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/utils.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/bind.js\n// module id = 3\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/Axios.js\n// module id = 4\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/buildURL.js\n// module id = 5\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/InterceptorManager.js\n// module id = 6\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/dispatchRequest.js\n// module id = 7\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/transformData.js\n// module id = 8\n// module chunks = 0","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/isCancel.js\n// module id = 9\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 10\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/normalizeHeaderName.js\n// module id = 11\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/adapters/xhr.js\n// module id = 12\n// module chunks = 0","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/settle.js\n// module id = 13\n// module chunks = 0","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/createError.js\n// module id = 14\n// module chunks = 0","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/enhanceError.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/buildFullPath.js\n// module id = 16\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAbsoluteURL.js\n// module id = 17\n// module chunks = 0","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/combineURLs.js\n// module id = 18\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/parseHeaders.js\n// module id = 19\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isURLSameOrigin.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/cookies.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];\n var defaultToConfig2Keys = [\n 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',\n 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath'\n ];\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys);\n\n var otherKeys = Object\n .keys(config2)\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/mergeConfig.js\n// module id = 22\n// module chunks = 0","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/Cancel.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/CancelToken.js\n// module id = 24\n// module chunks = 0","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/spread.js\n// module id = 25\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/axios/dist/axios.min.js b/node_modules/axios/dist/axios.min.js new file mode 100644 index 0000000..b87c0e3 --- /dev/null +++ b/node_modules/axios/dist/axios.min.js @@ -0,0 +1,3 @@ +/* axios v0.19.2 | (c) 2020 by Matt Zabriskie */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new s(e),n=i(s.prototype.request,t);return o.extend(n,s.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),s=n(4),a=n(22),u=n(10),c=r(u);c.Axios=s,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(9),c.all=function(e){return Promise.all(e)},c.spread=n(25),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){return"[object Array]"===j.call(e)}function o(e){return"undefined"==typeof e}function i(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function s(e){return"[object ArrayBuffer]"===j.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function u(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function c(e){return"string"==typeof e}function f(e){return"number"==typeof e}function p(e){return null!==e&&"object"==typeof e}function d(e){return"[object Date]"===j.call(e)}function l(e){return"[object File]"===j.call(e)}function h(e){return"[object Blob]"===j.call(e)}function m(e){return"[object Function]"===j.call(e)}function y(e){return p(e)&&m(e.pipe)}function g(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function v(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function x(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function w(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){u.headers[e]={}}),i.forEach(["post","put","patch"],function(e){u.headers[e]=i.merge(a)}),e.exports=u},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(13),i=n(5),s=n(16),a=n(19),u=n(20),c=n(14);e.exports=function(e){return new Promise(function(t,f){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=e.auth.password||"";d.Authorization="Basic "+btoa(h+":"+m)}var y=s(e.baseURL,e.url);if(l.open(e.method.toUpperCase(),i(y,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l.onreadystatechange=function(){if(l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in l?a(l.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?l.response:l.responseText,i={data:r,status:l.status,statusText:l.statusText,headers:n,config:e,request:l};o(t,f,i),l=null}},l.onabort=function(){l&&(f(c("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){f(c("Network Error",e,null,l)),l=null},l.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),f(c(t,e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=n(21),v=(e.withCredentials||u(y))&&e.xsrfCookieName?g.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),r.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),f(e),l=null)}),void 0===p&&(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t,n){var o=n.config.validateStatus;!o||o(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";var r=n(15);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(17),o=n(18);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([n]):s[t]=s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){t=t||{};var n={},o=["url","method","params","data"],i=["headers","auth","proxy"],s=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];r.forEach(o,function(e){"undefined"!=typeof t[e]&&(n[e]=t[e])}),r.forEach(i,function(o){r.isObject(t[o])?n[o]=r.deepMerge(e[o],t[o]):"undefined"!=typeof t[o]?n[o]=t[o]:r.isObject(e[o])?n[o]=r.deepMerge(e[o]):"undefined"!=typeof e[o]&&(n[o]=e[o])}),r.forEach(s,function(r){"undefined"!=typeof t[r]?n[r]=t[r]:"undefined"!=typeof e[r]&&(n[r]=e[r])});var a=o.concat(i).concat(s),u=Object.keys(t).filter(function(e){return a.indexOf(e)===-1});return r.forEach(u,function(r){"undefined"!=typeof t[r]?n[r]=t[r]:"undefined"!=typeof e[r]&&(n[r]=e[r])}),n}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); +//# sourceMappingURL=axios.min.map \ No newline at end of file diff --git a/node_modules/axios/dist/axios.min.map b/node_modules/axios/dist/axios.min.map new file mode 100644 index 0000000..82849cc --- /dev/null +++ b/node_modules/axios/dist/axios.min.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///axios.min.js","webpack:///webpack/bootstrap be8c45a40d7c235b46c5","webpack:///./index.js","webpack:///./lib/axios.js","webpack:///./lib/utils.js","webpack:///./lib/helpers/bind.js","webpack:///./lib/core/Axios.js","webpack:///./lib/helpers/buildURL.js","webpack:///./lib/core/InterceptorManager.js","webpack:///./lib/core/dispatchRequest.js","webpack:///./lib/core/transformData.js","webpack:///./lib/cancel/isCancel.js","webpack:///./lib/defaults.js","webpack:///./lib/helpers/normalizeHeaderName.js","webpack:///./lib/adapters/xhr.js","webpack:///./lib/core/settle.js","webpack:///./lib/core/createError.js","webpack:///./lib/core/enhanceError.js","webpack:///./lib/core/buildFullPath.js","webpack:///./lib/helpers/isAbsoluteURL.js","webpack:///./lib/helpers/combineURLs.js","webpack:///./lib/helpers/parseHeaders.js","webpack:///./lib/helpers/isURLSameOrigin.js","webpack:///./lib/helpers/cookies.js","webpack:///./lib/core/mergeConfig.js","webpack:///./lib/cancel/Cancel.js","webpack:///./lib/cancel/CancelToken.js","webpack:///./lib/helpers/spread.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","createInstance","defaultConfig","context","Axios","instance","bind","prototype","request","utils","extend","mergeConfig","defaults","axios","create","instanceConfig","Cancel","CancelToken","isCancel","all","promises","Promise","spread","default","isArray","val","toString","isUndefined","isBuffer","constructor","isArrayBuffer","isFormData","FormData","isArrayBufferView","result","ArrayBuffer","isView","buffer","isString","isNumber","isObject","isDate","isFile","isBlob","isFunction","isStream","pipe","isURLSearchParams","URLSearchParams","trim","str","replace","isStandardBrowserEnv","navigator","product","window","document","forEach","obj","fn","i","l","length","key","Object","hasOwnProperty","merge","assignValue","arguments","deepMerge","a","b","thisArg","args","Array","apply","interceptors","InterceptorManager","response","buildURL","dispatchRequest","config","url","method","toLowerCase","chain","undefined","promise","resolve","interceptor","unshift","fulfilled","rejected","push","then","shift","getUri","params","paramsSerializer","data","encode","encodeURIComponent","serializedParams","parts","v","toISOString","JSON","stringify","join","hashmarkIndex","indexOf","slice","handlers","use","eject","h","throwIfCancellationRequested","cancelToken","throwIfRequested","transformData","headers","transformRequest","common","adapter","transformResponse","reason","reject","fns","value","__CANCEL__","setContentTypeIfUnset","getDefaultAdapter","XMLHttpRequest","process","normalizeHeaderName","DEFAULT_CONTENT_TYPE","Content-Type","parse","e","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","validateStatus","status","Accept","normalizedName","name","toUpperCase","settle","buildFullPath","parseHeaders","isURLSameOrigin","createError","requestData","requestHeaders","auth","username","password","Authorization","btoa","fullPath","baseURL","open","onreadystatechange","readyState","responseURL","responseHeaders","getAllResponseHeaders","responseData","responseType","responseText","statusText","onabort","onerror","ontimeout","timeoutErrorMessage","cookies","xsrfValue","withCredentials","read","setRequestHeader","onDownloadProgress","addEventListener","onUploadProgress","upload","cancel","abort","send","enhanceError","message","code","error","Error","isAxiosError","toJSON","description","number","fileName","lineNumber","columnNumber","stack","isAbsoluteURL","combineURLs","requestedURL","test","relativeURL","ignoreDuplicateOf","parsed","split","line","substr","concat","resolveURL","href","msie","urlParsingNode","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","originURL","userAgent","createElement","location","requestURL","write","expires","path","domain","secure","cookie","Date","toGMTString","match","RegExp","decodeURIComponent","remove","now","config1","config2","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","prop","axiosKeys","otherKeys","keys","filter","executor","TypeError","resolvePromise","token","source","callback","arr"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,MAAAD,IAEAD,EAAA,MAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAAUL,EAAQD,EAASM,GEtDjCL,EAAAD,QAAAM,EAAA,IF4DM,SAAUL,EAAQD,EAASM,GG5DjC,YAcA,SAAAS,GAAAC,GACA,GAAAC,GAAA,GAAAC,GAAAF,GACAG,EAAAC,EAAAF,EAAAG,UAAAC,QAAAL,EAQA,OALAM,GAAAC,OAAAL,EAAAD,EAAAG,UAAAJ,GAGAM,EAAAC,OAAAL,EAAAF,GAEAE,EAtBA,GAAAI,GAAAjB,EAAA,GACAc,EAAAd,EAAA,GACAY,EAAA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xL,MAAA,KAAAyL","file":"axios.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(1);\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar bind = __webpack_require__(3);\n\tvar Axios = __webpack_require__(4);\n\tvar mergeConfig = __webpack_require__(22);\n\tvar defaults = __webpack_require__(10);\n\t\n\t/**\n\t * Create an instance of Axios\n\t *\n\t * @param {Object} defaultConfig The default config for the instance\n\t * @return {Axios} A new instance of Axios\n\t */\n\tfunction createInstance(defaultConfig) {\n\t var context = new Axios(defaultConfig);\n\t var instance = bind(Axios.prototype.request, context);\n\t\n\t // Copy axios.prototype to instance\n\t utils.extend(instance, Axios.prototype, context);\n\t\n\t // Copy context to instance\n\t utils.extend(instance, context);\n\t\n\t return instance;\n\t}\n\t\n\t// Create the default instance to be exported\n\tvar axios = createInstance(defaults);\n\t\n\t// Expose Axios class to allow class inheritance\n\taxios.Axios = Axios;\n\t\n\t// Factory for creating new instances\n\taxios.create = function create(instanceConfig) {\n\t return createInstance(mergeConfig(axios.defaults, instanceConfig));\n\t};\n\t\n\t// Expose Cancel & CancelToken\n\taxios.Cancel = __webpack_require__(23);\n\taxios.CancelToken = __webpack_require__(24);\n\taxios.isCancel = __webpack_require__(9);\n\t\n\t// Expose all/spread\n\taxios.all = function all(promises) {\n\t return Promise.all(promises);\n\t};\n\taxios.spread = __webpack_require__(25);\n\t\n\tmodule.exports = axios;\n\t\n\t// Allow use of default import syntax in TypeScript\n\tmodule.exports.default = axios;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar bind = __webpack_require__(3);\n\t\n\t/*global toString:true*/\n\t\n\t// utils is a library of generic helper functions non-specific to axios\n\t\n\tvar toString = Object.prototype.toString;\n\t\n\t/**\n\t * Determine if a value is an Array\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an Array, otherwise false\n\t */\n\tfunction isArray(val) {\n\t return toString.call(val) === '[object Array]';\n\t}\n\t\n\t/**\n\t * Determine if a value is undefined\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if the value is undefined, otherwise false\n\t */\n\tfunction isUndefined(val) {\n\t return typeof val === 'undefined';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Buffer\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Buffer, otherwise false\n\t */\n\tfunction isBuffer(val) {\n\t return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n\t && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n\t}\n\t\n\t/**\n\t * Determine if a value is an ArrayBuffer\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n\t */\n\tfunction isArrayBuffer(val) {\n\t return toString.call(val) === '[object ArrayBuffer]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a FormData\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an FormData, otherwise false\n\t */\n\tfunction isFormData(val) {\n\t return (typeof FormData !== 'undefined') && (val instanceof FormData);\n\t}\n\t\n\t/**\n\t * Determine if a value is a view on an ArrayBuffer\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n\t */\n\tfunction isArrayBufferView(val) {\n\t var result;\n\t if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n\t result = ArrayBuffer.isView(val);\n\t } else {\n\t result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Determine if a value is a String\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a String, otherwise false\n\t */\n\tfunction isString(val) {\n\t return typeof val === 'string';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Number\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Number, otherwise false\n\t */\n\tfunction isNumber(val) {\n\t return typeof val === 'number';\n\t}\n\t\n\t/**\n\t * Determine if a value is an Object\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an Object, otherwise false\n\t */\n\tfunction isObject(val) {\n\t return val !== null && typeof val === 'object';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Date\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Date, otherwise false\n\t */\n\tfunction isDate(val) {\n\t return toString.call(val) === '[object Date]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a File\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a File, otherwise false\n\t */\n\tfunction isFile(val) {\n\t return toString.call(val) === '[object File]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Blob\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Blob, otherwise false\n\t */\n\tfunction isBlob(val) {\n\t return toString.call(val) === '[object Blob]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Function\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Function, otherwise false\n\t */\n\tfunction isFunction(val) {\n\t return toString.call(val) === '[object Function]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Stream\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Stream, otherwise false\n\t */\n\tfunction isStream(val) {\n\t return isObject(val) && isFunction(val.pipe);\n\t}\n\t\n\t/**\n\t * Determine if a value is a URLSearchParams object\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n\t */\n\tfunction isURLSearchParams(val) {\n\t return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n\t}\n\t\n\t/**\n\t * Trim excess whitespace off the beginning and end of a string\n\t *\n\t * @param {String} str The String to trim\n\t * @returns {String} The String freed of excess whitespace\n\t */\n\tfunction trim(str) {\n\t return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n\t}\n\t\n\t/**\n\t * Determine if we're running in a standard browser environment\n\t *\n\t * This allows axios to run in a web worker, and react-native.\n\t * Both environments support XMLHttpRequest, but not fully standard globals.\n\t *\n\t * web workers:\n\t * typeof window -> undefined\n\t * typeof document -> undefined\n\t *\n\t * react-native:\n\t * navigator.product -> 'ReactNative'\n\t * nativescript\n\t * navigator.product -> 'NativeScript' or 'NS'\n\t */\n\tfunction isStandardBrowserEnv() {\n\t if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n\t navigator.product === 'NativeScript' ||\n\t navigator.product === 'NS')) {\n\t return false;\n\t }\n\t return (\n\t typeof window !== 'undefined' &&\n\t typeof document !== 'undefined'\n\t );\n\t}\n\t\n\t/**\n\t * Iterate over an Array or an Object invoking a function for each item.\n\t *\n\t * If `obj` is an Array callback will be called passing\n\t * the value, index, and complete array for each item.\n\t *\n\t * If 'obj' is an Object callback will be called passing\n\t * the value, key, and complete object for each property.\n\t *\n\t * @param {Object|Array} obj The object to iterate\n\t * @param {Function} fn The callback to invoke for each item\n\t */\n\tfunction forEach(obj, fn) {\n\t // Don't bother if no value provided\n\t if (obj === null || typeof obj === 'undefined') {\n\t return;\n\t }\n\t\n\t // Force an array if not already something iterable\n\t if (typeof obj !== 'object') {\n\t /*eslint no-param-reassign:0*/\n\t obj = [obj];\n\t }\n\t\n\t if (isArray(obj)) {\n\t // Iterate over array values\n\t for (var i = 0, l = obj.length; i < l; i++) {\n\t fn.call(null, obj[i], i, obj);\n\t }\n\t } else {\n\t // Iterate over object keys\n\t for (var key in obj) {\n\t if (Object.prototype.hasOwnProperty.call(obj, key)) {\n\t fn.call(null, obj[key], key, obj);\n\t }\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * Accepts varargs expecting each argument to be an object, then\n\t * immutably merges the properties of each object and returns result.\n\t *\n\t * When multiple objects contain the same key the later object in\n\t * the arguments list will take precedence.\n\t *\n\t * Example:\n\t *\n\t * ```js\n\t * var result = merge({foo: 123}, {foo: 456});\n\t * console.log(result.foo); // outputs 456\n\t * ```\n\t *\n\t * @param {Object} obj1 Object to merge\n\t * @returns {Object} Result of all merge properties\n\t */\n\tfunction merge(/* obj1, obj2, obj3, ... */) {\n\t var result = {};\n\t function assignValue(val, key) {\n\t if (typeof result[key] === 'object' && typeof val === 'object') {\n\t result[key] = merge(result[key], val);\n\t } else {\n\t result[key] = val;\n\t }\n\t }\n\t\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t forEach(arguments[i], assignValue);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Function equal to merge with the difference being that no reference\n\t * to original objects is kept.\n\t *\n\t * @see merge\n\t * @param {Object} obj1 Object to merge\n\t * @returns {Object} Result of all merge properties\n\t */\n\tfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n\t var result = {};\n\t function assignValue(val, key) {\n\t if (typeof result[key] === 'object' && typeof val === 'object') {\n\t result[key] = deepMerge(result[key], val);\n\t } else if (typeof val === 'object') {\n\t result[key] = deepMerge({}, val);\n\t } else {\n\t result[key] = val;\n\t }\n\t }\n\t\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t forEach(arguments[i], assignValue);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Extends object a by mutably adding to it the properties of object b.\n\t *\n\t * @param {Object} a The object to be extended\n\t * @param {Object} b The object to copy properties from\n\t * @param {Object} thisArg The object to bind function to\n\t * @return {Object} The resulting value of object a\n\t */\n\tfunction extend(a, b, thisArg) {\n\t forEach(b, function assignValue(val, key) {\n\t if (thisArg && typeof val === 'function') {\n\t a[key] = bind(val, thisArg);\n\t } else {\n\t a[key] = val;\n\t }\n\t });\n\t return a;\n\t}\n\t\n\tmodule.exports = {\n\t isArray: isArray,\n\t isArrayBuffer: isArrayBuffer,\n\t isBuffer: isBuffer,\n\t isFormData: isFormData,\n\t isArrayBufferView: isArrayBufferView,\n\t isString: isString,\n\t isNumber: isNumber,\n\t isObject: isObject,\n\t isUndefined: isUndefined,\n\t isDate: isDate,\n\t isFile: isFile,\n\t isBlob: isBlob,\n\t isFunction: isFunction,\n\t isStream: isStream,\n\t isURLSearchParams: isURLSearchParams,\n\t isStandardBrowserEnv: isStandardBrowserEnv,\n\t forEach: forEach,\n\t merge: merge,\n\t deepMerge: deepMerge,\n\t extend: extend,\n\t trim: trim\n\t};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = function bind(fn, thisArg) {\n\t return function wrap() {\n\t var args = new Array(arguments.length);\n\t for (var i = 0; i < args.length; i++) {\n\t args[i] = arguments[i];\n\t }\n\t return fn.apply(thisArg, args);\n\t };\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar buildURL = __webpack_require__(5);\n\tvar InterceptorManager = __webpack_require__(6);\n\tvar dispatchRequest = __webpack_require__(7);\n\tvar mergeConfig = __webpack_require__(22);\n\t\n\t/**\n\t * Create a new instance of Axios\n\t *\n\t * @param {Object} instanceConfig The default config for the instance\n\t */\n\tfunction Axios(instanceConfig) {\n\t this.defaults = instanceConfig;\n\t this.interceptors = {\n\t request: new InterceptorManager(),\n\t response: new InterceptorManager()\n\t };\n\t}\n\t\n\t/**\n\t * Dispatch a request\n\t *\n\t * @param {Object} config The config specific for this request (merged with this.defaults)\n\t */\n\tAxios.prototype.request = function request(config) {\n\t /*eslint no-param-reassign:0*/\n\t // Allow for axios('example/url'[, config]) a la fetch API\n\t if (typeof config === 'string') {\n\t config = arguments[1] || {};\n\t config.url = arguments[0];\n\t } else {\n\t config = config || {};\n\t }\n\t\n\t config = mergeConfig(this.defaults, config);\n\t\n\t // Set config.method\n\t if (config.method) {\n\t config.method = config.method.toLowerCase();\n\t } else if (this.defaults.method) {\n\t config.method = this.defaults.method.toLowerCase();\n\t } else {\n\t config.method = 'get';\n\t }\n\t\n\t // Hook up interceptors middleware\n\t var chain = [dispatchRequest, undefined];\n\t var promise = Promise.resolve(config);\n\t\n\t this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n\t chain.unshift(interceptor.fulfilled, interceptor.rejected);\n\t });\n\t\n\t this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n\t chain.push(interceptor.fulfilled, interceptor.rejected);\n\t });\n\t\n\t while (chain.length) {\n\t promise = promise.then(chain.shift(), chain.shift());\n\t }\n\t\n\t return promise;\n\t};\n\t\n\tAxios.prototype.getUri = function getUri(config) {\n\t config = mergeConfig(this.defaults, config);\n\t return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n\t};\n\t\n\t// Provide aliases for supported request methods\n\tutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n\t /*eslint func-names:0*/\n\t Axios.prototype[method] = function(url, config) {\n\t return this.request(utils.merge(config || {}, {\n\t method: method,\n\t url: url\n\t }));\n\t };\n\t});\n\t\n\tutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n\t /*eslint func-names:0*/\n\t Axios.prototype[method] = function(url, data, config) {\n\t return this.request(utils.merge(config || {}, {\n\t method: method,\n\t url: url,\n\t data: data\n\t }));\n\t };\n\t});\n\t\n\tmodule.exports = Axios;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tfunction encode(val) {\n\t return encodeURIComponent(val).\n\t replace(/%40/gi, '@').\n\t replace(/%3A/gi, ':').\n\t replace(/%24/g, '$').\n\t replace(/%2C/gi, ',').\n\t replace(/%20/g, '+').\n\t replace(/%5B/gi, '[').\n\t replace(/%5D/gi, ']');\n\t}\n\t\n\t/**\n\t * Build a URL by appending params to the end\n\t *\n\t * @param {string} url The base of the url (e.g., http://www.google.com)\n\t * @param {object} [params] The params to be appended\n\t * @returns {string} The formatted url\n\t */\n\tmodule.exports = function buildURL(url, params, paramsSerializer) {\n\t /*eslint no-param-reassign:0*/\n\t if (!params) {\n\t return url;\n\t }\n\t\n\t var serializedParams;\n\t if (paramsSerializer) {\n\t serializedParams = paramsSerializer(params);\n\t } else if (utils.isURLSearchParams(params)) {\n\t serializedParams = params.toString();\n\t } else {\n\t var parts = [];\n\t\n\t utils.forEach(params, function serialize(val, key) {\n\t if (val === null || typeof val === 'undefined') {\n\t return;\n\t }\n\t\n\t if (utils.isArray(val)) {\n\t key = key + '[]';\n\t } else {\n\t val = [val];\n\t }\n\t\n\t utils.forEach(val, function parseValue(v) {\n\t if (utils.isDate(v)) {\n\t v = v.toISOString();\n\t } else if (utils.isObject(v)) {\n\t v = JSON.stringify(v);\n\t }\n\t parts.push(encode(key) + '=' + encode(v));\n\t });\n\t });\n\t\n\t serializedParams = parts.join('&');\n\t }\n\t\n\t if (serializedParams) {\n\t var hashmarkIndex = url.indexOf('#');\n\t if (hashmarkIndex !== -1) {\n\t url = url.slice(0, hashmarkIndex);\n\t }\n\t\n\t url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n\t }\n\t\n\t return url;\n\t};\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tfunction InterceptorManager() {\n\t this.handlers = [];\n\t}\n\t\n\t/**\n\t * Add a new interceptor to the stack\n\t *\n\t * @param {Function} fulfilled The function to handle `then` for a `Promise`\n\t * @param {Function} rejected The function to handle `reject` for a `Promise`\n\t *\n\t * @return {Number} An ID used to remove interceptor later\n\t */\n\tInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n\t this.handlers.push({\n\t fulfilled: fulfilled,\n\t rejected: rejected\n\t });\n\t return this.handlers.length - 1;\n\t};\n\t\n\t/**\n\t * Remove an interceptor from the stack\n\t *\n\t * @param {Number} id The ID that was returned by `use`\n\t */\n\tInterceptorManager.prototype.eject = function eject(id) {\n\t if (this.handlers[id]) {\n\t this.handlers[id] = null;\n\t }\n\t};\n\t\n\t/**\n\t * Iterate over all the registered interceptors\n\t *\n\t * This method is particularly useful for skipping over any\n\t * interceptors that may have become `null` calling `eject`.\n\t *\n\t * @param {Function} fn The function to call for each interceptor\n\t */\n\tInterceptorManager.prototype.forEach = function forEach(fn) {\n\t utils.forEach(this.handlers, function forEachHandler(h) {\n\t if (h !== null) {\n\t fn(h);\n\t }\n\t });\n\t};\n\t\n\tmodule.exports = InterceptorManager;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar transformData = __webpack_require__(8);\n\tvar isCancel = __webpack_require__(9);\n\tvar defaults = __webpack_require__(10);\n\t\n\t/**\n\t * Throws a `Cancel` if cancellation has been requested.\n\t */\n\tfunction throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}\n\t\n\t/**\n\t * Dispatch a request to the server using the configured adapter.\n\t *\n\t * @param {object} config The config that is to be used for the request\n\t * @returns {Promise} The Promise to be fulfilled\n\t */\n\tmodule.exports = function dispatchRequest(config) {\n\t throwIfCancellationRequested(config);\n\t\n\t // Ensure headers exist\n\t config.headers = config.headers || {};\n\t\n\t // Transform request data\n\t config.data = transformData(\n\t config.data,\n\t config.headers,\n\t config.transformRequest\n\t );\n\t\n\t // Flatten headers\n\t config.headers = utils.merge(\n\t config.headers.common || {},\n\t config.headers[config.method] || {},\n\t config.headers\n\t );\n\t\n\t utils.forEach(\n\t ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n\t function cleanHeaderConfig(method) {\n\t delete config.headers[method];\n\t }\n\t );\n\t\n\t var adapter = config.adapter || defaults.adapter;\n\t\n\t return adapter(config).then(function onAdapterResolution(response) {\n\t throwIfCancellationRequested(config);\n\t\n\t // Transform response data\n\t response.data = transformData(\n\t response.data,\n\t response.headers,\n\t config.transformResponse\n\t );\n\t\n\t return response;\n\t }, function onAdapterRejection(reason) {\n\t if (!isCancel(reason)) {\n\t throwIfCancellationRequested(config);\n\t\n\t // Transform response data\n\t if (reason && reason.response) {\n\t reason.response.data = transformData(\n\t reason.response.data,\n\t reason.response.headers,\n\t config.transformResponse\n\t );\n\t }\n\t }\n\t\n\t return Promise.reject(reason);\n\t });\n\t};\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\t/**\n\t * Transform the data for a request or a response\n\t *\n\t * @param {Object|String} data The data to be transformed\n\t * @param {Array} headers The headers for the request or response\n\t * @param {Array|Function} fns A single function or Array of functions\n\t * @returns {*} The resulting transformed data\n\t */\n\tmodule.exports = function transformData(data, headers, fns) {\n\t /*eslint no-param-reassign:0*/\n\t utils.forEach(fns, function transform(fn) {\n\t data = fn(data, headers);\n\t });\n\t\n\t return data;\n\t};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = function isCancel(value) {\n\t return !!(value && value.__CANCEL__);\n\t};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar normalizeHeaderName = __webpack_require__(11);\n\t\n\tvar DEFAULT_CONTENT_TYPE = {\n\t 'Content-Type': 'application/x-www-form-urlencoded'\n\t};\n\t\n\tfunction setContentTypeIfUnset(headers, value) {\n\t if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n\t headers['Content-Type'] = value;\n\t }\n\t}\n\t\n\tfunction getDefaultAdapter() {\n\t var adapter;\n\t if (typeof XMLHttpRequest !== 'undefined') {\n\t // For browsers use XHR adapter\n\t adapter = __webpack_require__(12);\n\t } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n\t // For node use HTTP adapter\n\t adapter = __webpack_require__(12);\n\t }\n\t return adapter;\n\t}\n\t\n\tvar defaults = {\n\t adapter: getDefaultAdapter(),\n\t\n\t transformRequest: [function transformRequest(data, headers) {\n\t normalizeHeaderName(headers, 'Accept');\n\t normalizeHeaderName(headers, 'Content-Type');\n\t if (utils.isFormData(data) ||\n\t utils.isArrayBuffer(data) ||\n\t utils.isBuffer(data) ||\n\t utils.isStream(data) ||\n\t utils.isFile(data) ||\n\t utils.isBlob(data)\n\t ) {\n\t return data;\n\t }\n\t if (utils.isArrayBufferView(data)) {\n\t return data.buffer;\n\t }\n\t if (utils.isURLSearchParams(data)) {\n\t setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n\t return data.toString();\n\t }\n\t if (utils.isObject(data)) {\n\t setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n\t return JSON.stringify(data);\n\t }\n\t return data;\n\t }],\n\t\n\t transformResponse: [function transformResponse(data) {\n\t /*eslint no-param-reassign:0*/\n\t if (typeof data === 'string') {\n\t try {\n\t data = JSON.parse(data);\n\t } catch (e) { /* Ignore */ }\n\t }\n\t return data;\n\t }],\n\t\n\t /**\n\t * A timeout in milliseconds to abort a request. If set to 0 (default) a\n\t * timeout is not created.\n\t */\n\t timeout: 0,\n\t\n\t xsrfCookieName: 'XSRF-TOKEN',\n\t xsrfHeaderName: 'X-XSRF-TOKEN',\n\t\n\t maxContentLength: -1,\n\t\n\t validateStatus: function validateStatus(status) {\n\t return status >= 200 && status < 300;\n\t }\n\t};\n\t\n\tdefaults.headers = {\n\t common: {\n\t 'Accept': 'application/json, text/plain, */*'\n\t }\n\t};\n\t\n\tutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n\t defaults.headers[method] = {};\n\t});\n\t\n\tutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n\t defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n\t});\n\t\n\tmodule.exports = defaults;\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n\t utils.forEach(headers, function processHeader(value, name) {\n\t if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n\t headers[normalizedName] = value;\n\t delete headers[name];\n\t }\n\t });\n\t};\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar settle = __webpack_require__(13);\n\tvar buildURL = __webpack_require__(5);\n\tvar buildFullPath = __webpack_require__(16);\n\tvar parseHeaders = __webpack_require__(19);\n\tvar isURLSameOrigin = __webpack_require__(20);\n\tvar createError = __webpack_require__(14);\n\t\n\tmodule.exports = function xhrAdapter(config) {\n\t return new Promise(function dispatchXhrRequest(resolve, reject) {\n\t var requestData = config.data;\n\t var requestHeaders = config.headers;\n\t\n\t if (utils.isFormData(requestData)) {\n\t delete requestHeaders['Content-Type']; // Let the browser set it\n\t }\n\t\n\t var request = new XMLHttpRequest();\n\t\n\t // HTTP basic authentication\n\t if (config.auth) {\n\t var username = config.auth.username || '';\n\t var password = config.auth.password || '';\n\t requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n\t }\n\t\n\t var fullPath = buildFullPath(config.baseURL, config.url);\n\t request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\t\n\t // Set the request timeout in MS\n\t request.timeout = config.timeout;\n\t\n\t // Listen for ready state\n\t request.onreadystatechange = function handleLoad() {\n\t if (!request || request.readyState !== 4) {\n\t return;\n\t }\n\t\n\t // The request errored out and we didn't get a response, this will be\n\t // handled by onerror instead\n\t // With one exception: request that using file: protocol, most browsers\n\t // will return status as 0 even though it's a successful request\n\t if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n\t return;\n\t }\n\t\n\t // Prepare the response\n\t var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n\t var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n\t var response = {\n\t data: responseData,\n\t status: request.status,\n\t statusText: request.statusText,\n\t headers: responseHeaders,\n\t config: config,\n\t request: request\n\t };\n\t\n\t settle(resolve, reject, response);\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Handle browser request cancellation (as opposed to a manual cancellation)\n\t request.onabort = function handleAbort() {\n\t if (!request) {\n\t return;\n\t }\n\t\n\t reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Handle low level network errors\n\t request.onerror = function handleError() {\n\t // Real errors are hidden from us by the browser\n\t // onerror should only fire if it's a network error\n\t reject(createError('Network Error', config, null, request));\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Handle timeout\n\t request.ontimeout = function handleTimeout() {\n\t var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n\t if (config.timeoutErrorMessage) {\n\t timeoutErrorMessage = config.timeoutErrorMessage;\n\t }\n\t reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n\t request));\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Add xsrf header\n\t // This is only done if running in a standard browser environment.\n\t // Specifically not if we're in a web worker, or react-native.\n\t if (utils.isStandardBrowserEnv()) {\n\t var cookies = __webpack_require__(21);\n\t\n\t // Add xsrf header\n\t var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n\t cookies.read(config.xsrfCookieName) :\n\t undefined;\n\t\n\t if (xsrfValue) {\n\t requestHeaders[config.xsrfHeaderName] = xsrfValue;\n\t }\n\t }\n\t\n\t // Add headers to the request\n\t if ('setRequestHeader' in request) {\n\t utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n\t if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n\t // Remove Content-Type if data is undefined\n\t delete requestHeaders[key];\n\t } else {\n\t // Otherwise add header to the request\n\t request.setRequestHeader(key, val);\n\t }\n\t });\n\t }\n\t\n\t // Add withCredentials to request if needed\n\t if (!utils.isUndefined(config.withCredentials)) {\n\t request.withCredentials = !!config.withCredentials;\n\t }\n\t\n\t // Add responseType to request if needed\n\t if (config.responseType) {\n\t try {\n\t request.responseType = config.responseType;\n\t } catch (e) {\n\t // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n\t // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n\t if (config.responseType !== 'json') {\n\t throw e;\n\t }\n\t }\n\t }\n\t\n\t // Handle progress if needed\n\t if (typeof config.onDownloadProgress === 'function') {\n\t request.addEventListener('progress', config.onDownloadProgress);\n\t }\n\t\n\t // Not all browsers support upload events\n\t if (typeof config.onUploadProgress === 'function' && request.upload) {\n\t request.upload.addEventListener('progress', config.onUploadProgress);\n\t }\n\t\n\t if (config.cancelToken) {\n\t // Handle cancellation\n\t config.cancelToken.promise.then(function onCanceled(cancel) {\n\t if (!request) {\n\t return;\n\t }\n\t\n\t request.abort();\n\t reject(cancel);\n\t // Clean up request\n\t request = null;\n\t });\n\t }\n\t\n\t if (requestData === undefined) {\n\t requestData = null;\n\t }\n\t\n\t // Send the request\n\t request.send(requestData);\n\t });\n\t};\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar createError = __webpack_require__(14);\n\t\n\t/**\n\t * Resolve or reject a Promise based on response status.\n\t *\n\t * @param {Function} resolve A function that resolves the promise.\n\t * @param {Function} reject A function that rejects the promise.\n\t * @param {object} response The response.\n\t */\n\tmodule.exports = function settle(resolve, reject, response) {\n\t var validateStatus = response.config.validateStatus;\n\t if (!validateStatus || validateStatus(response.status)) {\n\t resolve(response);\n\t } else {\n\t reject(createError(\n\t 'Request failed with status code ' + response.status,\n\t response.config,\n\t null,\n\t response.request,\n\t response\n\t ));\n\t }\n\t};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar enhanceError = __webpack_require__(15);\n\t\n\t/**\n\t * Create an Error with the specified message, config, error code, request and response.\n\t *\n\t * @param {string} message The error message.\n\t * @param {Object} config The config.\n\t * @param {string} [code] The error code (for example, 'ECONNABORTED').\n\t * @param {Object} [request] The request.\n\t * @param {Object} [response] The response.\n\t * @returns {Error} The created error.\n\t */\n\tmodule.exports = function createError(message, config, code, request, response) {\n\t var error = new Error(message);\n\t return enhanceError(error, config, code, request, response);\n\t};\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Update an Error with the specified config, error code, and response.\n\t *\n\t * @param {Error} error The error to update.\n\t * @param {Object} config The config.\n\t * @param {string} [code] The error code (for example, 'ECONNABORTED').\n\t * @param {Object} [request] The request.\n\t * @param {Object} [response] The response.\n\t * @returns {Error} The error.\n\t */\n\tmodule.exports = function enhanceError(error, config, code, request, response) {\n\t error.config = config;\n\t if (code) {\n\t error.code = code;\n\t }\n\t\n\t error.request = request;\n\t error.response = response;\n\t error.isAxiosError = true;\n\t\n\t error.toJSON = function() {\n\t return {\n\t // Standard\n\t message: this.message,\n\t name: this.name,\n\t // Microsoft\n\t description: this.description,\n\t number: this.number,\n\t // Mozilla\n\t fileName: this.fileName,\n\t lineNumber: this.lineNumber,\n\t columnNumber: this.columnNumber,\n\t stack: this.stack,\n\t // Axios\n\t config: this.config,\n\t code: this.code\n\t };\n\t };\n\t return error;\n\t};\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar isAbsoluteURL = __webpack_require__(17);\n\tvar combineURLs = __webpack_require__(18);\n\t\n\t/**\n\t * Creates a new URL by combining the baseURL with the requestedURL,\n\t * only when the requestedURL is not already an absolute URL.\n\t * If the requestURL is absolute, this function returns the requestedURL untouched.\n\t *\n\t * @param {string} baseURL The base URL\n\t * @param {string} requestedURL Absolute or relative URL to combine\n\t * @returns {string} The combined full path\n\t */\n\tmodule.exports = function buildFullPath(baseURL, requestedURL) {\n\t if (baseURL && !isAbsoluteURL(requestedURL)) {\n\t return combineURLs(baseURL, requestedURL);\n\t }\n\t return requestedURL;\n\t};\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Determines whether the specified URL is absolute\n\t *\n\t * @param {string} url The URL to test\n\t * @returns {boolean} True if the specified URL is absolute, otherwise false\n\t */\n\tmodule.exports = function isAbsoluteURL(url) {\n\t // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n\t // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n\t // by any combination of letters, digits, plus, period, or hyphen.\n\t return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n\t};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Creates a new URL by combining the specified URLs\n\t *\n\t * @param {string} baseURL The base URL\n\t * @param {string} relativeURL The relative URL\n\t * @returns {string} The combined URL\n\t */\n\tmodule.exports = function combineURLs(baseURL, relativeURL) {\n\t return relativeURL\n\t ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n\t : baseURL;\n\t};\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\t// Headers whose duplicates are ignored by node\n\t// c.f. https://nodejs.org/api/http.html#http_message_headers\n\tvar ignoreDuplicateOf = [\n\t 'age', 'authorization', 'content-length', 'content-type', 'etag',\n\t 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n\t 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n\t 'referer', 'retry-after', 'user-agent'\n\t];\n\t\n\t/**\n\t * Parse headers into an object\n\t *\n\t * ```\n\t * Date: Wed, 27 Aug 2014 08:58:49 GMT\n\t * Content-Type: application/json\n\t * Connection: keep-alive\n\t * Transfer-Encoding: chunked\n\t * ```\n\t *\n\t * @param {String} headers Headers needing to be parsed\n\t * @returns {Object} Headers parsed into an object\n\t */\n\tmodule.exports = function parseHeaders(headers) {\n\t var parsed = {};\n\t var key;\n\t var val;\n\t var i;\n\t\n\t if (!headers) { return parsed; }\n\t\n\t utils.forEach(headers.split('\\n'), function parser(line) {\n\t i = line.indexOf(':');\n\t key = utils.trim(line.substr(0, i)).toLowerCase();\n\t val = utils.trim(line.substr(i + 1));\n\t\n\t if (key) {\n\t if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n\t return;\n\t }\n\t if (key === 'set-cookie') {\n\t parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n\t } else {\n\t parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n\t }\n\t }\n\t });\n\t\n\t return parsed;\n\t};\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tmodule.exports = (\n\t utils.isStandardBrowserEnv() ?\n\t\n\t // Standard browser envs have full support of the APIs needed to test\n\t // whether the request URL is of the same origin as current location.\n\t (function standardBrowserEnv() {\n\t var msie = /(msie|trident)/i.test(navigator.userAgent);\n\t var urlParsingNode = document.createElement('a');\n\t var originURL;\n\t\n\t /**\n\t * Parse a URL to discover it's components\n\t *\n\t * @param {String} url The URL to be parsed\n\t * @returns {Object}\n\t */\n\t function resolveURL(url) {\n\t var href = url;\n\t\n\t if (msie) {\n\t // IE needs attribute set twice to normalize properties\n\t urlParsingNode.setAttribute('href', href);\n\t href = urlParsingNode.href;\n\t }\n\t\n\t urlParsingNode.setAttribute('href', href);\n\t\n\t // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n\t return {\n\t href: urlParsingNode.href,\n\t protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n\t host: urlParsingNode.host,\n\t search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n\t hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n\t hostname: urlParsingNode.hostname,\n\t port: urlParsingNode.port,\n\t pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n\t urlParsingNode.pathname :\n\t '/' + urlParsingNode.pathname\n\t };\n\t }\n\t\n\t originURL = resolveURL(window.location.href);\n\t\n\t /**\n\t * Determine if a URL shares the same origin as the current location\n\t *\n\t * @param {String} requestURL The URL to test\n\t * @returns {boolean} True if URL shares the same origin, otherwise false\n\t */\n\t return function isURLSameOrigin(requestURL) {\n\t var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n\t return (parsed.protocol === originURL.protocol &&\n\t parsed.host === originURL.host);\n\t };\n\t })() :\n\t\n\t // Non standard browser envs (web workers, react-native) lack needed support.\n\t (function nonStandardBrowserEnv() {\n\t return function isURLSameOrigin() {\n\t return true;\n\t };\n\t })()\n\t);\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tmodule.exports = (\n\t utils.isStandardBrowserEnv() ?\n\t\n\t // Standard browser envs support document.cookie\n\t (function standardBrowserEnv() {\n\t return {\n\t write: function write(name, value, expires, path, domain, secure) {\n\t var cookie = [];\n\t cookie.push(name + '=' + encodeURIComponent(value));\n\t\n\t if (utils.isNumber(expires)) {\n\t cookie.push('expires=' + new Date(expires).toGMTString());\n\t }\n\t\n\t if (utils.isString(path)) {\n\t cookie.push('path=' + path);\n\t }\n\t\n\t if (utils.isString(domain)) {\n\t cookie.push('domain=' + domain);\n\t }\n\t\n\t if (secure === true) {\n\t cookie.push('secure');\n\t }\n\t\n\t document.cookie = cookie.join('; ');\n\t },\n\t\n\t read: function read(name) {\n\t var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n\t return (match ? decodeURIComponent(match[3]) : null);\n\t },\n\t\n\t remove: function remove(name) {\n\t this.write(name, '', Date.now() - 86400000);\n\t }\n\t };\n\t })() :\n\t\n\t // Non standard browser env (web workers, react-native) lack needed support.\n\t (function nonStandardBrowserEnv() {\n\t return {\n\t write: function write() {},\n\t read: function read() { return null; },\n\t remove: function remove() {}\n\t };\n\t })()\n\t);\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\t/**\n\t * Config-specific merge-function which creates a new config-object\n\t * by merging two configuration objects together.\n\t *\n\t * @param {Object} config1\n\t * @param {Object} config2\n\t * @returns {Object} New object resulting from merging config2 to config1\n\t */\n\tmodule.exports = function mergeConfig(config1, config2) {\n\t // eslint-disable-next-line no-param-reassign\n\t config2 = config2 || {};\n\t var config = {};\n\t\n\t var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];\n\t var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];\n\t var defaultToConfig2Keys = [\n\t 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',\n\t 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n\t 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',\n\t 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',\n\t 'httpsAgent', 'cancelToken', 'socketPath'\n\t ];\n\t\n\t utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n\t if (typeof config2[prop] !== 'undefined') {\n\t config[prop] = config2[prop];\n\t }\n\t });\n\t\n\t utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {\n\t if (utils.isObject(config2[prop])) {\n\t config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n\t } else if (typeof config2[prop] !== 'undefined') {\n\t config[prop] = config2[prop];\n\t } else if (utils.isObject(config1[prop])) {\n\t config[prop] = utils.deepMerge(config1[prop]);\n\t } else if (typeof config1[prop] !== 'undefined') {\n\t config[prop] = config1[prop];\n\t }\n\t });\n\t\n\t utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n\t if (typeof config2[prop] !== 'undefined') {\n\t config[prop] = config2[prop];\n\t } else if (typeof config1[prop] !== 'undefined') {\n\t config[prop] = config1[prop];\n\t }\n\t });\n\t\n\t var axiosKeys = valueFromConfig2Keys\n\t .concat(mergeDeepPropertiesKeys)\n\t .concat(defaultToConfig2Keys);\n\t\n\t var otherKeys = Object\n\t .keys(config2)\n\t .filter(function filterAxiosKeys(key) {\n\t return axiosKeys.indexOf(key) === -1;\n\t });\n\t\n\t utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {\n\t if (typeof config2[prop] !== 'undefined') {\n\t config[prop] = config2[prop];\n\t } else if (typeof config1[prop] !== 'undefined') {\n\t config[prop] = config1[prop];\n\t }\n\t });\n\t\n\t return config;\n\t};\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * A `Cancel` is an object that is thrown when an operation is canceled.\n\t *\n\t * @class\n\t * @param {string=} message The message.\n\t */\n\tfunction Cancel(message) {\n\t this.message = message;\n\t}\n\t\n\tCancel.prototype.toString = function toString() {\n\t return 'Cancel' + (this.message ? ': ' + this.message : '');\n\t};\n\t\n\tCancel.prototype.__CANCEL__ = true;\n\t\n\tmodule.exports = Cancel;\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar Cancel = __webpack_require__(23);\n\t\n\t/**\n\t * A `CancelToken` is an object that can be used to request cancellation of an operation.\n\t *\n\t * @class\n\t * @param {Function} executor The executor function.\n\t */\n\tfunction CancelToken(executor) {\n\t if (typeof executor !== 'function') {\n\t throw new TypeError('executor must be a function.');\n\t }\n\t\n\t var resolvePromise;\n\t this.promise = new Promise(function promiseExecutor(resolve) {\n\t resolvePromise = resolve;\n\t });\n\t\n\t var token = this;\n\t executor(function cancel(message) {\n\t if (token.reason) {\n\t // Cancellation has already been requested\n\t return;\n\t }\n\t\n\t token.reason = new Cancel(message);\n\t resolvePromise(token.reason);\n\t });\n\t}\n\t\n\t/**\n\t * Throws a `Cancel` if cancellation has been requested.\n\t */\n\tCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n\t if (this.reason) {\n\t throw this.reason;\n\t }\n\t};\n\t\n\t/**\n\t * Returns an object that contains a new `CancelToken` and a function that, when called,\n\t * cancels the `CancelToken`.\n\t */\n\tCancelToken.source = function source() {\n\t var cancel;\n\t var token = new CancelToken(function executor(c) {\n\t cancel = c;\n\t });\n\t return {\n\t token: token,\n\t cancel: cancel\n\t };\n\t};\n\t\n\tmodule.exports = CancelToken;\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Syntactic sugar for invoking a function and expanding an array for arguments.\n\t *\n\t * Common use case would be to use `Function.prototype.apply`.\n\t *\n\t * ```js\n\t * function f(x, y, z) {}\n\t * var args = [1, 2, 3];\n\t * f.apply(null, args);\n\t * ```\n\t *\n\t * With `spread` this example can be re-written.\n\t *\n\t * ```js\n\t * spread(function(x, y, z) {})([1, 2, 3]);\n\t * ```\n\t *\n\t * @param {Function} callback\n\t * @returns {Function}\n\t */\n\tmodule.exports = function spread(callback) {\n\t return function wrap(arr) {\n\t return callback.apply(null, arr);\n\t };\n\t};\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// axios.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap be8c45a40d7c235b46c5","module.exports = require('./lib/axios');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/axios.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/utils.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/bind.js\n// module id = 3\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/Axios.js\n// module id = 4\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/buildURL.js\n// module id = 5\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/InterceptorManager.js\n// module id = 6\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/dispatchRequest.js\n// module id = 7\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/transformData.js\n// module id = 8\n// module chunks = 0","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/isCancel.js\n// module id = 9\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 10\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/normalizeHeaderName.js\n// module id = 11\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/adapters/xhr.js\n// module id = 12\n// module chunks = 0","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/settle.js\n// module id = 13\n// module chunks = 0","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/createError.js\n// module id = 14\n// module chunks = 0","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/enhanceError.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/buildFullPath.js\n// module id = 16\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAbsoluteURL.js\n// module id = 17\n// module chunks = 0","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/combineURLs.js\n// module id = 18\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/parseHeaders.js\n// module id = 19\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isURLSameOrigin.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/cookies.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];\n var defaultToConfig2Keys = [\n 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',\n 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath'\n ];\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys);\n\n var otherKeys = Object\n .keys(config2)\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/mergeConfig.js\n// module id = 22\n// module chunks = 0","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/Cancel.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/CancelToken.js\n// module id = 24\n// module chunks = 0","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/spread.js\n// module id = 25\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/axios/index.d.ts b/node_modules/axios/index.d.ts new file mode 100644 index 0000000..fc1fd18 --- /dev/null +++ b/node_modules/axios/index.d.ts @@ -0,0 +1,157 @@ +export interface AxiosTransformer { + (data: any, headers?: any): any; +} + +export interface AxiosAdapter { + (config: AxiosRequestConfig): AxiosPromise; +} + +export interface AxiosBasicCredentials { + username: string; + password: string; +} + +export interface AxiosProxyConfig { + host: string; + port: number; + auth?: { + username: string; + password:string; + }; + protocol?: string; +} + +export type Method = + | 'get' | 'GET' + | 'delete' | 'DELETE' + | 'head' | 'HEAD' + | 'options' | 'OPTIONS' + | 'post' | 'POST' + | 'put' | 'PUT' + | 'patch' | 'PATCH' + | 'link' | 'LINK' + | 'unlink' | 'UNLINK' + +export type ResponseType = + | 'arraybuffer' + | 'blob' + | 'document' + | 'json' + | 'text' + | 'stream' + +export interface AxiosRequestConfig { + url?: string; + method?: Method; + baseURL?: string; + transformRequest?: AxiosTransformer | AxiosTransformer[]; + transformResponse?: AxiosTransformer | AxiosTransformer[]; + headers?: any; + params?: any; + paramsSerializer?: (params: any) => string; + data?: any; + timeout?: number; + timeoutErrorMessage?: string; + withCredentials?: boolean; + adapter?: AxiosAdapter; + auth?: AxiosBasicCredentials; + responseType?: ResponseType; + xsrfCookieName?: string; + xsrfHeaderName?: string; + onUploadProgress?: (progressEvent: any) => void; + onDownloadProgress?: (progressEvent: any) => void; + maxContentLength?: number; + validateStatus?: (status: number) => boolean; + maxRedirects?: number; + socketPath?: string | null; + httpAgent?: any; + httpsAgent?: any; + proxy?: AxiosProxyConfig | false; + cancelToken?: CancelToken; +} + +export interface AxiosResponse { + data: T; + status: number; + statusText: string; + headers: any; + config: AxiosRequestConfig; + request?: any; +} + +export interface AxiosError extends Error { + config: AxiosRequestConfig; + code?: string; + request?: any; + response?: AxiosResponse; + isAxiosError: boolean; + toJSON: () => object; +} + +export interface AxiosPromise extends Promise> { +} + +export interface CancelStatic { + new (message?: string): Cancel; +} + +export interface Cancel { + message: string; +} + +export interface Canceler { + (message?: string): void; +} + +export interface CancelTokenStatic { + new (executor: (cancel: Canceler) => void): CancelToken; + source(): CancelTokenSource; +} + +export interface CancelToken { + promise: Promise; + reason?: Cancel; + throwIfRequested(): void; +} + +export interface CancelTokenSource { + token: CancelToken; + cancel: Canceler; +} + +export interface AxiosInterceptorManager { + use(onFulfilled?: (value: V) => V | Promise, onRejected?: (error: any) => any): number; + eject(id: number): void; +} + +export interface AxiosInstance { + (config: AxiosRequestConfig): AxiosPromise; + (url: string, config?: AxiosRequestConfig): AxiosPromise; + defaults: AxiosRequestConfig; + interceptors: { + request: AxiosInterceptorManager; + response: AxiosInterceptorManager; + }; + getUri(config?: AxiosRequestConfig): string; + request> (config: AxiosRequestConfig): Promise; + get>(url: string, config?: AxiosRequestConfig): Promise; + delete>(url: string, config?: AxiosRequestConfig): Promise; + head>(url: string, config?: AxiosRequestConfig): Promise; + options>(url: string, config?: AxiosRequestConfig): Promise; + post>(url: string, data?: any, config?: AxiosRequestConfig): Promise; + put>(url: string, data?: any, config?: AxiosRequestConfig): Promise; + patch>(url: string, data?: any, config?: AxiosRequestConfig): Promise; +} + +export interface AxiosStatic extends AxiosInstance { + create(config?: AxiosRequestConfig): AxiosInstance; + Cancel: CancelStatic; + CancelToken: CancelTokenStatic; + isCancel(value: any): boolean; + all(values: (T | Promise)[]): Promise; + spread(callback: (...args: T[]) => R): (array: T[]) => R; +} + +declare const Axios: AxiosStatic; + +export default Axios; diff --git a/node_modules/axios/index.js b/node_modules/axios/index.js new file mode 100644 index 0000000..79dfd09 --- /dev/null +++ b/node_modules/axios/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/axios'); \ No newline at end of file diff --git a/node_modules/axios/lib/adapters/README.md b/node_modules/axios/lib/adapters/README.md new file mode 100644 index 0000000..68f1118 --- /dev/null +++ b/node_modules/axios/lib/adapters/README.md @@ -0,0 +1,37 @@ +# axios // adapters + +The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received. + +## Example + +```js +var settle = require('./../core/settle'); + +module.exports = function myAdapter(config) { + // At this point: + // - config has been merged with defaults + // - request transformers have already run + // - request interceptors have already run + + // Make the request using config provided + // Upon response settle the Promise + + return new Promise(function(resolve, reject) { + + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(resolve, reject, response); + + // From here: + // - response transformers will run + // - response interceptors will run + }); +} +``` diff --git a/node_modules/axios/lib/adapters/http.js b/node_modules/axios/lib/adapters/http.js new file mode 100755 index 0000000..16dad12 --- /dev/null +++ b/node_modules/axios/lib/adapters/http.js @@ -0,0 +1,279 @@ +'use strict'; + +var utils = require('./../utils'); +var settle = require('./../core/settle'); +var buildFullPath = require('../core/buildFullPath'); +var buildURL = require('./../helpers/buildURL'); +var http = require('http'); +var https = require('https'); +var httpFollow = require('follow-redirects').http; +var httpsFollow = require('follow-redirects').https; +var url = require('url'); +var zlib = require('zlib'); +var pkg = require('./../../package.json'); +var createError = require('../core/createError'); +var enhanceError = require('../core/enhanceError'); + +var isHttps = /https:?/; + +/*eslint consistent-return:0*/ +module.exports = function httpAdapter(config) { + return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { + var resolve = function resolve(value) { + resolvePromise(value); + }; + var reject = function reject(value) { + rejectPromise(value); + }; + var data = config.data; + var headers = config.headers; + + // Set User-Agent (required by some servers) + // Only set header if it hasn't been set in config + // See https://github.com/axios/axios/issues/69 + if (!headers['User-Agent'] && !headers['user-agent']) { + headers['User-Agent'] = 'axios/' + pkg.version; + } + + if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) { + // Nothing to do... + } else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(createError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + config + )); + } + + // Add Content-Length header if data exists + headers['Content-Length'] = data.length; + } + + // HTTP basic authentication + var auth = undefined; + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password || ''; + auth = username + ':' + password; + } + + // Parse url + var fullPath = buildFullPath(config.baseURL, config.url); + var parsed = url.parse(fullPath); + var protocol = parsed.protocol || 'http:'; + + if (!auth && parsed.auth) { + var urlAuth = parsed.auth.split(':'); + var urlUsername = urlAuth[0] || ''; + var urlPassword = urlAuth[1] || ''; + auth = urlUsername + ':' + urlPassword; + } + + if (auth) { + delete headers.Authorization; + } + + var isHttpsRequest = isHttps.test(protocol); + var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + + var options = { + path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), + method: config.method.toUpperCase(), + headers: headers, + agent: agent, + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth: auth + }; + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + } + + var proxy = config.proxy; + if (!proxy && proxy !== false) { + var proxyEnv = protocol.slice(0, -1) + '_proxy'; + var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; + if (proxyUrl) { + var parsedProxyUrl = url.parse(proxyUrl); + var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; + var shouldProxy = true; + + if (noProxyEnv) { + var noProxy = noProxyEnv.split(',').map(function trim(s) { + return s.trim(); + }); + + shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { + if (!proxyElement) { + return false; + } + if (proxyElement === '*') { + return true; + } + if (proxyElement[0] === '.' && + parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { + return true; + } + + return parsed.hostname === proxyElement; + }); + } + + + if (shouldProxy) { + proxy = { + host: parsedProxyUrl.hostname, + port: parsedProxyUrl.port + }; + + if (parsedProxyUrl.auth) { + var proxyUrlAuth = parsedProxyUrl.auth.split(':'); + proxy.auth = { + username: proxyUrlAuth[0], + password: proxyUrlAuth[1] + }; + } + } + } + } + + if (proxy) { + options.hostname = proxy.host; + options.host = proxy.host; + options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); + options.port = proxy.port; + options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path; + + // Basic proxy authorization + if (proxy.auth) { + var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } + } + + var transport; + var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsProxy ? https : http; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + transport = isHttpsProxy ? httpsFollow : httpFollow; + } + + if (config.maxContentLength && config.maxContentLength > -1) { + options.maxBodyLength = config.maxContentLength; + } + + // Create the request + var req = transport.request(options, function handleResponse(res) { + if (req.aborted) return; + + // uncompress the response body transparently if required + var stream = res; + switch (res.headers['content-encoding']) { + /*eslint default-case:0*/ + case 'gzip': + case 'compress': + case 'deflate': + // add the unzipper to the body stream processing pipeline + stream = (res.statusCode === 204) ? stream : stream.pipe(zlib.createUnzip()); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + } + + // return the last request in case of redirects + var lastRequest = res.req || req; + + var response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: res.headers, + config: config, + request: lastRequest + }; + + if (config.responseType === 'stream') { + response.data = stream; + settle(resolve, reject, response); + } else { + var responseBuffer = []; + stream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { + stream.destroy(); + reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + config, null, lastRequest)); + } + }); + + stream.on('error', function handleStreamError(err) { + if (req.aborted) return; + reject(enhanceError(err, config, null, lastRequest)); + }); + + stream.on('end', function handleStreamEnd() { + var responseData = Buffer.concat(responseBuffer); + if (config.responseType !== 'arraybuffer') { + responseData = responseData.toString(config.responseEncoding); + } + + response.data = responseData; + settle(resolve, reject, response); + }); + } + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + if (req.aborted) return; + reject(enhanceError(err, config, null, req)); + }); + + // Handle request timeout + if (config.timeout) { + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devoring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(config.timeout, function handleRequestTimeout() { + req.abort(); + reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); + }); + } + + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (req.aborted) return; + + req.abort(); + reject(cancel); + }); + } + + // Send the request + if (utils.isStream(data)) { + data.on('error', function handleStreamError(err) { + reject(enhanceError(err, config, null, req)); + }).pipe(req); + } else { + req.end(data); + } + }); +}; diff --git a/node_modules/axios/lib/adapters/xhr.js b/node_modules/axios/lib/adapters/xhr.js new file mode 100644 index 0000000..377e3e9 --- /dev/null +++ b/node_modules/axios/lib/adapters/xhr.js @@ -0,0 +1,180 @@ +'use strict'; + +var utils = require('./../utils'); +var settle = require('./../core/settle'); +var buildURL = require('./../helpers/buildURL'); +var buildFullPath = require('../core/buildFullPath'); +var parseHeaders = require('./../helpers/parseHeaders'); +var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); +var createError = require('../core/createError'); + +module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + + if (utils.isFormData(requestData)) { + delete requestHeaders['Content-Type']; // Let the browser set it + } + + var request = new XMLHttpRequest(); + + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password || ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); + } + + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + + // Set the request timeout in MS + request.timeout = config.timeout; + + // Listen for ready state + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(resolve, reject, response); + + // Clean up request + request = null; + }; + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(createError('Request aborted', config, 'ECONNABORTED', request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(createError('Network Error', config, null, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', + request)); + + // Clean up request + request = null; + }; + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + var cookies = require('./../helpers/cookies'); + + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; + + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + + // Add responseType to request if needed + if (config.responseType) { + try { + request.responseType = config.responseType; + } catch (e) { + // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. + // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. + if (config.responseType !== 'json') { + throw e; + } + } + } + + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } + + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } + + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (!request) { + return; + } + + request.abort(); + reject(cancel); + // Clean up request + request = null; + }); + } + + if (requestData === undefined) { + requestData = null; + } + + // Send the request + request.send(requestData); + }); +}; diff --git a/node_modules/axios/lib/axios.js b/node_modules/axios/lib/axios.js new file mode 100644 index 0000000..8142437 --- /dev/null +++ b/node_modules/axios/lib/axios.js @@ -0,0 +1,53 @@ +'use strict'; + +var utils = require('./utils'); +var bind = require('./helpers/bind'); +var Axios = require('./core/Axios'); +var mergeConfig = require('./core/mergeConfig'); +var defaults = require('./defaults'); + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + return instance; +} + +// Create the default instance to be exported +var axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Factory for creating new instances +axios.create = function create(instanceConfig) { + return createInstance(mergeConfig(axios.defaults, instanceConfig)); +}; + +// Expose Cancel & CancelToken +axios.Cancel = require('./cancel/Cancel'); +axios.CancelToken = require('./cancel/CancelToken'); +axios.isCancel = require('./cancel/isCancel'); + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; +axios.spread = require('./helpers/spread'); + +module.exports = axios; + +// Allow use of default import syntax in TypeScript +module.exports.default = axios; diff --git a/node_modules/axios/lib/cancel/Cancel.js b/node_modules/axios/lib/cancel/Cancel.js new file mode 100644 index 0000000..e0de400 --- /dev/null +++ b/node_modules/axios/lib/cancel/Cancel.js @@ -0,0 +1,19 @@ +'use strict'; + +/** + * A `Cancel` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ +function Cancel(message) { + this.message = message; +} + +Cancel.prototype.toString = function toString() { + return 'Cancel' + (this.message ? ': ' + this.message : ''); +}; + +Cancel.prototype.__CANCEL__ = true; + +module.exports = Cancel; diff --git a/node_modules/axios/lib/cancel/CancelToken.js b/node_modules/axios/lib/cancel/CancelToken.js new file mode 100644 index 0000000..6b46e66 --- /dev/null +++ b/node_modules/axios/lib/cancel/CancelToken.js @@ -0,0 +1,57 @@ +'use strict'; + +var Cancel = require('./Cancel'); + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ +function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + var token = this; + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); +} + +/** + * Throws a `Cancel` if cancellation has been requested. + */ +CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } +}; + +/** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ +CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; +}; + +module.exports = CancelToken; diff --git a/node_modules/axios/lib/cancel/isCancel.js b/node_modules/axios/lib/cancel/isCancel.js new file mode 100644 index 0000000..051f3ae --- /dev/null +++ b/node_modules/axios/lib/cancel/isCancel.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); +}; diff --git a/node_modules/axios/lib/core/Axios.js b/node_modules/axios/lib/core/Axios.js new file mode 100644 index 0000000..fb34ace --- /dev/null +++ b/node_modules/axios/lib/core/Axios.js @@ -0,0 +1,94 @@ +'use strict'; + +var utils = require('./../utils'); +var buildURL = require('../helpers/buildURL'); +var InterceptorManager = require('./InterceptorManager'); +var dispatchRequest = require('./dispatchRequest'); +var mergeConfig = require('./mergeConfig'); + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ +function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; +} + +/** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ +Axios.prototype.request = function request(config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; + } + + config = mergeConfig(this.defaults, config); + + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } + + // Hook up interceptors middleware + var chain = [dispatchRequest, undefined]; + var promise = Promise.resolve(config); + + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + chain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + chain.push(interceptor.fulfilled, interceptor.rejected); + }); + + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } + + return promise; +}; + +Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); +}; + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(utils.merge(config || {}, { + method: method, + url: url + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, data, config) { + return this.request(utils.merge(config || {}, { + method: method, + url: url, + data: data + })); + }; +}); + +module.exports = Axios; diff --git a/node_modules/axios/lib/core/InterceptorManager.js b/node_modules/axios/lib/core/InterceptorManager.js new file mode 100644 index 0000000..50d667b --- /dev/null +++ b/node_modules/axios/lib/core/InterceptorManager.js @@ -0,0 +1,52 @@ +'use strict'; + +var utils = require('./../utils'); + +function InterceptorManager() { + this.handlers = []; +} + +/** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ +InterceptorManager.prototype.use = function use(fulfilled, rejected) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected + }); + return this.handlers.length - 1; +}; + +/** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ +InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } +}; + +/** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ +InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); +}; + +module.exports = InterceptorManager; diff --git a/node_modules/axios/lib/core/README.md b/node_modules/axios/lib/core/README.md new file mode 100644 index 0000000..253bc48 --- /dev/null +++ b/node_modules/axios/lib/core/README.md @@ -0,0 +1,7 @@ +# axios // core + +The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are: + +- Dispatching requests +- Managing interceptors +- Handling config diff --git a/node_modules/axios/lib/core/buildFullPath.js b/node_modules/axios/lib/core/buildFullPath.js new file mode 100644 index 0000000..00b2b05 --- /dev/null +++ b/node_modules/axios/lib/core/buildFullPath.js @@ -0,0 +1,20 @@ +'use strict'; + +var isAbsoluteURL = require('../helpers/isAbsoluteURL'); +var combineURLs = require('../helpers/combineURLs'); + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ +module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +}; diff --git a/node_modules/axios/lib/core/createError.js b/node_modules/axios/lib/core/createError.js new file mode 100644 index 0000000..933680f --- /dev/null +++ b/node_modules/axios/lib/core/createError.js @@ -0,0 +1,18 @@ +'use strict'; + +var enhanceError = require('./enhanceError'); + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ +module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); +}; diff --git a/node_modules/axios/lib/core/dispatchRequest.js b/node_modules/axios/lib/core/dispatchRequest.js new file mode 100644 index 0000000..c8267ad --- /dev/null +++ b/node_modules/axios/lib/core/dispatchRequest.js @@ -0,0 +1,79 @@ +'use strict'; + +var utils = require('./../utils'); +var transformData = require('./transformData'); +var isCancel = require('../cancel/isCancel'); +var defaults = require('../defaults'); + +/** + * Throws a `Cancel` if cancellation has been requested. + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ +module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); + + // Ensure headers exist + config.headers = config.headers || {}; + + // Transform request data + config.data = transformData( + config.data, + config.headers, + config.transformRequest + ); + + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); + + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); + + var adapter = config.adapter || defaults.adapter; + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData( + response.data, + response.headers, + config.transformResponse + ); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData( + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } + + return Promise.reject(reason); + }); +}; diff --git a/node_modules/axios/lib/core/enhanceError.js b/node_modules/axios/lib/core/enhanceError.js new file mode 100644 index 0000000..02fbbd6 --- /dev/null +++ b/node_modules/axios/lib/core/enhanceError.js @@ -0,0 +1,42 @@ +'use strict'; + +/** + * Update an Error with the specified config, error code, and response. + * + * @param {Error} error The error to update. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The error. + */ +module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; + } + + error.request = request; + error.response = response; + error.isAxiosError = true; + + error.toJSON = function() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code + }; + }; + return error; +}; diff --git a/node_modules/axios/lib/core/mergeConfig.js b/node_modules/axios/lib/core/mergeConfig.js new file mode 100644 index 0000000..8e1ce61 --- /dev/null +++ b/node_modules/axios/lib/core/mergeConfig.js @@ -0,0 +1,73 @@ +'use strict'; + +var utils = require('../utils'); + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ +module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + + var valueFromConfig2Keys = ['url', 'method', 'params', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy']; + var defaultToConfig2Keys = [ + 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', + 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath' + ]; + + utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { + if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } + }); + + utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) { + if (utils.isObject(config2[prop])) { + config[prop] = utils.deepMerge(config1[prop], config2[prop]); + } else if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } else if (utils.isObject(config1[prop])) { + config[prop] = utils.deepMerge(config1[prop]); + } else if (typeof config1[prop] !== 'undefined') { + config[prop] = config1[prop]; + } + }); + + utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { + if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } else if (typeof config1[prop] !== 'undefined') { + config[prop] = config1[prop]; + } + }); + + var axiosKeys = valueFromConfig2Keys + .concat(mergeDeepPropertiesKeys) + .concat(defaultToConfig2Keys); + + var otherKeys = Object + .keys(config2) + .filter(function filterAxiosKeys(key) { + return axiosKeys.indexOf(key) === -1; + }); + + utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) { + if (typeof config2[prop] !== 'undefined') { + config[prop] = config2[prop]; + } else if (typeof config1[prop] !== 'undefined') { + config[prop] = config1[prop]; + } + }); + + return config; +}; diff --git a/node_modules/axios/lib/core/settle.js b/node_modules/axios/lib/core/settle.js new file mode 100644 index 0000000..071d9e3 --- /dev/null +++ b/node_modules/axios/lib/core/settle.js @@ -0,0 +1,25 @@ +'use strict'; + +var createError = require('./createError'); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ +module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + 'Request failed with status code ' + response.status, + response.config, + null, + response.request, + response + )); + } +}; diff --git a/node_modules/axios/lib/core/transformData.js b/node_modules/axios/lib/core/transformData.js new file mode 100644 index 0000000..e065362 --- /dev/null +++ b/node_modules/axios/lib/core/transformData.js @@ -0,0 +1,20 @@ +'use strict'; + +var utils = require('./../utils'); + +/** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ +module.exports = function transformData(data, headers, fns) { + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn(data, headers); + }); + + return data; +}; diff --git a/node_modules/axios/lib/defaults.js b/node_modules/axios/lib/defaults.js new file mode 100644 index 0000000..23e1cbd --- /dev/null +++ b/node_modules/axios/lib/defaults.js @@ -0,0 +1,97 @@ +'use strict'; + +var utils = require('./utils'); +var normalizeHeaderName = require('./helpers/normalizeHeaderName'); + +var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' +}; + +function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } +} + +function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = require('./adapters/xhr'); + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = require('./adapters/http'); + } + return adapter; +} + +var defaults = { + adapter: getDefaultAdapter(), + + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + if (utils.isObject(data)) { + setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); + return JSON.stringify(data); + } + return data; + }], + + transformResponse: [function transformResponse(data) { + /*eslint no-param-reassign:0*/ + if (typeof data === 'string') { + try { + data = JSON.parse(data); + } catch (e) { /* Ignore */ } + } + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + } +}; + +defaults.headers = { + common: { + 'Accept': 'application/json, text/plain, */*' + } +}; + +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); + +module.exports = defaults; diff --git a/node_modules/axios/lib/helpers/README.md b/node_modules/axios/lib/helpers/README.md new file mode 100644 index 0000000..4ae3419 --- /dev/null +++ b/node_modules/axios/lib/helpers/README.md @@ -0,0 +1,7 @@ +# axios // helpers + +The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like: + +- Browser polyfills +- Managing cookies +- Parsing HTTP headers diff --git a/node_modules/axios/lib/helpers/bind.js b/node_modules/axios/lib/helpers/bind.js new file mode 100644 index 0000000..6147c60 --- /dev/null +++ b/node_modules/axios/lib/helpers/bind.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; +}; diff --git a/node_modules/axios/lib/helpers/buildURL.js b/node_modules/axios/lib/helpers/buildURL.js new file mode 100644 index 0000000..8c40e40 --- /dev/null +++ b/node_modules/axios/lib/helpers/buildURL.js @@ -0,0 +1,71 @@ +'use strict'; + +var utils = require('./../utils'); + +function encode(val) { + return encodeURIComponent(val). + replace(/%40/gi, '@'). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ +module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; + + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } + + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } + + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); + + serializedParams = parts.join('&'); + } + + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +}; diff --git a/node_modules/axios/lib/helpers/combineURLs.js b/node_modules/axios/lib/helpers/combineURLs.js new file mode 100644 index 0000000..f1b58a5 --- /dev/null +++ b/node_modules/axios/lib/helpers/combineURLs.js @@ -0,0 +1,14 @@ +'use strict'; + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL + */ +module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +}; diff --git a/node_modules/axios/lib/helpers/cookies.js b/node_modules/axios/lib/helpers/cookies.js new file mode 100644 index 0000000..5a8a666 --- /dev/null +++ b/node_modules/axios/lib/helpers/cookies.js @@ -0,0 +1,53 @@ +'use strict'; + +var utils = require('./../utils'); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() +); diff --git a/node_modules/axios/lib/helpers/deprecatedMethod.js b/node_modules/axios/lib/helpers/deprecatedMethod.js new file mode 100644 index 0000000..ed40965 --- /dev/null +++ b/node_modules/axios/lib/helpers/deprecatedMethod.js @@ -0,0 +1,24 @@ +'use strict'; + +/*eslint no-console:0*/ + +/** + * Supply a warning to the developer that a method they are using + * has been deprecated. + * + * @param {string} method The name of the deprecated method + * @param {string} [instead] The alternate method to use if applicable + * @param {string} [docs] The documentation URL to get further details + */ +module.exports = function deprecatedMethod(method, instead, docs) { + try { + console.warn( + 'DEPRECATED method `' + method + '`.' + + (instead ? ' Use `' + instead + '` instead.' : '') + + ' This method will be removed in a future release.'); + + if (docs) { + console.warn('For more information about usage see ' + docs); + } + } catch (e) { /* Ignore */ } +}; diff --git a/node_modules/axios/lib/helpers/isAbsoluteURL.js b/node_modules/axios/lib/helpers/isAbsoluteURL.js new file mode 100644 index 0000000..d33e992 --- /dev/null +++ b/node_modules/axios/lib/helpers/isAbsoluteURL.js @@ -0,0 +1,14 @@ +'use strict'; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); +}; diff --git a/node_modules/axios/lib/helpers/isURLSameOrigin.js b/node_modules/axios/lib/helpers/isURLSameOrigin.js new file mode 100644 index 0000000..f1d89ad --- /dev/null +++ b/node_modules/axios/lib/helpers/isURLSameOrigin.js @@ -0,0 +1,68 @@ +'use strict'; + +var utils = require('./../utils'); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() +); diff --git a/node_modules/axios/lib/helpers/normalizeHeaderName.js b/node_modules/axios/lib/helpers/normalizeHeaderName.js new file mode 100644 index 0000000..738c9fe --- /dev/null +++ b/node_modules/axios/lib/helpers/normalizeHeaderName.js @@ -0,0 +1,12 @@ +'use strict'; + +var utils = require('../utils'); + +module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); +}; diff --git a/node_modules/axios/lib/helpers/parseHeaders.js b/node_modules/axios/lib/helpers/parseHeaders.js new file mode 100644 index 0000000..8af2cc7 --- /dev/null +++ b/node_modules/axios/lib/helpers/parseHeaders.js @@ -0,0 +1,53 @@ +'use strict'; + +var utils = require('./../utils'); + +// Headers whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]; + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ +module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; + + if (!headers) { return parsed; } + + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); + + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); + + return parsed; +}; diff --git a/node_modules/axios/lib/helpers/spread.js b/node_modules/axios/lib/helpers/spread.js new file mode 100644 index 0000000..25e3cdd --- /dev/null +++ b/node_modules/axios/lib/helpers/spread.js @@ -0,0 +1,27 @@ +'use strict'; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ +module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +}; diff --git a/node_modules/axios/lib/utils.js b/node_modules/axios/lib/utils.js new file mode 100644 index 0000000..e028c67 --- /dev/null +++ b/node_modules/axios/lib/utils.js @@ -0,0 +1,344 @@ +'use strict'; + +var bind = require('./helpers/bind'); + +/*global toString:true*/ + +// utils is a library of generic helper functions non-specific to axios + +var toString = Object.prototype.toString; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ +function isArray(val) { + return toString.call(val) === '[object Array]'; +} + +/** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ +function isUndefined(val) { + return typeof val === 'undefined'; +} + +/** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +function isArrayBuffer(val) { + return toString.call(val) === '[object ArrayBuffer]'; +} + +/** + * Determine if a value is a FormData + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ +function isFormData(val) { + return (typeof FormData !== 'undefined') && (val instanceof FormData); +} + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ +function isString(val) { + return typeof val === 'string'; +} + +/** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ +function isNumber(val) { + return typeof val === 'number'; +} + +/** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ +function isObject(val) { + return val !== null && typeof val === 'object'; +} + +/** + * Determine if a value is a Date + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ +function isDate(val) { + return toString.call(val) === '[object Date]'; +} + +/** + * Determine if a value is a File + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +function isFile(val) { + return toString.call(val) === '[object File]'; +} + +/** + * Determine if a value is a Blob + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ +function isBlob(val) { + return toString.call(val) === '[object Blob]'; +} + +/** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +function isFunction(val) { + return toString.call(val) === '[object Function]'; +} + +/** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ +function isStream(val) { + return isObject(val) && isFunction(val.pipe); +} + +/** + * Determine if a value is a URLSearchParams object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +function isURLSearchParams(val) { + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; +} + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ +function trim(str) { + return str.replace(/^\s*/, '').replace(/\s*$/, ''); +} + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ +function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); +} + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ +function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } +} + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (typeof result[key] === 'object' && typeof val === 'object') { + result[key] = merge(result[key], val); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Function equal to merge with the difference being that no reference + * to original objects is kept. + * + * @see merge + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ +function deepMerge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (typeof result[key] === 'object' && typeof val === 'object') { + result[key] = deepMerge(result[key], val); + } else if (typeof val === 'object') { + result[key] = deepMerge({}, val); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ +function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; +} + +module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + deepMerge: deepMerge, + extend: extend, + trim: trim +}; diff --git a/node_modules/axios/package.json b/node_modules/axios/package.json new file mode 100644 index 0000000..1c1713b --- /dev/null +++ b/node_modules/axios/package.json @@ -0,0 +1,111 @@ +{ + "_from": "axios@0.19.2", + "_id": "axios@0.19.2", + "_inBundle": false, + "_integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "_location": "/axios", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "axios@0.19.2", + "name": "axios", + "escapedName": "axios", + "rawSpec": "0.19.2", + "saveSpec": null, + "fetchSpec": "0.19.2" + }, + "_requiredBy": [ + "/docker-hub-utils" + ], + "_resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "_shasum": "3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27", + "_spec": "axios@0.19.2", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils", + "author": { + "name": "Matt Zabriskie" + }, + "browser": { + "./lib/adapters/http.js": "./lib/adapters/xhr.js" + }, + "bugs": { + "url": "https://github.com/axios/axios/issues" + }, + "bundleDependencies": false, + "bundlesize": [ + { + "path": "./dist/axios.min.js", + "threshold": "5kB" + } + ], + "dependencies": { + "follow-redirects": "1.5.10" + }, + "deprecated": false, + "description": "Promise based HTTP client for the browser and node.js", + "devDependencies": { + "bundlesize": "^0.17.0", + "coveralls": "^3.0.0", + "es6-promise": "^4.2.4", + "grunt": "^1.0.2", + "grunt-banner": "^0.6.0", + "grunt-cli": "^1.2.0", + "grunt-contrib-clean": "^1.1.0", + "grunt-contrib-watch": "^1.0.0", + "grunt-eslint": "^20.1.0", + "grunt-karma": "^2.0.0", + "grunt-mocha-test": "^0.13.3", + "grunt-ts": "^6.0.0-beta.19", + "grunt-webpack": "^1.0.18", + "istanbul-instrumenter-loader": "^1.0.0", + "jasmine-core": "^2.4.1", + "karma": "^1.3.0", + "karma-chrome-launcher": "^2.2.0", + "karma-coverage": "^1.1.1", + "karma-firefox-launcher": "^1.1.0", + "karma-jasmine": "^1.1.1", + "karma-jasmine-ajax": "^0.1.13", + "karma-opera-launcher": "^1.0.0", + "karma-safari-launcher": "^1.0.0", + "karma-sauce-launcher": "^1.2.0", + "karma-sinon": "^1.0.5", + "karma-sourcemap-loader": "^0.3.7", + "karma-webpack": "^1.7.0", + "load-grunt-tasks": "^3.5.2", + "minimist": "^1.2.0", + "mocha": "^5.2.0", + "sinon": "^4.5.0", + "typescript": "^2.8.1", + "url-search-params": "^0.10.0", + "webpack": "^1.13.1", + "webpack-dev-server": "^1.14.1" + }, + "homepage": "https://github.com/axios/axios", + "keywords": [ + "xhr", + "http", + "ajax", + "promise", + "node" + ], + "license": "MIT", + "main": "index.js", + "name": "axios", + "repository": { + "type": "git", + "url": "git+https://github.com/axios/axios.git" + }, + "scripts": { + "build": "NODE_ENV=production grunt build", + "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", + "examples": "node ./examples/server.js", + "fix": "eslint --fix lib/**/*.js", + "postversion": "git push && git push --tags", + "preversion": "npm test", + "start": "node ./sandbox/server.js", + "test": "grunt test && bundlesize", + "version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json" + }, + "typings": "./index.d.ts", + "version": "0.19.2" +} diff --git a/node_modules/camelcase-keys/index.d.ts b/node_modules/camelcase-keys/index.d.ts new file mode 100644 index 0000000..8a196b2 --- /dev/null +++ b/node_modules/camelcase-keys/index.d.ts @@ -0,0 +1,103 @@ +declare namespace camelcaseKeys { + interface Options { + /** + Recurse nested objects and objects in arrays. + + @default false + */ + readonly deep?: boolean; + + /** + Exclude keys from being camel-cased. + + @default [] + */ + readonly exclude?: ReadonlyArray; + + /** + Exclude children at the given object paths in dot-notation from being camel-cased. For example, with an object like `{a: {b: '🦄'}}`, the object path to reach the unicorn is `'a.b'`. + + @default [] + + @example + ``` + camelcaseKeys({ + a_b: 1, + a_c: { + c_d: 1, + c_e: { + e_f: 1 + } + } + }, { + deep: true, + stopPaths: [ + 'a_c.c_e' + ] + }), + // { + // aB: 1, + // aC: { + // cD: 1, + // cE: { + // e_f: 1 + // } + // } + // } + ``` + */ + readonly stopPaths?: ReadonlyArray; + + /** + Uppercase the first character as in `bye-bye` → `ByeBye`. + + @default false + */ + readonly pascalCase?: boolean; + } +} + +/** +Convert object keys to camel case using [`camelcase`](https://github.com/sindresorhus/camelcase). + +@param input - Object or array of objects to camel-case. + +@example +``` +import camelcaseKeys = require('camelcase-keys'); + +// Convert an object +camelcaseKeys({'foo-bar': true}); +//=> {fooBar: true} + +// Convert an array of objects +camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]); +//=> [{fooBar: true}, {barFoo: false}] + +camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true}); +//=> {fooBar: true, nested: {unicornRainbow: true}} + +// Convert object keys to pascal case +camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true, pascalCase: true}); +//=> {FooBar: true, Nested: {UnicornRainbow: true}} + +import minimist = require('minimist'); + +const argv = minimist(process.argv.slice(2)); +//=> {_: [], 'foo-bar': true} + +camelcaseKeys(argv); +//=> {_: [], fooBar: true} +``` +*/ +declare function camelcaseKeys>( + input: T, + options?: camelcaseKeys.Options, +): T; + +declare function camelcaseKeys( + input: T, + options?: camelcaseKeys.Options, +): T; + +export = camelcaseKeys; diff --git a/node_modules/camelcase-keys/index.js b/node_modules/camelcase-keys/index.js new file mode 100644 index 0000000..40a6fb6 --- /dev/null +++ b/node_modules/camelcase-keys/index.js @@ -0,0 +1,73 @@ +'use strict'; +const mapObj = require('map-obj'); +const camelCase = require('camelcase'); +const QuickLru = require('quick-lru'); + +const has = (array, key) => array.some(x => { + if (typeof x === 'string') { + return x === key; + } + + x.lastIndex = 0; + return x.test(key); +}); + +const cache = new QuickLru({maxSize: 100000}); + +// Reproduces behavior from `map-obj` +const isObject = value => + typeof value === 'object' && + value !== null && + !(value instanceof RegExp) && + !(value instanceof Error) && + !(value instanceof Date); + +const camelCaseConvert = (input, options) => { + options = { + deep: false, + pascalCase: false, + ...options + }; + + const {exclude, pascalCase, stopPaths, deep} = options; + + const stopPathsSet = new Set(stopPaths); + + const makeMapper = parentPath => (key, value) => { + if (deep && isObject(value)) { + const path = parentPath === undefined ? key : `${parentPath}.${key}`; + + if (!stopPathsSet.has(path)) { + value = mapObj(value, makeMapper(path)); + } + } + + if (!(exclude && has(exclude, key))) { + const cacheKey = pascalCase ? `${key}_` : key; + + if (cache.has(cacheKey)) { + key = cache.get(cacheKey); + } else { + const ret = camelCase(key, {pascalCase}); + + if (key.length < 100) { // Prevent abuse + cache.set(cacheKey, ret); + } + + key = ret; + } + } + + return [key, value]; + }; + + return mapObj(input, makeMapper(undefined)); +}; + +module.exports = (input, options) => { + if (Array.isArray(input)) { + return Object.keys(input).map(key => camelCaseConvert(input[key], options)); + } + + return camelCaseConvert(input, options); +}; diff --git a/node_modules/camelcase-keys/license b/node_modules/camelcase-keys/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/camelcase-keys/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/camelcase-keys/package.json b/node_modules/camelcase-keys/package.json new file mode 100644 index 0000000..b5a76b5 --- /dev/null +++ b/node_modules/camelcase-keys/package.json @@ -0,0 +1,105 @@ +{ + "_from": "camelcase-keys@6.2.1", + "_id": "camelcase-keys@6.2.1", + "_inBundle": false, + "_integrity": "sha512-BPCNVH56RVIxQQIXskp5tLQXUNGQ6sXr7iCv1FHDt81xBOQ/1r6H8SPxf19InVP6DexWar4s87q9thfuk8X9HA==", + "_location": "/camelcase-keys", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "camelcase-keys@6.2.1", + "name": "camelcase-keys", + "escapedName": "camelcase-keys", + "rawSpec": "6.2.1", + "saveSpec": null, + "fetchSpec": "6.2.1" + }, + "_requiredBy": [ + "/docker-hub-utils" + ], + "_resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.1.tgz", + "_shasum": "cd3e2d2d7db767aa3f247e4c2df93b4661008945", + "_spec": "camelcase-keys@6.2.1", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/camelcase-keys/issues" + }, + "bundleDependencies": false, + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "deprecated": false, + "description": "Convert object keys to camel case", + "devDependencies": { + "ava": "^2.1.0", + "matcha": "^0.7.0", + "tsd": "^0.11.0", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/sponsors/sindresorhus", + "homepage": "https://github.com/sindresorhus/camelcase-keys#readme", + "keywords": [ + "map", + "obj", + "object", + "key", + "keys", + "value", + "values", + "val", + "iterate", + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert", + "pascalcase", + "pascal-case", + "deep", + "recurse", + "recursive" + ], + "license": "MIT", + "name": "camelcase-keys", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/camelcase-keys.git" + }, + "scripts": { + "bench": "matcha bench/bench.js", + "test": "xo && ava && tsd" + }, + "version": "6.2.1", + "xo": { + "overrides": [ + { + "files": "bench/bench.js", + "rules": { + "import/no-unresolved": "off" + } + } + ] + } +} diff --git a/node_modules/camelcase-keys/readme.md b/node_modules/camelcase-keys/readme.md new file mode 100644 index 0000000..f0ac0f1 --- /dev/null +++ b/node_modules/camelcase-keys/readme.md @@ -0,0 +1,125 @@ +# camelcase-keys [![Build Status](https://travis-ci.org/sindresorhus/camelcase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase-keys) + +> Convert object keys to camel case using [`camelcase`](https://github.com/sindresorhus/camelcase) + +## Install + +``` +$ npm install camelcase-keys +``` + +## Usage + +```js +const camelcaseKeys = require('camelcase-keys'); + +// Convert an object +camelcaseKeys({'foo-bar': true}); +//=> {fooBar: true} + +// Convert an array of objects +camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]); +//=> [{fooBar: true}, {barFoo: false}] + +camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true}); +//=> {fooBar: true, nested: {unicornRainbow: true}} + +camelcaseKeys({a_b: 1, a_c: {c_d: 1, c_e: {e_f: 1}}}, {deep: true, stopPaths: ['a_c.c_e']}), +//=> {aB: 1, aC: {cD: 1, cE: {e_f: 1}}} + +// Convert object keys to pascal case +camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true, pascalCase: true}); +//=> {FooBar: true, Nested: {UnicornRainbow: true}} +``` + +```js +const camelcaseKeys = require('camelcase-keys'); + +const argv = require('minimist')(process.argv.slice(2)); +//=> {_: [], 'foo-bar': true} + +camelcaseKeys(argv); +//=> {_: [], fooBar: true} +``` + +## API + +### camelcaseKeys(input, options?) + +#### input + +Type: `object | object[]` + +An object or array of objects to camel-case. + +#### options + +Type: `object` + +##### exclude + +Type: `Array`\ +Default: `[]` + +Exclude keys from being camel-cased. + +##### stopPaths + +Type: `string[]`\ +Default: `[]` + +Exclude children at the given object paths in dot-notation from being camel-cased. For example, with an object like `{a: {b: '🦄'}}`, the object path to reach the unicorn is `'a.b'`. + +```js +camelcaseKeys({ + a_b: 1, + a_c: { + c_d: 1, + c_e: { + e_f: 1 + } + } +}, { + deep: true, + stopPaths: [ + 'a_c.c_e' + ] +}), +/* +{ + aB: 1, + aC: { + cD: 1, + cE: { + e_f: 1 + } + } +} +*/ +``` + +##### deep + +Type: `boolean`\ +Default: `false` + +Recurse nested objects and objects in arrays. + +##### pascalCase + +Type: `boolean`\ +Default: `false` + +Uppercase the first character as in `bye-bye` → `ByeBye`. + +## camelcase-keys for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of camelcase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase-keys?utm_source=npm-camelcase-keys&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [snakecase-keys](https://github.com/bendrucker/snakecase-keys) +- [kebabcase-keys](https://github.com/mattiloh/kebabcase-keys) + diff --git a/node_modules/camelcase/index.d.ts b/node_modules/camelcase/index.d.ts new file mode 100644 index 0000000..58f2069 --- /dev/null +++ b/node_modules/camelcase/index.d.ts @@ -0,0 +1,63 @@ +declare namespace camelcase { + interface Options { + /** + Uppercase the first character: `foo-bar` → `FooBar`. + + @default false + */ + readonly pascalCase?: boolean; + } +} + +declare const camelcase: { + /** + Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. + + @param input - String to convert to camel case. + + @example + ``` + import camelCase = require('camelcase'); + + camelCase('foo-bar'); + //=> 'fooBar' + + camelCase('foo_bar'); + //=> 'fooBar' + + camelCase('Foo-Bar'); + //=> 'fooBar' + + camelCase('Foo-Bar', {pascalCase: true}); + //=> 'FooBar' + + camelCase('--foo.bar', {pascalCase: false}); + //=> 'fooBar' + + camelCase('foo bar'); + //=> 'fooBar' + + console.log(process.argv[3]); + //=> '--foo-bar' + camelCase(process.argv[3]); + //=> 'fooBar' + + camelCase(['foo', 'bar']); + //=> 'fooBar' + + camelCase(['__foo__', '--bar'], {pascalCase: true}); + //=> 'FooBar' + ``` + */ + (input: string | ReadonlyArray, options?: camelcase.Options): string; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function camelcase( + // input: string | ReadonlyArray, + // options?: camelcase.Options + // ): string; + // export = camelcase; + default: typeof camelcase; +}; + +export = camelcase; diff --git a/node_modules/camelcase/index.js b/node_modules/camelcase/index.js new file mode 100644 index 0000000..579f99b --- /dev/null +++ b/node_modules/camelcase/index.js @@ -0,0 +1,76 @@ +'use strict'; + +const preserveCamelCase = string => { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < string.length; i++) { + const character = string[i]; + + if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { + string = string.slice(0, i) + '-' + string.slice(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { + string = string.slice(0, i - 1) + '-' + string.slice(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; + } + } + + return string; +}; + +const camelCase = (input, options) => { + if (!(typeof input === 'string' || Array.isArray(input))) { + throw new TypeError('Expected the input to be `string | string[]`'); + } + + options = Object.assign({ + pascalCase: false + }, options); + + const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; + + if (Array.isArray(input)) { + input = input.map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + input = input.trim(); + } + + if (input.length === 0) { + return ''; + } + + if (input.length === 1) { + return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); + } + + const hasUpperCase = input !== input.toLowerCase(); + + if (hasUpperCase) { + input = preserveCamelCase(input); + } + + input = input + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) + .replace(/\d+(\w|$)/g, m => m.toUpperCase()); + + return postProcess(input); +}; + +module.exports = camelCase; +// TODO: Remove this for the next major release +module.exports.default = camelCase; diff --git a/node_modules/camelcase/license b/node_modules/camelcase/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/camelcase/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/camelcase/package.json b/node_modules/camelcase/package.json new file mode 100644 index 0000000..f934715 --- /dev/null +++ b/node_modules/camelcase/package.json @@ -0,0 +1,75 @@ +{ + "_from": "camelcase@^5.3.1", + "_id": "camelcase@5.3.1", + "_inBundle": false, + "_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "_location": "/camelcase", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "camelcase@^5.3.1", + "name": "camelcase", + "escapedName": "camelcase", + "rawSpec": "^5.3.1", + "saveSpec": null, + "fetchSpec": "^5.3.1" + }, + "_requiredBy": [ + "/camelcase-keys" + ], + "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "_shasum": "e3c9b31569e106811df242f715725a1f4c494320", + "_spec": "camelcase@^5.3.1", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/camelcase-keys", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/camelcase/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/camelcase#readme", + "keywords": [ + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert", + "pascalcase", + "pascal-case" + ], + "license": "MIT", + "name": "camelcase", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/camelcase.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "5.3.1" +} diff --git a/node_modules/camelcase/readme.md b/node_modules/camelcase/readme.md new file mode 100644 index 0000000..fde2726 --- /dev/null +++ b/node_modules/camelcase/readme.md @@ -0,0 +1,99 @@ +# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) + +> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` + +--- + +
+ + Get professional support for 'camelcase' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
+ +--- + +## Install + +``` +$ npm install camelcase +``` + + +## Usage + +```js +const camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('Foo-Bar', {pascalCase: true}); +//=> 'FooBar' + +camelCase('--foo.bar', {pascalCase: false}); +//=> 'fooBar' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase(['foo', 'bar']); +//=> 'fooBar' + +camelCase(['__foo__', '--bar'], {pascalCase: true}); +//=> 'FooBar' +``` + + +## API + +### camelCase(input, [options]) + +#### input + +Type: `string` `string[]` + +String to convert to camel case. + +#### options + +Type: `Object` + +##### pascalCase + +Type: `boolean`
+Default: `false` + +Uppercase the first character: `foo-bar` → `FooBar` + + +## Security + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. + + +## Related + +- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module +- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase +- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string +- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/debug/.coveralls.yml b/node_modules/debug/.coveralls.yml new file mode 100644 index 0000000..20a7068 --- /dev/null +++ b/node_modules/debug/.coveralls.yml @@ -0,0 +1 @@ +repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve diff --git a/node_modules/debug/.eslintrc b/node_modules/debug/.eslintrc new file mode 100644 index 0000000..146371e --- /dev/null +++ b/node_modules/debug/.eslintrc @@ -0,0 +1,14 @@ +{ + "env": { + "browser": true, + "node": true + }, + "globals": { + "chrome": true + }, + "rules": { + "no-console": 0, + "no-empty": [1, { "allowEmptyCatch": true }] + }, + "extends": "eslint:recommended" +} diff --git a/node_modules/debug/.npmignore b/node_modules/debug/.npmignore new file mode 100644 index 0000000..5f60eec --- /dev/null +++ b/node_modules/debug/.npmignore @@ -0,0 +1,9 @@ +support +test +examples +example +*.sock +dist +yarn.lock +coverage +bower.json diff --git a/node_modules/debug/.travis.yml b/node_modules/debug/.travis.yml new file mode 100644 index 0000000..a764300 --- /dev/null +++ b/node_modules/debug/.travis.yml @@ -0,0 +1,20 @@ +sudo: false + +language: node_js + +node_js: + - "4" + - "6" + - "8" + +install: + - make install + +script: + - make lint + - make test + +matrix: + include: + - node_js: '8' + env: BROWSER=1 diff --git a/node_modules/debug/CHANGELOG.md b/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000..820d21e --- /dev/null +++ b/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/debug/LICENSE b/node_modules/debug/LICENSE new file mode 100644 index 0000000..658c933 --- /dev/null +++ b/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/debug/Makefile b/node_modules/debug/Makefile new file mode 100644 index 0000000..3ddd136 --- /dev/null +++ b/node_modules/debug/Makefile @@ -0,0 +1,58 @@ +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# Path +PATH := node_modules/.bin:$(PATH) +SHELL := /bin/bash + +# applications +NODE ?= $(shell which node) +YARN ?= $(shell which yarn) +PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +install: node_modules + +browser: dist/debug.js + +node_modules: package.json + @NODE_ENV= $(PKG) install + @touch node_modules + +dist/debug.js: src/*.js node_modules + @mkdir -p dist + @$(BROWSERIFY) \ + --standalone debug \ + . > dist/debug.js + +lint: + @eslint *.js src/*.js + +test-node: + @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js + @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + +test-browser: + @$(MAKE) browser + @karma start --single-run + +test-all: + @concurrently \ + "make test-node" \ + "make test-browser" + +test: + @if [ "x$(BROWSER)" = "x" ]; then \ + $(MAKE) test-node; \ + else \ + $(MAKE) test-browser; \ + fi + +clean: + rimraf dist coverage + +.PHONY: browser install clean lint test test-all test-node test-browser diff --git a/node_modules/debug/README.md b/node_modules/debug/README.md new file mode 100644 index 0000000..8e754d1 --- /dev/null +++ b/node_modules/debug/README.md @@ -0,0 +1,368 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows note + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Note that PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Then, run the program to be debugged as usual. + + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/debug/karma.conf.js b/node_modules/debug/karma.conf.js new file mode 100644 index 0000000..103a82d --- /dev/null +++ b/node_modules/debug/karma.conf.js @@ -0,0 +1,70 @@ +// Karma configuration +// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['mocha', 'chai', 'sinon'], + + + // list of files / patterns to load in the browser + files: [ + 'dist/debug.js', + 'test/*spec.js' + ], + + + // list of files to exclude + exclude: [ + 'src/node.js' + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/node_modules/debug/node.js b/node_modules/debug/node.js new file mode 100644 index 0000000..7fc36fe --- /dev/null +++ b/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json new file mode 100644 index 0000000..59afeb9 --- /dev/null +++ b/node_modules/debug/package.json @@ -0,0 +1,82 @@ +{ + "_from": "debug@=3.1.0", + "_id": "debug@3.1.0", + "_inBundle": false, + "_integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "_location": "/debug", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "debug@=3.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "=3.1.0", + "saveSpec": null, + "fetchSpec": "=3.1.0" + }, + "_requiredBy": [ + "/follow-redirects" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "_shasum": "5bb5a0672628b64149566ba16819e61518c67261", + "_spec": "debug@=3.1.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/follow-redirects", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "2.0.0" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^2.11.15", + "eslint": "^3.12.1", + "istanbul": "^0.4.5", + "karma": "^1.3.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-sinon": "^1.0.5", + "mocha": "^3.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "sinon": "^1.17.6", + "sinon-chai": "^2.8.0" + }, + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "version": "3.1.0" +} diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js new file mode 100644 index 0000000..f5149ff --- /dev/null +++ b/node_modules/debug/src/browser.js @@ -0,0 +1,195 @@ +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', + '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', + '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', + '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', + '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', + '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', + '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', + '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', + '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', + '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', + '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/debug/src/debug.js b/node_modules/debug/src/debug.js new file mode 100644 index 0000000..77e6384 --- /dev/null +++ b/node_modules/debug/src/debug.js @@ -0,0 +1,225 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * Active `debug` instances. + */ +exports.instances = []; + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; +} + +function destroy () { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/debug/src/index.js b/node_modules/debug/src/index.js new file mode 100644 index 0000000..cabcbcd --- /dev/null +++ b/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer') { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js new file mode 100644 index 0000000..d666fb9 --- /dev/null +++ b/node_modules/debug/src/node.js @@ -0,0 +1,186 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [ 6, 2, 3, 4, 5, 1 ]; + +try { + var supportsColor = require('supports-color'); + if (supportsColor && supportsColor.level >= 2) { + exports.colors = [ + 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, + 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, + 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 214, 215, 220, 221 + ]; + } +} catch (err) { + // swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(process.stderr.fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); + var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } else { + return new Date().toISOString() + ' '; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/docker-hub-utils/README.md b/node_modules/docker-hub-utils/README.md new file mode 100644 index 0000000..7799a6d --- /dev/null +++ b/node_modules/docker-hub-utils/README.md @@ -0,0 +1,50 @@ +

+ + + +

+

+ docker-hub-utils +

+ +[![CircleCI][circleci-badge]][circleci-link] [![npm][npm-badge]][npm-link] +[![codecov][codecov]][codecov 2] + +### What is this? + +`docker-hub-utils` is an [NPM package][npm-link] (packaged to work both in +`node.js` as well as in the browser), providing utility functions wrapping the +[Docker Hub API][docker 2]. This was created because the native API provides +little to no support for basic operations like filtering queries, and can be +quite verbose when e.g., fetching [Manifest Lists][docker], which is required to +determine which architectures a given image supports. + +--- + +### Currently supported operations + +- Querying top repos by username / organization name. +- Filtering top user / org repositories by date last updated; this is useful + when you're only interested in repositories that have been updated in the past + `N` months / years / etc, a feature missing from the native API. +- Fetching Manifest Lists for any repository image in a single function call, + abstracting away the bearer token authentication dance. + +You can see examples of these operations in use within the +[`docker-hub-graphql-api`][github 2] project, or in this project's test cases. + +[circleci-badge]: + https://circleci.com/gh/jessestuart/docker-hub-utils.svg?style=shield +[circleci-link]: https://circleci.com/gh/jessestuart/docker-hub-utils +[codecov 2]: https://codecov.io/gh/jessestuart/docker-hub-utils +[codecov]: + https://codecov.io/gh/jessestuart/docker-hub-utils/branch/master/graph/badge.svg +[docker 2]: https://docs.docker.com/registry/spec/api/ +[docker]: https://docs.docker.com/registry/spec/manifest-v2-2/ +[github 2]: https://github.com/jessestuart/docker-hub-graphql-api +[github]: https://github.com/jessestuart/multiar.ch +[npm-badge]: https://img.shields.io/npm/v/docker-hub-utils.svg +[npm-link]: https://www.npmjs.com/package/docker-hub-utils diff --git a/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js new file mode 100644 index 0000000..5ab6d72 --- /dev/null +++ b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js @@ -0,0 +1,272 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var axios = _interopDefault(require('axios')); +var camelcaseKeys = _interopDefault(require('camelcase-keys')); +var luxon = require('luxon'); +var R = _interopDefault(require('ramda')); +var pino = _interopDefault(require('pino')); + +/** + * Union type representing the architecture defined in part of an OCI image's + * manifest list. + * + * As specified in the Docker Manifest spec, any valid GOARCH values are valid + * image architecture values, and vice versa: + * > The platform object describes the platform which the image in the manifest + * > runs on. A full list of valid operating system and architecture values are + * > listed in the Go language documentation for $GOOS and $GOARCH + * @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions + */ + +(function (Architecture) { + Architecture["i386"] = "386"; + Architecture["amd64"] = "amd64"; + Architecture["arm"] = "arm"; + Architecture["arm64"] = "arm64"; + Architecture["mips"] = "mips"; + Architecture["mips64"] = "mips64"; + Architecture["mips64le"] = "mips64le"; + Architecture["mipsle"] = "mipsle"; + Architecture["ppc64"] = "ppc64"; + Architecture["ppc64le"] = "ppc64le"; + Architecture["s390x"] = "s390x"; + Architecture["wasm"] = "wasm"; +})(exports.Architecture || (exports.Architecture = {})); +/** + * Union type representing the OS defined in part of an OCI image's + * manifest list. + * See the docs for the `Architecture` type above for more info. + */ + + +var OS; + +(function (OS) { + OS["aix"] = "aix"; + OS["android"] = "android"; + OS["darwin"] = "darwin"; + OS["dragonfly"] = "dragonfly"; + OS["freebsd"] = "freebsd"; + OS["illumos"] = "illumos"; + OS["js"] = "js"; + OS["linux"] = "linux"; + OS["netbsd"] = "netbsd"; + OS["openbsd"] = "openbsd"; + OS["plan9"] = "plan9"; + OS["solaris"] = "solaris"; + OS["windows"] = "windows"; +})(OS || (OS = {})); + +(function (ManifestMediaType) { + ManifestMediaType["Manifest"] = "application/vnd.docker.distribution.manifest.v2+json"; + ManifestMediaType["ManifestList"] = "application/vnd.docker.distribution.manifest.list.v2+json"; +})(exports.ManifestMediaType || (exports.ManifestMediaType = {})); + +var log = /*#__PURE__*/ +pino({ + base: null, + useLevelLabels: true +}); + +var DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/'; +var DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token'; + +/** + * Currently only supports fetching the manifest for the `latest` tag; in + * reality, we can pass any valid content digest[1] to retrieve the manifest(s) + * for that image. + * + * [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests + */ + +var createManifestListURL = function createManifestListURL(_ref) { + var repo = _ref.repo; + return "https://registry-1.docker.io/v2/" + repo.user + "/" + repo.name + "/manifests/latest"; +}; + +var createUserReposListURL = function createUserReposListURL(user) { + return DOCKER_HUB_API_ROOT + "repositories/" + user; +}; +/** + * The OCI distribution spec requires a unique token for each repo manifest queried. + */ + + +var fetchDockerHubToken = function fetchDockerHubToken(repo) { + try { + var name = repo.name, + user = repo.user; + return Promise.resolve(axios.get(DOCKER_HUB_API_AUTH_URL, { + params: { + scope: "repository:" + user + "/" + name + ":pull", + service: 'registry.docker.io' + } + })).then(function (tokenRequest) { + var token = R.path(['data', 'token'], tokenRequest); + + if (!token) { + throw new Error('Unable to retrieve auth token from registry.'); + } + + return token; + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Pure function that massages the Docker Hub API response into the + * format we want to return. e.g., only extracting certain fields; + * converting snake_case to camelCase, etc. + */ + +var extractRepositoryDetails = function extractRepositoryDetails(repos, lastUpdatedSince) { + if (!repos || R.isEmpty(repos)) { + return []; + } + + var parsedRepos = camelcaseKeys(repos); + + if (R.isNil(lastUpdatedSince)) { + return parsedRepos; + } + + return parsedRepos.filter(function (repo) { + return luxon.DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince; + }); +}; +/** + * Query a single repository given a repo name and username. + * + * @param user The DockerHub username or org name to query for. + * @param name The DockerHub repo name -- restrict to this single repo. + */ + +var queryRepo = function queryRepo(_ref2) { + var name = _ref2.name, + user = _ref2.user; + + try { + return Promise.resolve(axios.request({ + url: DOCKER_HUB_API_ROOT + "repositories/" + user + "/" + name + "/" + })).then(function (repoResult) { + var repo = R.prop('data', repoResult); + + if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) { + return; + } + + return camelcaseKeys(repo); + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Top-level function for querying repositories. + * + * @TODO Rename to just `queryRepos`. + * + * @param user The DockerHub username or org name to query for. + * @param numRepos The number of repos to query (max 100). + * @param lastUpdatedSince Filter by the DateTime at which a repo was last updated. + */ + +var queryTopRepos = function queryTopRepos(_ref3) { + var lastUpdatedSince = _ref3.lastUpdatedSince, + _ref3$numRepos = _ref3.numRepos, + numRepos = _ref3$numRepos === void 0 ? 100 : _ref3$numRepos, + user = _ref3.user; + + try { + if (numRepos > 100) { + throw new RangeError('Number of repos to query cannot exceed 100.'); + } + + var listReposURL = createUserReposListURL(user); + return Promise.resolve(axios.get(listReposURL, { + params: { + page: 1, + page_size: numRepos + } + })).then(function (repoResults) { + var repos = R.path(['data', 'results'], repoResults); + return extractRepositoryDetails(repos, lastUpdatedSince); + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Query image tags. + */ + +var queryTags = function queryTags(repo) { + try { + var repoUrl = createUserReposListURL(repo.user); + var tagsUrl = repoUrl + "/" + repo.name + "/tags?page_size=100"; + return Promise.resolve(axios.get(tagsUrl)).then(function (tagsResults) { + var tags = R.path(['data', 'results'], tagsResults); + + if (!tags || R.isEmpty(tags)) { + return; + } // @ts-ignore + + + return camelcaseKeys(tags); + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Queries the Docker Hub API to retrieve a "fat manifest", an object of + * `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`. + * Read up on the Manifest v2, Schema 2 Spec in more detail: + * @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md + * Or the shiny new OCI distribution spec which builds on it: + * @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md + */ + +var fetchManifestList = function fetchManifestList(repo) { + try { + // Docker Hub requires a unique token for each repo manifest queried. + return Promise.resolve(fetchDockerHubToken(repo)).then(function (token) { + var manifestListURL = createManifestListURL({ + repo: repo + }); + return Promise.resolve(axios.get(manifestListURL, { + headers: { + Accept: 'application/vnd.docker.distribution.manifest.list.v2+json', + Authorization: "Bearer " + token + } + })).then(function (manifestListResponse) { + // For now, just ignore legacy V1 schema manifests. They have an entirely + // different response shape and it's not worth mucking up the schema to + // support a legacy format. + if (manifestListResponse.data.schemaVersion === 1) { + log.info('Schema version 1 is unsupported.', repo.name); + return; + } + + return R.path(['data'], manifestListResponse); + }); + }); + } catch (e) { + return Promise.reject(e); + } +}; + +exports.DOCKER_HUB_API_AUTH_URL = DOCKER_HUB_API_AUTH_URL; +exports.DOCKER_HUB_API_ROOT = DOCKER_HUB_API_ROOT; +exports.extractRepositoryDetails = extractRepositoryDetails; +exports.fetchDockerHubToken = fetchDockerHubToken; +exports.fetchManifestList = fetchManifestList; +exports.queryRepo = queryRepo; +exports.queryTags = queryTags; +exports.queryTopRepos = queryTopRepos; +//# sourceMappingURL=docker-hub-utils.cjs.development.js.map diff --git a/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js.map b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js.map new file mode 100644 index 0000000..ef30bad --- /dev/null +++ b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.development.js.map @@ -0,0 +1 @@ +{"version":3,"file":"docker-hub-utils.cjs.development.js","sources":["../src/types/DockerHubRepo.ts","../src/utils/log.ts","../src/utils/constants.ts","../src/services/DockerHubAPI.ts"],"sourcesContent":["/**\n * This is a direct representation of what we get back from the `/repositories`\n * API call.\n */\nexport interface DockerHubAPIRepo {\n readonly can_edit: boolean\n readonly description: string\n readonly is_automated: boolean\n readonly is_migrated: boolean\n readonly is_private: boolean\n readonly last_updated: string\n readonly name: string\n readonly namespace: string\n readonly pull_count: number\n readonly repository_type: string\n readonly star_count: number\n readonly status: number\n readonly user: string\n}\n\n/**\n * Union type representing the architecture defined in part of an OCI image's\n * manifest list.\n *\n * As specified in the Docker Manifest spec, any valid GOARCH values are valid\n * image architecture values, and vice versa:\n * > The platform object describes the platform which the image in the manifest\n * > runs on. A full list of valid operating system and architecture values are\n * > listed in the Go language documentation for $GOOS and $GOARCH\n * @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions\n */\nexport enum Architecture {\n i386 = '386',\n amd64 = 'amd64',\n arm = 'arm',\n arm64 = 'arm64',\n mips = 'mips',\n mips64 = 'mips64',\n mips64le = 'mips64le',\n mipsle = 'mipsle',\n ppc64 = 'ppc64',\n ppc64le = 'ppc64le',\n s390x = 's390x',\n wasm = 'wasm',\n}\n\n/**\n * Union type representing the OS defined in part of an OCI image's\n * manifest list.\n * See the docs for the `Architecture` type above for more info.\n */\nexport enum OS {\n aix = 'aix',\n android = 'android',\n darwin = 'darwin',\n dragonfly = 'dragonfly',\n freebsd = 'freebsd',\n illumos = 'illumos',\n js = 'js',\n linux = 'linux',\n netbsd = 'netbsd',\n openbsd = 'openbsd',\n plan9 = 'plan9',\n solaris = 'solaris',\n windows = 'windows',\n}\n\nexport enum ManifestMediaType {\n Manifest = 'application/vnd.docker.distribution.manifest.v2+json',\n ManifestList = 'application/vnd.docker.distribution.manifest.list.v2+json',\n}\n\n/**\n * Yes, there's *way* more information contained in the manifest / \"fat\"\n * manifestList than just architectures, but I find this to be the most\n * relevant section for my projects. PR's welcome.\n */\nexport interface DockerManifest {\n readonly digest: string\n readonly mediaType: ManifestMediaType\n readonly platform: Array<{\n architecture: Architecture\n os: OS\n }>\n readonly schemaVersion: 1 | 2 | number\n}\n\nexport interface DockerManifestList {\n readonly manifests: DockerManifest[]\n readonly mediaType: ManifestMediaType\n readonly schemaVersion: 1 | 2 | any\n}\n\nexport interface DockerHubRepo {\n // ========================\n // Main fields of interest\n // ========================\n readonly description: string | null | undefined\n readonly lastUpdated: string\n readonly name: string\n readonly pullCount: number\n readonly starCount: number\n readonly user: string\n\n // Manifest type *may* be nested within this interface, but is usually\n // fetched and returned separately.\n readonly manifestList?: DockerManifestList\n readonly tags?: Tag[]\n\n // =============================================\n // Other stuff that comes down through the API,\n // that some may find useful\n // =============================================\n readonly canEdit?: boolean\n readonly isAutomated?: boolean\n readonly isMigrated?: boolean\n readonly isPrivate?: boolean\n readonly namespace?: string\n readonly repositoryType?: string\n readonly status?: number\n}\n\nexport interface Tag {\n creator: number\n fullSize: number\n id: number\n images: TagElement[]\n lastUpdated: string\n lastUpdater: number\n lastUpdaterUsername: string\n name: string\n repository: number\n v2: boolean\n}\n\nexport interface TagElement {\n architecture: Architecture\n digest: string\n features: string\n os: OS\n size: number\n}\n","import pino from 'pino'\n\nexport default pino({ base: null, useLevelLabels: true })\n","export const DOCKER_CLOUD_URL = 'https://cloud.docker.com/repository/docker/'\nexport const DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/'\nexport const DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token'\n","import axios from 'axios'\nimport camelcaseKeys from 'camelcase-keys'\nimport { DateTime } from 'luxon'\nimport R from 'ramda'\nimport log from '../utils/log'\n\nimport {\n DockerHubAPIRepo,\n DockerHubRepo,\n DockerManifestList,\n Tag,\n} from '../types/DockerHubRepo'\nimport {\n DOCKER_HUB_API_AUTH_URL,\n DOCKER_HUB_API_ROOT,\n} from '../utils/constants'\n\n/**\n * Currently only supports fetching the manifest for the `latest` tag; in\n * reality, we can pass any valid content digest[1] to retrieve the manifest(s)\n * for that image.\n *\n * [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests\n */\nconst createManifestListURL = ({ repo }: { repo: DockerHubRepo }): string =>\n `https://registry-1.docker.io/v2/${repo.user}/${repo.name}/manifests/latest`\n\nconst createUserReposListURL = (user: string): string =>\n `${DOCKER_HUB_API_ROOT}repositories/${user}`\n\n/**\n * The OCI distribution spec requires a unique token for each repo manifest queried.\n */\nexport const fetchDockerHubToken = async (\n repo: DockerHubRepo,\n): Promise => {\n const { name, user } = repo\n const tokenRequest = await axios.get(DOCKER_HUB_API_AUTH_URL, {\n params: {\n scope: `repository:${user}/${name}:pull`,\n service: 'registry.docker.io',\n },\n })\n\n const token: string | undefined = R.path(['data', 'token'], tokenRequest)\n if (!token) {\n throw new Error('Unable to retrieve auth token from registry.')\n }\n return token\n}\n\n/**\n * Pure function that massages the Docker Hub API response into the\n * format we want to return. e.g., only extracting certain fields;\n * converting snake_case to camelCase, etc.\n */\nexport const extractRepositoryDetails = (\n repos: DockerHubAPIRepo[],\n lastUpdatedSince?: DateTime,\n): DockerHubRepo[] => {\n if (!repos || R.isEmpty(repos)) {\n return []\n }\n\n const parsedRepos: DockerHubRepo[] = (camelcaseKeys(\n repos,\n ) as unknown) as DockerHubRepo[]\n\n if (R.isNil(lastUpdatedSince)) {\n return parsedRepos\n }\n\n return parsedRepos.filter(\n repo => DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince,\n )\n}\n\n/**\n * Query a single repository given a repo name and username.\n *\n * @param user The DockerHub username or org name to query for.\n * @param name The DockerHub repo name -- restrict to this single repo.\n */\nexport const queryRepo = async ({\n name,\n user,\n}: {\n name: string\n user: string\n}): Promise => {\n const repoResult = await axios.request({\n url: `${DOCKER_HUB_API_ROOT}repositories/${user}/${name}/`,\n })\n const repo: DockerHubRepo | undefined = R.prop('data', repoResult)\n if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {\n return\n }\n return (camelcaseKeys(repo) as unknown) as DockerHubRepo\n}\n\n/**\n * Top-level function for querying repositories.\n *\n * @TODO Rename to just `queryRepos`.\n *\n * @param user The DockerHub username or org name to query for.\n * @param numRepos The number of repos to query (max 100).\n * @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.\n */\nexport const queryTopRepos = async ({\n lastUpdatedSince,\n numRepos = 100,\n user,\n}: {\n lastUpdatedSince?: DateTime\n numRepos?: number\n user: string\n}): Promise => {\n if (numRepos > 100) {\n throw new RangeError('Number of repos to query cannot exceed 100.')\n }\n\n const listReposURL = createUserReposListURL(user)\n const repoResults = await axios.get(listReposURL, {\n params: { page: 1, page_size: numRepos },\n })\n const repos: DockerHubAPIRepo[] = R.path(\n ['data', 'results'],\n repoResults,\n ) as DockerHubAPIRepo[]\n\n return extractRepositoryDetails(repos, lastUpdatedSince)\n}\n\n/**\n * Query image tags.\n */\nexport const queryTags = async (\n repo: DockerHubRepo,\n): Promise => {\n const repoUrl = createUserReposListURL(repo.user)\n const tagsUrl = `${repoUrl}/${repo.name}/tags?page_size=100`\n const tagsResults = await axios.get(tagsUrl)\n const tags = R.path(['data', 'results'], tagsResults)\n if (!tags || R.isEmpty(tags)) {\n return\n }\n // @ts-ignore\n return camelcaseKeys(tags)\n}\n\n/**\n * Queries the Docker Hub API to retrieve a \"fat manifest\", an object of\n * `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.\n * Read up on the Manifest v2, Schema 2 Spec in more detail:\n * @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md\n * Or the shiny new OCI distribution spec which builds on it:\n * @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md\n */\nexport const fetchManifestList = async (\n repo: DockerHubRepo,\n): Promise => {\n // Docker Hub requires a unique token for each repo manifest queried.\n const token = await fetchDockerHubToken(repo)\n\n const manifestListURL = createManifestListURL({ repo })\n const manifestListResponse = await axios.get(manifestListURL, {\n headers: {\n Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',\n Authorization: `Bearer ${token}`,\n },\n })\n // For now, just ignore legacy V1 schema manifests. They have an entirely\n // different response shape and it's not worth mucking up the schema to\n // support a legacy format.\n if (manifestListResponse.data.schemaVersion === 1) {\n log.info('Schema version 1 is unsupported.', repo.name)\n return\n }\n\n return R.path(['data'], manifestListResponse)\n}\n"],"names":["Architecture","OS","ManifestMediaType","pino","base","useLevelLabels","DOCKER_HUB_API_ROOT","DOCKER_HUB_API_AUTH_URL","createManifestListURL","repo","user","name","createUserReposListURL","fetchDockerHubToken","axios","get","params","scope","service","tokenRequest","token","R","path","Error","extractRepositoryDetails","repos","lastUpdatedSince","isEmpty","parsedRepos","camelcaseKeys","isNil","filter","DateTime","fromISO","lastUpdated","queryRepo","request","url","repoResult","prop","status","queryTopRepos","numRepos","RangeError","listReposURL","page","page_size","repoResults","queryTags","repoUrl","tagsUrl","tagsResults","tags","fetchManifestList","manifestListURL","headers","Accept","Authorization","manifestListResponse","data","schemaVersion","log","info"],"mappings":";;;;;;;;;;;;AAoBA;;;;;;;;;;;;AAWA,WAAYA;AACVA,EAAAA,oBAAA,QAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,mBAAA,QAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,oBAAA,SAAA;AACAA,EAAAA,sBAAA,WAAA;AACAA,EAAAA,wBAAA,aAAA;AACAA,EAAAA,sBAAA,WAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,uBAAA,YAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,oBAAA,SAAA;AACD,CAbD,EAAYA,oBAAY,KAAZA,oBAAY,KAAA,CAAxB;AAeA;;;;;;;AAKA,IAAYC,EAAZ;;AAAA,WAAYA;AACVA,EAAAA,SAAA,QAAA;AACAA,EAAAA,aAAA,YAAA;AACAA,EAAAA,YAAA,WAAA;AACAA,EAAAA,eAAA,cAAA;AACAA,EAAAA,aAAA,YAAA;AACAA,EAAAA,aAAA,YAAA;AACAA,EAAAA,QAAA,OAAA;AACAA,EAAAA,WAAA,UAAA;AACAA,EAAAA,YAAA,WAAA;AACAA,EAAAA,aAAA,YAAA;AACAA,EAAAA,WAAA,UAAA;AACAA,EAAAA,aAAA,YAAA;AACAA,EAAAA,aAAA,YAAA;AACD,CAdD,EAAYA,EAAE,KAAFA,EAAE,KAAA,CAAd;;AAgBA,WAAYC;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AAAA,aAAa,cAAYrC;AAFlB;AADmD,OAA3B,kBAA7BsC;AAMN;AACA;AACA;AACA,YAAIA,oBAAoB,CAACC,IAArB,CAA0BC,aAA1B,KAA4C,CAAhD,EAAmD;AACjDC,UAAAA,GAAG,CAACC,IAAJ,CAAS,kCAAT,EAA6CrD,IAAI,CAACE,IAAlD;AACA;AACD;;AAED,eAAOU,CAAC,CAACC,IAAF,CAAO,CAAC,MAAD,CAAP,EAAiBoC,oBAAjB,CAAP;;;AACD,GAtB6B;AAAA;AAAA;AAAA,CAAvB;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js new file mode 100644 index 0000000..1848dee --- /dev/null +++ b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js @@ -0,0 +1,2 @@ +"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,s,i=e(require("axios")),o=e(require("camelcase-keys")),n=require("luxon"),a=e(require("ramda")),u=e(require("pino"));(r=exports.Architecture||(exports.Architecture={})).i386="386",r.amd64="amd64",r.arm="arm",r.arm64="arm64",r.mips="mips",r.mips64="mips64",r.mips64le="mips64le",r.mipsle="mipsle",r.ppc64="ppc64",r.ppc64le="ppc64le",r.s390x="s390x",r.wasm="wasm",function(e){e.aix="aix",e.android="android",e.darwin="darwin",e.dragonfly="dragonfly",e.freebsd="freebsd",e.illumos="illumos",e.js="js",e.linux="linux",e.netbsd="netbsd",e.openbsd="openbsd",e.plan9="plan9",e.solaris="solaris",e.windows="windows"}(t||(t={})),(s=exports.ManifestMediaType||(exports.ManifestMediaType={})).Manifest="application/vnd.docker.distribution.manifest.v2+json",s.ManifestList="application/vnd.docker.distribution.manifest.list.v2+json";var p=u({base:null,useLevelLabels:!0}),c=function(e){return"https://hub.docker.com/v2/repositories/"+e},d=function(e){try{return Promise.resolve(i.get("https://auth.docker.io/token",{params:{scope:"repository:"+e.user+"/"+e.name+":pull",service:"registry.docker.io"}})).then((function(e){var r=a.path(["data","token"],e);if(!r)throw new Error("Unable to retrieve auth token from registry.");return r}))}catch(e){return Promise.reject(e)}},m=function(e,r){if(!e||a.isEmpty(e))return[];var t=o(e);return a.isNil(r)?t:t.filter((function(e){return n.DateTime.fromISO(e.lastUpdated)100)throw new RangeError("Number of repos to query cannot exceed 100.");var n=c(o);return Promise.resolve(i.get(n,{params:{page:1,page_size:s}})).then((function(e){var t=a.path(["data","results"],e);return m(t,r)}))}catch(e){return Promise.reject(e)}}; +//# sourceMappingURL=docker-hub-utils.cjs.production.min.js.map diff --git a/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js.map b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js.map new file mode 100644 index 0000000..baef2fc --- /dev/null +++ b/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"docker-hub-utils.cjs.production.min.js","sources":["../src/types/DockerHubRepo.ts","../src/utils/log.ts","../src/services/DockerHubAPI.ts","../src/utils/constants.ts"],"sourcesContent":["/**\n * This is a direct representation of what we get back from the `/repositories`\n * API call.\n */\nexport interface DockerHubAPIRepo {\n readonly can_edit: boolean\n readonly description: string\n readonly is_automated: boolean\n readonly is_migrated: boolean\n readonly is_private: boolean\n readonly last_updated: string\n readonly name: string\n readonly namespace: string\n readonly pull_count: number\n readonly repository_type: string\n readonly star_count: number\n readonly status: number\n readonly user: string\n}\n\n/**\n * Union type representing the architecture defined in part of an OCI image's\n * manifest list.\n *\n * As specified in the Docker Manifest spec, any valid GOARCH values are valid\n * image architecture values, and vice versa:\n * > The platform object describes the platform which the image in the manifest\n * > runs on. A full list of valid operating system and architecture values are\n * > listed in the Go language documentation for $GOOS and $GOARCH\n * @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions\n */\nexport enum Architecture {\n i386 = '386',\n amd64 = 'amd64',\n arm = 'arm',\n arm64 = 'arm64',\n mips = 'mips',\n mips64 = 'mips64',\n mips64le = 'mips64le',\n mipsle = 'mipsle',\n ppc64 = 'ppc64',\n ppc64le = 'ppc64le',\n s390x = 's390x',\n wasm = 'wasm',\n}\n\n/**\n * Union type representing the OS defined in part of an OCI image's\n * manifest list.\n * See the docs for the `Architecture` type above for more info.\n */\nexport enum OS {\n aix = 'aix',\n android = 'android',\n darwin = 'darwin',\n dragonfly = 'dragonfly',\n freebsd = 'freebsd',\n illumos = 'illumos',\n js = 'js',\n linux = 'linux',\n netbsd = 'netbsd',\n openbsd = 'openbsd',\n plan9 = 'plan9',\n solaris = 'solaris',\n windows = 'windows',\n}\n\nexport enum ManifestMediaType {\n Manifest = 'application/vnd.docker.distribution.manifest.v2+json',\n ManifestList = 'application/vnd.docker.distribution.manifest.list.v2+json',\n}\n\n/**\n * Yes, there's *way* more information contained in the manifest / \"fat\"\n * manifestList than just architectures, but I find this to be the most\n * relevant section for my projects. PR's welcome.\n */\nexport interface DockerManifest {\n readonly digest: string\n readonly mediaType: ManifestMediaType\n readonly platform: Array<{\n architecture: Architecture\n os: OS\n }>\n readonly schemaVersion: 1 | 2 | number\n}\n\nexport interface DockerManifestList {\n readonly manifests: DockerManifest[]\n readonly mediaType: ManifestMediaType\n readonly schemaVersion: 1 | 2 | any\n}\n\nexport interface DockerHubRepo {\n // ========================\n // Main fields of interest\n // ========================\n readonly description: string | null | undefined\n readonly lastUpdated: string\n readonly name: string\n readonly pullCount: number\n readonly starCount: number\n readonly user: string\n\n // Manifest type *may* be nested within this interface, but is usually\n // fetched and returned separately.\n readonly manifestList?: DockerManifestList\n readonly tags?: Tag[]\n\n // =============================================\n // Other stuff that comes down through the API,\n // that some may find useful\n // =============================================\n readonly canEdit?: boolean\n readonly isAutomated?: boolean\n readonly isMigrated?: boolean\n readonly isPrivate?: boolean\n readonly namespace?: string\n readonly repositoryType?: string\n readonly status?: number\n}\n\nexport interface Tag {\n creator: number\n fullSize: number\n id: number\n images: TagElement[]\n lastUpdated: string\n lastUpdater: number\n lastUpdaterUsername: string\n name: string\n repository: number\n v2: boolean\n}\n\nexport interface TagElement {\n architecture: Architecture\n digest: string\n features: string\n os: OS\n size: number\n}\n","import pino from 'pino'\n\nexport default pino({ base: null, useLevelLabels: true })\n","import axios from 'axios'\nimport camelcaseKeys from 'camelcase-keys'\nimport { DateTime } from 'luxon'\nimport R from 'ramda'\nimport log from '../utils/log'\n\nimport {\n DockerHubAPIRepo,\n DockerHubRepo,\n DockerManifestList,\n Tag,\n} from '../types/DockerHubRepo'\nimport {\n DOCKER_HUB_API_AUTH_URL,\n DOCKER_HUB_API_ROOT,\n} from '../utils/constants'\n\n/**\n * Currently only supports fetching the manifest for the `latest` tag; in\n * reality, we can pass any valid content digest[1] to retrieve the manifest(s)\n * for that image.\n *\n * [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests\n */\nconst createManifestListURL = ({ repo }: { repo: DockerHubRepo }): string =>\n `https://registry-1.docker.io/v2/${repo.user}/${repo.name}/manifests/latest`\n\nconst createUserReposListURL = (user: string): string =>\n `${DOCKER_HUB_API_ROOT}repositories/${user}`\n\n/**\n * The OCI distribution spec requires a unique token for each repo manifest queried.\n */\nexport const fetchDockerHubToken = async (\n repo: DockerHubRepo,\n): Promise => {\n const { name, user } = repo\n const tokenRequest = await axios.get(DOCKER_HUB_API_AUTH_URL, {\n params: {\n scope: `repository:${user}/${name}:pull`,\n service: 'registry.docker.io',\n },\n })\n\n const token: string | undefined = R.path(['data', 'token'], tokenRequest)\n if (!token) {\n throw new Error('Unable to retrieve auth token from registry.')\n }\n return token\n}\n\n/**\n * Pure function that massages the Docker Hub API response into the\n * format we want to return. e.g., only extracting certain fields;\n * converting snake_case to camelCase, etc.\n */\nexport const extractRepositoryDetails = (\n repos: DockerHubAPIRepo[],\n lastUpdatedSince?: DateTime,\n): DockerHubRepo[] => {\n if (!repos || R.isEmpty(repos)) {\n return []\n }\n\n const parsedRepos: DockerHubRepo[] = (camelcaseKeys(\n repos,\n ) as unknown) as DockerHubRepo[]\n\n if (R.isNil(lastUpdatedSince)) {\n return parsedRepos\n }\n\n return parsedRepos.filter(\n repo => DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince,\n )\n}\n\n/**\n * Query a single repository given a repo name and username.\n *\n * @param user The DockerHub username or org name to query for.\n * @param name The DockerHub repo name -- restrict to this single repo.\n */\nexport const queryRepo = async ({\n name,\n user,\n}: {\n name: string\n user: string\n}): Promise => {\n const repoResult = await axios.request({\n url: `${DOCKER_HUB_API_ROOT}repositories/${user}/${name}/`,\n })\n const repo: DockerHubRepo | undefined = R.prop('data', repoResult)\n if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {\n return\n }\n return (camelcaseKeys(repo) as unknown) as DockerHubRepo\n}\n\n/**\n * Top-level function for querying repositories.\n *\n * @TODO Rename to just `queryRepos`.\n *\n * @param user The DockerHub username or org name to query for.\n * @param numRepos The number of repos to query (max 100).\n * @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.\n */\nexport const queryTopRepos = async ({\n lastUpdatedSince,\n numRepos = 100,\n user,\n}: {\n lastUpdatedSince?: DateTime\n numRepos?: number\n user: string\n}): Promise => {\n if (numRepos > 100) {\n throw new RangeError('Number of repos to query cannot exceed 100.')\n }\n\n const listReposURL = createUserReposListURL(user)\n const repoResults = await axios.get(listReposURL, {\n params: { page: 1, page_size: numRepos },\n })\n const repos: DockerHubAPIRepo[] = R.path(\n ['data', 'results'],\n repoResults,\n ) as DockerHubAPIRepo[]\n\n return extractRepositoryDetails(repos, lastUpdatedSince)\n}\n\n/**\n * Query image tags.\n */\nexport const queryTags = async (\n repo: DockerHubRepo,\n): Promise => {\n const repoUrl = createUserReposListURL(repo.user)\n const tagsUrl = `${repoUrl}/${repo.name}/tags?page_size=100`\n const tagsResults = await axios.get(tagsUrl)\n const tags = R.path(['data', 'results'], tagsResults)\n if (!tags || R.isEmpty(tags)) {\n return\n }\n // @ts-ignore\n return camelcaseKeys(tags)\n}\n\n/**\n * Queries the Docker Hub API to retrieve a \"fat manifest\", an object of\n * `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.\n * Read up on the Manifest v2, Schema 2 Spec in more detail:\n * @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md\n * Or the shiny new OCI distribution spec which builds on it:\n * @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md\n */\nexport const fetchManifestList = async (\n repo: DockerHubRepo,\n): Promise => {\n // Docker Hub requires a unique token for each repo manifest queried.\n const token = await fetchDockerHubToken(repo)\n\n const manifestListURL = createManifestListURL({ repo })\n const manifestListResponse = await axios.get(manifestListURL, {\n headers: {\n Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',\n Authorization: `Bearer ${token}`,\n },\n })\n // For now, just ignore legacy V1 schema manifests. They have an entirely\n // different response shape and it's not worth mucking up the schema to\n // support a legacy format.\n if (manifestListResponse.data.schemaVersion === 1) {\n log.info('Schema version 1 is unsupported.', repo.name)\n return\n }\n\n return R.path(['data'], manifestListResponse)\n}\n","export const DOCKER_CLOUD_URL = 'https://cloud.docker.com/repository/docker/'\nexport const DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/'\nexport const DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token'\n"],"names":["Architecture","OS","ManifestMediaType","pino","base","useLevelLabels","createUserReposListURL","user","DOCKER_HUB_API_ROOT","fetchDockerHubToken","repo","axios","get","params","scope","name","service","tokenRequest","token","R","path","Error","extractRepositoryDetails","repos","lastUpdatedSince","isEmpty","parsedRepos","camelcaseKeys","isNil","filter","DateTime","fromISO","lastUpdated","manifestListURL","createManifestListURL","headers","Accept","Authorization","manifestListResponse","data","schemaVersion","log","info","request","url","repoResult","prop","status","repoUrl","tagsResults","tags","numRepos","RangeError","listReposURL","page","page_size","repoResults"],"mappings":"8IA+BYA,EAoBAC,EAgB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AAtBA,EAAWE,QAAmBrC,IAAQS,EAAEM,QAAQf,UAG5CiB,EAAcjB,qEAyCtBA,WAEMsC,EAAU1C,EAAuBI,EAAKH,6BAElBI,EAAMC,IADboC,MAAWtC,EAAKK,4CAC7BkC,OACAC,EAAO/B,EAAEC,KAAK,CAAC,OAAQ,WAAY6B,MACpCC,IAAQ/B,EAAEM,QAAQyB,UAIhBvB,EAAcuB,gFAtCrB1B,IAAAA,qBACA2B,SAAAA,aAAW,MACX5C,IAAAA,YAMI4C,EAAW,UACP,IAAIC,WAAW,mDAGjBC,EAAe/C,EAAuBC,0BAClBI,EAAMC,IAAIyC,EAAc,CAChDxC,OAAQ,CAAEyC,KAAM,EAAGC,UAAWJ,qBAD1BK,OAGAjC,EAA4BJ,EAAEC,KAClC,CAAC,OAAQ,WACToC,UAGKlC,EAAyBC,EAAOC"} \ No newline at end of file diff --git a/node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js b/node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js new file mode 100644 index 0000000..a1bba74 --- /dev/null +++ b/node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js @@ -0,0 +1,262 @@ +import axios from 'axios'; +import camelcaseKeys from 'camelcase-keys'; +import { DateTime } from 'luxon'; +import R from 'ramda'; +import pino from 'pino'; + +/** + * Union type representing the architecture defined in part of an OCI image's + * manifest list. + * + * As specified in the Docker Manifest spec, any valid GOARCH values are valid + * image architecture values, and vice versa: + * > The platform object describes the platform which the image in the manifest + * > runs on. A full list of valid operating system and architecture values are + * > listed in the Go language documentation for $GOOS and $GOARCH + * @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions + */ +var Architecture; + +(function (Architecture) { + Architecture["i386"] = "386"; + Architecture["amd64"] = "amd64"; + Architecture["arm"] = "arm"; + Architecture["arm64"] = "arm64"; + Architecture["mips"] = "mips"; + Architecture["mips64"] = "mips64"; + Architecture["mips64le"] = "mips64le"; + Architecture["mipsle"] = "mipsle"; + Architecture["ppc64"] = "ppc64"; + Architecture["ppc64le"] = "ppc64le"; + Architecture["s390x"] = "s390x"; + Architecture["wasm"] = "wasm"; +})(Architecture || (Architecture = {})); +/** + * Union type representing the OS defined in part of an OCI image's + * manifest list. + * See the docs for the `Architecture` type above for more info. + */ + + +var OS; + +(function (OS) { + OS["aix"] = "aix"; + OS["android"] = "android"; + OS["darwin"] = "darwin"; + OS["dragonfly"] = "dragonfly"; + OS["freebsd"] = "freebsd"; + OS["illumos"] = "illumos"; + OS["js"] = "js"; + OS["linux"] = "linux"; + OS["netbsd"] = "netbsd"; + OS["openbsd"] = "openbsd"; + OS["plan9"] = "plan9"; + OS["solaris"] = "solaris"; + OS["windows"] = "windows"; +})(OS || (OS = {})); + +var ManifestMediaType; + +(function (ManifestMediaType) { + ManifestMediaType["Manifest"] = "application/vnd.docker.distribution.manifest.v2+json"; + ManifestMediaType["ManifestList"] = "application/vnd.docker.distribution.manifest.list.v2+json"; +})(ManifestMediaType || (ManifestMediaType = {})); + +var log = /*#__PURE__*/ +pino({ + base: null, + useLevelLabels: true +}); + +var DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/'; +var DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token'; + +/** + * Currently only supports fetching the manifest for the `latest` tag; in + * reality, we can pass any valid content digest[1] to retrieve the manifest(s) + * for that image. + * + * [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests + */ + +var createManifestListURL = function createManifestListURL(_ref) { + var repo = _ref.repo; + return "https://registry-1.docker.io/v2/" + repo.user + "/" + repo.name + "/manifests/latest"; +}; + +var createUserReposListURL = function createUserReposListURL(user) { + return DOCKER_HUB_API_ROOT + "repositories/" + user; +}; +/** + * The OCI distribution spec requires a unique token for each repo manifest queried. + */ + + +var fetchDockerHubToken = function fetchDockerHubToken(repo) { + try { + var name = repo.name, + user = repo.user; + return Promise.resolve(axios.get(DOCKER_HUB_API_AUTH_URL, { + params: { + scope: "repository:" + user + "/" + name + ":pull", + service: 'registry.docker.io' + } + })).then(function (tokenRequest) { + var token = R.path(['data', 'token'], tokenRequest); + + if (!token) { + throw new Error('Unable to retrieve auth token from registry.'); + } + + return token; + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Pure function that massages the Docker Hub API response into the + * format we want to return. e.g., only extracting certain fields; + * converting snake_case to camelCase, etc. + */ + +var extractRepositoryDetails = function extractRepositoryDetails(repos, lastUpdatedSince) { + if (!repos || R.isEmpty(repos)) { + return []; + } + + var parsedRepos = camelcaseKeys(repos); + + if (R.isNil(lastUpdatedSince)) { + return parsedRepos; + } + + return parsedRepos.filter(function (repo) { + return DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince; + }); +}; +/** + * Query a single repository given a repo name and username. + * + * @param user The DockerHub username or org name to query for. + * @param name The DockerHub repo name -- restrict to this single repo. + */ + +var queryRepo = function queryRepo(_ref2) { + var name = _ref2.name, + user = _ref2.user; + + try { + return Promise.resolve(axios.request({ + url: DOCKER_HUB_API_ROOT + "repositories/" + user + "/" + name + "/" + })).then(function (repoResult) { + var repo = R.prop('data', repoResult); + + if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) { + return; + } + + return camelcaseKeys(repo); + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Top-level function for querying repositories. + * + * @TODO Rename to just `queryRepos`. + * + * @param user The DockerHub username or org name to query for. + * @param numRepos The number of repos to query (max 100). + * @param lastUpdatedSince Filter by the DateTime at which a repo was last updated. + */ + +var queryTopRepos = function queryTopRepos(_ref3) { + var lastUpdatedSince = _ref3.lastUpdatedSince, + _ref3$numRepos = _ref3.numRepos, + numRepos = _ref3$numRepos === void 0 ? 100 : _ref3$numRepos, + user = _ref3.user; + + try { + if (numRepos > 100) { + throw new RangeError('Number of repos to query cannot exceed 100.'); + } + + var listReposURL = createUserReposListURL(user); + return Promise.resolve(axios.get(listReposURL, { + params: { + page: 1, + page_size: numRepos + } + })).then(function (repoResults) { + var repos = R.path(['data', 'results'], repoResults); + return extractRepositoryDetails(repos, lastUpdatedSince); + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Query image tags. + */ + +var queryTags = function queryTags(repo) { + try { + var repoUrl = createUserReposListURL(repo.user); + var tagsUrl = repoUrl + "/" + repo.name + "/tags?page_size=100"; + return Promise.resolve(axios.get(tagsUrl)).then(function (tagsResults) { + var tags = R.path(['data', 'results'], tagsResults); + + if (!tags || R.isEmpty(tags)) { + return; + } // @ts-ignore + + + return camelcaseKeys(tags); + }); + } catch (e) { + return Promise.reject(e); + } +}; +/** + * Queries the Docker Hub API to retrieve a "fat manifest", an object of + * `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`. + * Read up on the Manifest v2, Schema 2 Spec in more detail: + * @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md + * Or the shiny new OCI distribution spec which builds on it: + * @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md + */ + +var fetchManifestList = function fetchManifestList(repo) { + try { + // Docker Hub requires a unique token for each repo manifest queried. + return Promise.resolve(fetchDockerHubToken(repo)).then(function (token) { + var manifestListURL = createManifestListURL({ + repo: repo + }); + return Promise.resolve(axios.get(manifestListURL, { + headers: { + Accept: 'application/vnd.docker.distribution.manifest.list.v2+json', + Authorization: "Bearer " + token + } + })).then(function (manifestListResponse) { + // For now, just ignore legacy V1 schema manifests. They have an entirely + // different response shape and it's not worth mucking up the schema to + // support a legacy format. + if (manifestListResponse.data.schemaVersion === 1) { + log.info('Schema version 1 is unsupported.', repo.name); + return; + } + + return R.path(['data'], manifestListResponse); + }); + }); + } catch (e) { + return Promise.reject(e); + } +}; + +export { Architecture, DOCKER_HUB_API_AUTH_URL, DOCKER_HUB_API_ROOT, ManifestMediaType, extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos }; +//# sourceMappingURL=docker-hub-utils.esm.js.map diff --git a/node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js.map b/node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js.map new file mode 100644 index 0000000..ab5b1fd --- /dev/null +++ b/node_modules/docker-hub-utils/dist/docker-hub-utils.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"docker-hub-utils.esm.js","sources":["../src/types/DockerHubRepo.ts","../src/utils/log.ts","../src/utils/constants.ts","../src/services/DockerHubAPI.ts"],"sourcesContent":["/**\n * This is a direct representation of what we get back from the `/repositories`\n * API call.\n */\nexport interface DockerHubAPIRepo {\n readonly can_edit: boolean\n readonly description: string\n readonly is_automated: boolean\n readonly is_migrated: boolean\n readonly is_private: boolean\n readonly last_updated: string\n readonly name: string\n readonly namespace: string\n readonly pull_count: number\n readonly repository_type: string\n readonly star_count: number\n readonly status: number\n readonly user: string\n}\n\n/**\n * Union type representing the architecture defined in part of an OCI image's\n * manifest list.\n *\n * As specified in the Docker Manifest spec, any valid GOARCH values are valid\n * image architecture values, and vice versa:\n * > The platform object describes the platform which the image in the manifest\n * > runs on. A full list of valid operating system and architecture values are\n * > listed in the Go language documentation for $GOOS and $GOARCH\n * @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions\n */\nexport enum Architecture {\n i386 = '386',\n amd64 = 'amd64',\n arm = 'arm',\n arm64 = 'arm64',\n mips = 'mips',\n mips64 = 'mips64',\n mips64le = 'mips64le',\n mipsle = 'mipsle',\n ppc64 = 'ppc64',\n ppc64le = 'ppc64le',\n s390x = 's390x',\n wasm = 'wasm',\n}\n\n/**\n * Union type representing the OS defined in part of an OCI image's\n * manifest list.\n * See the docs for the `Architecture` type above for more info.\n */\nexport enum OS {\n aix = 'aix',\n android = 'android',\n darwin = 'darwin',\n dragonfly = 'dragonfly',\n freebsd = 'freebsd',\n illumos = 'illumos',\n js = 'js',\n linux = 'linux',\n netbsd = 'netbsd',\n openbsd = 'openbsd',\n plan9 = 'plan9',\n solaris = 'solaris',\n windows = 'windows',\n}\n\nexport enum ManifestMediaType {\n Manifest = 'application/vnd.docker.distribution.manifest.v2+json',\n ManifestList = 'application/vnd.docker.distribution.manifest.list.v2+json',\n}\n\n/**\n * Yes, there's *way* more information contained in the manifest / \"fat\"\n * manifestList than just architectures, but I find this to be the most\n * relevant section for my projects. PR's welcome.\n */\nexport interface DockerManifest {\n readonly digest: string\n readonly mediaType: ManifestMediaType\n readonly platform: Array<{\n architecture: Architecture\n os: OS\n }>\n readonly schemaVersion: 1 | 2 | number\n}\n\nexport interface DockerManifestList {\n readonly manifests: DockerManifest[]\n readonly mediaType: ManifestMediaType\n readonly schemaVersion: 1 | 2 | any\n}\n\nexport interface DockerHubRepo {\n // ========================\n // Main fields of interest\n // ========================\n readonly description: string | null | undefined\n readonly lastUpdated: string\n readonly name: string\n readonly pullCount: number\n readonly starCount: number\n readonly user: string\n\n // Manifest type *may* be nested within this interface, but is usually\n // fetched and returned separately.\n readonly manifestList?: DockerManifestList\n readonly tags?: Tag[]\n\n // =============================================\n // Other stuff that comes down through the API,\n // that some may find useful\n // =============================================\n readonly canEdit?: boolean\n readonly isAutomated?: boolean\n readonly isMigrated?: boolean\n readonly isPrivate?: boolean\n readonly namespace?: string\n readonly repositoryType?: string\n readonly status?: number\n}\n\nexport interface Tag {\n creator: number\n fullSize: number\n id: number\n images: TagElement[]\n lastUpdated: string\n lastUpdater: number\n lastUpdaterUsername: string\n name: string\n repository: number\n v2: boolean\n}\n\nexport interface TagElement {\n architecture: Architecture\n digest: string\n features: string\n os: OS\n size: number\n}\n","import pino from 'pino'\n\nexport default pino({ base: null, useLevelLabels: true })\n","export const DOCKER_CLOUD_URL = 'https://cloud.docker.com/repository/docker/'\nexport const DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/'\nexport const DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token'\n","import axios from 'axios'\nimport camelcaseKeys from 'camelcase-keys'\nimport { DateTime } from 'luxon'\nimport R from 'ramda'\nimport log from '../utils/log'\n\nimport {\n DockerHubAPIRepo,\n DockerHubRepo,\n DockerManifestList,\n Tag,\n} from '../types/DockerHubRepo'\nimport {\n DOCKER_HUB_API_AUTH_URL,\n DOCKER_HUB_API_ROOT,\n} from '../utils/constants'\n\n/**\n * Currently only supports fetching the manifest for the `latest` tag; in\n * reality, we can pass any valid content digest[1] to retrieve the manifest(s)\n * for that image.\n *\n * [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests\n */\nconst createManifestListURL = ({ repo }: { repo: DockerHubRepo }): string =>\n `https://registry-1.docker.io/v2/${repo.user}/${repo.name}/manifests/latest`\n\nconst createUserReposListURL = (user: string): string =>\n `${DOCKER_HUB_API_ROOT}repositories/${user}`\n\n/**\n * The OCI distribution spec requires a unique token for each repo manifest queried.\n */\nexport const fetchDockerHubToken = async (\n repo: DockerHubRepo,\n): Promise => {\n const { name, user } = repo\n const tokenRequest = await axios.get(DOCKER_HUB_API_AUTH_URL, {\n params: {\n scope: `repository:${user}/${name}:pull`,\n service: 'registry.docker.io',\n },\n })\n\n const token: string | undefined = R.path(['data', 'token'], tokenRequest)\n if (!token) {\n throw new Error('Unable to retrieve auth token from registry.')\n }\n return token\n}\n\n/**\n * Pure function that massages the Docker Hub API response into the\n * format we want to return. e.g., only extracting certain fields;\n * converting snake_case to camelCase, etc.\n */\nexport const extractRepositoryDetails = (\n repos: DockerHubAPIRepo[],\n lastUpdatedSince?: DateTime,\n): DockerHubRepo[] => {\n if (!repos || R.isEmpty(repos)) {\n return []\n }\n\n const parsedRepos: DockerHubRepo[] = (camelcaseKeys(\n repos,\n ) as unknown) as DockerHubRepo[]\n\n if (R.isNil(lastUpdatedSince)) {\n return parsedRepos\n }\n\n return parsedRepos.filter(\n repo => DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince,\n )\n}\n\n/**\n * Query a single repository given a repo name and username.\n *\n * @param user The DockerHub username or org name to query for.\n * @param name The DockerHub repo name -- restrict to this single repo.\n */\nexport const queryRepo = async ({\n name,\n user,\n}: {\n name: string\n user: string\n}): Promise => {\n const repoResult = await axios.request({\n url: `${DOCKER_HUB_API_ROOT}repositories/${user}/${name}/`,\n })\n const repo: DockerHubRepo | undefined = R.prop('data', repoResult)\n if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {\n return\n }\n return (camelcaseKeys(repo) as unknown) as DockerHubRepo\n}\n\n/**\n * Top-level function for querying repositories.\n *\n * @TODO Rename to just `queryRepos`.\n *\n * @param user The DockerHub username or org name to query for.\n * @param numRepos The number of repos to query (max 100).\n * @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.\n */\nexport const queryTopRepos = async ({\n lastUpdatedSince,\n numRepos = 100,\n user,\n}: {\n lastUpdatedSince?: DateTime\n numRepos?: number\n user: string\n}): Promise => {\n if (numRepos > 100) {\n throw new RangeError('Number of repos to query cannot exceed 100.')\n }\n\n const listReposURL = createUserReposListURL(user)\n const repoResults = await axios.get(listReposURL, {\n params: { page: 1, page_size: numRepos },\n })\n const repos: DockerHubAPIRepo[] = R.path(\n ['data', 'results'],\n repoResults,\n ) as DockerHubAPIRepo[]\n\n return extractRepositoryDetails(repos, lastUpdatedSince)\n}\n\n/**\n * Query image tags.\n */\nexport const queryTags = async (\n repo: DockerHubRepo,\n): Promise => {\n const repoUrl = createUserReposListURL(repo.user)\n const tagsUrl = `${repoUrl}/${repo.name}/tags?page_size=100`\n const tagsResults = await axios.get(tagsUrl)\n const tags = R.path(['data', 'results'], tagsResults)\n if (!tags || R.isEmpty(tags)) {\n return\n }\n // @ts-ignore\n return camelcaseKeys(tags)\n}\n\n/**\n * Queries the Docker Hub API to retrieve a \"fat manifest\", an object of\n * `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.\n * Read up on the Manifest v2, Schema 2 Spec in more detail:\n * @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md\n * Or the shiny new OCI distribution spec which builds on it:\n * @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md\n */\nexport const fetchManifestList = async (\n repo: DockerHubRepo,\n): Promise => {\n // Docker Hub requires a unique token for each repo manifest queried.\n const token = await fetchDockerHubToken(repo)\n\n const manifestListURL = createManifestListURL({ repo })\n const manifestListResponse = await axios.get(manifestListURL, {\n headers: {\n Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',\n Authorization: `Bearer ${token}`,\n },\n })\n // For now, just ignore legacy V1 schema manifests. They have an entirely\n // different response shape and it's not worth mucking up the schema to\n // support a legacy format.\n if (manifestListResponse.data.schemaVersion === 1) {\n log.info('Schema version 1 is unsupported.', repo.name)\n return\n }\n\n return R.path(['data'], manifestListResponse)\n}\n"],"names":["Architecture","OS","ManifestMediaType","pino","base","useLevelLabels","DOCKER_HUB_API_ROOT","DOCKER_HUB_API_AUTH_URL","createManifestListURL","repo","user","name","createUserReposListURL","fetchDockerHubToken","axios","get","params","scope","service","tokenRequest","token","R","path","Error","extractRepositoryDetails","repos","lastUpdatedSince","isEmpty","parsedRepos","camelcaseKeys","isNil","filter","DateTime","fromISO","lastUpdated","queryRepo","request","url","repoResult","prop","status","queryTopRepos","numRepos","RangeError","listReposURL","page","page_size","repoResults","queryTags","repoUrl","tagsUrl","tagsResults","tags","fetchManifestList","manifestListURL","headers","Accept","Authorization","manifestListResponse","data","schemaVersion","log","info"],"mappings":";;;;;;AAoBA;;;;;;;;;;;IAWYA;;AAAZ,WAAYA;AACVA,EAAAA,oBAAA,QAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,mBAAA,QAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,oBAAA,SAAA;AACAA,EAAAA,sBAAA,WAAA;AACAA,EAAAA,wBAAA,aAAA;AACAA,EAAAA,sBAAA,WAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,uBAAA,YAAA;AACAA,EAAAA,qBAAA,UAAA;AACAA,EAAAA,oBAAA,SAAA;AACD,CAbD,EAAYA,YAAY,KAAZA,YAAY,KAAA,CAAxB;AAeA;;;;;;;AAKA,IAAYC,EAAZ;;AA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;AACD;;;AAED,aAAOvB,aAAa,CAACuB,IAAD,CAApB;;AACD,GAZqB;AAAA;AAAA;AAAA,CAAf;AAcP;;;;;;;;;AAQA,IAAaC,iBAAiB,YAAjBA,iBAAiB,CAC5B5C,IAD4B;AAAA;AAG5B;2BACoBI,mBAAmB,CAACJ,IAAD,kBAAjCW;AAEN,UAAMkC,eAAe,GAAG9C,qBAAqB,CAAC;AAAEC,QAAAA,IAAI,EAAJA;AAAF,OAAD,CAA7C;6BACmCK,KAAK,CAACC,GAAN,CAAUuC,eAAV,EAA2B;AAC5DC,QAAAA,OAAO,EAAE;AACPC,UAAAA,MAAM,EAAE,2DADD;AAEPC,UAAAA,aAAa,cAAYrC;AAFlB;AADmD,OAA3B,kBAA7BsC;AAMN;AACA;AACA;AACA,YAAIA,oBAAoB,CAACC,IAArB,CAA0BC,aAA1B,KAA4C,CAAhD,EAAmD;AACjDC,UAAAA,GAAG,CAACC,IAAJ,CAAS,kCAAT,EAA6CrD,IAAI,CAACE,IAAlD;AACA;AACD;;AAED,eAAOU,CAAC,CAACC,IAAF,CAAO,CAAC,MAAD,CAAP,EAAiBoC,oBAAjB,CAAP;;;AACD,GAtB6B;AAAA;AAAA;AAAA,CAAvB;;;;"} \ No newline at end of file diff --git a/node_modules/docker-hub-utils/dist/index.d.ts b/node_modules/docker-hub-utils/dist/index.d.ts new file mode 100644 index 0000000..9c5ed26 --- /dev/null +++ b/node_modules/docker-hub-utils/dist/index.d.ts @@ -0,0 +1,6 @@ +import { Architecture, DockerHubAPIRepo, DockerHubRepo, DockerManifest, DockerManifestList, ManifestMediaType, Tag } from './types/DockerHubRepo'; +import { extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos } from './services/DockerHubAPI'; +import { DOCKER_HUB_API_AUTH_URL, DOCKER_HUB_API_ROOT } from './utils/constants'; +export { Architecture, DockerHubAPIRepo, DockerHubRepo, DockerManifest, DockerManifestList, ManifestMediaType, Tag, }; +export { extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos, }; +export { DOCKER_HUB_API_ROOT, DOCKER_HUB_API_AUTH_URL }; diff --git a/node_modules/docker-hub-utils/dist/index.js b/node_modules/docker-hub-utils/dist/index.js new file mode 100644 index 0000000..a54c906 --- /dev/null +++ b/node_modules/docker-hub-utils/dist/index.js @@ -0,0 +1,8 @@ + +'use strict' + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./docker-hub-utils.cjs.production.min.js') +} else { + module.exports = require('./docker-hub-utils.cjs.development.js') +} diff --git a/node_modules/docker-hub-utils/dist/services/DockerHubAPI.d.ts b/node_modules/docker-hub-utils/dist/services/DockerHubAPI.d.ts new file mode 100644 index 0000000..64a0cfe --- /dev/null +++ b/node_modules/docker-hub-utils/dist/services/DockerHubAPI.d.ts @@ -0,0 +1,49 @@ +import { DateTime } from 'luxon'; +import { DockerHubAPIRepo, DockerHubRepo, DockerManifestList, Tag } from '../types/DockerHubRepo'; +/** + * The OCI distribution spec requires a unique token for each repo manifest queried. + */ +export declare const fetchDockerHubToken: (repo: DockerHubRepo) => Promise; +/** + * Pure function that massages the Docker Hub API response into the + * format we want to return. e.g., only extracting certain fields; + * converting snake_case to camelCase, etc. + */ +export declare const extractRepositoryDetails: (repos: DockerHubAPIRepo[], lastUpdatedSince?: DateTime | undefined) => DockerHubRepo[]; +/** + * Query a single repository given a repo name and username. + * + * @param user The DockerHub username or org name to query for. + * @param name The DockerHub repo name -- restrict to this single repo. + */ +export declare const queryRepo: ({ name, user, }: { + name: string; + user: string; +}) => Promise; +/** + * Top-level function for querying repositories. + * + * @TODO Rename to just `queryRepos`. + * + * @param user The DockerHub username or org name to query for. + * @param numRepos The number of repos to query (max 100). + * @param lastUpdatedSince Filter by the DateTime at which a repo was last updated. + */ +export declare const queryTopRepos: ({ lastUpdatedSince, numRepos, user, }: { + lastUpdatedSince?: DateTime | undefined; + numRepos?: number | undefined; + user: string; +}) => Promise; +/** + * Query image tags. + */ +export declare const queryTags: (repo: DockerHubRepo) => Promise; +/** + * Queries the Docker Hub API to retrieve a "fat manifest", an object of + * `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`. + * Read up on the Manifest v2, Schema 2 Spec in more detail: + * @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md + * Or the shiny new OCI distribution spec which builds on it: + * @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md + */ +export declare const fetchManifestList: (repo: DockerHubRepo) => Promise; diff --git a/node_modules/docker-hub-utils/dist/types/DockerHubRepo.d.ts b/node_modules/docker-hub-utils/dist/types/DockerHubRepo.d.ts new file mode 100644 index 0000000..ea3f39b --- /dev/null +++ b/node_modules/docker-hub-utils/dist/types/DockerHubRepo.d.ts @@ -0,0 +1,123 @@ +/** + * This is a direct representation of what we get back from the `/repositories` + * API call. + */ +export interface DockerHubAPIRepo { + readonly can_edit: boolean; + readonly description: string; + readonly is_automated: boolean; + readonly is_migrated: boolean; + readonly is_private: boolean; + readonly last_updated: string; + readonly name: string; + readonly namespace: string; + readonly pull_count: number; + readonly repository_type: string; + readonly star_count: number; + readonly status: number; + readonly user: string; +} +/** + * Union type representing the architecture defined in part of an OCI image's + * manifest list. + * + * As specified in the Docker Manifest spec, any valid GOARCH values are valid + * image architecture values, and vice versa: + * > The platform object describes the platform which the image in the manifest + * > runs on. A full list of valid operating system and architecture values are + * > listed in the Go language documentation for $GOOS and $GOARCH + * @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions + */ +export declare enum Architecture { + i386 = "386", + amd64 = "amd64", + arm = "arm", + arm64 = "arm64", + mips = "mips", + mips64 = "mips64", + mips64le = "mips64le", + mipsle = "mipsle", + ppc64 = "ppc64", + ppc64le = "ppc64le", + s390x = "s390x", + wasm = "wasm" +} +/** + * Union type representing the OS defined in part of an OCI image's + * manifest list. + * See the docs for the `Architecture` type above for more info. + */ +export declare enum OS { + aix = "aix", + android = "android", + darwin = "darwin", + dragonfly = "dragonfly", + freebsd = "freebsd", + illumos = "illumos", + js = "js", + linux = "linux", + netbsd = "netbsd", + openbsd = "openbsd", + plan9 = "plan9", + solaris = "solaris", + windows = "windows" +} +export declare enum ManifestMediaType { + Manifest = "application/vnd.docker.distribution.manifest.v2+json", + ManifestList = "application/vnd.docker.distribution.manifest.list.v2+json" +} +/** + * Yes, there's *way* more information contained in the manifest / "fat" + * manifestList than just architectures, but I find this to be the most + * relevant section for my projects. PR's welcome. + */ +export interface DockerManifest { + readonly digest: string; + readonly mediaType: ManifestMediaType; + readonly platform: Array<{ + architecture: Architecture; + os: OS; + }>; + readonly schemaVersion: 1 | 2 | number; +} +export interface DockerManifestList { + readonly manifests: DockerManifest[]; + readonly mediaType: ManifestMediaType; + readonly schemaVersion: 1 | 2 | any; +} +export interface DockerHubRepo { + readonly description: string | null | undefined; + readonly lastUpdated: string; + readonly name: string; + readonly pullCount: number; + readonly starCount: number; + readonly user: string; + readonly manifestList?: DockerManifestList; + readonly tags?: Tag[]; + readonly canEdit?: boolean; + readonly isAutomated?: boolean; + readonly isMigrated?: boolean; + readonly isPrivate?: boolean; + readonly namespace?: string; + readonly repositoryType?: string; + readonly status?: number; +} +export interface Tag { + creator: number; + fullSize: number; + id: number; + images: TagElement[]; + lastUpdated: string; + lastUpdater: number; + lastUpdaterUsername: string; + name: string; + repository: number; + v2: boolean; +} +export interface TagElement { + architecture: Architecture; + digest: string; + features: string; + os: OS; + size: number; +} diff --git a/node_modules/docker-hub-utils/dist/utils/constants.d.ts b/node_modules/docker-hub-utils/dist/utils/constants.d.ts new file mode 100644 index 0000000..2af7a97 --- /dev/null +++ b/node_modules/docker-hub-utils/dist/utils/constants.d.ts @@ -0,0 +1,3 @@ +export declare const DOCKER_CLOUD_URL = "https://cloud.docker.com/repository/docker/"; +export declare const DOCKER_HUB_API_ROOT = "https://hub.docker.com/v2/"; +export declare const DOCKER_HUB_API_AUTH_URL = "https://auth.docker.io/token"; diff --git a/node_modules/docker-hub-utils/dist/utils/log.d.ts b/node_modules/docker-hub-utils/dist/utils/log.d.ts new file mode 100644 index 0000000..05398da --- /dev/null +++ b/node_modules/docker-hub-utils/dist/utils/log.d.ts @@ -0,0 +1,3 @@ +import pino from 'pino'; +declare const _default: pino.Logger; +export default _default; diff --git a/node_modules/docker-hub-utils/package.json b/node_modules/docker-hub-utils/package.json new file mode 100644 index 0000000..9da7fa3 --- /dev/null +++ b/node_modules/docker-hub-utils/package.json @@ -0,0 +1,114 @@ +{ + "_from": "docker-hub-utils", + "_id": "docker-hub-utils@1.10.29", + "_inBundle": false, + "_integrity": "sha512-wZ3BmcG3mq90rlXGfGcgqwgyTyO0kWQA5D+3J7T+nLgE1mzjggK1ZDB44krt5dj5lK/nXla3vGIw7nF7IE2kQQ==", + "_location": "/docker-hub-utils", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "docker-hub-utils", + "name": "docker-hub-utils", + "escapedName": "docker-hub-utils", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/docker-hub-utils/-/docker-hub-utils-1.10.29.tgz", + "_shasum": "8e1f910e704c9a7706dba8fb2b3078d7fbbe7a6e", + "_spec": "docker-hub-utils", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package", + "author": { + "name": "Jesse Stuart", + "email": "hi@jessestuart.com" + }, + "bugs": { + "url": "https://github.com/jessestuart/docker-hub-utils/issues" + }, + "bundleDependencies": false, + "dependencies": { + "axios": "0.19.2", + "camelcase-keys": "6.2.1", + "luxon": "1.22.2", + "pino": "5.17.0", + "ramda": "0.27.0" + }, + "deprecated": false, + "description": "Typescript / Node utilities for interacting with the Docker Hub API.", + "devDependencies": { + "@semantic-release/git": "9.0.0", + "@types/jest": "25.1.4", + "@types/luxon": "1.22.0", + "@types/node": "13.9.4", + "@types/pino": "5.17.0", + "@types/ramda": "0.27.0", + "@typescript-eslint/eslint-plugin": "2.25.0", + "@typescript-eslint/parser": "2.25.0", + "codecov": "3.6.5", + "concurrently": "5.1.0", + "eslint": "6.8.0", + "eslint-config-prettier": "6.10.1", + "eslint-plugin-import": "2.20.1", + "eslint-plugin-prettier": "3.1.2", + "husky": "4.2.3", + "jest": "25.1.0", + "jest-junit": "10.0.0", + "nodemon": "2.0.2", + "prettier": "1.19.1", + "pretty-quick": "2.0.1", + "semantic-release": "17.0.4", + "source-map-support": "0.5.16", + "ts-jest": "25.2.1", + "tsdx": "0.13.0", + "tslib": "1.11.1", + "tslint": "6.1.0", + "tslint-config-prettier": "1.18.0", + "typedoc": "0.17.3", + "typescript": "3.8.3" + }, + "files": [ + "dist" + ], + "homepage": "https://github.com/jessestuart/docker-hub-utils", + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } + }, + "keywords": [ + "api", + "docker", + "docker-hub", + "typescript", + "utils", + "wrapper-api" + ], + "license": "MIT", + "main": "dist/index.js", + "module": "dist/docker-hub-utils.esm.js", + "name": "docker-hub-utils", + "peerDependencies": {}, + "repository": { + "type": "git", + "url": "git+https://github.com/jessestuart/docker-hub-utils.git" + }, + "scripts": { + "build": "tsdx build", + "ci": "JEST_JUNIT_OUTPUT=reports/junit/js-test-results.xml jest --ci --runInBand --coverage --reporters=default --reporters=jest-junit", + "docs": "typedoc --mode modules --out public", + "lint": "eslint --quiet src/ --ext ts,tsx", + "prepublishOnly": "yarn build", + "push": "yarn build && yalc push", + "rebuild": "rm -rf dist/* && yarn build", + "release": "yarn rebuild && semantic-release", + "start": "tsdx watch", + "test": "yarn jest --cache --coverage" + }, + "typings": "dist/index.d.ts", + "version": "1.10.29" +} diff --git a/node_modules/fast-redact/.travis.yml b/node_modules/fast-redact/.travis.yml new file mode 100644 index 0000000..f8c1e83 --- /dev/null +++ b/node_modules/fast-redact/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +sudo: false +node_js: + - 6 + - 8 + - 10 + - 11 +script: + - npm run ci diff --git a/node_modules/fast-redact/LICENSE b/node_modules/fast-redact/LICENSE new file mode 100644 index 0000000..e1c643e --- /dev/null +++ b/node_modules/fast-redact/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019-2020 David Mark Clements + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/fast-redact/benchmark/index.js b/node_modules/fast-redact/benchmark/index.js new file mode 100644 index 0000000..53fe3be --- /dev/null +++ b/node_modules/fast-redact/benchmark/index.js @@ -0,0 +1,148 @@ +'use strict' +const bench = require('fastbench') +const noir = require('pino-noir')(['a.b.c']) +const fastRedact = require('..') +const redactNoSerialize = fastRedact({ paths: ['a.b.c'], serialize: false }) +const redactWildNoSerialize = fastRedact({ paths: ['a.b.*'], serialize: false }) +const redactIntermediateWildNoSerialize = fastRedact({ paths: ['a.*.c'], serialize: false }) +const redact = fastRedact({ paths: ['a.b.c'] }) +const noirWild = require('pino-noir')(['a.b.*']) +const redactWild = fastRedact({ paths: ['a.b.*'] }) +const redactIntermediateWild = fastRedact({ paths: ['a.*.c'] }) +const redactIntermediateWildMatchWildOutcome = fastRedact({ paths: ['a.*.c', 'a.*.b', 'a.*.a'] }) +const redactStaticMatchWildOutcome = fastRedact({ paths: ['a.b.c', 'a.d.a', 'a.d.b', 'a.d.c'] }) +const noirCensorFunction = require('pino-noir')(['a.b.*'], (v) => v + '.') +const redactCensorFunction = fastRedact({ paths: ['a.b.*'], censor: (v) => v + '.', serialize: false }) + +const obj = { + a: { + b: { + c: 's' + }, + d: { + a: 's', + b: 's', + c: 's' + } + } +} + +const max = 500 + +var run = bench([ + function benchNoirV2 (cb) { + for (var i = 0; i < max; i++) { + noir.a(obj.a) + } + setImmediate(cb) + }, + function benchFastRedact (cb) { + for (var i = 0; i < max; i++) { + redactNoSerialize(obj) + } + setImmediate(cb) + }, + function benchFastRedactRestore (cb) { + for (var i = 0; i < max; i++) { + redactNoSerialize(obj) + redactNoSerialize.restore(obj) + } + setImmediate(cb) + }, + function benchNoirV2Wild (cb) { + for (var i = 0; i < max; i++) { + noirWild.a(obj.a) + } + setImmediate(cb) + }, + function benchFastRedactWild (cb) { + for (var i = 0; i < max; i++) { + redactWildNoSerialize(obj) + } + setImmediate(cb) + }, + function benchFastRedactWildRestore (cb) { + for (var i = 0; i < max; i++) { + redactWildNoSerialize(obj) + redactWildNoSerialize.restore(obj) + } + setImmediate(cb) + }, + function benchFastRedactIntermediateWild (cb) { + for (var i = 0; i < max; i++) { + redactIntermediateWildNoSerialize(obj) + } + setImmediate(cb) + }, + function benchFastRedactIntermediateWildRestore (cb) { + for (var i = 0; i < max; i++) { + redactIntermediateWildNoSerialize(obj) + redactIntermediateWildNoSerialize.restore(obj) + } + setImmediate(cb) + }, + function benchJSONStringify (cb) { + for (var i = 0; i < max; i++) { + JSON.stringify(obj) + } + setImmediate(cb) + }, + function benchNoirV2Serialize (cb) { + for (var i = 0; i < max; i++) { + noir.a(obj.a) + JSON.stringify(obj) + } + setImmediate(cb) + }, + function benchFastRedactSerialize (cb) { + for (var i = 0; i < max; i++) { + redact(obj) + } + setImmediate(cb) + }, + function benchNoirV2WildSerialize (cb) { + for (var i = 0; i < max; i++) { + noirWild.a(obj.a) + JSON.stringify(obj) + } + setImmediate(cb) + }, + function benchFastRedactWildSerialize (cb) { + for (var i = 0; i < max; i++) { + redactWild(obj) + } + setImmediate(cb) + }, + function benchFastRedactIntermediateWildSerialize (cb) { + for (var i = 0; i < max; i++) { + redactIntermediateWild(obj) + } + setImmediate(cb) + }, + function benchFastRedactIntermediateWildMatchWildOutcomeSerialize (cb) { + for (var i = 0; i < max; i++) { + redactIntermediateWildMatchWildOutcome(obj) + } + setImmediate(cb) + }, + function benchFastRedactStaticMatchWildOutcomeSerialize (cb) { + for (var i = 0; i < max; i++) { + redactStaticMatchWildOutcome(obj) + } + setImmediate(cb) + }, + function benchNoirV2CensorFunction (cb) { + for (var i = 0; i < max; i++) { + noirCensorFunction.a(obj.a) + } + setImmediate(cb) + }, + function benchFastRedactCensorFunction (cb) { + for (var i = 0; i < max; i++) { + redactCensorFunction(obj) + } + setImmediate(cb) + } +], 500) + +run(run) diff --git a/node_modules/fast-redact/example/default-usage.js b/node_modules/fast-redact/example/default-usage.js new file mode 100644 index 0000000..d74cfaf --- /dev/null +++ b/node_modules/fast-redact/example/default-usage.js @@ -0,0 +1,14 @@ +'use strict' +const fastRedact = require('..') +const fauxRequest = { + headers: { + host: 'http://example.com', + cookie: `oh oh we don't want this exposed in logs in etc.`, + referer: `if we're cool maybe we'll even redact this` + } +} +const redact = fastRedact({ + paths: ['headers.cookie', 'headers.referer'] +}) + +console.log(redact(fauxRequest)) diff --git a/node_modules/fast-redact/example/intermediate-wildcard-array.js b/node_modules/fast-redact/example/intermediate-wildcard-array.js new file mode 100644 index 0000000..2b4e1f8 --- /dev/null +++ b/node_modules/fast-redact/example/intermediate-wildcard-array.js @@ -0,0 +1,11 @@ +'use strict' +const fastRedact = require('..') +const redact = fastRedact({ paths: ['a[*].c.d'] }) +const obj = { + a: [ + { c: { d: 'hide me', e: 'leave me be' } }, + { c: { d: 'and me', f: 'I want to live' } }, + { c: { d: 'and also I', g: 'I want to run in a stream' } } + ] +} +console.log(redact(obj)) diff --git a/node_modules/fast-redact/example/serialize-false.js b/node_modules/fast-redact/example/serialize-false.js new file mode 100644 index 0000000..80d0a9a --- /dev/null +++ b/node_modules/fast-redact/example/serialize-false.js @@ -0,0 +1,11 @@ +'use strict' +const fastRedact = require('..') +const redact = fastRedact({ + paths: ['a'], + serialize: false +}) +const o = { a: 1, b: 2 } +console.log(redact(o) === o) +console.log(o) +console.log(redact.restore(o) === o) +console.log(o) diff --git a/node_modules/fast-redact/example/serialize-function.js b/node_modules/fast-redact/example/serialize-function.js new file mode 100644 index 0000000..2fc9fbd --- /dev/null +++ b/node_modules/fast-redact/example/serialize-function.js @@ -0,0 +1,4 @@ +'use strict' +const fastRedact = require('..') +const redact = fastRedact({ paths: ['a'], serialize: (o) => JSON.stringify(o, 0, 2) }) +console.log(redact({ a: 1, b: 2 })) diff --git a/node_modules/fast-redact/example/top-wildcard-object.js b/node_modules/fast-redact/example/top-wildcard-object.js new file mode 100644 index 0000000..2c91895 --- /dev/null +++ b/node_modules/fast-redact/example/top-wildcard-object.js @@ -0,0 +1,9 @@ +'use strict' +const fastRedact = require('..') +const redact = fastRedact({ paths: ['*.c.d'] }) +const obj = { + x: { c: { d: 'hide me', e: 'leave me be' } }, + y: { c: { d: 'and me', f: 'I want to live' } }, + z: { c: { d: 'and also I', g: 'I want to run in a stream' } } +} +console.log(redact(obj)) diff --git a/node_modules/fast-redact/index.js b/node_modules/fast-redact/index.js new file mode 100644 index 0000000..692a14a --- /dev/null +++ b/node_modules/fast-redact/index.js @@ -0,0 +1,55 @@ +'use strict' + +const validator = require('./lib/validator') +const parse = require('./lib/parse') +const redactor = require('./lib/redactor') +const restorer = require('./lib/restorer') +const { groupRedact, nestedRedact } = require('./lib/modifiers') +const state = require('./lib/state') +const rx = require('./lib/rx') +const validate = validator() +const noop = (o) => o +noop.restore = noop + +const DEFAULT_CENSOR = '[REDACTED]' +fastRedact.rx = rx +fastRedact.validator = validator + +module.exports = fastRedact + +function fastRedact (opts = {}) { + const paths = Array.from(new Set(opts.paths || [])) + const serialize = 'serialize' in opts ? ( + opts.serialize === false ? opts.serialize + : (typeof opts.serialize === 'function' ? opts.serialize : JSON.stringify) + ) : JSON.stringify + const remove = opts.remove + if (remove === true && serialize !== JSON.stringify) { + throw Error('fast-redact – remove option may only be set when serializer is JSON.stringify') + } + const censor = remove === true + ? undefined + : 'censor' in opts ? opts.censor : DEFAULT_CENSOR + + const isCensorFct = typeof censor === 'function' + + if (paths.length === 0) return serialize || noop + + validate({ paths, serialize, censor }) + + const { wildcards, wcLen, secret } = parse({ paths, censor }) + + const compileRestore = restorer({ secret, wcLen }) + const strict = 'strict' in opts ? opts.strict : true + + return redactor({ secret, wcLen, serialize, strict, isCensorFct }, state({ + secret, + censor, + compileRestore, + serialize, + groupRedact, + nestedRedact, + wildcards, + wcLen + })) +} diff --git a/node_modules/fast-redact/lib/modifiers.js b/node_modules/fast-redact/lib/modifiers.js new file mode 100644 index 0000000..e9c5aaa --- /dev/null +++ b/node_modules/fast-redact/lib/modifiers.js @@ -0,0 +1,96 @@ +'use strict' + +module.exports = { + groupRedact, + groupRestore, + nestedRedact, + nestedRestore +} + +function groupRestore ({ keys, values, target }) { + if (target == null) return + const length = keys.length + for (var i = 0; i < length; i++) { + const k = keys[i] + target[k] = values[i] + } +} + +function groupRedact (o, path, censor, isCensorFct) { + const target = get(o, path) + if (target == null) return { keys: null, values: null, target: null, flat: true } + const keys = Object.keys(target) + const length = keys.length + const values = new Array(length) + for (var i = 0; i < length; i++) { + const k = keys[i] + values[i] = target[k] + target[k] = isCensorFct ? censor(target[k]) : censor + } + return { keys, values, target, flat: true } +} + +function nestedRestore (arr) { + const length = arr.length + for (var i = 0; i < length; i++) { + const { key, target, value } = arr[i] + target[key] = value + } +} + +function nestedRedact (store, o, path, ns, censor, isCensorFct) { + const target = get(o, path) + if (target == null) return + const keys = Object.keys(target) + const length = keys.length + for (var i = 0; i < length; i++) { + const key = keys[i] + const { value, parent, exists } = specialSet(target, key, ns, censor, isCensorFct) + + if (exists === true && parent !== null) { + store.push({ key: ns[ns.length - 1], target: parent, value }) + } + } + return store +} + +function has (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop) +} + +function specialSet (o, k, p, v, f) { + var i = -1 + var l = p.length + var li = l - 1 + var n + var nv + var ov + var oov = null + var exists = true + ov = n = o[k] + if (typeof n !== 'object') return { value: null, parent: null, exists } + while (n != null && ++i < l) { + k = p[i] + oov = ov + if (!(k in n)) { + exists = false + break + } + ov = n[k] + nv = f ? v(ov) : v + nv = (i !== li) ? ov : nv + n[k] = (has(n, k) && nv === ov) || (nv === undefined && v !== undefined) ? n[k] : nv + n = n[k] + if (typeof n !== 'object') break + } + return { value: ov, parent: oov, exists } +} +function get (o, p) { + var i = -1 + var l = p.length + var n = o + while (n != null && ++i < l) { + n = n[p[i]] + } + return n +} diff --git a/node_modules/fast-redact/lib/parse.js b/node_modules/fast-redact/lib/parse.js new file mode 100644 index 0000000..ccbd980 --- /dev/null +++ b/node_modules/fast-redact/lib/parse.js @@ -0,0 +1,45 @@ +'use strict' + +const rx = require('./rx') + +module.exports = parse + +function parse ({ paths }) { + const wildcards = [] + var wcLen = 0 + const secret = paths.reduce(function (o, strPath, ix) { + var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, '')) + const leadingBracket = strPath[0] === '[' + path = path.map((p) => { + if (p[0] === '[') return p.substr(1, p.length - 2) + else return p + }) + const star = path.indexOf('*') + if (star > -1) { + const before = path.slice(0, star) + const beforeStr = before.join('.') + const after = path.slice(star + 1, path.length) + if (after.indexOf('*') > -1) throw Error('fast-redact – Only one wildcard per path is supported') + const nested = after.length > 0 + wcLen++ + wildcards.push({ + before, + beforeStr, + after, + nested + }) + } else { + o[strPath] = { + path: path, + val: undefined, + precensored: false, + circle: '', + escPath: JSON.stringify(strPath), + leadingBracket: leadingBracket + } + } + return o + }, {}) + + return { wildcards, wcLen, secret } +} diff --git a/node_modules/fast-redact/lib/redactor.js b/node_modules/fast-redact/lib/redactor.js new file mode 100644 index 0000000..3d7c7bb --- /dev/null +++ b/node_modules/fast-redact/lib/redactor.js @@ -0,0 +1,94 @@ +'use strict' + +const rx = require('./rx') + +module.exports = redactor + +function redactor ({ secret, serialize, wcLen, strict, isCensorFct }, state) { + /* eslint-disable-next-line */ + const redact = Function('o', ` + if (typeof o !== 'object' || o == null) { + ${strictImpl(strict, serialize)} + } + const { censor, secret } = this + ${redactTmpl(secret, isCensorFct)} + this.compileRestore() + ${dynamicRedactTmpl(wcLen > 0, isCensorFct)} + ${resultTmpl(serialize)} + `).bind(state) + + if (serialize === false) { + redact.restore = (o) => state.restore(o) + } + + return redact +} + +function redactTmpl (secret, isCensorFct) { + return Object.keys(secret).map((path) => { + const { escPath, leadingBracket } = secret[path] + const skip = leadingBracket ? 1 : 0 + const delim = leadingBracket ? '' : '.' + const hops = [] + var match + while ((match = rx.exec(path)) !== null) { + const [ , ix ] = match + const { index, input } = match + if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1))) + } + var existence = hops.map((p) => `o${delim}${p}`).join(' && ') + if (existence.length === 0) existence += `o${delim}${path} != null` + else existence += ` && o${delim}${path} != null` + + const circularDetection = ` + switch (true) { + ${hops.reverse().map((p) => ` + case o${delim}${p} === censor: + secret[${escPath}].circle = ${JSON.stringify(p)} + break + `).join('\n')} + } + ` + return ` + if (${existence}) { + const val = o${delim}${path} + if (val === censor) { + secret[${escPath}].precensored = true + } else { + secret[${escPath}].val = val + o${delim}${path} = ${isCensorFct ? 'censor(val)' : 'censor'} + ${circularDetection} + } + } + ` + }).join('\n') +} + +function dynamicRedactTmpl (hasWildcards, isCensorFct) { + return hasWildcards === true ? ` + { + const { wildcards, wcLen, groupRedact, nestedRedact } = this + for (var i = 0; i < wcLen; i++) { + const { before, beforeStr, after, nested } = wildcards[i] + if (nested === true) { + secret[beforeStr] = secret[beforeStr] || [] + nestedRedact(secret[beforeStr], o, before, after, censor, ${isCensorFct}) + } else secret[beforeStr] = groupRedact(o, before, censor, ${isCensorFct}) + } + } + ` : '' +} + +function resultTmpl (serialize) { + return serialize === false ? `return o` : ` + var s = this.serialize(o) + this.restore(o) + return s + ` +} + +function strictImpl (strict, serialize) { + return strict === true + ? `throw Error('fast-redact: primitives cannot be redacted')` + : serialize === false ? `return o` : `return this.serialize(o)` +} diff --git a/node_modules/fast-redact/lib/restorer.js b/node_modules/fast-redact/lib/restorer.js new file mode 100644 index 0000000..5871a9c --- /dev/null +++ b/node_modules/fast-redact/lib/restorer.js @@ -0,0 +1,71 @@ +'use strict' + +const { groupRestore, nestedRestore } = require('./modifiers') + +module.exports = restorer + +function restorer ({ secret, wcLen }) { + return function compileRestore () { + if (this.restore) return + const paths = Object.keys(secret) + .filter((path) => secret[path].precensored === false) + const resetters = resetTmpl(secret, paths) + const hasWildcards = wcLen > 0 + const state = hasWildcards ? { secret, groupRestore, nestedRestore } : { secret } + /* eslint-disable-next-line */ + this.restore = Function( + 'o', + restoreTmpl(resetters, paths, hasWildcards) + ).bind(state) + } +} + +/** + * Mutates the original object to be censored by restoring its original values + * prior to censoring. + * + * @param {object} secret Compiled object describing which target fields should + * be censored and the field states. + * @param {string[]} paths The list of paths to censor as provided at + * initialization time. + * + * @returns {string} String of JavaScript to be used by `Function()`. The + * string compiles to the function that does the work in the description. + */ +function resetTmpl (secret, paths) { + return paths.map((path) => { + const { circle, escPath, leadingBracket } = secret[path] + const delim = leadingBracket ? '' : '.' + const reset = circle + ? `o.${circle} = secret[${escPath}].val` + : `o${delim}${path} = secret[${escPath}].val` + const clear = `secret[${escPath}].val = undefined` + return ` + if (secret[${escPath}].val !== undefined) { + try { ${reset} } catch (e) {} + ${clear} + } + ` + }).join('') +} + +function restoreTmpl (resetters, paths, hasWildcards) { + const dynamicReset = hasWildcards === true ? ` + const keys = Object.keys(secret) + const len = keys.length + for (var i = ${paths.length}; i < len; i++) { + const k = keys[i] + const o = secret[k] + if (o.flat === true) this.groupRestore(o) + else this.nestedRestore(o) + secret[k] = null + } + ` : '' + + return ` + const secret = this.secret + ${resetters} + ${dynamicReset} + return o + ` +} diff --git a/node_modules/fast-redact/lib/rx.js b/node_modules/fast-redact/lib/rx.js new file mode 100644 index 0000000..fe72668 --- /dev/null +++ b/node_modules/fast-redact/lib/rx.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = /[^.[\]]+|\[((?:.)*?)\]/g diff --git a/node_modules/fast-redact/lib/state.js b/node_modules/fast-redact/lib/state.js new file mode 100644 index 0000000..0c5dc20 --- /dev/null +++ b/node_modules/fast-redact/lib/state.js @@ -0,0 +1,22 @@ +'use strict' + +module.exports = state + +function state (o) { + const { + secret, + censor, + isCensorFct, + compileRestore, + serialize, + groupRedact, + nestedRedact, + wildcards, + wcLen + } = o + const builder = [{ secret, censor, isCensorFct, compileRestore }] + builder.push({ secret }) + if (serialize !== false) builder.push({ serialize }) + if (wcLen > 0) builder.push({ groupRedact, nestedRedact, wildcards, wcLen }) + return Object.assign(...builder) +} diff --git a/node_modules/fast-redact/lib/validator.js b/node_modules/fast-redact/lib/validator.js new file mode 100644 index 0000000..cada8fb --- /dev/null +++ b/node_modules/fast-redact/lib/validator.js @@ -0,0 +1,38 @@ +'use strict' + +const { createContext, runInContext } = require('vm') + +module.exports = validator + +function validator (opts = {}) { + const { + ERR_PATHS_MUST_BE_STRINGS = () => 'fast-redact - Paths must be strings', + ERR_INVALID_PATH = (s) => `fast-redact – Invalid path (${s})` + } = opts + + return function validate ({ paths }) { + paths.forEach((s) => { + if (typeof s !== 'string') { + throw Error(ERR_PATHS_MUST_BE_STRINGS()) + } + try { + if (/〇/.test(s)) throw Error() + const proxy = new Proxy({}, { get: () => proxy, set: () => { throw Error() } }) + const expr = (s[0] === '[' ? '' : '.') + s.replace(/^\*/, '〇').replace(/\.\*/g, '.〇').replace(/\[\*\]/g, '[〇]') + if (/\n|\r|;/.test(expr)) throw Error() + if (/\/\*/.test(expr)) throw Error() + runInContext(` + (function () { + 'use strict' + o${expr} + if ([o${expr}].length !== 1) throw Error() + })() + `, createContext({ o: proxy, 〇: null }), { + codeGeneration: { strings: false, wasm: false } + }) + } catch (e) { + throw Error(ERR_INVALID_PATH(s)) + } + }) + } +} diff --git a/node_modules/fast-redact/package.json b/node_modules/fast-redact/package.json new file mode 100644 index 0000000..baaed63 --- /dev/null +++ b/node_modules/fast-redact/package.json @@ -0,0 +1,78 @@ +{ + "_from": "fast-redact@^2.0.0", + "_id": "fast-redact@2.0.0", + "_inBundle": false, + "_integrity": "sha512-zxpkULI9W9MNTK2sJ3BpPQrTEXFNESd2X6O1tXMFpK/XM0G5c5Rll2EVYZH2TqI3xRGK/VaJ+eEOt7pnENJpeA==", + "_location": "/fast-redact", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "fast-redact@^2.0.0", + "name": "fast-redact", + "escapedName": "fast-redact", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/pino" + ], + "_resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-2.0.0.tgz", + "_shasum": "17bb8f5e1f56ecf4a38c8455985e5eab4c478431", + "_spec": "fast-redact@^2.0.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino", + "author": { + "name": "David Mark Clements", + "email": "david.clements@nearform.com" + }, + "bugs": { + "url": "https://github.com/davidmarkclements/fast-redact/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "very fast object redaction", + "devDependencies": { + "fastbench": "^1.0.1", + "pino-noir": "^2.2.1", + "snazzy": "^8.0.0", + "standard": "^12.0.1", + "tap": "^12.5.2" + }, + "directories": { + "example": "example", + "lib": "lib", + "test": "test" + }, + "engines": { + "node": ">=6" + }, + "homepage": "https://github.com/davidmarkclements/fast-redact#readme", + "keywords": [ + "redact", + "censor", + "performance", + "performant", + "gdpr", + "fast", + "speed", + "serialize", + "stringify" + ], + "license": "MIT", + "main": "index.js", + "name": "fast-redact", + "repository": { + "type": "git", + "url": "git+https://github.com/davidmarkclements/fast-redact.git" + }, + "scripts": { + "bench": "node benchmark", + "ci": "tap --cov --100 test", + "cov": "tap --cov test", + "cov-ui": "tap --coverage-report=html test", + "posttest": "standard index.js 'lib/*.js' 'example/*.js' benchmark/index.js test/index.js | snazzy", + "test": "tap test" + }, + "version": "2.0.0" +} diff --git a/node_modules/fast-redact/readme.md b/node_modules/fast-redact/readme.md new file mode 100644 index 0000000..357106c --- /dev/null +++ b/node_modules/fast-redact/readme.md @@ -0,0 +1,280 @@ +# fast-redact + +very fast object redaction + +[![Build Status](https://travis-ci.org/davidmarkclements/fast-redact.svg?branch=master)](https://travis-ci.org/davidmarkclements/fast-redact) + +## Default Usage + +By default, `fast-redact` serializes an object with `JSON.stringify`, censoring any +data at paths specified: + +```js +const fastRedact = require('fast-redact') +const fauxRequest = { + headers: { + host: 'http://example.com', + cookie: `oh oh we don't want this exposed in logs in etc.`, + referer: `if we're cool maybe we'll even redact this` + } +} +const redact = fastRedact({ + paths: ['headers.cookie', 'headers.referer'] +}) + +console.log(redact(fauxRequest)) +// {"headers":{"host":"http://example.com","cookie":"[REDACTED]","referer":"[REDACTED]"}} +``` + +## API + +### `require('fast-redact')({paths, censor, serialize}) => Function` + +When called without any options, or with a zero length `paths` array, +`fast-redact` will return `JSON.stringify` or the `serialize` option, if set. + +#### `paths` – `Array` + +An array of strings describing the nested location of a key in an object. + +The syntax follows that of the EcmaScript specification, that is any JavaScript +path is accepted – both bracket and dot notation is supported. For instance in +each of the following cases, the `c` property will be redacted: `a.b.c`,`a['b'].c`, +`a["b"].c`, `a[``b``].c`. Since bracket notation is supported, array indices are also +supported `a[0].b` would redact the `b` key in the first object of the `a` array. + +Leading brackets are also allowed, for instance `["a"].b.c` will work. + +##### Wildcards + +In addition to static paths, asterisk wildcards are also supported. + +When an asterisk is place in the final position it will redact all keys within the +parent object. For instance `a.b.*` will redact all keys in the `b` object. Similarly +for arrays `a.b[*]` will redact all elements of an array (in truth it actually doesn't matter +whether `b` is in an object or array in either case, both notation styles will work). + +When an asterisk is in an intermediate or first position, the paths following the asterisk will +be redacted for every object within the parent. + +For example: + +```js +const fastRedact = require('fast-redact') +const redact = fastRedact({paths: ['*.c.d']}) +const obj = { + x: {c: {d: 'hide me', e: 'leave me be'}}, + y: {c: {d: 'and me', f: 'I want to live'}}, + z: {c: {d: 'and also I', g: 'I want to run in a stream'}} +} +console.log(redact(obj)) +// {"x":{"c":{"d":"[REDACTED]","e":"leave me be"}},"y":{"c":{"d":"[REDACTED]","f":"I want to live"}},"z":{"c":{"d":"[REDACTED]","g":"I want to run in a stream"}}} +``` + +Another example with a nested array: + +```js +const fastRedact = require('..') +const redact = fastRedact({paths: ['a[*].c.d']}) +const obj = { + a: [ + {c: {d: 'hide me', e: 'leave me be'}}, + {c: {d: 'and me', f: 'I want to live'}}, + {c: {d: 'and also I', g: 'I want to run in a stream'}} + ] +} +console.log(redact(obj)) +// {"a":[{"c":{"d":"[REDACTED]","e":"leave me be"}},{"c":{"d":"[REDACTED]","f":"I want to live"}},{"c":{"d":"[REDACTED]","g":"I want to run in a stream"}}]} +``` + +#### `remove` - `Boolean` - `[false]` + +The `remove` option, when set to `true` will cause keys to be removed from the +serialized output. + +Since the implementation exploits the fact that `undefined` keys are ignored +by `JSON.stringify` the `remove` option may *only* be used when `JSON.stringify` +is the serializer (this is the default) – otherwise `fast-redact` will throw. + +If supplying a custom serializer that has the same behavior (removing keys +with `undefined` values), this restriction can be bypassed by explicitly setting +the `censor` to `undefined`. + + +#### `censor` – `` – `('[REDACTED]')` + +This is the value which overwrites redacted properties. + +Setting `censor` to `undefined` will cause properties to removed as long as this is +the behavior of the `serializer` – which defaults to `JSON.stringify`, which does +remove `undefined` properties. + +Setting `censor` to a function will cause `fast-redact` to invoke it with the original +value. The output of the `censor` function sets the redacted value. +Please note that asynchronous functions are not supported. + +#### `serialize` – `Function | Boolean` – `(JSON.stringify)` + +The `serialize` option may be a function of a boolean. If a function is supplied, this +will be used to `serialize` the redacted object. It's important to understand that for +performance reasons `fast-redact` *mutates* the original object, then serializes, then +restores the original values. So the object passed to the serializer is the exact same +object passed to the redacting function. + +The `serialize` option as a function example: + +```js +const fastRedact = require('fast-redact') +const redact = fastRedact({ + paths: ['a'], + serialize: (o) => JSON.stringify(o, 0, 2) +}) +console.log(redact({a: 1, b: 2})) +// { +// "a": "[REDACTED]", +// "b": 2 +// } +``` + +For advanced usage the `serialize` option can be set to `false`. When `serialize` is set to `false`, +instead of the serialized object, the output of the redactor function will be the mutated object +itself (this is the exact same as the object passed in). In addition a `restore` method is supplied +on the redactor function allowing the redacted keys to be restored with the original data. + +```js +const fastRedact = require('fast-redact') +const redact = fastRedact({ + paths: ['a'], + serialize: false +}) +const o = {a: 1, b: 2} +console.log(redact(o) === o) // true +console.log(o) // { a: '[REDACTED]', b: 2 } +console.log(redact.restore(o) === o) // true +console.log(o) // { a: 1, b: 2 } +``` + +#### `strict` – `Boolean` - `[true]` +The `strict` option, when set to `true`, will cause the redactor function to throw if instead +of an object it finds a primitive. When `strict` is set to `false`, the redactor function +will treat the primitive value as having already been redacted, and return it serialized (with +`JSON.stringify` or the user's custom `serialize` function), or as-is if the `serialize` option +was set to false. + +## Approach + +In order to achieve lowest cost/highest performance redaction `fast-redact` +creates and compiles a function (using the `Function` constructor) on initialization. +It's important to distinguish this from the dangers of a runtime eval, no user input +is involved in creating the string that compiles into the function. This is as safe +as writing code normally and having it compiled by V8 in the usual way. + +Thanks to changes in V8 in recent years, state can be injected into compiled functions +using `bind` at very low cost (whereas `bind` used to be expensive, and getting state +into a compiled function by any means was difficult without a performance penalty). + +For static paths, this function simply checks that the path exists and then overwrites +with the censor. Wildcard paths are processed with normal functions that iterate over +the object redacting values as necessary. + +It's important to note, that the original object is mutated – for performance reasons +a copy is not made. See [rfdc](https://github.com/davidmarkclements/rfdc) (Really Fast +Deep Clone) for the fastest known way to clone – it's not nearly close enough in speed +to editing the original object, serializing and then restoring values. + +A `restore` function is also created and compiled to put the original state back on +to the object after redaction. This means that in the default usage case, the operation +is essentially atomic - the object is mutated, serialized and restored internally which +avoids any state management issues. + +## Caveat + +As mentioned in approach, the `paths` array input is dynamically compiled into a function +at initialization time. While the `paths` array is vigourously tested for any developer +errors, it's strongly recommended against allowing user input to directly supply any +paths to redact. It can't be guaranteed that allowing user input for `paths` couldn't +feasibly expose an attack vector. + +## Benchmarks + +The fastest known predecessor to `fast-redact` is the non-generic [`pino-noir`](http://npm.im/pino-noir) +library (which was also written by myself). + +In the direct calling case, `fast-redact` is ~30x faster than `pino-noir`, however a more realistic +comparison is overhead on `JSON.stringify`. + +For a static redaction case (no wildcards) `pino-noir` adds ~25% overhead on top of `JSON.stringify` +whereas `fast-redact` adds ~1% overhead. + +In the basic last-position wildcard case,`fast-redact` is ~12% faster than `pino-noir`. + +The `pino-noir` module does not support intermediate wildcards, but `fast-redact` does, +the cost of an intermediate wildcard that results in two keys over two nested objects +being redacted is about 25% overhead on `JSON.stringify`. The cost of an intermediate +wildcard that results in four keys across two objects being redacted is about 55% overhead +on `JSON.stringify` and ~50% more expensive that explicitly declaring the keys. + +```sh +npm run bench +``` + +``` +benchNoirV2*500: 59.108ms +benchFastRedact*500: 2.483ms +benchFastRedactRestore*500: 10.904ms +benchNoirV2Wild*500: 91.399ms +benchFastRedactWild*500: 21.200ms +benchFastRedactWildRestore*500: 27.304ms +benchFastRedactIntermediateWild*500: 92.304ms +benchFastRedactIntermediateWildRestore*500: 107.047ms +benchJSONStringify*500: 210.573ms +benchNoirV2Serialize*500: 281.148ms +benchFastRedactSerialize*500: 215.845ms +benchNoirV2WildSerialize*500: 281.168ms +benchFastRedactWildSerialize*500: 247.140ms +benchFastRedactIntermediateWildSerialize*500: 333.722ms +benchFastRedactIntermediateWildMatchWildOutcomeSerialize*500: 463.667ms +benchFastRedactStaticMatchWildOutcomeSerialize*500: 239.293ms +``` + +## Tests + +``` +npm test +``` + +``` + 224 passing (499.544ms) +``` + +### Coverage + +``` +npm run cov +``` + +``` +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files | 100 | 100 | 100 | 100 | | + fast-redact | 100 | 100 | 100 | 100 | | + index.js | 100 | 100 | 100 | 100 | | + fast-redact/lib | 100 | 100 | 100 | 100 | | + modifiers.js | 100 | 100 | 100 | 100 | | + parse.js | 100 | 100 | 100 | 100 | | + redactor.js | 100 | 100 | 100 | 100 | | + restorer.js | 100 | 100 | 100 | 100 | | + rx.js | 100 | 100 | 100 | 100 | | + state.js | 100 | 100 | 100 | 100 | | + validator.js | 100 | 100 | 100 | 100 | | +-----------------|----------|----------|----------|----------|-------------------| +``` + +## License + +MIT + +## Acknowledgements + +Sponsored by [nearForm](http://www.nearform.com) diff --git a/node_modules/fast-redact/test/index.js b/node_modules/fast-redact/test/index.js new file mode 100644 index 0000000..e862708 --- /dev/null +++ b/node_modules/fast-redact/test/index.js @@ -0,0 +1,964 @@ +'use strict' + +const { test } = require('tap') +const fastRedact = require('..') + +const censor = '[REDACTED]' +const censorFct = value => !value ? value : 'xxx' + value.substr(-2) + +test('returns no-op when passed no paths [serialize: false]', ({ end, doesNotThrow }) => { + const redact = fastRedact({ paths: [], serialize: false }) + doesNotThrow(() => redact({})) + doesNotThrow(() => { + const o = redact({}) + redact.restore(o) + }) + end() +}) + +test('returns serializer when passed no paths [serialize: default]', ({ end, is }) => { + is(fastRedact({ paths: [] }), JSON.stringify) + is(fastRedact(), JSON.stringify) + end() +}) + +test('throws when passed non-object using defaults', ({ end, throws }) => { + const redact = fastRedact({ paths: ['a.b.c'] }) + throws(() => redact(1)) + end() +}) + +test('throws when passed non-object number using [strict: true]', ({ end, throws }) => { + const redact = fastRedact({ paths: ['a.b.c'], strict: true }) + throws(() => redact(1)) + end() +}) + +test('returns JSON.stringified value when passed non-object using [strict: false] and no serialize option', ({ end, is, doesNotThrow }) => { + const redactDefaultSerialize = fastRedact({ paths: ['a.b.c'], strict: false }) + + // expectedOutputs holds `JSON.stringify`ied versions of each primitive. + // We write them out explicitly though to make the test a bit clearer. + const primitives = [null, undefined, 'A', 1, false] + const expectedOutputs = ['null', undefined, '"A"', '1', 'false'] + + primitives.forEach((it, i) => { + doesNotThrow(() => redactDefaultSerialize(it)) + const res = redactDefaultSerialize(it) + is(res, expectedOutputs[i]) + }) + + end() +}) + +test('returns custom serialized value when passed non-object using [strict: false, serialize: fn]', ({ end, is, doesNotThrow }) => { + const customSerialize = (v) => `Hello ${v}!` + const redactCustomSerialize = fastRedact({ + paths: ['a.b.c'], + strict: false, + serialize: customSerialize + }) + + const primitives = [null, undefined, 'A', 1, false] + + primitives.forEach((it) => { + doesNotThrow(() => redactCustomSerialize(it)) + const res = redactCustomSerialize(it) + is(res, customSerialize(it)) + }) + + end() +}) + +test('returns original value when passed non-object using [strict: false, serialize: false]', ({ end, is, doesNotThrow }) => { + const redactSerializeFalse = fastRedact({ + paths: ['a.b.c'], + strict: false, + serialize: false + }) + + const primitives = [null, undefined, 'A', 1, false] + + primitives.forEach((it) => { + doesNotThrow(() => redactSerializeFalse(it)) + const res = redactSerializeFalse(it) + is(res, it) + }) + + end() +}) + +test('throws if a path is not a string', ({ end, is, throws }) => { + throws((e) => { + fastRedact({ paths: [1] }) + }, Error('fast-redact - Paths must be strings')) + throws((e) => { + fastRedact({ paths: [null] }) + }, Error('fast-redact - Paths must be strings')) + throws((e) => { + fastRedact({ paths: [undefined] }) + }, Error('fast-redact - Paths must be strings')) + throws((e) => { + fastRedact({ paths: [{}] }) + }, Error('fast-redact - Paths must be strings')) + end() +}) + +test('throws when passed illegal paths', ({ end, is, throws }) => { + const err = (s) => Error(`fast-redact – Invalid path (${s})`) + throws((e) => { + fastRedact({ paths: ['@'] }) + }, err('@')) + throws((e) => { + fastRedact({ paths: ['0'] }) + }, err('0')) + throws((e) => { + fastRedact({ paths: ['〇'] }) + }, err('〇')) + throws((e) => { + fastRedact({ paths: ['a.1.c'] }) + }, err('a.1.c')) + throws((e) => { + fastRedact({ paths: ['a..c'] }) + }, err('a..c')) + throws((e) => { + fastRedact({ paths: ['1..c'] }) + }, err('1..c')) + throws((e) => { + fastRedact({ paths: ['a = b'] }) + }, err('a = b')) + throws((e) => { + fastRedact({ paths: ['a(b)'] }) + }, err('a(b)')) + throws((e) => { + fastRedact({ paths: ['//a.b.c'] }) + }, err('//a.b.c')) + throws((e) => { + fastRedact({ paths: ['\\a.b.c'] }) + }, err('\\a.b.c')) + throws((e) => { + fastRedact({ paths: ['a.#.c'] }) + }, err('a.#.c')) + throws((e) => { + fastRedact({ paths: ['~~a.b.c'] }) + }, err('~~a.b.c')) + throws((e) => { + fastRedact({ paths: ['^a.b.c'] }) + }, err('^a.b.c')) + throws((e) => { + fastRedact({ paths: ['a + b'] }) + }, err('a + b')) + throws((e) => { + fastRedact({ paths: ['return a + b'] }) + }, err('return a + b')) + throws((e) => { + fastRedact({ paths: ['a / b'] }) + }, err('a / b')) + throws((e) => { + fastRedact({ paths: ['a * b'] }) + }, err('a * b')) + throws((e) => { + fastRedact({ paths: ['a - b'] }) + }, err('a - b')) + throws((e) => { + fastRedact({ paths: ['a ** b'] }) + }, err('a ** b')) + throws((e) => { + fastRedact({ paths: ['a % b'] }) + }, err('a % b')) + throws((e) => { + fastRedact({ paths: ['a.b*.c'] }) + }, err('a.b*.c')) + throws((e) => { + fastRedact({ paths: ['a;global.foo = "bar"'] }) + }, err('a;global.foo = "bar"')) + throws((e) => { + fastRedact({ paths: ['a;while(1){}'] }) + }, err('a;while(1){}')) + throws((e) => { + fastRedact({ paths: ['a//'] }) + }, err('a//')) + throws((e) => { + fastRedact({ paths: ['a/*foo*/'] }) + }, err('a/*foo*/')) + throws((e) => { + fastRedact({ paths: ['a,o.b'] }) + }, err('a,o.b')) + throws((e) => { + fastRedact({ paths: ['a = o.b'] }) + }, err('a = o.b')) + throws((e) => { + fastRedact({ paths: ['a\n'] }) + }, err('a\n')) + throws((e) => { + fastRedact({ paths: ['a\r'] }) + }, err('a\r')) + end() +}) + +test('throws if more than one wildcard in a path', ({ end, throws }) => { + throws(() => { + fastRedact({ paths: ['a.*.x.*'], serialize: false }) + }, Error('fast-redact – Only one wildcard per path is supported')) + end() +}) + +test('throws if a custom serializer is used and remove is true', ({ end, throws }) => { + throws(() => { + fastRedact({ paths: ['a'], serialize: (o) => o, remove: true }) + }, Error('fast-redact – remove option may only be set when serializer is JSON.stringify')) + end() +}) + +test('throws if serialize is false and remove is true', ({ end, throws }) => { + throws(() => { + fastRedact({ paths: ['a'], serialize: false, remove: true }) + }, Error('fast-redact – remove option may only be set when serializer is JSON.stringify')) + end() +}) + +test('masks according to supplied censor', ({ end, is }) => { + const censor = 'test' + const redact = fastRedact({ paths: ['a'], censor, serialize: false }) + is(redact({ a: 'a' }).a, censor) + end() +}) + +test('redact.restore function is available when serialize is false', ({ end, is }) => { + const censor = 'test' + const redact = fastRedact({ paths: ['a'], censor, serialize: false }) + is(typeof redact.restore, 'function') + end() +}) + +test('redact.restore function places original values back in place', ({ end, is }) => { + const censor = 'test' + const redact = fastRedact({ paths: ['a'], censor, serialize: false }) + const o = { a: 'a' } + redact(o) + is(o.a, censor) + redact.restore(o) + is(o.a, 'a') + end() +}) + +test('masks according to supplied censor function', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'], censor: censorFct, serialize: false }) + is(redact({ a: '0123456' }).a, 'xxx56') + end() +}) + +test('masks according to supplied censor function with wildcards', ({ end, is }) => { + const redact = fastRedact({ paths: '*', censor: censorFct, serialize: false }) + is(redact({ a: '0123456' }).a, 'xxx56') + end() +}) + +test('masks according to supplied censor function with nested wildcards', ({ end, is }) => { + const redact = fastRedact({ paths: ['*.b'], censor: censorFct, serialize: false }) + is(redact({ a: { b: '0123456' } }).a.b, 'xxx56') + is(redact({ c: { b: '0123456', d: 'pristine' } }).c.b, 'xxx56') + is(redact({ c: { b: '0123456', d: 'pristine' } }).c.d, 'pristine') + end() +}) + +test('redact.restore function places original values back in place with censor function', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'], censor: censorFct, serialize: false }) + const o = { a: 'qwerty' } + redact(o) + is(o.a, 'xxxty') + redact.restore(o) + is(o.a, 'qwerty') + end() +}) + +test('serializes with JSON.stringify by default', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'] }) + const o = { a: 'a' } + is(redact(o), `{"a":"${censor}"}`) + is(o.a, 'a') + end() +}) + +test('removes during serialization instead of redacting when remove option is true', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'], remove: true }) + const o = { a: 'a', b: 'b' } + is(redact(o), `{"b":"b"}`) + is(o.a, 'a') + end() +}) + +test('serializes with JSON.stringify if serialize is true', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'], serialize: true }) + const o = { a: 'a' } + is(redact(o), `{"a":"${censor}"}`) + is(o.a, 'a') + end() +}) + +test('serializes with JSON.stringify if serialize is not a function', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'], serialize: {} }) + const o = { a: 'a' } + is(redact(o), `{"a":"${censor}"}`) + is(o.a, 'a') + end() +}) + +test('serializes with custom serializer if supplied', ({ end, is }) => { + const redact = fastRedact({ paths: ['a'], serialize: (o) => JSON.stringify(o, 0, 2) }) + const o = { a: 'a' } + is(redact(o), `{\n "a": "${censor}"\n}`) + is(o.a, 'a') + end() +}) + +test('redacts parent keys', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + end() +}) + +test('supports paths with array indexes', ({ end, same }) => { + const redact = fastRedact({ paths: ['insideArray.like[3].this'], serialize: false }) + same(redact({ insideArray: { like: ['a', 'b', 'c', { this: { foo: 'meow' } }] } }), { insideArray: { like: ['a', 'b', 'c', { this: censor }] } }) + end() +}) + +test('censor may be any type, including function', ({ end, same }) => { + const redactToString = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: 'censor', serialize: false }) + const redactToUndefined = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: undefined, serialize: false }) + const sym = Symbol('sym') + const redactToSymbol = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: sym, serialize: false }) + const redactToNumber = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: 0, serialize: false }) + const redactToBoolean = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: false, serialize: false }) + const redactToNull = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: null, serialize: false }) + const redactToObject = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: { redacted: true }, serialize: false }) + const redactToArray = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: ['redacted'], serialize: false }) + const redactToBuffer = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: Buffer.from('redacted'), serialize: false }) + const redactToError = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: Error('redacted'), serialize: false }) + const redactToFunction = fastRedact({ paths: ['a.b.c', 'a.b.d.*'], censor: () => 'redacted', serialize: false }) + same(redactToString({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: 'censor', d: { x: 'censor', y: 'censor' } } } }) + same(redactToUndefined({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: undefined, d: { x: undefined, y: undefined } } } }) + same(redactToSymbol({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: sym, d: { x: sym, y: sym } } } }) + same(redactToNumber({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: 0, d: { x: 0, y: 0 } } } }) + same(redactToBoolean({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: false, d: { x: false, y: false } } } }) + same(redactToNull({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: null, d: { x: null, y: null } } } }) + same(redactToObject({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: { redacted: true }, d: { x: { redacted: true }, y: { redacted: true } } } } }) + same(redactToArray({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: ['redacted'], d: { x: ['redacted'], y: ['redacted'] } } } }) + same(redactToBuffer({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: Buffer.from('redacted'), d: { x: Buffer.from('redacted'), y: Buffer.from('redacted') } } } }) + same(redactToError({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: Error('redacted'), d: { x: Error('redacted'), y: Error('redacted') } } } }) + same(redactToFunction({ a: { b: { c: 's', d: { x: 's', y: 's' } } } }), { a: { b: { c: 'redacted', d: { x: 'redacted', y: 'redacted' } } } }) + end() +}) + +test('supports multiple paths from the same root', ({ end, same }) => { + const redact = fastRedact({ paths: ['deep.bar.shoe', 'deep.baz.shoe', 'deep.foo', 'deep.not.there.sooo', 'deep.fum.shoe'], serialize: false }) + same(redact({ deep: { bar: 'hmm', baz: { shoe: { k: 1 } }, foo: {}, fum: { shoe: 'moo' } } }), { deep: { bar: 'hmm', baz: { shoe: censor }, foo: censor, fum: { shoe: censor } } }) + end() +}) + +test('supports strings in bracket notation paths (single quote)', ({ end, is }) => { + const redact = fastRedact({ paths: [`a['@#!='].c`], serialize: false }) + const result = redact({ a: { '@#!=': { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a['@#!='].c, censor) + end() +}) + +test('supports strings in bracket notation paths (double quote)', ({ end, is }) => { + const redact = fastRedact({ paths: [`a["@#!="].c`], serialize: false }) + const result = redact({ a: { '@#!=': { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a['@#!='].c, censor) + end() +}) + +test('supports strings in bracket notation paths (backtick quote)', ({ end, is }) => { + const redact = fastRedact({ paths: ['a[`@#!=`].c'], serialize: false }) + const result = redact({ a: { '@#!=': { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a['@#!='].c, censor) + end() +}) + +test('allows * within a bracket notation string', ({ end, is }) => { + const redact = fastRedact({ paths: ['a["*"].c'], serialize: false }) + const result = redact({ a: { '*': { c: 's', x: 1 } } }) + is(result.a['*'].c, censor) + is(result.a['*'].x, 1) + end() +}) + +test('redacts parent keys – restore', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + redact.restore(result) + is(result.a.b.c, 's') + end() +}) + +test('handles null proto objects', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c'], serialize: false }) + const result = redact({ __proto__: null, a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + end() +}) + +test('handles null proto objects – restore', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c'], serialize: false }) + const result = redact({ __proto__: null, a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + redact.restore(result, 's') + is(result.a.b.c, 's') + end() +}) + +test('handles paths that do not match object structure', ({ end, same }) => { + const redact = fastRedact({ paths: ['x.y.z'], serialize: false }) + same(redact({ a: { b: { c: 's' } } }), { a: { b: { c: 's' } } }) + end() +}) + +test('ignores missing paths in object', ({ end, same }) => { + const redact = fastRedact({ paths: ['a.b.c', 'a.z.d', 'a.b.z'], serialize: false }) + same(redact({ a: { b: { c: 's' } } }), { a: { b: { c: censor } } }) + end() +}) + +test('ignores missing paths in object – restore', ({ end, doesNotThrow }) => { + const redact = fastRedact({ paths: ['a.b.c', 'a.z.d', 'a.b.z'], serialize: false }) + const o = { a: { b: { c: 's' } } } + redact(o) + doesNotThrow(() => { + redact.restore(o) + }) + + end() +}) + +test('gracefully handles primitives that match intermediate keys in paths', ({ end, same }) => { + const redact = fastRedact({ paths: ['a.b.c', 'a.b.c.d'], serialize: false }) + same(redact({ a: { b: null } }), { a: { b: null } }) + same(redact({ a: { b: 's' } }), { a: { b: 's' } }) + same(redact({ a: { b: 1 } }), { a: { b: 1 } }) + same(redact({ a: { b: undefined } }), { a: { b: undefined } }) + same(redact({ a: { b: true } }), { a: { b: true } }) + const sym = Symbol('sym') + same(redact({ a: { b: sym } }), { a: { b: sym } }) + end() +}) + +test('handles circulars', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.baz'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar } + bar.baz = bar + o.bar.baz = o.bar + same(redact(o), { a: 1, bar: { b: 2, baz: censor } }) + end() +}) + +test('handles circulars – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.baz'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar } + bar.baz = bar + o.bar.baz = o.bar + is(o.bar.baz, bar) + redact(o) + is(o.bar.baz, censor) + redact.restore(o) + is(o.bar.baz, bar) + end() +}) + +test('handles circulars and cross references – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.baz', 'cf.bar'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar, cf: { bar } } + bar.baz = bar + o.bar.baz = o.bar + is(o.bar.baz, bar) + is(o.cf.bar, bar) + redact(o) + is(o.bar.baz, censor) + is(o.cf.bar, censor) + redact.restore(o) + is(o.bar.baz, bar) + is(o.cf.bar, bar) + end() +}) + +test('ultimate wildcards – shallow', ({ end, same }) => { + const redact = fastRedact({ paths: ['test.*'], serialize: false }) + same(redact({ test: { baz: 1, bar: 'private' } }), { test: { baz: censor, bar: censor } }) + end() +}) + +test('ultimate wildcards – deep', ({ end, same }) => { + const redact = fastRedact({ paths: ['deep.bar.baz.ding.*'], serialize: false }) + same(redact({ deep: { a: 1, bar: { b: 2, baz: { c: 3, ding: { d: 4, e: 5, f: 'six' } } } } }), { deep: { a: 1, bar: { b: 2, baz: { c: 3, ding: { d: censor, e: censor, f: censor } } } } }) + end() +}) + +test('ultimate wildcards - array – shallow', ({ end, same }) => { + const redact = fastRedact({ paths: ['array[*]'], serialize: false }) + same(redact({ array: ['a', 'b', 'c', 'd'] }), { array: [censor, censor, censor, censor] }) + end() +}) + +test('ultimate wildcards – array – deep', ({ end, same }) => { + const redact = fastRedact({ paths: ['deepArray.down.here[*]'], serialize: false }) + same(redact({ deepArray: { down: { here: ['a', 'b', 'c'] } } }), { deepArray: { down: { here: [censor, censor, censor] } } }) + end() +}) + +test('ultimate wildcards – array – single index', ({ end, same }) => { + const redact = fastRedact({ paths: ['insideArray.like[3].this.*'], serialize: false }) + same(redact({ insideArray: { like: ['a', 'b', 'c', { this: { foo: 'meow' } }] } }), { insideArray: { like: ['a', 'b', 'c', { this: { foo: censor } }] } }) + end() +}) + +test('ultimate wildcards - handles null proto objects', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c'], serialize: false }) + const result = redact({ __proto__: null, a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + end() +}) + +test('ultimate wildcards - handles paths that do not match object structure', ({ end, same }) => { + const redact = fastRedact({ paths: ['x.y.z'], serialize: false }) + same(redact({ a: { b: { c: 's' } } }), { a: { b: { c: 's' } } }) + end() +}) + +test('ultimate wildcards - gracefully handles primitives that match intermediate keys in paths', ({ end, same }) => { + const redact = fastRedact({ paths: ['a.b.c', 'a.b.c.d'], serialize: false }) + same(redact({ a: { b: null } }), { a: { b: null } }) + same(redact({ a: { b: 's' } }), { a: { b: 's' } }) + same(redact({ a: { b: 1 } }), { a: { b: 1 } }) + same(redact({ a: { b: undefined } }), { a: { b: undefined } }) + same(redact({ a: { b: true } }), { a: { b: true } }) + const sym = Symbol('sym') + same(redact({ a: { b: sym } }), { a: { b: sym } }) + end() +}) + +test('ultimate wildcards – handles circulars', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.*'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar } + bar.baz = bar + o.bar.baz = o.bar + same(redact(o), { a: 1, bar: { b: censor, baz: censor } }) + end() +}) + +test('ultimate wildcards – handles circulars – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.*'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar } + bar.baz = bar + o.bar.baz = o.bar + is(o.bar.baz, bar) + redact(o) + is(o.bar.baz, censor) + redact.restore(o) + is(o.bar.baz, bar) + end() +}) + +test('ultimate wildcards – handles circulars and cross references – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.*', 'cf.*'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar, cf: { bar } } + bar.baz = bar + o.bar.baz = o.bar + is(o.bar.baz, bar) + is(o.cf.bar, bar) + redact(o) + is(o.bar.baz, censor) + is(o.cf.bar, censor) + redact.restore(o) + is(o.bar.baz, bar) + is(o.cf.bar, bar) + end() +}) + +test('static + wildcards', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c', 'a.d.*', 'a.b.z.*'], serialize: false }) + const result = redact({ a: { b: { c: 's', z: { x: 's', y: 's' } }, d: { a: 's', b: 's', c: 's' } } }) + + is(result.a.b.c, censor) + is(result.a.d.a, censor) + is(result.a.d.b, censor) + is(result.a.d.c, censor) + is(result.a.b.z.x, censor) + is(result.a.b.z.y, censor) + end() +}) + +test('static + wildcards reuse', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.c', 'a.d.*'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + + is(result.a.b.c, censor) + is(result.a.d.a, censor) + is(result.a.d.b, censor) + is(result.a.d.c, censor) + + redact.restore(result) + + const result2 = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result2.a.b.c, censor) + is(result2.a.d.a, censor) + is(result2.a.d.b, censor) + is(result2.a.d.c, censor) + + redact.restore(result2) + end() +}) + +test('parent wildcard – first position', ({ end, is }) => { + const redact = fastRedact({ paths: ['*.c'], serialize: false }) + const result = redact({ b: { c: 's' }, d: { a: 's', b: 's', c: 's' } }) + is(result.b.c, censor) + is(result.d.a, 's') + is(result.d.b, 's') + is(result.d.c, censor) + end() +}) + +test('parent wildcard – one following key', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.c'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + is(result.a.d.a, 's') + is(result.a.d.b, 's') + is(result.a.d.c, censor) + end() +}) + +test('restore parent wildcard – one following key', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.c'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + redact.restore(result) + is(result.a.b.c, 's') + is(result.a.d.a, 's') + is(result.a.d.b, 's') + is(result.a.d.c, 's') + end() +}) + +test('parent wildcard – one following key – reuse', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.c'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + is(result.a.d.a, 's') + is(result.a.d.b, 's') + is(result.a.d.c, censor) + const result2 = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result2.a.b.c, censor) + is(result2.a.d.a, 's') + is(result2.a.d.b, 's') + is(result2.a.d.c, censor) + redact.restore(result2) + end() +}) + +test('parent wildcard – two following keys', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.x.c'], serialize: false }) + const result = redact({ a: { b: { x: { c: 's' } }, d: { x: { a: 's', b: 's', c: 's' } } } }) + is(result.a.b.x.c, censor) + is(result.a.d.x.a, 's') + is(result.a.d.x.b, 's') + is(result.a.d.x.c, censor) + end() +}) + +test('parent wildcard – two following keys – reuse', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.x.c'], serialize: false }) + const result = redact({ a: { b: { x: { c: 's' } }, d: { x: { a: 's', b: 's', c: 's' } } } }) + is(result.a.b.x.c, censor) + is(result.a.d.x.a, 's') + is(result.a.d.x.b, 's') + is(result.a.d.x.c, censor) + redact.restore(result) + const result2 = redact({ a: { b: { x: { c: 's' } }, d: { x: { a: 's', b: 's', c: 's' } } } }) + is(result2.a.b.x.c, censor) + is(result2.a.d.x.a, 's') + is(result2.a.d.x.b, 's') + is(result2.a.d.x.c, censor) + end() +}) + +test('restore parent wildcard – two following keys', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.x.c'], serialize: false }) + const result = redact({ a: { b: { x: { c: 's' } }, d: { x: { a: 's', b: 's', c: 's' } } } }) + redact.restore(result) + is(result.a.b.x.c, 's') + is(result.a.d.x.a, 's') + is(result.a.d.x.b, 's') + is(result.a.d.x.c, 's') + end() +}) + +test('parent wildcard - array', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b[*].x'], serialize: false }) + const result = redact({ a: { b: [{ x: 1 }, { a: 2 }], d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b[0].x, censor) + is(result.a.b[1].a, 2) + is(result.a.d.a, 's') + is(result.a.d.b, 's') + end() +}) + +test('parent wildcards – array – single index', ({ end, same }) => { + const redact = fastRedact({ paths: ['insideArray.like[3].*.foo'], serialize: false }) + same(redact({ insideArray: { like: ['a', 'b', 'c', { this: { foo: 'meow' } }] } }), { insideArray: { like: ['a', 'b', 'c', { this: { foo: censor } }] } }) + end() +}) + +test('parent wildcards - handles null proto objects', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.c'], serialize: false }) + const result = redact({ __proto__: null, a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result.a.b.c, censor) + end() +}) + +test('parent wildcards - handles paths that do not match object structure', ({ end, same }) => { + const redact = fastRedact({ paths: ['a.*.y.z'], serialize: false }) + same(redact({ a: { b: { c: 's' } } }), { a: { b: { c: 's' } } }) + end() +}) + +test('parent wildcards - gracefully handles primitives that match intermediate keys in paths', ({ end, same }) => { + const redact = fastRedact({ paths: ['a.*.c'], serialize: false }) + same(redact({ a: { b: null } }), { a: { b: null } }) + same(redact({ a: { b: 's' } }), { a: { b: 's' } }) + same(redact({ a: { b: 1 } }), { a: { b: 1 } }) + same(redact({ a: { b: undefined } }), { a: { b: undefined } }) + same(redact({ a: { b: true } }), { a: { b: true } }) + const sym = Symbol('sym') + same(redact({ a: { b: sym } }), { a: { b: sym } }) + end() +}) + +test('parent wildcards – handles circulars', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['x.*.baz'], serialize: false }) + const bar = { b: 2 } + const o = { x: { a: 1, bar } } + bar.baz = bar + o.x.bar.baz = o.x.bar + same(redact(o), { x: { a: 1, bar: { b: 2, baz: censor } } }) + end() +}) + +test('parent wildcards – handles circulars – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['x.*.baz'], serialize: false }) + const bar = { b: 2 } + const o = { x: { a: 1, bar } } + bar.baz = bar + o.x.bar.baz = o.x.bar + is(o.x.bar.baz, bar) + redact(o) + is(o.x.a, 1) + is(o.x.bar.baz, censor) + redact.restore(o) + is(o.x.bar.baz, bar) + end() +}) + +test('parent wildcards – handles circulars and cross references – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['x.*.baz', 'x.*.cf.bar'], serialize: false }) + const bar = { b: 2 } + const o = { x: { a: 1, bar, y: { cf: { bar } } } } + bar.baz = bar + o.x.bar.baz = o.x.bar + is(o.x.bar.baz, bar) + is(o.x.y.cf.bar, bar) + redact(o) + is(o.x.bar.baz, censor) + is(o.x.y.cf.bar, censor) + redact.restore(o) + is(o.x.bar.baz, bar) + is(o.x.y.cf.bar, bar) + end() +}) + +test('parent wildcards – handles missing paths', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['z.*.baz'] }) + const o = { a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } } + is(redact(o), JSON.stringify(o)) + end() +}) + +test('ultimate wildcards – handles missing paths', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['z.*'] }) + const o = { a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } } + is(redact(o), JSON.stringify(o)) + end() +}) + +test('parent wildcards – removes during serialization instead of redacting when remove option is true', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.*.c'], remove: true }) + const o = { a: { b: { c: 'c' }, x: { c: 1 } } } + is(redact(o), `{"a":{"b":{},"x":{}}}`) + end() +}) + +test('ultimate wildcards – removes during serialization instead of redacting when remove option is true', ({ end, is }) => { + const redact = fastRedact({ paths: ['a.b.*'], remove: true }) + const o = { a: { b: { c: 'c' }, x: { c: 1 } } } + is(redact(o), `{"a":{"b":{},"x":{"c":1}}}`) + end() +}) + +test('supports leading bracket notation', ({ end, is }) => { + const redact = fastRedact({ paths: ['["a"].b.c'] }) + const o = { a: { b: { c: 'd' } } } + is(redact(o), `{"a":{"b":{"c":"${censor}"}}}`) + end() +}) + +test('supports leading bracket notation containing non-legal keyword characters', ({ end, is }) => { + const redact = fastRedact({ paths: ['["a-x"].b.c'] }) + const o = { 'a-x': { b: { c: 'd' } } } + is(redact(o), `{"a-x":{"b":{"c":"${censor}"}}}`) + end() +}) + +test('supports single leading bracket', ({ end, is }) => { + const censor = 'test' + const redact = fastRedact({ paths: ['["a"]'], censor, serialize: false }) + is(redact({ a: 'a' }).a, censor) + end() +}) + +test('supports single leading bracket containing non-legal keyword characters', ({ end, is }) => { + const censor = 'test' + const redact = fastRedact({ paths: ['["a-x"]'], censor, serialize: false }) + is(redact({ 'a-x': 'a' })['a-x'], censor) + end() +}) + +test('(leading brackets) ultimate wildcards – handles circulars and cross references – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['bar.baz.*', 'cf.*'], serialize: false }) + const bar = { b: 2 } + const o = { a: 1, bar, cf: { bar } } + bar.baz = bar + o.bar.baz = o.bar + is(o.bar.baz, bar) + is(o.cf.bar, bar) + redact(o) + is(o.bar.baz, censor) + is(o.cf.bar, censor) + redact.restore(o) + is(o.bar.baz, bar) + is(o.cf.bar, bar) + end() +}) + +test('(leading brackets) parent wildcards – handles circulars and cross references – restore', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['["x"].*.baz', '["x"].*.cf.bar'], serialize: false }) + const bar = { b: 2 } + const o = { x: { a: 1, bar, y: { cf: { bar } } } } + bar.baz = bar + o.x.bar.baz = o.x.bar + is(o.x.bar.baz, bar) + is(o.x.y.cf.bar, bar) + redact(o) + is(o.x.bar.baz, censor) + is(o.x.y.cf.bar, censor) + redact.restore(o) + is(o.x.bar.baz, bar) + is(o.x.y.cf.bar, bar) + end() +}) + +test('(leading brackets) ultimate wildcards – handles missing paths', ({ end, is, same }) => { + const redact = fastRedact({ paths: ['["z"].*'] }) + const o = { a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } } + is(redact(o), JSON.stringify(o)) + end() +}) + +test('(leading brackets) static + wildcards reuse', ({ end, is }) => { + const redact = fastRedact({ paths: ['["a"].b.c', '["a"].d.*'], serialize: false }) + const result = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + + is(result.a.b.c, censor) + is(result.a.d.a, censor) + is(result.a.d.b, censor) + is(result.a.d.c, censor) + + redact.restore(result) + + const result2 = redact({ a: { b: { c: 's' }, d: { a: 's', b: 's', c: 's' } } }) + is(result2.a.b.c, censor) + is(result2.a.d.a, censor) + is(result2.a.d.b, censor) + is(result2.a.d.c, censor) + + redact.restore(result2) + end() +}) + +test('correctly restores original object when a path does not match object', ({ end, is }) => { + const redact = fastRedact({ paths: ['foo.bar'], strict: false }) + const o = {} + is(redact({ foo: o }), '{"foo":{}}') + is(o.hasOwnProperty('bar'), false) + end() +}) + +test('correctly restores original object when a matching path has value of `undefined`', ({ end, is }) => { + const redact = fastRedact({ paths: ['foo.bar'], strict: false }) + const o = { bar: undefined } + is(redact({ foo: o }), '{"foo":{}}') + is(o.hasOwnProperty('bar'), true) + is(o.bar, undefined) + end() +}) + +test('handles multiple paths with leading brackets', ({ end, is }) => { + const redact = fastRedact({ paths: ['["x-y"]', '["y-x"]'] }) + const o = { 'x-y': 'test', 'y-x': 'test2' } + is(redact(o), '{"x-y":"[REDACTED]","y-x":"[REDACTED]"}') + end() +}) + +test('handles objects with and then without target paths', ({ end, is }) => { + const redact = fastRedact({ paths: ['test'] }) + const o1 = { test: 'check' } + const o2 = {} + is(redact(o1), '{"test":"[REDACTED]"}') + is(redact(o2), '{}') + // run each check twice to ensure no mutations + is(redact(o1), '{"test":"[REDACTED]"}') + is(redact(o2), '{}') + is('test' in o1, true) + is('test' in o2, false) + end() +}) + +test('handles leading wildcards and null values', ({ end, is }) => { + const redact = fastRedact({ paths: ['*.test'] }) + const o = { prop: null } + is(redact(o), '{"prop":null}') + is(o.prop, null) + end() +}) + +test('handles keys with dots', ({ end, is }) => { + const redactSingleQ = fastRedact({ paths: [`a['b.c']`], serialize: false }) + const redactDoubleQ = fastRedact({ paths: [`a["b.c"]`], serialize: false }) + const redactBacktickQ = fastRedact({ paths: ['a[`b.c`]'], serialize: false }) + const redactNum = fastRedact({ paths: [`a[-1.2]`], serialize: false }) + const redactLeading = fastRedact({ paths: [`["b.c"]`], serialize: false }) + is(redactSingleQ({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['b.c'], censor) + is(redactDoubleQ({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['b.c'], censor) + is(redactBacktickQ({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['b.c'], censor) + is(redactNum({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['-1.2'], censor) + is(redactLeading({ 'b.c': 'x', '-1.2': 'x' })['b.c'], censor) + end() +}) diff --git a/node_modules/fast-safe-stringify/.travis.yml b/node_modules/fast-safe-stringify/.travis.yml new file mode 100644 index 0000000..2b06d25 --- /dev/null +++ b/node_modules/fast-safe-stringify/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +sudo: false +node_js: +- '4' +- '6' +- '8' +- '9' +- '10' diff --git a/node_modules/fast-safe-stringify/CHANGELOG.md b/node_modules/fast-safe-stringify/CHANGELOG.md new file mode 100644 index 0000000..55f2d08 --- /dev/null +++ b/node_modules/fast-safe-stringify/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +## v.2.0.0 + +Features + +- Added stable-stringify (see documentation) +- Support replacer +- Support spacer +- toJSON support without forceDecirc property +- Improved performance + +Breaking changes + +- Manipulating the input value in a `toJSON` function is not possible anymore in + all cases (see documentation) +- Dropped support for e.g. IE8 and Node.js < 4 diff --git a/node_modules/fast-safe-stringify/LICENSE b/node_modules/fast-safe-stringify/LICENSE new file mode 100644 index 0000000..d310c2d --- /dev/null +++ b/node_modules/fast-safe-stringify/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2016 David Mark Clements +Copyright (c) 2017 David Mark Clements & Matteo Collina +Copyright (c) 2018 David Mark Clements, Matteo Collina & Ruben Bridgewater + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/fast-safe-stringify/benchmark.js b/node_modules/fast-safe-stringify/benchmark.js new file mode 100644 index 0000000..7ba5e9f --- /dev/null +++ b/node_modules/fast-safe-stringify/benchmark.js @@ -0,0 +1,137 @@ +const Benchmark = require('benchmark') +const suite = new Benchmark.Suite() +const { inspect } = require('util') +const jsonStringifySafe = require('json-stringify-safe') +const fastSafeStringify = require('./') + +const array = new Array(10).fill(0).map((_, i) => i) +const obj = { foo: array } +const circ = JSON.parse(JSON.stringify(obj)) +circ.o = { obj: circ, array } +const circGetters = JSON.parse(JSON.stringify(obj)) +Object.assign(circGetters, { get o () { return { obj: circGetters, array } } }) + +const deep = require('./package.json') +deep.deep = JSON.parse(JSON.stringify(deep)) +deep.deep.deep = JSON.parse(JSON.stringify(deep)) +deep.deep.deep.deep = JSON.parse(JSON.stringify(deep)) +deep.array = array + +const deepCirc = JSON.parse(JSON.stringify(deep)) +deepCirc.deep.deep.deep.circ = deepCirc +deepCirc.deep.deep.circ = deepCirc +deepCirc.deep.circ = deepCirc +deepCirc.array = array + +const deepCircGetters = JSON.parse(JSON.stringify(deep)) +for (let i = 0; i < 10; i++) { + deepCircGetters[i.toString()] = { + deep: { + deep: { + get circ () { return deep.deep }, + deep: { get circ () { return deep.deep.deep } } + }, + get circ () { return deep } + }, + get array () { return array } + } +} + +const deepCircNonCongifurableGetters = JSON.parse(JSON.stringify(deep)) +Object.defineProperty(deepCircNonCongifurableGetters.deep.deep.deep, 'circ', { + get: () => deepCircNonCongifurableGetters, + enumerable: true, + configurable: false +}) +Object.defineProperty(deepCircNonCongifurableGetters.deep.deep, 'circ', { + get: () => deepCircNonCongifurableGetters, + enumerable: true, + configurable: false +}) +Object.defineProperty(deepCircNonCongifurableGetters.deep, 'circ', { + get: () => deepCircNonCongifurableGetters, + enumerable: true, + configurable: false +}) +Object.defineProperty(deepCircNonCongifurableGetters, 'array', { + get: () => array, + enumerable: true, + configurable: false +}) + +suite.add('util.inspect: simple object ', function () { + inspect(obj, { showHidden: false, depth: null }) +}) +suite.add('util.inspect: circular ', function () { + inspect(circ, { showHidden: false, depth: null }) +}) +suite.add('util.inspect: circular getters ', function () { + inspect(circGetters, { showHidden: false, depth: null }) +}) +suite.add('util.inspect: deep ', function () { + inspect(deep, { showHidden: false, depth: null }) +}) +suite.add('util.inspect: deep circular ', function () { + inspect(deepCirc, { showHidden: false, depth: null }) +}) +suite.add('util.inspect: large deep circular getters ', function () { + inspect(deepCircGetters, { showHidden: false, depth: null }) +}) +suite.add('util.inspect: deep non-conf circular getters', function () { + inspect(deepCircNonCongifurableGetters, { showHidden: false, depth: null }) +}) + +suite.add('\njson-stringify-safe: simple object ', function () { + jsonStringifySafe(obj) +}) +suite.add('json-stringify-safe: circular ', function () { + jsonStringifySafe(circ) +}) +suite.add('json-stringify-safe: circular getters ', function () { + jsonStringifySafe(circGetters) +}) +suite.add('json-stringify-safe: deep ', function () { + jsonStringifySafe(deep) +}) +suite.add('json-stringify-safe: deep circular ', function () { + jsonStringifySafe(deepCirc) +}) +suite.add('json-stringify-safe: large deep circular getters ', function () { + jsonStringifySafe(deepCircGetters) +}) +suite.add('json-stringify-safe: deep non-conf circular getters', function () { + jsonStringifySafe(deepCircNonCongifurableGetters) +}) + +suite.add('\nfast-safe-stringify: simple object ', function () { + fastSafeStringify(obj) +}) +suite.add('fast-safe-stringify: circular ', function () { + fastSafeStringify(circ) +}) +suite.add('fast-safe-stringify: circular getters ', function () { + fastSafeStringify(circGetters) +}) +suite.add('fast-safe-stringify: deep ', function () { + fastSafeStringify(deep) +}) +suite.add('fast-safe-stringify: deep circular ', function () { + fastSafeStringify(deepCirc) +}) +suite.add('fast-safe-stringify: large deep circular getters ', function () { + fastSafeStringify(deepCircGetters) +}) +suite.add('fast-safe-stringify: deep non-conf circular getters', function () { + fastSafeStringify(deepCircNonCongifurableGetters) +}) + +// add listeners +suite.on('cycle', function (event) { + console.log(String(event.target)) +}) + +suite.on('complete', function () { + console.log('\nFastest is ' + this.filter('fastest').map('name')) +}) + +suite.run({ delay: 1, minSamples: 150 }) diff --git a/node_modules/fast-safe-stringify/index.d.ts b/node_modules/fast-safe-stringify/index.d.ts new file mode 100644 index 0000000..56f6865 --- /dev/null +++ b/node_modules/fast-safe-stringify/index.d.ts @@ -0,0 +1,8 @@ +declare function stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + +declare namespace stringify { + export function stable(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + export function stableStringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; +} + +export default stringify; diff --git a/node_modules/fast-safe-stringify/index.js b/node_modules/fast-safe-stringify/index.js new file mode 100644 index 0000000..670698d --- /dev/null +++ b/node_modules/fast-safe-stringify/index.js @@ -0,0 +1,161 @@ +module.exports = stringify +stringify.default = stringify +stringify.stable = deterministicStringify +stringify.stableStringify = deterministicStringify + +var arr = [] +var replacerStack = [] + +// Regular stringify +function stringify (obj, replacer, spacer) { + decirc(obj, '', [], undefined) + var res + if (replacerStack.length === 0) { + res = JSON.stringify(obj, replacer, spacer) + } else { + res = JSON.stringify(obj, replaceGetterValues(replacer), spacer) + } + while (arr.length !== 0) { + var part = arr.pop() + if (part.length === 4) { + Object.defineProperty(part[0], part[1], part[3]) + } else { + part[0][part[1]] = part[2] + } + } + return res +} +function decirc (val, k, stack, parent) { + var i + if (typeof val === 'object' && val !== null) { + for (i = 0; i < stack.length; i++) { + if (stack[i] === val) { + var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k) + if (propertyDescriptor.get !== undefined) { + if (propertyDescriptor.configurable) { + Object.defineProperty(parent, k, { value: '[Circular]' }) + arr.push([parent, k, val, propertyDescriptor]) + } else { + replacerStack.push([val, k]) + } + } else { + parent[k] = '[Circular]' + arr.push([parent, k, val]) + } + return + } + } + stack.push(val) + // Optimize for Arrays. Big arrays could kill the performance otherwise! + if (Array.isArray(val)) { + for (i = 0; i < val.length; i++) { + decirc(val[i], i, stack, val) + } + } else { + var keys = Object.keys(val) + for (i = 0; i < keys.length; i++) { + var key = keys[i] + decirc(val[key], key, stack, val) + } + } + stack.pop() + } +} + +// Stable-stringify +function compareFunction (a, b) { + if (a < b) { + return -1 + } + if (a > b) { + return 1 + } + return 0 +} + +function deterministicStringify (obj, replacer, spacer) { + var tmp = deterministicDecirc(obj, '', [], undefined) || obj + var res + if (replacerStack.length === 0) { + res = JSON.stringify(tmp, replacer, spacer) + } else { + res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer) + } + while (arr.length !== 0) { + var part = arr.pop() + if (part.length === 4) { + Object.defineProperty(part[0], part[1], part[3]) + } else { + part[0][part[1]] = part[2] + } + } + return res +} + +function deterministicDecirc (val, k, stack, parent) { + var i + if (typeof val === 'object' && val !== null) { + for (i = 0; i < stack.length; i++) { + if (stack[i] === val) { + var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k) + if (propertyDescriptor.get !== undefined) { + if (propertyDescriptor.configurable) { + Object.defineProperty(parent, k, { value: '[Circular]' }) + arr.push([parent, k, val, propertyDescriptor]) + } else { + replacerStack.push([val, k]) + } + } else { + parent[k] = '[Circular]' + arr.push([parent, k, val]) + } + return + } + } + if (typeof val.toJSON === 'function') { + return + } + stack.push(val) + // Optimize for Arrays. Big arrays could kill the performance otherwise! + if (Array.isArray(val)) { + for (i = 0; i < val.length; i++) { + deterministicDecirc(val[i], i, stack, val) + } + } else { + // Create a temporary object in the required way + var tmp = {} + var keys = Object.keys(val).sort(compareFunction) + for (i = 0; i < keys.length; i++) { + var key = keys[i] + deterministicDecirc(val[key], key, stack, val) + tmp[key] = val[key] + } + if (parent !== undefined) { + arr.push([parent, k, val]) + parent[k] = tmp + } else { + return tmp + } + } + stack.pop() + } +} + +// wraps replacer function to handle values we couldn't replace +// and mark them as [Circular] +function replaceGetterValues (replacer) { + replacer = replacer !== undefined ? replacer : function (k, v) { return v } + return function (key, val) { + if (replacerStack.length > 0) { + for (var i = 0; i < replacerStack.length; i++) { + var part = replacerStack[i] + if (part[1] === key && part[0] === val) { + val = '[Circular]' + replacerStack.splice(i, 1) + break + } + } + } + return replacer.call(this, key, val) + } +} diff --git a/node_modules/fast-safe-stringify/package.json b/node_modules/fast-safe-stringify/package.json new file mode 100644 index 0000000..528f5c9 --- /dev/null +++ b/node_modules/fast-safe-stringify/package.json @@ -0,0 +1,87 @@ +{ + "_from": "fast-safe-stringify@^2.0.7", + "_id": "fast-safe-stringify@2.0.7", + "_inBundle": false, + "_integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==", + "_location": "/fast-safe-stringify", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "fast-safe-stringify@^2.0.7", + "name": "fast-safe-stringify", + "escapedName": "fast-safe-stringify", + "rawSpec": "^2.0.7", + "saveSpec": null, + "fetchSpec": "^2.0.7" + }, + "_requiredBy": [ + "/pino" + ], + "_resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "_shasum": "124aa885899261f68aedb42a7c080de9da608743", + "_spec": "fast-safe-stringify@^2.0.7", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino", + "author": { + "name": "David Mark Clements" + }, + "bugs": { + "url": "https://github.com/davidmarkclements/fast-safe-stringify/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Ruben Bridgewater" + }, + { + "name": "Matteo Collina" + }, + { + "name": "Ben Gourley" + }, + { + "name": "Gabriel Lesperance" + }, + { + "name": "Alex Liu" + }, + { + "name": "Christoph Walcher" + }, + { + "name": "Nicholas Young" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Safely and quickly serialize JavaScript objects", + "devDependencies": { + "benchmark": "^2.1.4", + "clone": "^2.1.0", + "json-stringify-safe": "^5.0.1", + "standard": "^11.0.0", + "tap": "^12.0.0" + }, + "homepage": "https://github.com/davidmarkclements/fast-safe-stringify#readme", + "keywords": [ + "stable", + "stringify", + "JSON", + "JSON.stringify", + "safe", + "serialize" + ], + "license": "MIT", + "main": "index.js", + "name": "fast-safe-stringify", + "repository": { + "type": "git", + "url": "git+https://github.com/davidmarkclements/fast-safe-stringify.git" + }, + "scripts": { + "benchmark": "node benchmark.js", + "test": "standard && tap --no-esm test.js test-stable.js" + }, + "typings": "index", + "version": "2.0.7" +} diff --git a/node_modules/fast-safe-stringify/readme.md b/node_modules/fast-safe-stringify/readme.md new file mode 100644 index 0000000..51ed1fb --- /dev/null +++ b/node_modules/fast-safe-stringify/readme.md @@ -0,0 +1,154 @@ +# fast-safe-stringify + +Safe and fast serialization alternative to [JSON.stringify][]. + +Gracefully handles circular structures instead of throwing. + +Provides a deterministic ("stable") version as well that will also gracefully +handle circular structures. See the example below for further information. + +## Usage + +The same as [JSON.stringify][]. + +`stringify(value[, replacer[, space]])` + +```js +const safeStringify = require('fast-safe-stringify') +const o = { a: 1 } +o.o = o + +console.log(safeStringify(o)) +// '{"a":1,"o":"[Circular]"}' +console.log(JSON.stringify(o)) +// TypeError: Converting circular structure to JSON + +function replacer(key, value) { + console.log('Key:', JSON.stringify(key), 'Value:', JSON.stringify(value)) + // Remove the circular structure + if (value === '[Circular]') { + return + } + return value +} +const serialized = safeStringify(o, replacer, 2) +// Key: "" Value: {"a":1,"o":"[Circular]"} +// Key: "a" Value: 1 +// Key: "o" Value: "[Circular]" +console.log(serialized) +// { +// "a": 1 +// } +``` + +Using the deterministic version also works the same: + +```js +const safeStringify = require('fast-safe-stringify') +const o = { b: 1, a: 0 } +o.o = o + +console.log(safeStringify(o)) +// '{"b":1,"a":0,"o":"[Circular]"}' +console.log(safeStringify.stableStringify(o)) +// '{"a":0,"b":1,"o":"[Circular]"}' +console.log(JSON.stringify(o)) +// TypeError: Converting circular structure to JSON +``` + +A faster and side-effect free implementation is available in the +[safe-stable-stringify][] module. However it is still considered experimental +due to a new and more complex implementation. + +## Differences to JSON.stringify + +In general the behavior is identical to [JSON.stringify][]. The [`replacer`][] +and [`space`][] options are also available. + +A few exceptions exist to [JSON.stringify][] while using [`toJSON`][] or +[`replacer`][]: + +### Regular safe stringify + +- Manipulating a circular structure of the passed in value in a `toJSON` or the + `replacer` is not possible! It is possible for any other value and property. + +- In case a circular structure is detected and the [`replacer`][] is used it + will receive the string `[Circular]` as the argument instead of the circular + object itself. + +### Deterministic ("stable") safe stringify + +- Manipulating the input object either in a [`toJSON`][] or the [`replacer`][] + function will not have any effect on the output. The output entirely relies on + the shape the input value had at the point passed to the stringify function! + +- In case a circular structure is detected and the [`replacer`][] is used it + will receive the string `[Circular]` as the argument instead of the circular + object itself. + +A side effect free variation without these limitations can be found as well +([`safe-stable-stringify`][]). It is also faster than the current +implementation. It is still considered experimental due to a new and more +complex implementation. + +## Benchmarks + +Although not JSON, the Node.js `util.inspect` method can be used for similar +purposes (e.g. logging) and also handles circular references. + +Here we compare `fast-safe-stringify` with some alternatives: +(Lenovo T450s with a i7-5600U CPU using Node.js 8.9.4) + +```md +fast-safe-stringify: simple object x 1,121,497 ops/sec ±0.75% (97 runs sampled) +fast-safe-stringify: circular x 560,126 ops/sec ±0.64% (96 runs sampled) +fast-safe-stringify: deep x 32,472 ops/sec ±0.57% (95 runs sampled) +fast-safe-stringify: deep circular x 32,513 ops/sec ±0.80% (92 runs sampled) + +util.inspect: simple object x 272,837 ops/sec ±1.48% (90 runs sampled) +util.inspect: circular x 116,896 ops/sec ±1.19% (95 runs sampled) +util.inspect: deep x 19,382 ops/sec ±0.66% (92 runs sampled) +util.inspect: deep circular x 18,717 ops/sec ±0.63% (96 runs sampled) + +json-stringify-safe: simple object x 233,621 ops/sec ±0.97% (94 runs sampled) +json-stringify-safe: circular x 110,409 ops/sec ±1.85% (95 runs sampled) +json-stringify-safe: deep x 8,705 ops/sec ±0.87% (96 runs sampled) +json-stringify-safe: deep circular x 8,336 ops/sec ±2.20% (93 runs sampled) +``` + +For stable stringify comparisons, see the performance benchmarks in the +[`safe-stable-stringify`][] readme. + +## Protip + +Whether `fast-safe-stringify` or alternatives are used: if the use case +consists of deeply nested objects without circular references the following +pattern will give best results. +Shallow or one level nested objects on the other hand will slow down with it. +It is entirely dependant on the use case. + +```js +const stringify = require('fast-safe-stringify') + +function tryJSONStringify (obj) { + try { return JSON.stringify(obj) } catch (_) {} +} + +const serializedString = tryJSONStringify(deep) || stringify(deep) +``` + +## Acknowledgements + +Sponsored by [nearForm](http://nearform.com) + +## License + +MIT + +[`replacer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20replacer%20parameter +[`safe-stable-stringify`]: https://github.com/BridgeAR/safe-stable-stringify +[`space`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20space%20argument +[`toJSON`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior +[benchmark]: https://github.com/epoberezkin/fast-json-stable-stringify/blob/67f688f7441010cfef91a6147280cc501701e83b/benchmark +[JSON.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify diff --git a/node_modules/fast-safe-stringify/test-stable.js b/node_modules/fast-safe-stringify/test-stable.js new file mode 100644 index 0000000..93d8bc4 --- /dev/null +++ b/node_modules/fast-safe-stringify/test-stable.js @@ -0,0 +1,311 @@ +const test = require('tap').test +const fss = require('./').stable +const clone = require('clone') +const s = JSON.stringify + +test('circular reference to root', function (assert) { + const fixture = { name: 'Tywin Lannister' } + fixture.circle = fixture + const expected = s( + { circle: '[Circular]', name: 'Tywin Lannister' } + ) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('circular getter reference to root', function (assert) { + const fixture = { + name: 'Tywin Lannister', + get circle () { + return fixture + } + } + + const expected = s( + { circle: '[Circular]', name: 'Tywin Lannister' } + ) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested circular reference to root', function (assert) { + const fixture = { name: 'Tywin Lannister' } + fixture.id = { circle: fixture } + const expected = s( + { id: { circle: '[Circular]' }, name: 'Tywin Lannister' } + ) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('child circular reference', function (assert) { + const fixture = { name: 'Tywin Lannister', child: { name: 'Tyrion Lannister' } } + fixture.child.dinklage = fixture.child + const expected = s({ + child: { + dinklage: '[Circular]', name: 'Tyrion Lannister' + }, + name: 'Tywin Lannister' + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested child circular reference', function (assert) { + const fixture = { name: 'Tywin Lannister', child: { name: 'Tyrion Lannister' } } + fixture.child.actor = { dinklage: fixture.child } + const expected = s({ + child: { + actor: { dinklage: '[Circular]' }, name: 'Tyrion Lannister' + }, + name: 'Tywin Lannister' + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('circular objects in an array', function (assert) { + const fixture = { name: 'Tywin Lannister' } + fixture.hand = [fixture, fixture] + const expected = s({ + hand: ['[Circular]', '[Circular]'], name: 'Tywin Lannister' + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested circular references in an array', function (assert) { + const fixture = { + name: 'Tywin Lannister', + offspring: [{ name: 'Tyrion Lannister' }, { name: 'Cersei Lannister' }] + } + fixture.offspring[0].dinklage = fixture.offspring[0] + fixture.offspring[1].headey = fixture.offspring[1] + + const expected = s({ + name: 'Tywin Lannister', + offspring: [ + { dinklage: '[Circular]', name: 'Tyrion Lannister' }, + { headey: '[Circular]', name: 'Cersei Lannister' } + ] + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('circular arrays', function (assert) { + const fixture = [] + fixture.push(fixture, fixture) + const expected = s(['[Circular]', '[Circular]']) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested circular arrays', function (assert) { + const fixture = [] + fixture.push( + { name: 'Jon Snow', bastards: fixture }, + { name: 'Ramsay Bolton', bastards: fixture } + ) + const expected = s([ + { bastards: '[Circular]', name: 'Jon Snow' }, + { bastards: '[Circular]', name: 'Ramsay Bolton' } + ]) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('repeated non-circular references in objects', function (assert) { + const daenerys = { name: 'Daenerys Targaryen' } + const fixture = { + motherOfDragons: daenerys, + queenOfMeereen: daenerys + } + const expected = s(fixture) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('repeated non-circular references in arrays', function (assert) { + const daenerys = { name: 'Daenerys Targaryen' } + const fixture = [daenerys, daenerys] + const expected = s(fixture) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('double child circular reference', function (assert) { + // create circular reference + const child = { name: 'Tyrion Lannister' } + child.dinklage = child + + // include it twice in the fixture + const fixture = { name: 'Tywin Lannister', childA: child, childB: child } + const cloned = clone(fixture) + const expected = s({ + childA: { + dinklage: '[Circular]', name: 'Tyrion Lannister' + }, + childB: { + dinklage: '[Circular]', name: 'Tyrion Lannister' + }, + name: 'Tywin Lannister' + }) + const actual = fss(fixture) + assert.is(actual, expected) + + // check if the fixture has not been modified + assert.deepEqual(fixture, cloned) + assert.end() +}) + +test('child circular reference with toJSON', function (assert) { + // Create a test object that has an overriden `toJSON` property + TestObject.prototype.toJSON = function () { return { special: 'case' } } + function TestObject (content) {} + + // Creating a simple circular object structure + const parentObject = {} + parentObject.childObject = new TestObject() + parentObject.childObject.parentObject = parentObject + + // Creating a simple circular object structure + const otherParentObject = new TestObject() + otherParentObject.otherChildObject = {} + otherParentObject.otherChildObject.otherParentObject = otherParentObject + + // Making sure our original tests work + assert.deepEqual(parentObject.childObject.parentObject, parentObject) + assert.deepEqual(otherParentObject.otherChildObject.otherParentObject, otherParentObject) + + // Should both be idempotent + assert.equal(fss(parentObject), '{"childObject":{"special":"case"}}') + assert.equal(fss(otherParentObject), '{"special":"case"}') + + // Therefore the following assertion should be `true` + assert.deepEqual(parentObject.childObject.parentObject, parentObject) + assert.deepEqual(otherParentObject.otherChildObject.otherParentObject, otherParentObject) + + assert.end() +}) + +test('null object', function (assert) { + const expected = s(null) + const actual = fss(null) + assert.is(actual, expected) + assert.end() +}) + +test('null property', function (assert) { + const expected = s({ f: null }) + const actual = fss({ f: null }) + assert.is(actual, expected) + assert.end() +}) + +test('nested child circular reference in toJSON', function (assert) { + var circle = { some: 'data' } + circle.circle = circle + var a = { + b: { + toJSON: function () { + a.b = 2 + return '[Redacted]' + } + }, + baz: { + circle, + toJSON: function () { + a.baz = circle + return '[Redacted]' + } + } + } + var o = { + a, + bar: a + } + + const expected = s({ + a: { + b: '[Redacted]', + baz: '[Redacted]' + }, + bar: { + // TODO: This is a known limitation of the current implementation. + // The ideal result would be: + // + // b: 2, + // baz: { + // circle: '[Circular]', + // some: 'data' + // } + // + b: '[Redacted]', + baz: '[Redacted]' + } + }) + const actual = fss(o) + assert.is(actual, expected) + assert.end() +}) + +test('circular getters are restored when stringified', function (assert) { + const fixture = { + name: 'Tywin Lannister', + get circle () { + return fixture + } + } + fss(fixture) + + assert.is(fixture.circle, fixture) + assert.end() +}) + +test('non-configurable circular getters use a replacer instead of markers', function (assert) { + const fixture = { name: 'Tywin Lannister' } + Object.defineProperty(fixture, 'circle', { + configurable: false, + get: function () { return fixture }, + enumerable: true + }) + + fss(fixture) + + assert.is(fixture.circle, fixture) + assert.end() +}) + +test('getter child circular reference', function (assert) { + const fixture = { + name: 'Tywin Lannister', + child: { + name: 'Tyrion Lannister', + get dinklage () { return fixture.child } + }, + get self () { return fixture } + } + + const expected = s({ + child: { + dinklage: '[Circular]', name: 'Tyrion Lannister' + }, + name: 'Tywin Lannister', + self: '[Circular]' + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) diff --git a/node_modules/fast-safe-stringify/test.js b/node_modules/fast-safe-stringify/test.js new file mode 100644 index 0000000..7da5821 --- /dev/null +++ b/node_modules/fast-safe-stringify/test.js @@ -0,0 +1,304 @@ +const test = require('tap').test +const fss = require('./') +const clone = require('clone') +const s = JSON.stringify + +test('circular reference to root', function (assert) { + const fixture = { name: 'Tywin Lannister' } + fixture.circle = fixture + const expected = s( + { name: 'Tywin Lannister', circle: '[Circular]' } + ) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('circular getter reference to root', function (assert) { + const fixture = { + name: 'Tywin Lannister', + get circle () { + return fixture + } + } + const expected = s( + { name: 'Tywin Lannister', circle: '[Circular]' } + ) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested circular reference to root', function (assert) { + const fixture = { name: 'Tywin Lannister' } + fixture.id = { circle: fixture } + const expected = s( + { name: 'Tywin Lannister', id: { circle: '[Circular]' } } + ) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('child circular reference', function (assert) { + const fixture = { name: 'Tywin Lannister', child: { name: 'Tyrion Lannister' } } + fixture.child.dinklage = fixture.child + const expected = s({ + name: 'Tywin Lannister', + child: { + name: 'Tyrion Lannister', dinklage: '[Circular]' + } + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested child circular reference', function (assert) { + const fixture = { name: 'Tywin Lannister', child: { name: 'Tyrion Lannister' } } + fixture.child.actor = { dinklage: fixture.child } + const expected = s({ + name: 'Tywin Lannister', + child: { + name: 'Tyrion Lannister', actor: { dinklage: '[Circular]' } + } + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('circular objects in an array', function (assert) { + const fixture = { name: 'Tywin Lannister' } + fixture.hand = [fixture, fixture] + const expected = s({ + name: 'Tywin Lannister', hand: ['[Circular]', '[Circular]'] + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested circular references in an array', function (assert) { + const fixture = { + name: 'Tywin Lannister', + offspring: [{ name: 'Tyrion Lannister' }, { name: 'Cersei Lannister' }] + } + fixture.offspring[0].dinklage = fixture.offspring[0] + fixture.offspring[1].headey = fixture.offspring[1] + + const expected = s({ + name: 'Tywin Lannister', + offspring: [ + { name: 'Tyrion Lannister', dinklage: '[Circular]' }, + { name: 'Cersei Lannister', headey: '[Circular]' } + ] + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('circular arrays', function (assert) { + const fixture = [] + fixture.push(fixture, fixture) + const expected = s(['[Circular]', '[Circular]']) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('nested circular arrays', function (assert) { + const fixture = [] + fixture.push( + { name: 'Jon Snow', bastards: fixture }, + { name: 'Ramsay Bolton', bastards: fixture } + ) + const expected = s([ + { name: 'Jon Snow', bastards: '[Circular]' }, + { name: 'Ramsay Bolton', bastards: '[Circular]' } + ]) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('repeated non-circular references in objects', function (assert) { + const daenerys = { name: 'Daenerys Targaryen' } + const fixture = { + motherOfDragons: daenerys, + queenOfMeereen: daenerys + } + const expected = s(fixture) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('repeated non-circular references in arrays', function (assert) { + const daenerys = { name: 'Daenerys Targaryen' } + const fixture = [daenerys, daenerys] + const expected = s(fixture) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) + +test('double child circular reference', function (assert) { + // create circular reference + const child = { name: 'Tyrion Lannister' } + child.dinklage = child + + // include it twice in the fixture + const fixture = { name: 'Tywin Lannister', childA: child, childB: child } + const cloned = clone(fixture) + const expected = s({ + name: 'Tywin Lannister', + childA: { + name: 'Tyrion Lannister', dinklage: '[Circular]' + }, + childB: { + name: 'Tyrion Lannister', dinklage: '[Circular]' + } + }) + const actual = fss(fixture) + assert.is(actual, expected) + + // check if the fixture has not been modified + assert.deepEqual(fixture, cloned) + assert.end() +}) + +test('child circular reference with toJSON', function (assert) { + // Create a test object that has an overriden `toJSON` property + TestObject.prototype.toJSON = function () { return { special: 'case' } } + function TestObject (content) {} + + // Creating a simple circular object structure + const parentObject = {} + parentObject.childObject = new TestObject() + parentObject.childObject.parentObject = parentObject + + // Creating a simple circular object structure + const otherParentObject = new TestObject() + otherParentObject.otherChildObject = {} + otherParentObject.otherChildObject.otherParentObject = otherParentObject + + // Making sure our original tests work + assert.deepEqual(parentObject.childObject.parentObject, parentObject) + assert.deepEqual(otherParentObject.otherChildObject.otherParentObject, otherParentObject) + + // Should both be idempotent + assert.equal(fss(parentObject), '{"childObject":{"special":"case"}}') + assert.equal(fss(otherParentObject), '{"special":"case"}') + + // Therefore the following assertion should be `true` + assert.deepEqual(parentObject.childObject.parentObject, parentObject) + assert.deepEqual(otherParentObject.otherChildObject.otherParentObject, otherParentObject) + + assert.end() +}) + +test('null object', function (assert) { + const expected = s(null) + const actual = fss(null) + assert.is(actual, expected) + assert.end() +}) + +test('null property', function (assert) { + const expected = s({ f: null }) + const actual = fss({ f: null }) + assert.is(actual, expected) + assert.end() +}) + +test('nested child circular reference in toJSON', function (assert) { + const circle = { some: 'data' } + circle.circle = circle + const a = { + b: { + toJSON: function () { + a.b = 2 + return '[Redacted]' + } + }, + baz: { + circle, + toJSON: function () { + a.baz = circle + return '[Redacted]' + } + } + } + const o = { + a, + bar: a + } + + const expected = s({ + a: { + b: '[Redacted]', + baz: '[Redacted]' + }, + bar: { + b: 2, + baz: { + some: 'data', + circle: '[Circular]' + } + } + }) + const actual = fss(o) + assert.is(actual, expected) + assert.end() +}) + +test('circular getters are restored when stringified', function (assert) { + const fixture = { + name: 'Tywin Lannister', + get circle () { + return fixture + } + } + fss(fixture) + + assert.is(fixture.circle, fixture) + assert.end() +}) + +test('non-configurable circular getters use a replacer instead of markers', function (assert) { + const fixture = { name: 'Tywin Lannister' } + Object.defineProperty(fixture, 'circle', { + configurable: false, + get: function () { return fixture }, + enumerable: true + }) + + fss(fixture) + + assert.is(fixture.circle, fixture) + assert.end() +}) + +test('getter child circular reference are replaced instead of marked', function (assert) { + const fixture = { + name: 'Tywin Lannister', + child: { + name: 'Tyrion Lannister', + get dinklage () { return fixture.child } + }, + get self () { return fixture } + } + + const expected = s({ + name: 'Tywin Lannister', + child: { + name: 'Tyrion Lannister', dinklage: '[Circular]' + }, + self: '[Circular]' + }) + const actual = fss(fixture) + assert.is(actual, expected) + assert.end() +}) diff --git a/node_modules/flatstr/LICENSE b/node_modules/flatstr/LICENSE new file mode 100644 index 0000000..b5d3b6e --- /dev/null +++ b/node_modules/flatstr/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 David Mark Clements + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/flatstr/alt-benchmark.js b/node_modules/flatstr/alt-benchmark.js new file mode 100644 index 0000000..b9eb819 --- /dev/null +++ b/node_modules/flatstr/alt-benchmark.js @@ -0,0 +1,234 @@ +'use strict' +var nul = process.platform === 'win32' ? '\\\\.\\NUL' : '/dev/null' +var bench = require('fastbench') +var stream = require('fs').createWriteStream(nul) +var alt0 = require('./') +var largeStr = JSON.stringify(require('./package.json')) +largeStr += largeStr +largeStr += largeStr + +var run = bench([ + function alt0ManySmallConcats (cb) { + stream.write(alt0(makeStr('a', 200))) + setImmediate(cb) + }, + function alt1ManySmallConcats (cb) { + stream.write(alt1(makeStr('a', 200))) + setImmediate(cb) + }, + function alt2ManySmallConcats (cb) { + stream.write(alt2(makeStr('a', 200))) + setImmediate(cb) + }, + function alt3ManySmallConcats (cb) { + stream.write(alt3(makeStr('a', 200))) + setImmediate(cb) + }, + function alt4ManySmallConcats (cb) { + stream.write(alt4(makeStr('a', 200))) + setImmediate(cb) + }, + function alt5ManySmallConcats (cb) { + stream.write(alt5(makeStr('a', 200))) + setImmediate(cb) + }, + function alt6ManySmallConcats (cb) { + stream.write(alt6(makeStr('a', 200))) + setImmediate(cb) + }, + function alt7ManySmallConcats (cb) { + stream.write(alt7(makeStr('a', 200))) + setImmediate(cb) + }, + function alt8ManySmallConcats (cb) { + stream.write(alt8(makeStr('a', 200))) + setImmediate(cb) + }, + function alt9ManySmallConcats (cb) { + stream.write(alt9(makeStr('a', 200))) + setImmediate(cb) + }, + function alt0SeveralLargeConcats (cb) { + stream.write(alt0(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt1SeveralLargeConcats (cb) { + stream.write(alt1(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt2SeveralLargeConcats (cb) { + stream.write(alt2(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt3SeveralLargeConcats (cb) { + stream.write(alt3(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt4SeveralLargeConcats (cb) { + stream.write(alt4(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt5SeveralLargeConcats (cb) { + stream.write(alt5(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt6SeveralLargeConcats (cb) { + stream.write(alt6(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt7SeveralLargeConcats (cb) { + stream.write(alt7(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt8SeveralLargeConcats (cb) { + stream.write(alt8(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt9SeveralLargeConcats (cb) { + stream.write(alt9(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function alt0ExponentialSmallConcats (cb) { + stream.write(alt0(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt1ExponentialSmallConcats (cb) { + stream.write(alt1(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt2ExponentialSmallConcats (cb) { + stream.write(alt2(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt3ExponentialSmallConcats (cb) { + stream.write(alt3(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt4ExponentialSmallConcats (cb) { + stream.write(alt4(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt5ExponentialSmallConcats (cb) { + stream.write(alt5(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt6ExponentialSmallConcats (cb) { + stream.write(alt6(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt7ExponentialSmallConcats (cb) { + stream.write(alt7(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt8ExponentialSmallConcats (cb) { + stream.write(alt8(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt9ExponentialSmallConcats (cb) { + stream.write(alt9(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function alt0ExponentialLargeConcats (cb) { + stream.write(alt0(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt1ExponentialLargeConcats (cb) { + stream.write(alt1(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt2ExponentialLargeConcats (cb) { + stream.write(alt2(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt3ExponentialLargeConcats (cb) { + stream.write(alt3(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt4ExponentialLargeConcats (cb) { + stream.write(alt4(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt5ExponentialLargeConcats (cb) { + stream.write(alt5(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt6ExponentialLargeConcats (cb) { + stream.write(alt6(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt7ExponentialLargeConcats (cb) { + stream.write(alt7(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt8ExponentialLargeConcats (cb) { + stream.write(alt8(makeExpoStr(largeStr, 7))) + setImmediate(cb) + }, + function alt9ExponentialLargeConcats (cb) { + stream.write(alt9(makeExpoStr(largeStr, 7))) + setImmediate(cb) + } +], 10000) + +run(run) + +var rx = /()/ +function alt1 (s) { + rx.test(s) + return s +} +function alt2 (s) { + rx.exec(s) + return s +} + +function alt3 (s) { + s | 0 + return s +} + +function alt4 (s) { + ~s + return s +} + +function alt5 (s) { + escape(s) + return s +} + +function alt6 (s) { + unescape(s) + return s +} + +function alt7 (s) { + parseInt(s, 10) + return s +} + +function alt8 (s) { + parseFloat(s) + return s +} + +function alt9 (s) { + alt9[s] = null + return s +} + +function makeStr (str, concats) { + var s = '' + while (concats--) { + s += str + } + return s +} + +function makeExpoStr (str, concats) { + var s = str + while (concats--) { + s += s + } + return s +} diff --git a/node_modules/flatstr/benchmark.js b/node_modules/flatstr/benchmark.js new file mode 100644 index 0000000..b2122c7 --- /dev/null +++ b/node_modules/flatstr/benchmark.js @@ -0,0 +1,61 @@ +'use strict' +var nul = process.platform === 'win32' ? '\\\\.\\NUL' : '/dev/null' +var bench = require('fastbench') +var stream = require('fs').createWriteStream(nul) +var flatstr = require('./') +var largeStr = JSON.stringify(require('./package.json')) +largeStr += largeStr +largeStr += largeStr + +var run = bench([ + function unflattenedManySmallConcats (cb) { + stream.write(makeStr('a', 200)) + setImmediate(cb) + }, + function flattenedManySmallConcats (cb) { + stream.write(flatstr(makeStr('a', 200))) + setImmediate(cb) + }, + function unflattenedSeveralLargeConcats (cb) { + stream.write(makeStr(largeStr, 10)) + setImmediate(cb) + }, + function flattenedSeveralLargeConcats (cb) { + stream.write(flatstr(makeStr(largeStr, 10))) + setImmediate(cb) + }, + function unflattenedExponentialSmallConcats (cb) { + stream.write(makeExpoStr('a', 12)) + setImmediate(cb) + }, + function flattenedExponentialSmallConcats (cb) { + stream.write(flatstr(makeExpoStr('a', 12))) + setImmediate(cb) + }, + function unflattenedExponentialLargeConcats (cb) { + stream.write(makeExpoStr(largeStr, 7)) + setImmediate(cb) + }, + function flattenedExponentialLargeConcats (cb) { + stream.write(flatstr(makeExpoStr(largeStr, 7))) + setImmediate(cb) + } +], 10000) + +run(run) + +function makeStr (str, concats) { + var s = '' + while (concats--) { + s += str + } + return s +} + +function makeExpoStr (str, concats) { + var s = str + while (concats--) { + s += s + } + return s +} diff --git a/node_modules/flatstr/index.js b/node_modules/flatstr/index.js new file mode 100644 index 0000000..0513eb1 --- /dev/null +++ b/node_modules/flatstr/index.js @@ -0,0 +1,15 @@ +'use strict' + +// You may be tempted to copy and paste this, +// but take a look at the commit history first, +// this is a moving target so relying on the module +// is the best way to make sure the optimization +// method is kept up to date and compatible with +// every Node version. + +function flatstr (s) { + s | 0 + return s +} + +module.exports = flatstr \ No newline at end of file diff --git a/node_modules/flatstr/package.json b/node_modules/flatstr/package.json new file mode 100644 index 0000000..b403596 --- /dev/null +++ b/node_modules/flatstr/package.json @@ -0,0 +1,58 @@ +{ + "_from": "flatstr@^1.0.12", + "_id": "flatstr@1.0.12", + "_inBundle": false, + "_integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==", + "_location": "/flatstr", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "flatstr@^1.0.12", + "name": "flatstr", + "escapedName": "flatstr", + "rawSpec": "^1.0.12", + "saveSpec": null, + "fetchSpec": "^1.0.12" + }, + "_requiredBy": [ + "/pino", + "/sonic-boom" + ], + "_resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", + "_shasum": "c2ba6a08173edbb6c9640e3055b95e287ceb5931", + "_spec": "flatstr@^1.0.12", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino", + "author": { + "name": "David Mark Clements" + }, + "browser": { + "v8": "./v8" + }, + "bugs": { + "url": "https://github.com/davidmarkclements/flatstr/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Flattens the underlying C structures of a concatenated JavaScript string", + "devDependencies": { + "fastbench": "^1.0.1", + "tap": "^12.0.1" + }, + "homepage": "https://github.com/davidmarkclements/flatstr#readme", + "license": "MIT", + "main": "index.js", + "name": "flatstr", + "repository": { + "type": "git", + "url": "git+https://github.com/davidmarkclements/flatstr.git" + }, + "tags": [ + "perf", + "performance", + "strings", + "concatenation" + ], + "version": "1.0.12" +} diff --git a/node_modules/flatstr/readme.md b/node_modules/flatstr/readme.md new file mode 100644 index 0000000..d8b77b3 --- /dev/null +++ b/node_modules/flatstr/readme.md @@ -0,0 +1,82 @@ +# flatstr + +Flattens the underlying C structures of a concatenated JavaScript string + +## About + +If you're doing lots of string concatenation and then writing that +string somewhere, you may find that passing your string through +`flatstr` vastly improves performance. + +## Usage + +```js +var flatstr = require('flatstr') +flatstr(someHeavilyConcatenatedString) +``` + +## Benchmarks + +Benchmarks test flat vs non-flat strings being written to +an `fs.WriteStream`. + +``` +unflattenedManySmallConcats*10000: 147.540ms +flattenedManySmallConcats*10000: 105.994ms +unflattenedSeveralLargeConcats*10000: 287.901ms +flattenedSeveralLargeConcats*10000: 226.121ms +unflattenedExponentialSmallConcats*10000: 410.533ms +flattenedExponentialSmallConcats*10000: 219.973ms +unflattenedExponentialLargeConcats*10000: 2774.230ms +flattenedExponentialLargeConcats*10000: 1862.815ms +``` + +In each case, flattened strings win, +here's the performance gains from using `flatstr` + +``` +ManySmallConcats: 28% +SeveralLargeConcats: 21% +ExponentialSmallConcats: 46% +ExponentialLargeConcats: 33% +``` + +## How does it work + +In the v8 C++ layer, JavaScript strings can be represented in two ways. + +1. As an array +2. As a tree + +When JavaScript strings are concatenated, tree structures are used +to represent them. For the concat operation, this is cheaper than +reallocating a larger array. However, performing other operations +on the tree structures can become costly (particularly where lots of +concatenation has occurred). + +V8 has a a method called `String::Flatten`which converts the tree into a C array. This method is typically called before operations that walk through the bytes of the string (for instance, when testing against a regular expression). It may also be called if a string is accessed many times over, +as an optimization on the string. However, strings aren't always flattened. One example is when we pass a string into a `WriteStream`, at some point the string will be converted to a buffer, and this may be expensive if the underlying representation is a tree. + +`String::Flatten` is not exposed as a JavaScript function, but it can be triggered as a side effect. + +There are several ways to indirectly call `String::Flatten` (see `alt-benchmark.js`), +but coercion to a number appears to be (one of) the cheapest. + +However since Node 10 the V8 version has stopped using Flatten in all +places identified. Thus the code has been updated to seamlessly +use the native runtime function `%FlattenString` without having to use +the `--allow-natives-syntax` flag directly. + +One final note: calling flatstr too much can in fact negatively effect performance. For instance, don't call it every time you concat (if that +was performant, v8 wouldn't be using trees in the first place). The best +place to use flatstr is just prior to passing it to an API that eventually +runs non-v8 code (such as `fs.WriteStream`, or perhaps `xhr` or DOM apis in the browser). + + +## Acknowledgements + +* Sponsored by nearForm + +## License + +MIT diff --git a/node_modules/flatstr/test.js b/node_modules/flatstr/test.js new file mode 100644 index 0000000..50efe8c --- /dev/null +++ b/node_modules/flatstr/test.js @@ -0,0 +1,26 @@ +'use strict' +var test = require('tap').test +var flatstr = require('.') + +test('does not throw', function (t) { + t.doesNotThrow(() => { + flatstr('abc') + }) + t.doesNotThrow(() => { + flatstr({}) + }) + t.doesNotThrow(() => { + flatstr(1) + }) + t.doesNotThrow(() => { + flatstr(null) + }) + t.end() +}) + +test('returns the same value that was passed in', function (t) { + var o = {} + t.is(flatstr('abc'), 'abc') + t.is(flatstr(o), o) + t.end() +}) diff --git a/node_modules/follow-redirects/LICENSE b/node_modules/follow-redirects/LICENSE new file mode 100644 index 0000000..742cbad --- /dev/null +++ b/node_modules/follow-redirects/LICENSE @@ -0,0 +1,18 @@ +Copyright 2014–present Olivier Lalonde , James Talmage , Ruben Verborgh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/follow-redirects/README.md b/node_modules/follow-redirects/README.md new file mode 100644 index 0000000..6d41337 --- /dev/null +++ b/node_modules/follow-redirects/README.md @@ -0,0 +1,155 @@ +## Follow Redirects + +Drop-in replacement for Nodes `http` and `https` that automatically follows redirects. + +[![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) +[![Build Status](https://travis-ci.org/follow-redirects/follow-redirects.svg?branch=master)](https://travis-ci.org/follow-redirects/follow-redirects) +[![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master) +[![Dependency Status](https://david-dm.org/follow-redirects/follow-redirects.svg)](https://david-dm.org/follow-redirects/follow-redirects) +[![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) + +`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback) + methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback) + modules, with the exception that they will seamlessly follow redirects. + +```javascript +var http = require('follow-redirects').http; +var https = require('follow-redirects').https; + +http.get('http://bit.ly/900913', function (response) { + response.on('data', function (chunk) { + console.log(chunk); + }); +}).on('error', function (err) { + console.error(err); +}); +``` + +You can inspect the final redirected URL through the `responseUrl` property on the `response`. +If no redirection happened, `responseUrl` is the original request URL. + +```javascript +https.request({ + host: 'bitly.com', + path: '/UHfDGO', +}, function (response) { + console.log(response.responseUrl); + // 'http://duckduckgo.com/robots.txt' +}); +``` + +## Options +### Global options +Global options are set directly on the `follow-redirects` module: + +```javascript +var followRedirects = require('follow-redirects'); +followRedirects.maxRedirects = 10; +followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB +``` + +The following global options are supported: + +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. + +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. + + +### Per-request options +Per-request options are set by passing an `options` object: + +```javascript +var url = require('url'); +var followRedirects = require('follow-redirects'); + +var options = url.parse('http://bit.ly/900913'); +options.maxRedirects = 10; +http.request(options); +``` + +In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback), +the following per-request options are supported: +- `followRedirects` (default: `true`) – whether redirects should be followed. + +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. + +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. + +- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }` + +- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object. + + +### Advanced usage +By default, `follow-redirects` will use the Node.js default implementations +of [`http`](https://nodejs.org/api/http.html) +and [`https`](https://nodejs.org/api/https.html). +To enable features such as caching and/or intermediate request tracking, +you might instead want to wrap `follow-redirects` around custom protocol implementations: + +```javascript +var followRedirects = require('follow-redirects').wrap({ + http: require('your-custom-http'), + https: require('your-custom-https'), +}); +``` + +Such custom protocols only need an implementation of the `request` method. + +## Browserify Usage + +Due to the way `XMLHttpRequest` works, the `browserify` versions of `http` and `https` already follow redirects. + If you are *only* targeting the browser, then this library has little value for you. If you want to write cross + platform code for node and the browser, `follow-redirects` provides a great solution for making the native node + modules behave the same as they do in browserified builds in the browser. To avoid bundling unnecessary code + you should tell browserify to swap out `follow-redirects` with the standard modules when bundling. + To make this easier, you need to change how you require the modules: + +```javascript +var http = require('follow-redirects/http'); +var https = require('follow-redirects/https'); +``` + +You can then replace `follow-redirects` in your browserify configuration like so: + +```javascript +"browser": { + "follow-redirects/http" : "http", + "follow-redirects/https" : "https" +} +``` + +The `browserify-http` module has not kept pace with node development, and no long behaves identically to the native + module when running in the browser. If you are experiencing problems, you may want to check out + [browserify-http-2](https://www.npmjs.com/package/http-browserify-2). It is more actively maintained and + attempts to address a few of the shortcomings of `browserify-http`. In that case, your browserify config should + look something like this: + +```javascript +"browser": { + "follow-redirects/http" : "browserify-http-2/http", + "follow-redirects/https" : "browserify-http-2/https" +} +``` + +## Contributing + +Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues) + detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied + by tests. You can run the test suite locally with a simple `npm test` command. + +## Debug Logging + +`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging + set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test + suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well. + +## Authors + +- Olivier Lalonde (olalonde@gmail.com) +- James Talmage (james@talmage.io) +- [Ruben Verborgh](https://ruben.verborgh.org/) + +## License + +[https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE](MIT License) diff --git a/node_modules/follow-redirects/http.js b/node_modules/follow-redirects/http.js new file mode 100644 index 0000000..695e356 --- /dev/null +++ b/node_modules/follow-redirects/http.js @@ -0,0 +1 @@ +module.exports = require("./").http; diff --git a/node_modules/follow-redirects/https.js b/node_modules/follow-redirects/https.js new file mode 100644 index 0000000..d21c921 --- /dev/null +++ b/node_modules/follow-redirects/https.js @@ -0,0 +1 @@ +module.exports = require("./").https; diff --git a/node_modules/follow-redirects/index.js b/node_modules/follow-redirects/index.js new file mode 100644 index 0000000..4d7297a --- /dev/null +++ b/node_modules/follow-redirects/index.js @@ -0,0 +1,322 @@ +var url = require("url"); +var http = require("http"); +var https = require("https"); +var assert = require("assert"); +var Writable = require("stream").Writable; +var debug = require("debug")("follow-redirects"); + +// RFC7231§4.2.1: Of the request methods defined by this specification, +// the GET, HEAD, OPTIONS, and TRACE methods are defined to be safe. +var SAFE_METHODS = { GET: true, HEAD: true, OPTIONS: true, TRACE: true }; + +// Create handlers that pass events from native requests +var eventHandlers = Object.create(null); +["abort", "aborted", "error", "socket", "timeout"].forEach(function (event) { + eventHandlers[event] = function (arg) { + this._redirectable.emit(event, arg); + }; +}); + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + options.headers = options.headers || {}; + this._options = options; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + self._processResponse(response); + }; + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Validate input and shift parameters if necessary + if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { + throw new Error("data should be a string, Buffer or Uint8Array"); + } + if (typeof encoding === "function") { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new Error("Request body larger than maxBodyLength limit")); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (typeof data === "function") { + callback = data; + data = encoding = null; + } + else if (typeof encoding === "function") { + callback = encoding; + encoding = null; + } + + // Write data and end + var currentRequest = this._currentRequest; + this.write(data || "", encoding, function () { + currentRequest.end(null, null, callback); + }); +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Proxy all other public ClientRequest methods +[ + "abort", "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", "setTimeout", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + this.emit("error", new Error("Unsupported protocol " + protocol)); + return; + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.substr(0, protocol.length - 1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + this._currentUrl = url.format(this._options); + + // Set up event handlers + request._redirectable = this; + for (var event in eventHandlers) { + /* istanbul ignore else */ + if (event) { + request.on(event, eventHandlers[event]); + } + } + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end. + var i = 0; + var buffers = this._requestBodyBuffers; + (function writeNext() { + if (i < buffers.length) { + var buffer = buffers[i++]; + request.write(buffer.data, buffer.encoding, writeNext); + } + else { + request.end(); + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: response.statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + var location = response.headers.location; + if (location && this._options.followRedirects !== false && + response.statusCode >= 300 && response.statusCode < 400) { + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + this.emit("error", new Error("Max redirects exceeded.")); + return; + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe […], + // since the user might not wish to redirect an unsafe request. + // RFC7231§6.4.7: The 307 (Temporary Redirect) status code indicates + // that the target resource resides temporarily under a different URI + // and the user agent MUST NOT change the request method + // if it performs an automatic redirection to that URI. + var header; + var headers = this._options.headers; + if (response.statusCode !== 307 && !(this._options.method in SAFE_METHODS)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + for (header in headers) { + if (/^content-/i.test(header)) { + delete headers[header]; + } + } + } + + // Drop the Host header, as the redirect might lead to a different host + if (!this._isRedirect) { + for (header in headers) { + if (/^host$/i.test(header)) { + delete headers[header]; + } + } + } + + // Perform the redirected request + var redirectUrl = url.resolve(this._currentUrl, location); + debug("redirecting to", redirectUrl); + Object.assign(this._options, url.parse(redirectUrl)); + this._isRedirect = true; + this._performRequest(); + + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + } + else { + // The response is not a redirect; return it as-is + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + } +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + wrappedProtocol.request = function (options, callback) { + if (typeof options === "string") { + options = url.parse(options); + options.maxRedirects = exports.maxRedirects; + } + else { + options = Object.assign({ + protocol: protocol, + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, options); + } + options.nativeProtocols = nativeProtocols; + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + }; + + // Executes a GET request, following redirects + wrappedProtocol.get = function (options, callback) { + var request = wrappedProtocol.request(options, callback); + request.end(); + return request; + }; + }); + return exports; +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; diff --git a/node_modules/follow-redirects/package.json b/node_modules/follow-redirects/package.json new file mode 100644 index 0000000..b532b42 --- /dev/null +++ b/node_modules/follow-redirects/package.json @@ -0,0 +1,96 @@ +{ + "_from": "follow-redirects@1.5.10", + "_id": "follow-redirects@1.5.10", + "_inBundle": false, + "_integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "_location": "/follow-redirects", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "follow-redirects@1.5.10", + "name": "follow-redirects", + "escapedName": "follow-redirects", + "rawSpec": "1.5.10", + "saveSpec": null, + "fetchSpec": "1.5.10" + }, + "_requiredBy": [ + "/axios" + ], + "_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "_shasum": "7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a", + "_spec": "follow-redirects@1.5.10", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/axios", + "author": { + "name": "Ruben Verborgh", + "email": "ruben@verborgh.org", + "url": "https://ruben.verborgh.org/" + }, + "bugs": { + "url": "https://github.com/follow-redirects/follow-redirects/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Olivier Lalonde", + "email": "olalonde@gmail.com", + "url": "http://www.syskall.com" + }, + { + "name": "James Talmage", + "email": "james@talmage.io" + } + ], + "dependencies": { + "debug": "=3.1.0" + }, + "deprecated": false, + "description": "HTTP and HTTPS modules that follow redirects.", + "devDependencies": { + "concat-stream": "^1.6.0", + "coveralls": "^3.0.2", + "eslint": "^4.19.1", + "express": "^4.16.2", + "mocha": "^5.0.0", + "nyc": "^11.8.0" + }, + "engines": { + "node": ">=4.0" + }, + "files": [ + "index.js", + "create.js", + "http.js", + "https.js" + ], + "homepage": "https://github.com/follow-redirects/follow-redirects", + "keywords": [ + "http", + "https", + "url", + "redirect", + "client", + "location", + "utility" + ], + "license": "MIT", + "main": "index.js", + "name": "follow-redirects", + "nyc": { + "reporter": [ + "lcov", + "text" + ] + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/follow-redirects/follow-redirects.git" + }, + "scripts": { + "lint": "eslint *.js test", + "mocha": "nyc mocha", + "test": "npm run lint && npm run mocha" + }, + "version": "1.5.10" +} diff --git a/node_modules/luxon/README.md b/node_modules/luxon/README.md new file mode 100644 index 0000000..feaaeab --- /dev/null +++ b/node_modules/luxon/README.md @@ -0,0 +1,54 @@ +# Luxon + +[![MIT License][license-image]][license] [![Build Status][travis-image]][travis-url] [![NPM version][npm-version-image]][npm-url] [![Coverage Status][test-coverage-image]][test-coverage-url] [![Doc coverage][doc-coverage-image]][doc-url] [![PRs welcome][contributing-image]][contributing-url] + +Luxon is a library for working with dates and times in Javascript. + +```js +DateTime.local().setZone('America/New_York').minus({ weeks: 1 }).endOf('day').toISO(); +``` + +## Features + * DateTime, Duration, and Interval types. + * Immutable, chainable, unambiguous API. + * Parsing and formatting for common and custom formats. + * Native time zone and Intl support (no locale or tz files). + +## Download/install + +[Download/install instructions](https://moment.github.io/luxon/docs/manual/install.html) + +## Documentation + +* [General documentation][doc-url] +* [API docs](https://moment.github.io/luxon/docs/identifiers.html) +* [Quick tour](https://moment.github.io/luxon/docs/manual/tour.html) +* [For Moment users](https://moment.github.io/luxon/docs/manual/moment.html) +* [Why does Luxon exist?](https://moment.github.io/luxon/docs/manual/why.html) +* [A quick demo](https://moment.github.io/luxon/demo/global.html) + +## Development + +See [contributing](contributing.md). + +![Phasers to stun][phasers-image] + +[license-image]: http://img.shields.io/badge/license-MIT-blue.svg +[license]: license.md + +[travis-url]: http://travis-ci.org/moment/luxon +[travis-image]: https://api.travis-ci.org/moment/luxon.svg?branch=master + +[npm-url]: https://npmjs.org/package/luxon +[npm-version-image]: https://badge.fury.io/js/luxon.svg + +[doc-url]: https://moment.github.io/luxon/docs/ +[doc-coverage-image]: https://moment.github.io/luxon/docs/badge.svg + +[test-coverage-url]: https://codecov.io/gh/moment/luxon +[test-coverage-image]: https://codecov.io/gh/moment/luxon/branch/master/graph/badge.svg + +[contributing-url]: https://moment.github.io/luxon/docs/manual/contributing.html +[contributing-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg + +[phasers-image]: https://img.shields.io/badge/phasers-stun-brightgreen.svg diff --git a/node_modules/luxon/build/amd/luxon.js b/node_modules/luxon/build/amd/luxon.js new file mode 100644 index 0000000..dc69e08 --- /dev/null +++ b/node_modules/luxon/build/amd/luxon.js @@ -0,0 +1,8349 @@ +define(['exports'], function (exports) { 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _construct(Parent, args, Class) { + if (isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); + } + + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); + } + + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; + } + + // these aren't really private, but nor are they really useful to document + + /** + * @private + */ + var LuxonError = + /*#__PURE__*/ + function (_Error) { + _inheritsLoose(LuxonError, _Error); + + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + + return LuxonError; + }(_wrapNativeSuper(Error)); + /** + * @private + */ + + + var InvalidDateTimeError = + /*#__PURE__*/ + function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + + return InvalidDateTimeError; + }(LuxonError); + /** + * @private + */ + + var InvalidIntervalError = + /*#__PURE__*/ + function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + + return InvalidIntervalError; + }(LuxonError); + /** + * @private + */ + + var InvalidDurationError = + /*#__PURE__*/ + function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + + return InvalidDurationError; + }(LuxonError); + /** + * @private + */ + + var ConflictingSpecificationError = + /*#__PURE__*/ + function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + + return ConflictingSpecificationError; + }(LuxonError); + /** + * @private + */ + + var InvalidUnitError = + /*#__PURE__*/ + function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + + return InvalidUnitError; + }(LuxonError); + /** + * @private + */ + + var InvalidArgumentError = + /*#__PURE__*/ + function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + + return InvalidArgumentError; + }(LuxonError); + /** + * @private + */ + + var ZoneIsAbstractError = + /*#__PURE__*/ + function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + + return ZoneIsAbstractError; + }(LuxonError); + + /** + * @private + */ + var n = "numeric", + s = "short", + l = "long"; + var DATE_SHORT = { + year: n, + month: n, + day: n + }; + var DATE_MED = { + year: n, + month: s, + day: n + }; + var DATE_FULL = { + year: n, + month: l, + day: n + }; + var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l + }; + var TIME_SIMPLE = { + hour: n, + minute: n + }; + var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n + }; + var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + var TIME_24_SIMPLE = { + hour: n, + minute: n, + hour12: false + }; + /** + * {@link toLocaleString}; format like '09:30:23', always 24-hour. + */ + + var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hour12: false + }; + /** + * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour. + */ + + var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: s + }; + /** + * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour. + */ + + var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: l + }; + /** + * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + */ + + var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n + }; + /** + * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + */ + + var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n + }; + var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n + }; + var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s + }; + var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l + }; + var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + + /* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. + */ + /** + * @private + */ + // TYPES + + function isUndefined(o) { + return typeof o === "undefined"; + } + function isNumber(o) { + return typeof o === "number"; + } + function isInteger(o) { + return typeof o === "number" && o % 1 === 0; + } + function isString(o) { + return typeof o === "string"; + } + function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; + } // CAPABILITIES + + function hasIntl() { + try { + return typeof Intl !== "undefined" && Intl.DateTimeFormat; + } catch (e) { + return false; + } + } + function hasFormatToParts() { + return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); + } + function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } + } // OBJECTS AND ARRAYS + + function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; + } + function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; + } + function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); + } + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } // NUMBERS AND STRINGS + + function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; + } // x % n but takes the sign of n instead of x + + function floorMod(x, n) { + return x - n * Math.floor(x / n); + } + function padStart(input, n) { + if (n === void 0) { + n = 2; + } + + if (input.toString().length < n) { + return ("0".repeat(n) + input).slice(-n); + } else { + return input.toString(); + } + } + function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } + } + function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } + } + function roundTo(number, digits, towardZero) { + if (towardZero === void 0) { + towardZero = false; + } + + var factor = Math.pow(10, digits), + rounder = towardZero ? Math.trunc : Math.round; + return rounder(number * factor) / factor; + } // DATE BASICS + + function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + } + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } + } // covert a calendar object to a local timestamp (epoch, but with the offset baked in) + + function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + + return +d; + } + function weeksInWeekYear(weekYear) { + var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, + last = weekYear - 1, + p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; + return p1 === 4 || p2 === 3 ? 53 : 52; + } + function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > 60 ? 1900 + year : 2000 + year; + } // PARSING + + function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + + var date = new Date(ts), + intlOpts = { + hour12: false, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + var modified = Object.assign({ + timeZoneName: offsetFormat + }, intlOpts), + intl = hasIntl(); + + if (intl && hasFormatToParts()) { + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; + } else if (intl) { + // this probably doesn't work for all locales + var without = new Intl.DateTimeFormat(locale, intlOpts).format(date), + included = new Intl.DateTimeFormat(locale, modified).format(date), + diffed = included.substring(without.length), + trimmed = diffed.replace(/^[, \u200e]+/, ""); + return trimmed; + } else { + return null; + } + } // signedOffset('-5', '30') -> -330 + + function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); // don't || this because we want to preserve -0 + + if (Number.isNaN(offHour)) { + offHour = 0; + } + + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; + } // COERCION + + function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; + } + function normalizeObject(obj, normalizer, nonUnitKeys) { + var normalized = {}; + + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + if (nonUnitKeys.indexOf(u) >= 0) continue; + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + + return normalized; + } + function formatOffset(offset, format) { + var hours = Math.trunc(offset / 60), + minutes = Math.abs(offset % 60), + sign = hours >= 0 && !Object.is(hours, -0) ? "+" : "-", + base = "" + sign + Math.abs(hours); + + switch (format) { + case "short": + return "" + sign + padStart(Math.abs(hours), 2) + ":" + padStart(minutes, 2); + + case "narrow": + return minutes > 0 ? base + ":" + minutes : base; + + case "techie": + return "" + sign + padStart(Math.abs(hours), 2) + padStart(minutes, 2); + + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } + } + function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); + } + var ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; + + function stringify(obj) { + return JSON.stringify(obj, Object.keys(obj).sort()); + } + /** + * @private + */ + + + var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + function months(length) { + switch (length) { + case "narrow": + return monthsNarrow; + + case "short": + return monthsShort; + + case "long": + return monthsLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + + default: + return null; + } + } + var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; + var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + function weekdays(length) { + switch (length) { + case "narrow": + return weekdaysNarrow; + + case "short": + return weekdaysShort; + + case "long": + return weekdaysLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + + default: + return null; + } + } + var meridiems = ["AM", "PM"]; + var erasLong = ["Before Christ", "Anno Domini"]; + var erasShort = ["BC", "AD"]; + var erasNarrow = ["B", "A"]; + function eras(length) { + switch (length) { + case "narrow": + return erasNarrow; + + case "short": + return erasShort; + + case "long": + return erasLong; + + default: + return null; + } + } + function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; + } + function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; + } + function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; + } + function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; + } + function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + + if (narrow === void 0) { + narrow = false; + } + + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + + case 0: + return isDay ? "today" : "this " + units[unit][0]; + + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; + } + function formatString(knownFormat) { + // these all have the offsets removed because we don't have access to them + // without all the intl stuff this is backfilling + var filtered = pick(knownFormat, ["weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "hour12"]), + key = stringify(filtered), + dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; + + switch (key) { + case stringify(DATE_SHORT): + return "M/d/yyyy"; + + case stringify(DATE_MED): + return "LLL d, yyyy"; + + case stringify(DATE_FULL): + return "LLLL d, yyyy"; + + case stringify(DATE_HUGE): + return "EEEE, LLLL d, yyyy"; + + case stringify(TIME_SIMPLE): + return "h:mm a"; + + case stringify(TIME_WITH_SECONDS): + return "h:mm:ss a"; + + case stringify(TIME_WITH_SHORT_OFFSET): + return "h:mm a"; + + case stringify(TIME_WITH_LONG_OFFSET): + return "h:mm a"; + + case stringify(TIME_24_SIMPLE): + return "HH:mm"; + + case stringify(TIME_24_WITH_SECONDS): + return "HH:mm:ss"; + + case stringify(TIME_24_WITH_SHORT_OFFSET): + return "HH:mm"; + + case stringify(TIME_24_WITH_LONG_OFFSET): + return "HH:mm"; + + case stringify(DATETIME_SHORT): + return "M/d/yyyy, h:mm a"; + + case stringify(DATETIME_MED): + return "LLL d, yyyy, h:mm a"; + + case stringify(DATETIME_FULL): + return "LLLL d, yyyy, h:mm a"; + + case stringify(DATETIME_HUGE): + return dateTimeHuge; + + case stringify(DATETIME_SHORT_WITH_SECONDS): + return "M/d/yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_SECONDS): + return "LLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_WEEKDAY): + return "EEE, d LLL yyyy, h:mm a"; + + case stringify(DATETIME_FULL_WITH_SECONDS): + return "LLLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_HUGE_WITH_SECONDS): + return "EEEE, LLLL d, yyyy, h:mm:ss a"; + + default: + return dateTimeHuge; + } + } + + function stringifyTokens(splits, tokenToString) { + var s = ""; + + for (var _iterator = splits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var token = _ref; + + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + + return s; + } + + var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS + }; + /** + * @private + */ + + var Formatter = + /*#__PURE__*/ + function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + + return new Formatter(locale, opts); + }; + + Formatter.parseFormat = function parseFormat(fmt) { + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + + if (c === "'") { + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: false, + val: currentFull + }); + } + + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + return splits; + }; + + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + var _proto = Formatter.prototype; + + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + + var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTime = function formatDateTime(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.formatToParts(); + }; + + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.resolvedOptions(); + }; + + _proto.num = function num(n, p) { + if (p === void 0) { + p = 0; + } + + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + var opts = Object.assign({}, this.opts); + + if (p > 0) { + opts.padTo = p; + } + + return this.loc.numberFormatter(opts).format(n); + }; + + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hour12: true + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + + case "u": // falls through + + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + + case "s": + return _this.num(dt.second); + + case "ss": + return _this.num(dt.second, 2); + // minutes + + case "m": + return _this.num(dt.minute); + + case "mm": + return _this.num(dt.minute, 2); + // hours + + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + + case "H": + return _this.num(dt.hour); + + case "HH": + return _this.num(dt.hour, 2); + // offset + + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + + case "a": + return meridiem(); + // dates + + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + + case "c": + // like 1 + return _this.num(dt.weekday); + + case "ccc": + // like 'Tues' + return weekday("short", true); + + case "cccc": + // like 'Tuesday' + return weekday("long", true); + + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + + case "E": + // like 1 + return _this.num(dt.weekday); + + case "EEE": + // like 'Tues' + return weekday("short", false); + + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + + case "LLL": + // like Jan + return month("short", true); + + case "LLLL": + // like January + return month("long", true); + + case "LLLLL": + // like J + return month("narrow", true); + // months - format + + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + + case "MMM": + // like Jan + return month("short", false); + + case "MMMM": + // like January + return month("long", false); + + case "MMMMM": + // like J + return month("narrow", false); + // years + + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + + case "G": + // like AD + return era("short"); + + case "GG": + // like Anno Domini + return era("long"); + + case "GGGGG": + return era("narrow"); + + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + + case "kkkk": + return _this.num(dt.weekYear, 4); + + case "W": + return _this.num(dt.weekNumber); + + case "WW": + return _this.num(dt.weekNumber, 2); + + case "o": + return _this.num(dt.ordinal); + + case "ooo": + return _this.num(dt.ordinal, 3); + + case "q": + // like 1 + return _this.num(dt.quarter); + + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + + case "x": + return _this.num(dt.ts); + + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + return "hour"; + + case "d": + return "day"; + + case "M": + return "month"; + + case "y": + return "year"; + + default: + return null; + } + }, + tokenToString = function tokenToString(lildur) { + return function (token) { + var mapped = tokenToField(token); + + if (mapped) { + return _this2.num(lildur.get(mapped), token.length); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref2) { + var literal = _ref2.literal, + val = _ref2.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })); + + return stringifyTokens(tokens, tokenToString(collapsed)); + }; + + return Formatter; + }(); + + var Invalid = + /*#__PURE__*/ + function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + var _proto = Invalid.prototype; + + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + + return Invalid; + }(); + + /** + * @interface + */ + + var Zone = + /*#__PURE__*/ + function () { + function Zone() {} + + var _proto = Zone.prototype; + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + ; + + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + ; + + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + ; + + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + ; + + _createClass(Zone, [{ + key: "type", + + /** + * The type of zone + * @abstract + * @type {string} + */ + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * The name of this zone. + * @abstract + * @type {string} + */ + + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + + }, { + key: "universal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + + return Zone; + }(); + + var singleton = null; + /** + * Represents the local zone for this Javascript environment. + * @implements {Zone} + */ + + var LocalZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(LocalZone, _Zone); + + function LocalZone() { + return _Zone.apply(this, arguments) || this; + } + + var _proto = LocalZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "local"; + } + /** @override **/ + ; + + _createClass(LocalZone, [{ + key: "type", + + /** @override **/ + get: function get() { + return "local"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + if (hasIntl()) { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } else return "local"; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + + /** + * Get a singleton instance of the local zone + * @return {LocalZone} + */ + get: function get() { + if (singleton === null) { + singleton = new LocalZone(); + } + + return singleton; + } + }]); + + return LocalZone; + }(Zone); + + var matchingRegex = RegExp("^" + ianaRegex.source + "$"); + var dtfCache = {}; + + function makeDTF(zone) { + if (!dtfCache[zone]) { + dtfCache[zone] = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zone, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" + }); + } + + return dtfCache[zone]; + } + + var typeToPos = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5 + }; + + function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fHour = parsed[4], + fMinute = parsed[5], + fSecond = parsed[6]; + return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; + } + + function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date), + filled = []; + + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value, + pos = typeToPos[type]; + + if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + + return filled; + } + + var ianaZoneCache = {}; + /** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + + var IANAZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + if (!ianaZoneCache[name]) { + ianaZoneCache[name] = new IANAZone(name); + } + + return ianaZoneCache[name]; + } + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + ; + + IANAZone.resetCache = function resetCache() { + ianaZoneCache = {}; + dtfCache = {}; + } + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Fantasia/Castle") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return !!(s && s.match(matchingRegex)); + } + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidZone = function isValidZone(zone) { + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + } // Etc/GMT+8 -> -480 + + /** @ignore */ + ; + + IANAZone.parseGMTOffset = function parseGMTOffset(specifier) { + if (specifier) { + var match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); + + if (match) { + return -60 * parseInt(match[1]); + } + } + + return null; + }; + + function IANAZone(name) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.zoneName = name; + /** @private **/ + + _this.valid = IANAZone.isValidZone(name); + return _this; + } + /** @override **/ + + + var _proto = IANAZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + var date = new Date(ts), + dtf = makeDTF(this.name), + _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + hour = _ref2[3], + minute = _ref2[4], + second = _ref2[5], + adjustedHour = hour === 24 ? 0 : hour; + + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + /** @override **/ + ; + + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + + return IANAZone; + }(Zone); + + var singleton$1 = null; + /** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + + var FixedOffsetZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + ; + + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + + return null; + }; + + _createClass(FixedOffsetZone, null, [{ + key: "utcInstance", + + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + get: function get() { + if (singleton$1 === null) { + singleton$1 = new FixedOffsetZone(0); + } + + return singleton$1; + } + }]); + + function FixedOffsetZone(offset) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.fixed = offset; + return _this; + } + /** @override **/ + + + var _proto = FixedOffsetZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return this.name; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + /** @override **/ + ; + + /** @override **/ + _proto.offset = function offset() { + return this.fixed; + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + /** @override **/ + ; + + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + }, { + key: "universal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }]); + + return FixedOffsetZone; + }(Zone); + + /** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + + var InvalidZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + + function InvalidZone(zoneName) { + var _this; + + _this = _Zone.call(this) || this; + /** @private */ + + _this.zoneName = zoneName; + return _this; + } + /** @override **/ + + + var _proto = InvalidZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset() { + return ""; + } + /** @override **/ + ; + + _proto.offset = function offset() { + return NaN; + } + /** @override **/ + ; + + _proto.equals = function equals() { + return false; + } + /** @override **/ + ; + + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + + return InvalidZone; + }(Zone); + + /** + * @private + */ + function normalizeZone(input, defaultZone) { + var offset; + + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "local") return defaultZone;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) { + // handle Etc/GMT-4, which V8 chokes on + return FixedOffsetZone.instance(offset); + } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } + } + + var now = function now() { + return Date.now(); + }, + defaultZone = null, + // not setting this directly to LocalZone.instance bc loading order issues + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + throwOnInvalid = false; + /** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + + + var Settings = + /*#__PURE__*/ + function () { + function Settings() {} + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + }; + + _createClass(Settings, null, [{ + key: "now", + + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + get: function get() { + return now; + } + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + , + set: function set(n) { + now = n; + } + /** + * Get the default time zone to create DateTimes in. + * @type {string} + */ + + }, { + key: "defaultZoneName", + get: function get() { + return Settings.defaultZone.name; + } + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * @type {string} + */ + , + set: function set(z) { + if (!z) { + defaultZone = null; + } else { + defaultZone = normalizeZone(z); + } + } + /** + * Get the default time zone object to create DateTimes in. Does not affect existing instances. + * @type {Zone} + */ + + }, { + key: "defaultZone", + get: function get() { + return defaultZone || LocalZone.instance; + } + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(locale) { + defaultLocale = locale; + } + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + , + set: function set(t) { + throwOnInvalid = t; + } + }]); + + return Settings; + }(); + + var intlDTCache = {}; + + function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache[key]; + + if (!dtf) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache[key] = dtf; + } + + return dtf; + } + + var intlNumCache = {}; + + function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache[key]; + + if (!inf) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache[key] = inf; + } + + return inf; + } + + var intlRelCache = {}; + + function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var _opts = opts, + base = _opts.base, + cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, ["base"]); // exclude `base` from the options + + + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache[key]; + + if (!inf) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache[key] = inf; + } + + return inf; + } + + var sysLocaleCache = null; + + function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else if (hasIntl()) { + var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; // node sometimes defaults to "und". Override that because that is dumb + + sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; + return sysLocaleCache; + } else { + sysLocaleCache = "en-US"; + return sysLocaleCache; + } + } + + function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + var uIndex = localeStr.indexOf("-u-"); + + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var smaller = localeStr.substring(0, uIndex); + + try { + options = getCachedDTF(localeStr).resolvedOptions(); + } catch (e) { + options = getCachedDTF(smaller).resolvedOptions(); + } + + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; // return the smaller one so that we can append the calendar and numbering overrides to it + + return [smaller, numberingSystem, calendar]; + } + } + + function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (hasIntl()) { + if (outputCalendar || numberingSystem) { + localeStr += "-u"; + + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + + return localeStr; + } else { + return localeStr; + } + } else { + return []; + } + } + + function mapMonths(f) { + var ms = []; + + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2016, i, 1); + ms.push(f(dt)); + } + + return ms; + } + + function mapWeekdays(f) { + var ms = []; + + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + + return ms; + } + + function listStuff(loc, length, defaultOK, englishFn, intlFn) { + var mode = loc.listingMode(defaultOK); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } + } + + function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; + } + } + /** + * @private + */ + + + var PolyNumberFormatter = + /*#__PURE__*/ + function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + if (!forceSimple && hasIntl()) { + var intlOpts = { + useGrouping: false + }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + var _proto = PolyNumberFormatter.prototype; + + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + + return padStart(_fixed, this.padTo); + } + }; + + return PolyNumberFormatter; + }(); + /** + * @private + */ + + + var PolyDateFormatter = + /*#__PURE__*/ + function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.hasIntl = hasIntl(); + var z; + + if (dt.zone.universal && this.hasIntl) { + // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter, + // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374. + // So we have to make do. Two cases: + // 1. The format options tell us to show the zone. We can't do that, so the best + // we can do is format the date in UTC. + // 2. The format options don't tell us to show the zone. Then we can adjust them + // the time and tell the formatter to show it to us in UTC, so that the time is right + // and the bad zone doesn't show up. + // We can clean all this up when Chrome fixes this. + z = "UTC"; + + if (opts.timeZoneName) { + this.dt = dt; + } else { + this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000); + } + } else if (dt.zone.type === "local") { + this.dt = dt; + } else { + this.dt = dt; + z = dt.zone.name; + } + + if (this.hasIntl) { + var intlOpts = Object.assign({}, this.opts); + + if (z) { + intlOpts.timeZone = z; + } + + this.dtf = getCachedDTF(intl, intlOpts); + } + } + + var _proto2 = PolyDateFormatter.prototype; + + _proto2.format = function format() { + if (this.hasIntl) { + return this.dtf.format(this.dt.toJSDate()); + } else { + var tokenFormat = formatString(this.opts), + loc = Locale.create("en-US"); + return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); + } + }; + + _proto2.formatToParts = function formatToParts() { + if (this.hasIntl && hasFormatToParts()) { + return this.dtf.formatToParts(this.dt.toJSDate()); + } else { + // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings + // and IMO it's too weird to have an uncanny valley like that + return []; + } + }; + + _proto2.resolvedOptions = function resolvedOptions() { + if (this.hasIntl) { + return this.dtf.resolvedOptions(); + } else { + return { + locale: "en-US", + numberingSystem: "latn", + outputCalendar: "gregory" + }; + } + }; + + return PolyDateFormatter; + }(); + /** + * @private + */ + + + var PolyRelFormatter = + /*#__PURE__*/ + function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = Object.assign({ + style: "long" + }, opts); + + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + var _proto3 = PolyRelFormatter.prototype; + + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + + return PolyRelFormatter; + }(); + /** + * @private + */ + + + var Locale = + /*#__PURE__*/ + function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); + }; + + Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + + var specifiedLocale = locale || Settings.defaultLocale, + // the system locale is useful for human readable strings but annoying for parsing/formatting known formats + localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), + numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, + outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); + }; + + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache = {}; + intlNumCache = {}; + intlRelCache = {}; + }; + + Locale.fromObject = function fromObject(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + outputCalendar = _ref.outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar); + }; + + function Locale(locale, numbering, outputCalendar, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + var _proto4 = Locale.prototype; + + _proto4.listingMode = function listingMode(defaultOK) { + if (defaultOK === void 0) { + defaultOK = true; + } + + var intl = hasIntl(), + hasFTP = intl && hasFormatToParts(), + isActuallyEn = this.isEnglish(), + hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + + if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { + return "error"; + } else if (!hasFTP || isActuallyEn && hasNoWeirdness) { + return "en"; + } else { + return "intl"; + } + }; + + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false); + } + }; + + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: true + })); + }; + + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: false + })); + }; + + _proto4.months = function months$1(length, format, defaultOK) { + var _this = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, months, function () { + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this.monthsCache[formatStr][length]) { + _this.monthsCache[formatStr][length] = mapMonths(function (dt) { + return _this.extract(dt, intl, "month"); + }); + } + + return _this.monthsCache[formatStr][length]; + }); + }; + + _proto4.weekdays = function weekdays$1(length, format, defaultOK) { + var _this2 = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this2.weekdaysCache[formatStr][length]) { + _this2.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this2.extract(dt, intl, "weekday"); + }); + } + + return _this2.weekdaysCache[formatStr][length]; + }); + }; + + _proto4.meridiems = function meridiems$1(defaultOK) { + var _this3 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, undefined, defaultOK, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this3.meridiemCache) { + var intl = { + hour: "numeric", + hour12: true + }; + _this3.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this3.extract(dt, intl, "dayperiod"); + }); + } + + return _this3.meridiemCache; + }); + }; + + _proto4.eras = function eras$1(length, defaultOK) { + var _this4 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, eras, function () { + var intl = { + era: length + }; // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + + if (!_this4.eraCache[length]) { + _this4.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this4.extract(dt, intl, "era"); + }); + } + + return _this4.eraCache[length]; + }); + }; + + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); + }; + + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + }]); + + return Locale; + }(); + + /* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + + function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); + } + + function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + + return [Object.assign(mergedVals, val), mergedZone || zone, next]; + }, [{}, null, 1]).slice(0, 2); + }; + } + + function parse(s) { + if (s == null) { + return [null, null]; + } + + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + + if (m) { + return extractor(m); + } + } + + return [null, null]; + } + + function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + + return function (match, cursor) { + var ret = {}; + var i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + + return [ret, null, cursor + i]; + }; + } // ISO and SQL parsing + + + var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, + isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/, + isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + offsetRegex.source + "?"), + isoTimeExtensionRegex = RegExp("(?:T" + isoTimeRegex.source + ")?"), + isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, + isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, + isoOrdinalRegex = /(\d{4})-?(\d{3})/, + extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), + extractISOOrdinalData = simpleParse("year", "ordinal"), + sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, + // dumbed-down version of the ISO one + sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"), + sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); + + function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); + } + + function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; + } + + function extractISOTime(match, cursor) { + var item = { + hour: int(match, cursor, 0), + minute: int(match, cursor + 1, 0), + second: int(match, cursor + 2, 0), + millisecond: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; + } + + function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; + } + + function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; + } // ISO duration parsing + + + var isoDuration = /^P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})(?:[.,](-?\d{1,9}))?S)?)?)$/; + + function extractISODuration(match) { + var yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + return [{ + years: parseInteger(yearStr), + months: parseInteger(monthStr), + weeks: parseInteger(weekStr), + days: parseInteger(dayStr), + hours: parseInteger(hourStr), + minutes: parseInteger(minuteStr), + seconds: parseInteger(secondStr), + milliseconds: parseMillis(millisecondsStr) + }]; + } // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York + // and not just that we're in -240 *right now*. But since I don't think these are used that often + // I'm just going to ignore that + + + var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + + function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; + } // RFC 2822/5322 + + + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + + function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); + } // http date + + + var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + + function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + + function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + + var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); + var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); + var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); + var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset); + var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset); + var extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime); + var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); + /** + * @private + */ + + function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); + } + function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); + } + function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); + } + function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); + } + var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); + var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); + } + + var INVALID = "Invalid Duration"; // unit conversion constants + + var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = Object.assign({ + years: { + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = Object.assign({ + years: { + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix); // units ordered by size + + var orderedUnits = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; + var reverseUnits = orderedUnits.slice(0).reverse(); // clone really means "create another instance just like this one, but with these changes" + + function clone(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + + // deep merge for vals + var conf = { + values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy + }; + return new Duration(conf); + } + + function antiTrunc(n) { + return n < 0 ? Math.floor(n) : Math.ceil(n); + } // NB: mutates parameters + + + function convert(matrix, fromMap, fromUnit, toMap, toUnit) { + var conv = matrix[toUnit][fromUnit], + raw = fromMap[fromUnit] / conv, + sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), + // ok, so this is wild, but see the matrix in the tests + added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); + toMap[toUnit] += added; + fromMap[fromUnit] -= added * conv; + } // NB: mutates parameters + + + function normalizeValues(matrix, vals) { + reverseUnits.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + convert(matrix, vals, previous, vals, current); + } + + return current; + } else { + return previous; + } + }, null); + } + /** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. + * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + + + var Duration = + /*#__PURE__*/ + function () { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + /** + * @access private + */ + + this.values = config.values; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.matrix = accurate ? accurateMatrix : casualMatrix; + /** + * @access private + */ + + this.isLuxonDuration = true; + } + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject(Object.assign({ + milliseconds: count + }, opts)); + } + /** + * Create a Duration from a Javascript object with keys like 'years' and 'hours. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {string} [obj.locale='en-US'] - the locale to use + * @param {string} obj.numberingSystem - the numbering system to use + * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + Duration.fromObject = function fromObject(obj) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit, ["locale", "numberingSystem", "conversionAccuracy", "zone" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this + ]), + loc: Locale.fromObject(obj), + conversionAccuracy: obj.conversionAccuracy + }); + } + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + ; + + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + + if (parsed) { + var obj = Object.assign(parsed, opts); + return Duration.fromObject(obj); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + ; + + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + /** + * @private + */ + ; + + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + ; + + var _proto = Duration.prototype; + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = Object.assign({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID; + } + /** + * Returns a Javascript object with this Duration's values. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.values); + + if (opts.includeConfig) { + base.conversionAccuracy = this.conversionAccuracy; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + ; + + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.toISO(); + } + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.as("milliseconds"); + } + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration), + result = {}; + + for (var _iterator = orderedUnits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var k = _ref; + + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone(this, { + values: result + }, true); + } + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return this.plus(dur.negate()); + } + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + ; + + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + + for (var _i2 = 0, _Object$keys = Object.keys(this.values); _i2 < _Object$keys.length; _i2++) { + var k = _Object$keys[_i2]; + result[k] = asNumber(fn(this.values[k], k)); + } + + return clone(this, { + values: result + }, true); + } + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).years //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).months //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).days //=> 3 + * @return {number} + */ + ; + + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, [])); + return clone(this, { + values: mixed + }); + } + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + ; + + _proto.reconfigure = function reconfigure(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + locale = _ref2.locale, + numberingSystem = _ref2.numberingSystem, + conversionAccuracy = _ref2.conversionAccuracy; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }), + opts = { + loc: loc + }; + + if (conversionAccuracy) { + opts.conversionAccuracy = conversionAccuracy; + } + + return clone(this, opts); + } + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + ; + + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + /** + * Reduce this Duration to its canonical representation in its current units. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @return {Duration} + */ + ; + + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone(this, { + values: vals + }, true); + } + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + ; + + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + normalizeValues(this.matrix, vals); + + for (var _iterator2 = orderedUnits, _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i3 >= _iterator2.length) break; + _ref3 = _iterator2[_i3++]; + } else { + _i3 = _iterator2.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var k = _ref3; + + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; // anything we haven't boiled down yet should get boiled to this unit + + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } // plus anything that's already in this unit + + + if (isNumber(vals[k])) { + own += vals[k]; + } + + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = own - i; // we'd like to absorb these fractions in another unit + // plus anything further down the chain that should be rolled up in to this + + for (var down in vals) { + if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { + convert(this.matrix, vals, down, built, k); + } + } // otherwise, keep it in the wings to boil it later + + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + + + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + return clone(this, { + values: built + }, true).normalize(); + } + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + ; + + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + + for (var _i4 = 0, _Object$keys2 = Object.keys(this.values); _i4 < _Object$keys2.length; _i4++) { + var k = _Object$keys2[_i4]; + negated[k] = -this.values[k]; + } + + return clone(this, { + values: negated + }, true); + } + /** + * Get the years. + * @type {number} + */ + ; + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + for (var _iterator3 = orderedUnits, _isArray3 = Array.isArray(_iterator3), _i5 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref4; + + if (_isArray3) { + if (_i5 >= _iterator3.length) break; + _ref4 = _iterator3[_i5++]; + } else { + _i5 = _iterator3.next(); + if (_i5.done) break; + _ref4 = _i5.value; + } + + var u = _ref4; + + if (this.values[u] !== other.values[u]) { + return false; + } + } + + return true; + }; + + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + /** + * Get the quarters. + * @type {number} + */ + + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + /** + * Get the months. + * @type {number} + */ + + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + /** + * Get the weeks + * @type {number} + */ + + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + /** + * Get the days. + * @type {number} + */ + + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + /** + * Get the hours. + * @type {number} + */ + + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + /** + * Get the minutes. + * @type {number} + */ + + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + /** + * Get the seconds. + * @return {number} + */ + + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + /** + * Get the milliseconds. + * @return {number} + */ + + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Duration; + }(); + function friendlyDuration(durationish) { + if (isNumber(durationish)) { + return Duration.fromMillis(durationish); + } else if (Duration.isDuration(durationish)) { + return durationish; + } else if (typeof durationish === "object") { + return Duration.fromObject(durationish); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationish + " of type " + typeof durationish); + } + } + + var INVALID$1 = "Invalid Interval"; // checks if the start is equal to or before the end + + function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } + } + /** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. + * * **Accessors** Use {@link start} and {@link end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}. + * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs} + * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. + */ + + + var Interval = + /*#__PURE__*/ + function () { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + + this.e = config.end; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.isLuxonInterval = true; + } + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + + + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + ; + + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.after = function after(start, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.before = function before(end, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + ; + + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + + if (s && e) { + var start = DateTime.fromISO(s, opts), + end = DateTime.fromISO(e, opts); + + if (start.isValid && end.isValid) { + return Interval.fromDateTimes(start, end); + } + + if (start.isValid) { + var dur = Duration.fromISO(e, opts); + + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (end.isValid) { + var _dur = Duration.fromISO(s, opts); + + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + /** + * Returns the start of the Interval + * @type {DateTime} + */ + ; + + var _proto = Interval.prototype; + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @return {number} + */ + ; + + _proto.count = function count(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (!this.isValid) return NaN; + var start = this.start.startOf(unit), + end = this.end.startOf(unit); + return Math.floor(end.diff(start, unit).get(unit)) + 1; + } + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false; + } + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + ; + + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + ; + + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + /** + * Split this Interval at each of the specified DateTimes + * @param {...[DateTime]} dateTimes - the unit of time to count. + * @return {[Interval]} + */ + ; + + _proto.splitAt = function splitAt() { + var _this = this; + + if (!this.isValid) return []; + + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(), + results = []; + var s = this.s, + i = 0; + + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {[Interval]} + */ + ; + + _proto.splitBy = function splitBy(duration) { + var dur = friendlyDuration(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + var s = this.s, + added, + next; + var results = []; + + while (s < this.e) { + added = s.plus(dur); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + } + + return results; + } + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {[Interval]} + */ + ; + + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + /** + * Return whether this Interval engulfs the start and end of the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s > e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + + if (final) { + found.push(final); + } + + return found; + } + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.xor = function xor(intervals) { + var _Array$prototype; + + var start = null, + currentCount = 0; + + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + + for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var i = _ref3; + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {[Interval]} + */ + ; + + _proto.difference = function difference() { + var _this2 = this; + + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + ; + + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + /** + * Returns a string representation of this Interval formatted according to the specified format string. + * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. + * @param {Object} opts - options + * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref4 = _temp2 === void 0 ? {} : _temp2, + _ref4$separator = _ref4.separator, + separator = _ref4$separator === void 0 ? " – " : _ref4$separator; + + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + ; + + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + + return this.e.diff(this.s, unit, opts); + } + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + ; + + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + /** + * Returns the end of the Interval + * @type {DateTime} + */ + + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Interval; + }(); + + /** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + + var Info = + /*#__PURE__*/ + function () { + function Info() {} + + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + + var proto = DateTime.local().setZone(zone).set({ + month: 12 + }); + return !zone.universal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + ; + + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); + } + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone.isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + ; + + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {[string]} + */ + ; + + Info.months = function months(length, _temp) { + if (length === void 0) { + length = "long"; + } + + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$numberingSystem = _ref.numberingSystem, + numberingSystem = _ref$numberingSystem === void 0 ? null : _ref$numberingSystem, + _ref$outputCalendar = _ref.outputCalendar, + outputCalendar = _ref$outputCalendar === void 0 ? "gregory" : _ref$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length); + } + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {[string]} + */ + ; + + Info.monthsFormat = function monthsFormat(length, _temp2) { + if (length === void 0) { + length = "long"; + } + + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$numberingSystem = _ref2.numberingSystem, + numberingSystem = _ref2$numberingSystem === void 0 ? null : _ref2$numberingSystem, + _ref2$outputCalendar = _ref2.outputCalendar, + outputCalendar = _ref2$outputCalendar === void 0 ? "gregory" : _ref2$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length, true); + } + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {[string]} + */ + ; + + Info.weekdays = function weekdays(length, _temp3) { + if (length === void 0) { + length = "long"; + } + + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$numberingSystem = _ref3.numberingSystem, + numberingSystem = _ref3$numberingSystem === void 0 ? null : _ref3$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length); + } + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @return {[string]} + */ + ; + + Info.weekdaysFormat = function weekdaysFormat(length, _temp4) { + if (length === void 0) { + length = "long"; + } + + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length, true); + } + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {[string]} + */ + ; + + Info.meridiems = function meridiems(_temp5) { + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale; + + return Locale.create(locale).meridiems(); + } + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {[string]} + */ + ; + + Info.eras = function eras(length, _temp6) { + if (length === void 0) { + length = "short"; + } + + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale; + + return Locale.create(locale, null, "gregory").eras(length); + } + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case. + * Keys: + * * `zones`: whether this environment supports IANA timezones + * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing + * * `intl`: whether this environment supports general internationalization + * * `relative`: whether this environment supports relative time formatting + * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false } + * @return {Object} + */ + ; + + Info.features = function features() { + var intl = false, + intlTokens = false, + zones = false, + relative = false; + + if (hasIntl()) { + intl = true; + intlTokens = hasFormatToParts(); + relative = hasRelative(); + + try { + zones = new Intl.DateTimeFormat("en", { + timeZone: "America/New_York" + }).resolvedOptions().timeZone === "America/New_York"; + } catch (e) { + zones = false; + } + } + + return { + intl: intl, + intlTokens: intlTokens, + zones: zones, + relative: relative + }; + }; + + return Info; + }(); + + function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + + return Math.floor(Duration.fromMillis(ms).as("days")); + } + + function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var lowestOrder, highWater; + + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + + if (units.indexOf(unit) >= 0) { + var _cursor$plus; + + lowestOrder = unit; + var delta = differ(cursor, later); + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[unit] = delta, _cursor$plus)); + + if (highWater > later) { + var _cursor$plus2; + + cursor = cursor.plus((_cursor$plus2 = {}, _cursor$plus2[unit] = delta - 1, _cursor$plus2)); + delta -= 1; + } else { + cursor = highWater; + } + + results[unit] = delta; + } + } + + return [cursor, results, highWater, lowestOrder]; + } + + function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus3; + + highWater = cursor.plus((_cursor$plus3 = {}, _cursor$plus3[lowestOrder] = 1, _cursor$plus3)); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + var duration = Duration.fromObject(Object.assign(results, opts)); + + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } + } + + var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" + }; + var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] + }; // eslint-disable-next-line + + var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + function parseDigits(str) { + var value = parseInt(str, 10); + + if (isNaN(value)) { + value = ""; + + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + + return parseInt(value, 10); + } else { + return value; + } + } + function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + + if (append === void 0) { + append = ""; + } + + return new RegExp("" + numberingSystems[numberingSystem || "latn"] + append); + } + + var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + + function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; + } + + function fixListRegex(s) { + // make dots optional and also make them literal + return s.replace(/\./, "\\.?"); + } + + function stripInsensitivities(s) { + return s.replace(/\./, "").toLowerCase(); + } + + function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } + } + + function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; + } + + function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; + } + + function escapeToken(value) { + // eslint-disable-next-line no-useless-escape + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + } + + function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short", false), 0); + + case "GG": + return oneOf(loc.eras("long", false), 0); + // years + + case "y": + return intUnit(oneToSix); + + case "yy": + return intUnit(twoToFour, untruncateYear); + + case "yyyy": + return intUnit(four); + + case "yyyyy": + return intUnit(fourToSix); + + case "yyyyyy": + return intUnit(six); + // months + + case "M": + return intUnit(oneOrTwo); + + case "MM": + return intUnit(two); + + case "MMM": + return oneOf(loc.months("short", true, false), 1); + + case "MMMM": + return oneOf(loc.months("long", true, false), 1); + + case "L": + return intUnit(oneOrTwo); + + case "LL": + return intUnit(two); + + case "LLL": + return oneOf(loc.months("short", false, false), 1); + + case "LLLL": + return oneOf(loc.months("long", false, false), 1); + // dates + + case "d": + return intUnit(oneOrTwo); + + case "dd": + return intUnit(two); + // ordinals + + case "o": + return intUnit(oneToThree); + + case "ooo": + return intUnit(three); + // time + + case "HH": + return intUnit(two); + + case "H": + return intUnit(oneOrTwo); + + case "hh": + return intUnit(two); + + case "h": + return intUnit(oneOrTwo); + + case "mm": + return intUnit(two); + + case "m": + return intUnit(oneOrTwo); + + case "q": + return intUnit(oneOrTwo); + + case "qq": + return intUnit(two); + + case "s": + return intUnit(oneOrTwo); + + case "ss": + return intUnit(two); + + case "S": + return intUnit(oneToThree); + + case "SSS": + return intUnit(three); + + case "u": + return simple(oneToNine); + // meridiem + + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + + case "kkkk": + return intUnit(four); + + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + + case "W": + return intUnit(oneOrTwo); + + case "WW": + return intUnit(two); + // weekdays + + case "E": + case "c": + return intUnit(one); + + case "EEE": + return oneOf(loc.weekdays("short", false, false), 1); + + case "EEEE": + return oneOf(loc.weekdays("long", false, false), 1); + + case "ccc": + return oneOf(loc.weekdays("short", true, false), 1); + + case "cccc": + return oneOf(loc.weekdays("long", true, false), 1); + // offset/zone + + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + + default: + return literal(t); + } + }; + + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; + } + + var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour: { + numeric: "h", + "2-digit": "hh" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + } + }; + + function tokenForPart(part, locale, formatOpts) { + var type = part.type, + value = part.value; + + if (type === "literal") { + return { + literal: true, + val: value + }; + } + + var style = formatOpts[type]; + var val = partTypeStyleToTokenVal[type]; + + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val: val + }; + } + + return undefined; + } + + function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; + } + + function match(input, regex, handlers) { + var matches = input.match(regex); + + if (matches) { + var all = {}; + var matchIndex = 1; + + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + + matchIndex += groups; + } + } + + return [matches, all]; + } else { + return [matches, {}]; + } + } + + function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + case "H": + return "hour"; + + case "d": + return "day"; + + case "o": + return "ordinal"; + + case "L": + case "M": + return "month"; + + case "y": + return "year"; + + case "E": + case "c": + return "weekday"; + + case "W": + return "weekNumber"; + + case "k": + return "weekYear"; + + case "q": + return "quarter"; + + default: + return null; + } + }; + + var zone; + + if (!isUndefined(matches.Z)) { + zone = new FixedOffsetZone(matches.Z); + } else if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } else { + zone = null; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + return [vals, zone]; + } + + var dummyDateTimeCache = null; + + function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; + } + + function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + + if (!formatOpts) { + return token; + } + + var formatter = Formatter.create(locale, formatOpts); + var parts = formatter.formatDateTimeParts(getDummyDateTime()); + var tokens = parts.map(function (p) { + return tokenForPart(p, locale, formatOpts); + }); + + if (tokens.includes(undefined)) { + return token; + } + + return tokens; + } + + function expandMacroTokens(tokens, locale) { + var _Array$prototype; + + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); + } + /** + * @private + */ + + + function explainFromTokens(locale, input, format) { + var tokens = expandMacroTokens(Formatter.parseFormat(format), locale), + units = tokens.map(function (t) { + return unitForToken(t, locale); + }), + disqualifyingUnit = units.find(function (t) { + return t.invalidReason; + }); + + if (disqualifyingUnit) { + return { + input: input, + tokens: tokens, + invalidReason: disqualifyingUnit.invalidReason + }; + } else { + var _buildRegex = buildRegex(units), + regexString = _buildRegex[0], + handlers = _buildRegex[1], + regex = RegExp(regexString, "i"), + _match = match(input, regex, handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null], + result = _ref6[0], + zone = _ref6[1]; + + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + + return { + input: input, + tokens: tokens, + regex: regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone + }; + } + } + function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + invalidReason = _explainFromTokens.invalidReason; + + return [result, zone, invalidReason]; + } + + var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + + function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); + } + + function dayOfWeek(year, month, day) { + var js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); + return js === 0 ? 7 : js; + } + + function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; + } + + function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; + } + /** + * @private + */ + + + function gregorianToWeek(gregObj) { + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = dayOfWeek(year, month, day); + var weekNumber = Math.floor((ordinal - weekday + 10) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear); + } else if (weekNumber > weeksInWeekYear(year)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return Object.assign({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); + } + function weekToGregorian(weekData) { + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(weekData)); + } + function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day, + ordinal = computeOrdinal(year, month, day); + return Object.assign({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); + } + function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal, + _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); + } + function hasInvalidWeekData(obj) { + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.week); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; + } + function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; + } + function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; + } + function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; + } + + var INVALID$2 = "Invalid DateTime"; + var MAX_DATE = 8.64e15; + + function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); + } // we cache week data on the DT object and this intermediates the cache + + + function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + + return dt.weekData; + } // clone really means, "make a new object with these modifications". all "setters" really use this + // to create a new object while only changing some of the properties + + + function clone$1(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(Object.assign({}, current, alts, { + old: current + })); + } // find the right offset a given local time. The o input is our guess, which determines which + // offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + + + function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts + + var o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done + + if (o === o2) { + return [utcGuess, o]; + } // If not, change the ts by the difference in the offset + + + utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done + + var o3 = tz.offset(utcGuess); + + if (o2 === o3) { + return [utcGuess, o2]; + } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + + + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; + } // convert an epoch timestamp into a calendar object with the given offset + + + function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; + } // convert a calendar object to a epoch timestamp + + + function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); + } // create a new DT instance by adding a duration, adjusting for DSTs + + + function adjustTime(inst, dur) { + var _dur; + + var keys = Object.keys(dur.values); + + if (keys.indexOf("milliseconds") === -1) { + keys.push("milliseconds"); + } + + dur = (_dur = dur).shiftTo.apply(_dur, keys); + var oPre = inst.o, + year = inst.c.year + dur.years, + month = inst.c.month + dur.months + dur.quarters * 3, + c = Object.assign({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7 + }), + millisToAdd = Duration.fromObject({ + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + + if (millisToAdd !== 0) { + ts += millisToAdd; // that could have changed the offset by going over a DST, but we want to keep the ts the same + + o = inst.zone.offset(ts); + } + + return { + ts: ts, + o: o + }; + } // helper useful in turning the results of parsing into real dates + // by handling the zone options + + + function parseDataToDateTime(parsed, parsedZone, opts, format, text) { + var setZone = opts.setZone, + zone = opts.zone; + + if (parsed && Object.keys(parsed).length !== 0) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(Object.assign(parsed, opts, { + zone: interpretationZone, + // setZone is a valid option in the calling methods, but not in fromObject + setZone: undefined + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } + } // if you want to output a technical format (e.g. RFC 2822), this helper + // helps handle the details + + + function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; + } // technical time formats (e.g. the time part of ISO 8601), take some options + // and this commonizes their handling + + + function toTechTimeFormat(dt, _ref) { + var _ref$suppressSeconds = _ref.suppressSeconds, + suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds, + _ref$suppressMillisec = _ref.suppressMilliseconds, + suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec, + includeOffset = _ref.includeOffset, + _ref$includeZone = _ref.includeZone, + includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone, + _ref$spaceZone = _ref.spaceZone, + spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone, + _ref$format = _ref.format, + format = _ref$format === void 0 ? "extended" : _ref$format; + var fmt = format === "basic" ? "HHmm" : "HH:mm"; + + if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { + fmt += format === "basic" ? "ss" : ":ss"; + + if (!suppressMilliseconds || dt.millisecond !== 0) { + fmt += ".SSS"; + } + } + + if ((includeZone || includeOffset) && spaceZone) { + fmt += " "; + } + + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += format === "basic" ? "ZZZ" : "ZZ"; + } + + return toTechFormat(dt, fmt); + } // defaults for unspecified units in the supported calendars + + + var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; // Units in the supported calendars, sorted by bigness + + var orderedUnits$1 = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; // standardize case and plurality in units + + function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } // this is a dumbed down version of fromObject() that runs about 60% faster + // but doesn't do any validation, makes a bunch of assumptions about what units + // are present, and so on. + + + function quickDT(obj, zone) { + // assume we have the higher-order units + for (var _iterator = orderedUnits$1, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var u = _ref2; + + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + + if (invalid) { + return DateTime.invalid(invalid); + } + + var tsNow = Settings.now(), + offsetProvis = zone.offset(tsNow), + _objToTS = objToTS(obj, offsetProvis, zone), + ts = _objToTS[0], + o = _objToTS[1]; + + return new DateTime({ + ts: ts, + zone: zone, + o: o + }); + } + + function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, true); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (var _iterator2 = opts.units, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var unit = _ref3; + var count = differ(unit); + + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + + return format(0, opts.units[opts.units.length - 1]); + } + /** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, + * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. + * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + + + var DateTime = + /*#__PURE__*/ + function () { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + var _ref4 = [config.old.c, config.old.o]; + c = _ref4[0]; + o = _ref4[1]; + } else { + var ot = zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + /** + * @access private + */ + + + this._zone = zone; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.invalid = invalid; + /** + * @access private + */ + + this.weekData = null; + /** + * @access private + */ + + this.c = c; + /** + * @access private + */ + + this.o = o; + /** + * @access private + */ + + this.isLuxonDateTime = true; + } // CONSTRUCT + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + + + DateTime.local = function local(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now() + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, Settings.defaultZone); + } + } + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @return {DateTime} + */ + ; + + DateTime.utc = function utc(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now(), + zone: FixedOffsetZone.utcInstance + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, FixedOffsetZone.utcInstance); + } + } + /** + * Create a DateTime from a Javascript Date object. Uses the default zone. + * @param {Date} date - a Javascript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + ; + + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + + var ts = isDate(date) ? date.valueOf() : NaN; + + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @return {DateTime} + */ + ; + + DateTime.fromObject = function fromObject(obj) { + var zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + var tsNow = Settings.now(), + offsetProvis = zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit, ["zone", "locale", "outputCalendar", "numberingSystem"]), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber, + loc = Locale.fromObject(obj); // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; // configure ourselves to deal with gregorian dates or week stuff + + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits$1; + defaultValues = defaultUnitValues; + } // set default values for missing stuff + + + var foundFirst = false; + + for (var _iterator3 = units, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref5; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref5 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref5 = _i3.value; + } + + var u = _ref5; + var v = normalized[u]; + + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } // make sure the values we have are in range + + + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } // compute the actual time + + + var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); // gregorian data + weekday serves only to validate + + + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + + return inst; + } + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + ; + + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + ; + + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + ; + + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + invalid = _parseFromTokens[2]; + + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text); + } + } + /** + * @deprecated use fromFormat instead + */ + ; + + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return DateTime.fromFormat(text, fmt, opts); + } + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + ; + + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + ; + + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + /** + * Check if an object is a DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + ; + + var _proto = DateTime.prototype; + + _proto.get = function get(unit) { + return this[unit]; + } + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + ; + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOpts = function resolvedLocaleOpts(opts) { + if (opts === void 0) { + opts = {}; + } + + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + ; + + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + + if (opts === void 0) { + opts = {}; + } + + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + ; + + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + ; + + _proto.setZone = function setZone(zone, _temp) { + var _ref6 = _temp === void 0 ? {} : _temp, + _ref6$keepLocalTime = _ref6.keepLocalTime, + keepLocalTime = _ref6$keepLocalTime === void 0 ? false : _ref6$keepLocalTime, + _ref6$keepCalendarTim = _ref6.keepCalendarTime, + keepCalendarTime = _ref6$keepCalendarTim === void 0 ? false : _ref6$keepCalendarTim; + + zone = normalizeZone(zone, Settings.defaultZone); + + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + + newTS = _objToTS3[0]; + } + + return clone$1(this, { + ts: newTS, + zone: zone + }); + } + } + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + ; + + _proto.reconfigure = function reconfigure(_temp2) { + var _ref7 = _temp2 === void 0 ? {} : _temp2, + locale = _ref7.locale, + numberingSystem = _ref7.numberingSystem, + outputCalendar = _ref7.outputCalendar; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone$1(this, { + loc: loc + }); + } + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + ; + + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnit, []), + settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday); + var mixed; + + if (settingWeekStuff) { + mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + } else { + mixed = Object.assign(this.toObject(), normalized); // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + + return clone$1(this, { + ts: ts, + o: o + }); + } + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.local().plus(123) //~> in 123 milliseconds + * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return clone$1(this, adjustTime(this, dur)); + } + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration).negate(); + return clone$1(this, adjustTime(this, dur)); + } + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + ; + + _proto.startOf = function startOf(unit) { + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + + case "quarters": + case "months": + o.day = 1; + // falls through + + case "weeks": + case "days": + o.hour = 0; + // falls through + + case "hours": + o.minute = 0; + // falls through + + case "minutes": + o.second = 0; + // falls through + + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + o.weekday = 1; + } + + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + ; + + _proto.endOf = function endOf(unit) { + var _this$plus; + + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this; + } // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options + * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$2; + } + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @example DateTime.local().toLocaleString(); //=> 4/20/2017 + * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' + * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' + * @return {string} + */ + ; + + _proto.toLocaleString = function toLocaleString(opts) { + if (opts === void 0) { + opts = DATE_SHORT; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID$2; + } + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.local().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + ; + + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toISODate(opts) + "T" + this.toISOTime(opts); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + ; + + _proto.toISODate = function toISODate(_temp3) { + var _ref8 = _temp3 === void 0 ? {} : _temp3, + _ref8$format = _ref8.format, + format = _ref8$format === void 0 ? "extended" : _ref8$format; + + var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; + + if (this.year > 9999) { + fmt = "+" + fmt; + } + + return toTechFormat(this, fmt); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + ; + + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(_temp4) { + var _ref9 = _temp4 === void 0 ? {} : _temp4, + _ref9$suppressMillise = _ref9.suppressMilliseconds, + suppressMilliseconds = _ref9$suppressMillise === void 0 ? false : _ref9$suppressMillise, + _ref9$suppressSeconds = _ref9.suppressSeconds, + suppressSeconds = _ref9$suppressSeconds === void 0 ? false : _ref9$suppressSeconds, + _ref9$includeOffset = _ref9.includeOffset, + includeOffset = _ref9$includeOffset === void 0 ? true : _ref9$includeOffset, + _ref9$format = _ref9.format, + format = _ref9$format === void 0 ? "extended" : _ref9$format; + + return toTechTimeFormat(this, { + suppressSeconds: suppressSeconds, + suppressMilliseconds: suppressMilliseconds, + includeOffset: includeOffset, + format: format + }); + } + /** + * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + ; + + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + ; + + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + ; + + _proto.toSQLDate = function toSQLDate() { + return toTechFormat(this, "yyyy-MM-dd"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + ; + + _proto.toSQLTime = function toSQLTime(_temp5) { + var _ref10 = _temp5 === void 0 ? {} : _temp5, + _ref10$includeOffset = _ref10.includeOffset, + includeOffset = _ref10$includeOffset === void 0 ? true : _ref10$includeOffset, + _ref10$includeZone = _ref10.includeZone, + includeZone = _ref10$includeZone === void 0 ? false : _ref10$includeZone; + + return toTechTimeFormat(this, { + includeOffset: includeOffset, + includeZone: includeZone, + spaceZone: true + }); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + ; + + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID$2; + } + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + ; + + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + ; + + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + /** + * Returns a Javascript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.c); + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns a Javascript Date equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + ; + + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid(this.invalid || otherDateTime.invalid, "created by diffing an invalid DateTime"); + } + + var durOpts = Object.assign({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + + return otherIsLater ? diffed.negate() : diffed; + } + /** + * Return the difference between this DateTime and right now. + * See {@link diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + return this.diff(DateTime.local(), unit, opts); + } + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + ; + + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + /** + * Return whether this DateTime is in the same unit of time as another DateTime + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(otherDateTime, unit) { + if (!this.isValid) return false; + + if (unit === "millisecond") { + return this.valueOf() === otherDateTime.valueOf(); + } else { + var inputMs = otherDateTime.valueOf(); + return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit); + } + } + /** + * Equality check + * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + ; + + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({ + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + return diffRelative(base, this.plus(padding), Object.assign(options, { + numeric: "always", + units: ["years", "months", "days", "hours", "minutes", "seconds"] + })); + } + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + ; + + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({ + zone: this.zone + }), this, Object.assign(options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + ; + + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + ; + + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + ; + + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + /** + * @deprecated use fromFormatExplain instead + */ + ; + + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + return DateTime.fromFormatExplain(text, fmt, options); + } // FORMAT PRESETS + + /** + * {@link toLocaleString} format like 10/14/1983 + * @type {Object} + */ + ; + + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + + }, { + key: "zone", + get: function get() { + return this._zone; + } + /** + * Get the name of the time zone. + * @type {string} + */ + + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekYear //=> 2015 + * @type {number} + */ + + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.local().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.universal : null; + } + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + /** + * {@link toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + /** + * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + /** + * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + + return DateTime; + }(); + function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } + } + + exports.DateTime = DateTime; + exports.Duration = Duration; + exports.FixedOffsetZone = FixedOffsetZone; + exports.IANAZone = IANAZone; + exports.Info = Info; + exports.Interval = Interval; + exports.InvalidZone = InvalidZone; + exports.LocalZone = LocalZone; + exports.Settings = Settings; + exports.Zone = Zone; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}); +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/amd/luxon.js.map b/node_modules/luxon/build/amd/luxon.js.map new file mode 100644 index 0000000..81305bb --- /dev/null +++ b/node_modules/luxon/build/amd/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/invalid.js","../../src/zone.js","../../src/zones/localZone.js","../../src/zones/IANAZone.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/settings.js","../../src/impl/locale.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/digits.js","../../src/impl/tokenParser.js","../../src/impl/conversions.js","../../src/datetime.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23', always 24-hour.\n */\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour.\n */\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: s\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour.\n */\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: l\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasIntl() {\n try {\n return typeof Intl !== \"undefined\" && Intl.DateTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasFormatToParts() {\n return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts);\n}\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n if (input.toString().length < n) {\n return (\"0\".repeat(n) + input).slice(-n);\n } else {\n return input.toString();\n }\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, towardZero = false) {\n const factor = 10 ** digits,\n rounder = towardZero ? Math.trunc : Math.round;\n return rounder(number * factor) / factor;\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// covert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n return +d;\n}\n\nexport function weeksInWeekYear(weekYear) {\n const p1 =\n (weekYear +\n Math.floor(weekYear / 4) -\n Math.floor(weekYear / 100) +\n Math.floor(weekYear / 400)) %\n 7,\n last = weekYear - 1,\n p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;\n return p1 === 4 || p2 === 3 ? 53 : 52;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > 60 ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hour12: false,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\"\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts),\n intl = hasIntl();\n\n if (intl && hasFormatToParts()) {\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find(m => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n } else if (intl) {\n // this probably doesn't work for all locales\n const without = new Intl.DateTimeFormat(locale, intlOpts).format(date),\n included = new Intl.DateTimeFormat(locale, modified).format(date),\n diffed = included.substring(without.length),\n trimmed = diffed.replace(/^[, \\u200e]+/, \"\");\n return trimmed;\n } else {\n return null;\n }\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || Number.isNaN(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer, nonUnitKeys) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n if (nonUnitKeys.indexOf(u) >= 0) continue;\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(offset / 60),\n minutes = Math.abs(offset % 60),\n sign = hours >= 0 && !Object.is(hours, -0) ? \"+\" : \"-\",\n base = `${sign}${Math.abs(hours)}`;\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(Math.abs(hours), 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return minutes > 0 ? `${base}:${minutes}` : base;\n case \"techie\":\n return `${sign}${padStart(Math.abs(hours), 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n\nexport const ianaRegex = /[A-Za-z_+-]{1,256}(:?\\/[A-Za-z_+-]{1,256}(\\/[A-Za-z_+-]{1,256})?)?/;\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return monthsNarrow;\n case \"short\":\n return monthsShort;\n case \"long\":\n return monthsLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\"\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return weekdaysNarrow;\n case \"short\":\n return weekdaysShort;\n case \"long\":\n return weekdaysLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return erasNarrow;\n case \"short\":\n return erasShort;\n case \"long\":\n return erasLong;\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"]\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hour12\"\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { hasFormatToParts, padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: false, val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTime(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTimeParts(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.formatToParts();\n }\n\n resolvedOptions(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.resolvedOptions();\n }\n\n num(n, p = 0) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = Object.assign({}, this.opts);\n\n if (p > 0) {\n opts.padTo = p;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter =\n this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\" && hasFormatToParts(),\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = opts => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hour12: true }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = token => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = length =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = token => {\n // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const tokenToField = token => {\n switch (token[0]) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n default:\n return null;\n }\n },\n tokenToString = lildur => token => {\n const mapped = tokenToField(token);\n if (mapped) {\n return this.num(lildur.get(mapped), token.length);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t));\n return stringifyTokens(tokens, tokenToString(collapsed));\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","/* eslint no-unused-vars: \"off\" */\nimport { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get universal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo, hasIntl } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this Javascript environment.\n * @implements {Zone}\n */\nexport default class LocalZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {LocalZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new LocalZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"local\";\n }\n\n /** @override **/\n get name() {\n if (hasIntl()) {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n } else return \"local\";\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"local\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, ianaRegex, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst matchingRegex = RegExp(`^${ianaRegex.source}$`);\n\nlet dtfCache = {};\nfunction makeDTF(zone) {\n if (!dtfCache[zone]) {\n dtfCache[zone] = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\"\n });\n }\n return dtfCache[zone];\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date),\n filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i],\n pos = typeToPos[type];\n\n if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nlet ianaZoneCache = {};\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n if (!ianaZoneCache[name]) {\n ianaZoneCache[name] = new IANAZone(name);\n }\n return ianaZoneCache[name];\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache = {};\n dtfCache = {};\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Fantasia/Castle\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return !!(s && s.match(matchingRegex));\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n // Etc/GMT+8 -> -480\n /** @ignore */\n static parseGMTOffset(specifier) {\n if (specifier) {\n const match = specifier.match(/^Etc\\/GMT([+-]\\d{1,2})$/i);\n if (match) {\n return -60 * parseInt(match[1]);\n }\n }\n return null;\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /** @override **/\n get type() {\n return \"iana\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n const date = new Date(ts),\n dtf = makeDTF(this.name),\n [year, month, day, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date),\n // work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /** @override **/\n get isValid() {\n return this.valid;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /** @override **/\n get type() {\n return \"fixed\";\n }\n\n /** @override **/\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /** @override **/\n offsetName() {\n return this.name;\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /** @override **/\n get universal() {\n return true;\n }\n\n /** @override **/\n offset() {\n return this.fixed;\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"local\") return defaultZone;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else if ((offset = IANAZone.parseGMTOffset(input)) != null) {\n // handle Etc/GMT-4, which V8 chokes on\n return FixedOffsetZone.instance(offset);\n } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);\n else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && input.offset && typeof input.offset === \"number\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","import LocalZone from \"./zones/localZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nlet now = () => Date.now(),\n defaultZone = null, // not setting this directly to LocalZone.instance bc loading order issues\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n throwOnInvalid = false;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Get the default time zone to create DateTimes in.\n * @type {string}\n */\n static get defaultZoneName() {\n return Settings.defaultZone.name;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * @type {string}\n */\n static set defaultZoneName(z) {\n if (!z) {\n defaultZone = null;\n } else {\n defaultZone = normalizeZone(z);\n }\n }\n\n /**\n * Get the default time zone object to create DateTimes in. Does not affect existing instances.\n * @type {Zone}\n */\n static get defaultZone() {\n return defaultZone || LocalZone.instance;\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n }\n}\n","import { hasFormatToParts, hasIntl, padStart, roundTo, hasRelative } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport Formatter from \"./formatter.js\";\n\nlet intlDTCache = {};\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache[key];\n if (!dtf) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache[key] = dtf;\n }\n return dtf;\n}\n\nlet intlNumCache = {};\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache[key];\n if (!inf) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache[key] = inf;\n }\n return inf;\n}\n\nlet intlRelCache = {};\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache[key];\n if (!inf) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache[key] = inf;\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else if (hasIntl()) {\n const computedSys = new Intl.DateTimeFormat().resolvedOptions().locale;\n // node sometimes defaults to \"und\". Override that because that is dumb\n sysLocaleCache = !computedSys || computedSys === \"und\" ? \"en-US\" : computedSys;\n return sysLocaleCache;\n } else {\n sysLocaleCache = \"en-US\";\n return sysLocaleCache;\n }\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n const smaller = localeStr.substring(0, uIndex);\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n } catch (e) {\n options = getCachedDTF(smaller).resolvedOptions();\n }\n\n const { numberingSystem, calendar } = options;\n // return the smaller one so that we can append the calendar and numbering overrides to it\n return [smaller, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (hasIntl()) {\n if (outputCalendar || numberingSystem) {\n localeStr += \"-u\";\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n } else {\n return [];\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2016, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, defaultOK, englishFn, intlFn) {\n const mode = loc.listingMode(defaultOK);\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n (hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === \"latn\")\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n if (!forceSimple && hasIntl()) {\n const intlOpts = { useGrouping: false };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.hasIntl = hasIntl();\n\n let z;\n if (dt.zone.universal && this.hasIntl) {\n // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.\n // So we have to make do. Two cases:\n // 1. The format options tell us to show the zone. We can't do that, so the best\n // we can do is format the date in UTC.\n // 2. The format options don't tell us to show the zone. Then we can adjust them\n // the time and tell the formatter to show it to us in UTC, so that the time is right\n // and the bad zone doesn't show up.\n // We can clean all this up when Chrome fixes this.\n z = \"UTC\";\n if (opts.timeZoneName) {\n this.dt = dt;\n } else {\n this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);\n }\n } else if (dt.zone.type === \"local\") {\n this.dt = dt;\n } else {\n this.dt = dt;\n z = dt.zone.name;\n }\n\n if (this.hasIntl) {\n const intlOpts = Object.assign({}, this.opts);\n if (z) {\n intlOpts.timeZone = z;\n }\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n }\n\n format() {\n if (this.hasIntl) {\n return this.dtf.format(this.dt.toJSDate());\n } else {\n const tokenFormat = English.formatString(this.opts),\n loc = Locale.create(\"en-US\");\n return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat);\n }\n }\n\n formatToParts() {\n if (this.hasIntl && hasFormatToParts()) {\n return this.dtf.formatToParts(this.dt.toJSDate());\n } else {\n // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings\n // and IMO it's too weird to have an uncanny valley like that\n return [];\n }\n }\n\n resolvedOptions() {\n if (this.hasIntl) {\n return this.dtf.resolvedOptions();\n } else {\n return {\n locale: \"en-US\",\n numberingSystem: \"latn\",\n outputCalendar: \"gregory\"\n };\n }\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = Object.assign({ style: \"long\" }, opts);\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\n/**\n * @private\n */\n\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);\n }\n\n static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale,\n // the system locale is useful for human readable strings but annoying for parsing/formatting known formats\n localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale()),\n numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,\n outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache = {};\n intlNumCache = {};\n intlRelCache = {};\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar);\n }\n\n constructor(locale, numbering, outputCalendar, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode(defaultOK = true) {\n const intl = hasIntl(),\n hasFTP = intl && hasFormatToParts(),\n isActuallyEn = this.isEnglish(),\n hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n\n if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) {\n return \"error\";\n } else if (!hasFTP || (isActuallyEn && hasNoWeirdness)) {\n return \"en\";\n } else {\n return \"intl\";\n }\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: true }));\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: false }));\n }\n\n months(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.months, () => {\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n this.monthsCache[formatStr][length] = mapMonths(dt => this.extract(dt, intl, \"month\"));\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays(dt =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems(defaultOK = true) {\n return listStuff(\n this,\n undefined,\n defaultOK,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hour12: true };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n dt => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.eras, () => {\n const intl = { era: length };\n\n // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find(m => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n (hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith(\"en-us\"))\n );\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n ianaRegex,\n isUndefined\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return m =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [Object.assign(mergedVals, val), mergedZone || zone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:(Z)|([+-]\\d\\d)(?::?(\\d\\d))?)/,\n isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,9}))?)?)?/,\n isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`),\n isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`),\n isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/,\n isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/,\n isoOrdinalRegex = /(\\d{4})-?(\\d{3})/,\n extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\"),\n extractISOOrdinalData = simpleParse(\"year\", \"ordinal\"),\n sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/, // dumbed-down version of the ISO one\n sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n ),\n sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1)\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hour: int(match, cursor, 0),\n minute: int(match, cursor + 1, 0),\n second: int(match, cursor + 2, 0),\n millisecond: parseMillis(match[cursor + 3])\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO duration parsing\n\nconst isoDuration = /^P(?:(?:(-?\\d{1,9})Y)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})W)?(?:(-?\\d{1,9})D)?(?:T(?:(-?\\d{1,9})H)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})(?:[.,](-?\\d{1,9}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [\n ,\n yearStr,\n monthStr,\n weekStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr,\n millisecondsStr\n ] = match;\n\n return [\n {\n years: parseInteger(yearStr),\n months: parseInteger(monthStr),\n weeks: parseInteger(weekStr),\n days: parseInteger(dayStr),\n hours: parseInteger(hourStr),\n minutes: parseInteger(minuteStr),\n seconds: parseInteger(secondStr),\n milliseconds: parseMillis(millisecondsStr)\n }\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr)\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime);\nconst extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);\n\n/**\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOYmdTimeOffsetAndIANAZone = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nconst lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 }\n },\n casualMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n ),\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n );\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy\n };\n return new Duration(conf);\n}\n\nfunction antiTrunc(n) {\n return n < 0 ? Math.floor(n) : Math.ceil(n);\n}\n\n// NB: mutates parameters\nfunction convert(matrix, fromMap, fromUnit, toMap, toUnit) {\n const conv = matrix[toUnit][fromUnit],\n raw = fromMap[fromUnit] / conv,\n sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),\n // ok, so this is wild, but see the matrix in the tests\n added =\n !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);\n toMap[toUnit] += added;\n fromMap[fromUnit] -= added * conv;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n reverseUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n convert(matrix, vals, previous, vals, current);\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors.\n * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = accurate ? accurateMatrix : casualMatrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject(Object.assign({ milliseconds: count }, opts));\n }\n\n /**\n * Create a Duration from a Javascript object with keys like 'years' and 'hours.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {string} [obj.locale='en-US'] - the locale to use\n * @param {string} obj.numberingSystem - the numbering system to use\n * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromObject(obj) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit, [\n \"locale\",\n \"numberingSystem\",\n \"conversionAccuracy\",\n \"zone\" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this\n ]),\n loc: Locale.fromObject(obj),\n conversionAccuracy: obj.conversionAccuracy\n });\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n const obj = Object.assign(parsed, opts);\n return Duration.fromObject(obj);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\"\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = Object.assign({}, opts, {\n floor: opts.round !== false && opts.floor !== false\n });\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a Javascript object with this Duration's values.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.values);\n\n if (opts.includeConfig) {\n base.conversionAccuracy = this.conversionAccuracy;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n valueOf() {\n return this.as(\"milliseconds\");\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === \"hour\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).years //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).months //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).days //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, []));\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem }),\n opts = { loc };\n\n if (conversionAccuracy) {\n opts.conversionAccuracy = conversionAccuracy;\n }\n\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map(u => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n normalizeValues(this.matrix, vals);\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = own - i; // we'd like to absorb these fractions in another unit\n\n // plus anything further down the chain that should be rolled up in to this\n for (const down in vals) {\n if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {\n convert(this.matrix, vals, down, built, k);\n }\n }\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n return clone(this, { values: built }, true).normalize();\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n for (const u of orderedUnits) {\n if (this.values[u] !== other.values[u]) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDuration(durationish) {\n if (isNumber(durationish)) {\n return Duration.fromMillis(durationish);\n } else if (Duration.isDuration(durationish)) {\n return durationish;\n } else if (typeof durationish === \"object\") {\n return Duration.fromObject(durationish);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationish} of type ${typeof durationish}`\n );\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration, { friendlyDuration } from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}.\n * * **Accessors** Use {@link start} and {@link end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.\n * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}\n * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n const start = DateTime.fromISO(s, opts),\n end = DateTime.fromISO(e, opts);\n\n if (start.isValid && end.isValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (start.isValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (end.isValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @return {number}\n */\n count(unit = \"milliseconds\") {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit),\n end = this.end.startOf(unit);\n return Math.floor(end.diff(start, unit).get(unit)) + 1;\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...[DateTime]} dateTimes - the unit of time to count.\n * @return {[Interval]}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter(d => this.contains(d))\n .sort(),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {[Interval]}\n */\n splitBy(duration) {\n const dur = friendlyDuration(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n added,\n next;\n\n const results = [];\n while (s < this.e) {\n added = s.plus(dur);\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {[Interval]}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Return whether this Interval engulfs the start and end of the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s > e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into a equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static merge(intervals) {\n const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map(i => [{ time: i.s, type: \"s\" }, { time: i.e, type: \"e\" }]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {[Interval]}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map(i => this.intersection(i))\n .filter(i => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format string.\n * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details.\n * @param {Object} opts - options\n * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasFormatToParts, hasIntl, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.local()\n .setZone(zone)\n .set({ month: 12 });\n\n return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone.isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {[string]}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {[string]}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {[string]}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @return {[string]}\n */\n static weekdaysFormat(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {[string]}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {[string]}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `zones`: whether this environment supports IANA timezones\n * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing\n * * `intl`: whether this environment supports general internationalization\n * * `relative`: whether this environment supports relative time formatting\n * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false }\n * @return {Object}\n */\n static features() {\n let intl = false,\n intlTokens = false,\n zones = false,\n relative = false;\n\n if (hasIntl()) {\n intl = true;\n intlTokens = hasFormatToParts();\n relative = hasRelative();\n\n try {\n zones =\n new Intl.DateTimeFormat(\"en\", { timeZone: \"America/New_York\" }).resolvedOptions()\n .timeZone === \"America/New_York\";\n } catch (e) {\n zones = false;\n }\n }\n\n return { intl, intlTokens, zones, relative };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = dt =>\n dt\n .toUTC(0, { keepLocalTime: true })\n .startOf(\"day\")\n .valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n }\n ],\n [\"days\", dayDiff]\n ];\n\n const results = {};\n let lowestOrder, highWater;\n\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n let delta = differ(cursor, later);\n highWater = cursor.plus({ [unit]: delta });\n\n if (highWater > later) {\n cursor = cursor.plus({ [unit]: delta - 1 });\n delta -= 1;\n } else {\n cursor = highWater;\n }\n\n results[unit] = delta;\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function(earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n u => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(Object.assign(results, opts));\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\"\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881]\n};\n\n// eslint-disable-next-line\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n return new RegExp(`${numberingSystems[numberingSystem || \"latn\"]}${append}`);\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = i => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n return s.replace(/\\./, \"\\\\.?\");\n}\n\nfunction stripInsensitivities(s) {\n return s.replace(/\\./, \"\").toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n // eslint-disable-next-line no-useless-escape\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = t => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = t => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\", false), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\", false), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true, false), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true, false), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false, false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false, false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false, false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false, false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true, false), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true, false), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\"\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\"\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\"\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\"\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour: {\n numeric: \"h\",\n \"2-digit\": \"hh\"\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\"\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\"\n }\n};\n\nfunction tokenForPart(part, locale, formatOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n return {\n literal: true,\n val: value\n };\n }\n\n const style = formatOpts[type];\n\n let val = partTypeStyleToTokenVal[type];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = token => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone;\n if (!isUndefined(matches.Z)) {\n zone = new FixedOffsetZone(matches.Z);\n } else if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n } else {\n zone = null;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n\n if (!formatOpts) {\n return token;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const parts = formatter.formatDateTimeParts(getDummyDateTime());\n\n const tokens = parts.map(p => tokenForPart(p, locale, formatOpts));\n\n if (tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nfunction expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport function explainFromTokens(locale, input, format) {\n const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),\n units = tokens.map(t => unitForToken(t, locale)),\n disqualifyingUnit = units.find(t => t.invalidReason);\n\n if (disqualifyingUnit) {\n return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };\n } else {\n const [regexString, handlers] = buildRegex(units),\n regex = RegExp(regexString, \"i\"),\n [rawMatches, matches] = match(input, regex, handlers),\n [result, zone] = matches ? dateTimeFromMatches(matches) : [null, null];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return { input, tokens, regex, rawMatches, matches, result, zone };\n }\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, invalidReason];\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nfunction dayOfWeek(year, month, day) {\n const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay();\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex(i => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = dayOfWeek(year, month, day);\n\n let weekNumber = Math.floor((ordinal - weekday + 10) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear);\n } else if (weekNumber > weeksInWeekYear(year)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return Object.assign({ weekYear, weekNumber, weekday }, timeObject(gregObj));\n}\n\nexport function weekToGregorian(weekData) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(weekData));\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData,\n ordinal = computeOrdinal(year, month, day);\n\n return Object.assign({ year, ordinal }, timeObject(gregData));\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData,\n { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(ordinalData));\n}\n\nexport function hasInvalidWeekData(obj) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.week);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","import Duration, { friendlyDuration } from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport { parseFromTokens, explainFromTokens } from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid\n };\n return new DateTime(Object.assign({}, current, alts, { old: current }));\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds()\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const keys = Object.keys(dur.values);\n if (keys.indexOf(\"milliseconds\") === -1) {\n keys.push(\"milliseconds\");\n }\n\n dur = dur.shiftTo(...keys);\n\n const oPre = inst.o,\n year = inst.c.year + dur.years,\n month = inst.c.month + dur.months + dur.quarters * 3,\n c = Object.assign({}, inst.c, {\n year,\n month,\n day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7\n }),\n millisToAdd = Duration.fromObject({\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text) {\n const { setZone, zone } = opts;\n if (parsed && Object.keys(parsed).length !== 0) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(\n Object.assign(parsed, opts, {\n zone: interpretationZone,\n // setZone is a valid option in the calling methods, but not in fromObject\n setZone: undefined\n })\n );\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\n// technical time formats (e.g. the time part of ISO 8601), take some options\n// and this commonizes their handling\nfunction toTechTimeFormat(\n dt,\n {\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset,\n includeZone = false,\n spaceZone = false,\n format = \"extended\"\n }\n) {\n let fmt = format === \"basic\" ? \"HHmm\" : \"HH:mm\";\n\n if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {\n fmt += format === \"basic\" ? \"ss\" : \":ss\";\n if (!suppressMilliseconds || dt.millisecond !== 0) {\n fmt += \".SSS\";\n }\n }\n\n if ((includeZone || includeOffset) && spaceZone) {\n fmt += \" \";\n }\n\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += format === \"basic\" ? \"ZZZ\" : \"ZZ\";\n }\n\n return toTechFormat(dt, fmt);\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\"\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\"\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, zone) {\n // assume we have the higher-order units\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zone.offset(tsNow),\n [ts, o] = objToTS(obj, offsetProvis, zone);\n\n return new DateTime({\n ts,\n zone,\n o\n });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, true);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = unit => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end\n .startOf(unit)\n .diff(start.startOf(unit), unit)\n .get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(0, opts.units[opts.units.length - 1]);\n}\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month},\n * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors.\n * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n const ot = zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({ ts: Settings.now() });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n Settings.defaultZone\n );\n }\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z\n * @return {DateTime}\n */\n static utc(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({\n ts: Settings.now(),\n zone: FixedOffsetZone.utcInstance\n });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n FixedOffsetZone.utcInstance\n );\n }\n }\n\n /**\n * Create a DateTime from a Javascript Date object. Uses the default zone.\n * @param {Date} date - a Javascript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options)\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @return {DateTime}\n */\n static fromObject(obj) {\n const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zoneToUse.offset(tsNow),\n normalized = normalizeObject(obj, normalizeUnit, [\n \"zone\",\n \"locale\",\n \"outputCalendar\",\n \"numberingSystem\"\n ]),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber,\n loc = Locale.fromObject(obj);\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n }),\n [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is a DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.local().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.universal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOpts(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link reconfigure} and {@link setZone}.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnit, []),\n settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday);\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized));\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized));\n } else {\n mixed = Object.assign(this.toObject(), normalized);\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.local().plus(123) //~> in 123 milliseconds\n * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit) {\n if (!this.isValid) return this;\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n o.weekday = 1;\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options\n * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.local().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.local().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @example DateTime.local().toLocaleString(); //=> 4/20/2017\n * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(opts = Formats.DATE_SHORT) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.local().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @return {string}\n */\n toISO(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toISODate(opts)}T${this.toISOTime(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @return {string}\n */\n toISODate({ format = \"extended\" } = {}) {\n let fmt = format === \"basic\" ? \"yyyyMMdd\" : \"yyyy-MM-dd\";\n if (this.year > 9999) {\n fmt = \"+\" + fmt;\n }\n\n return toTechFormat(this, fmt);\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n format = \"extended\"\n } = {}) {\n return toTechTimeFormat(this, {\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n format\n });\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string}\n */\n toSQLDate() {\n return toTechFormat(this, \"yyyy-MM-dd\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false } = {}) {\n return toTechTimeFormat(this, {\n includeOffset,\n includeZone,\n spaceZone: true\n });\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a Javascript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.c);\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a Javascript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\n this.invalid || otherDateTime.invalid,\n \"created by diffing an invalid DateTime\"\n );\n }\n\n const durOpts = Object.assign(\n { locale: this.locale, numberingSystem: this.numberingSystem },\n opts\n );\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.local(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit) {\n if (!this.isValid) return false;\n if (unit === \"millisecond\") {\n return this.valueOf() === otherDateTime.valueOf();\n } else {\n const inputMs = otherDateTime.valueOf();\n return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit);\n }\n }\n\n /**\n * Equality check\n * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds down by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.local().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.local().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({ zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n return diffRelative(\n base,\n this.plus(padding),\n Object.assign(options, {\n numeric: \"always\",\n units: [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"]\n })\n );\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.local().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(\n options.base || DateTime.fromObject({ zone: this.zone }),\n this,\n Object.assign(options, {\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true\n })\n );\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n"],"names":["LuxonError","Error","InvalidDateTimeError","reason","toMessage","InvalidIntervalError","InvalidDurationError","ConflictingSpecificationError","InvalidUnitError","unit","InvalidArgumentError","ZoneIsAbstractError","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_FULL","DATE_HUGE","weekday","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hour12","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","isUndefined","o","isNumber","isInteger","isString","isDate","Object","prototype","toString","call","hasIntl","Intl","DateTimeFormat","e","hasFormatToParts","formatToParts","hasRelative","RelativeTimeFormat","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","length","undefined","reduce","best","next","pair","pick","obj","keys","a","k","hasOwnProperty","prop","integerBetween","bottom","top","floorMod","x","Math","floor","padStart","input","repeat","slice","parseInteger","string","parseInt","parseMillis","fraction","f","parseFloat","roundTo","number","digits","towardZero","factor","rounder","trunc","round","isLeapYear","daysInYear","daysInMonth","modMonth","modYear","objToLocalTS","d","Date","UTC","millisecond","setUTCFullYear","getUTCFullYear","weeksInWeekYear","weekYear","p1","last","p2","untruncateYear","parseZoneInfo","ts","offsetFormat","locale","timeZone","date","intlOpts","modified","assign","intl","parsed","find","m","type","toLowerCase","value","without","format","included","diffed","substring","trimmed","replace","signedOffset","offHourStr","offMinuteStr","offHour","Number","isNaN","offMin","offMinSigned","is","asNumber","numericValue","normalizeObject","normalizer","nonUnitKeys","normalized","u","indexOf","v","formatOffset","offset","hours","minutes","abs","sign","base","RangeError","timeObject","ianaRegex","stringify","JSON","sort","monthsLong","monthsShort","monthsNarrow","months","weekdaysLong","weekdaysShort","weekdaysNarrow","weekdays","meridiems","erasLong","erasShort","erasNarrow","eras","meridiemForDateTime","dt","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","count","numeric","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","formatString","knownFormat","filtered","key","dateTimeHuge","Formats","stringifyTokens","splits","tokenToString","token","literal","val","macroTokenToFormatOpts","D","DD","DDD","DDDD","t","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","create","opts","parseFormat","fmt","current","currentFull","bracketed","i","c","charAt","push","formatOpts","loc","systemLoc","formatWithSystemDefault","redefaultToSystem","df","dtFormatter","formatDateTime","formatDateTimeParts","resolvedOptions","num","p","forceSimple","padTo","numberFormatter","formatDateTimeFromString","knownEnglish","listingMode","useDateTimeFormatter","outputCalendar","extract","isOffsetFixed","allowZ","isValid","zone","meridiem","English","standalone","maybeMacro","era","offsetName","zoneName","weekNumber","ordinal","quarter","formatDurationFromString","dur","tokenToField","lildur","mapped","get","tokens","realTokens","found","concat","collapsed","shiftTo","map","filter","Invalid","explanation","Zone","equals","otherZone","singleton","LocalZone","getTimezoneOffset","matchingRegex","RegExp","source","dtfCache","makeDTF","typeToPos","hackyOffset","dtf","formatted","exec","fMonth","fDay","fYear","fHour","fMinute","fSecond","partsOffset","filled","pos","ianaZoneCache","IANAZone","name","resetCache","isValidSpecifier","match","isValidZone","parseGMTOffset","specifier","valid","adjustedHour","asUTC","asTS","over","FixedOffsetZone","instance","utcInstance","parseSpecifier","r","fixed","InvalidZone","NaN","normalizeZone","defaultZone","lowered","now","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","throwOnInvalid","Settings","resetCaches","Locale","z","numberingSystem","intlDTCache","getCachedDTF","locString","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","cacheKeyOpts","sysLocaleCache","systemLocale","computedSys","parseLocaleString","localeStr","uIndex","options","smaller","calendar","intlConfigString","mapMonths","ms","DateTime","utc","mapWeekdays","listStuff","defaultOK","englishFn","intlFn","mode","supportsFastNumbers","startsWith","PolyNumberFormatter","useGrouping","minimumIntegerDigits","PolyDateFormatter","universal","fromMillis","toJSDate","tokenFormat","PolyRelFormatter","isEnglish","style","rtf","fromOpts","defaultToEN","specifiedLocale","localeR","numberingSystemR","outputCalendarR","fromObject","numbering","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","monthsCache","meridiemCache","eraCache","fastNumbersCached","hasFTP","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","formatStr","field","results","matching","fastNumbers","relFormatter","other","combineRegexes","regexes","full","combineExtractors","extractors","ex","mergedVals","mergedZone","cursor","parse","patterns","regex","extractor","simpleParse","ret","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","extractISOOffset","local","fullOffset","extractIANAZone","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","milliseconds","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDataAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOYmdTimeOffsetAndIANAZone","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","clear","conf","values","conversionAccuracy","Duration","antiTrunc","ceil","convert","matrix","fromMap","fromUnit","toMap","toUnit","conv","raw","sameSign","added","normalizeValues","vals","previous","config","accurate","invalid","isLuxonDuration","normalizeUnit","fromISO","text","week","isDuration","toFormat","fmtOpts","toObject","includeConfig","toISO","toJSON","valueOf","as","plus","duration","friendlyDuration","minus","negate","mapUnits","fn","set","mixed","reconfigure","normalize","built","accumulated","lastUnit","own","ak","down","negated","durationish","validateStartEnd","start","end","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","split","isInterval","toDuration","startOf","diff","hasSame","isEmpty","isAfter","dateTime","isBefore","contains","splitAt","dateTimes","sorted","splitBy","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","b","sofar","final","xor","currentCount","ends","time","flattened","difference","toISODate","toISOTime","dateFormat","separator","invalidReason","mapEndpoints","mapFn","Info","hasDST","proto","setZone","isValidIANAZone","monthsFormat","weekdaysFormat","features","intlTokens","zones","relative","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","differ","delta","remainingMillis","lowerOrderUnits","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","parseDigits","str","code","charCodeAt","search","min","max","digitRegex","append","MISSING_FTP","intUnit","post","deser","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","join","findIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","tokenForPart","part","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatter","parts","includes","expandMacroTokens","explainFromTokens","disqualifyingUnit","regexString","rawMatches","parseFromTokens","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","js","getUTCDay","computeOrdinal","uncomputeOrdinal","table","month0","gregorianToWeek","gregObj","weekToGregorian","weekData","weekdayOfJan4","yearInDays","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","hasInvalidWeekData","validYear","validWeek","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","MAX_DATE","unsupportedZone","possiblyCachedWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","toTechTimeFormat","suppressSeconds","suppressMilliseconds","includeOffset","includeZone","spaceZone","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","quickDT","tsNow","offsetProvis","diffRelative","calendary","unchanged","ot","_zone","isLuxonDateTime","fromJSDate","zoneToUse","fromSeconds","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","higherOrderInvalid","gregorian","tsFinal","offsetFinal","fromRFC2822","fromHTTP","fromFormat","localeToUse","fromString","fromSQL","isDateTime","resolvedLocaleOpts","toLocal","keepCalendarTime","newTS","offsetGuess","asObj","setLocale","settingWeekStuff","normalizedUnit","endOf","toLocaleString","toLocaleParts","toISOWeekDate","toRFC2822","toHTTP","toSQLDate","toSQLTime","toSQL","toMillis","toSeconds","toBSON","otherDateTime","durOpts","otherIsLater","diffNow","until","inputMs","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","fromStringExplain","dateTimeish"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;EAEA;;;MAGMA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A3B,IAAsCnhB,QAAQ,CAACi2B,WAAW,CAAC9U,OAAZ,EAAD,CAAlD,EAA2E;EAChF,WAAOxL,QAAQ,CAAC8c,UAAT,CAAoBwD,WAApB,CAAP;EACD,GAFM,MAEA,IAAIA,WAAW,IAAI,OAAOA,WAAP,KAAuB,QAA1C,EAAoD;EACzD,WAAOtgB,QAAQ,CAAC4B,UAAT,CAAoB0e,WAApB,CAAP;EACD,GAFM,MAEA;EACL,UAAM,IAAIt4B,oBAAJ,iCAC0Bs4B,WAD1B,kBACkD,OAAOA,WADzD,CAAN;EAGD;EACF;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/cjs-browser/luxon.js b/node_modules/luxon/build/cjs-browser/luxon.js new file mode 100644 index 0000000..2ba0685 --- /dev/null +++ b/node_modules/luxon/build/cjs-browser/luxon.js @@ -0,0 +1,8347 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); +} + +function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } +} + +function _construct(Parent, args, Class) { + if (isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); +} + +function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} + +function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); +} + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +// these aren't really private, but nor are they really useful to document + +/** + * @private + */ +var LuxonError = +/*#__PURE__*/ +function (_Error) { + _inheritsLoose(LuxonError, _Error); + + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + + return LuxonError; +}(_wrapNativeSuper(Error)); +/** + * @private + */ + + +var InvalidDateTimeError = +/*#__PURE__*/ +function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + + return InvalidDateTimeError; +}(LuxonError); +/** + * @private + */ + +var InvalidIntervalError = +/*#__PURE__*/ +function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + + return InvalidIntervalError; +}(LuxonError); +/** + * @private + */ + +var InvalidDurationError = +/*#__PURE__*/ +function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + + return InvalidDurationError; +}(LuxonError); +/** + * @private + */ + +var ConflictingSpecificationError = +/*#__PURE__*/ +function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + + return ConflictingSpecificationError; +}(LuxonError); +/** + * @private + */ + +var InvalidUnitError = +/*#__PURE__*/ +function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + + return InvalidUnitError; +}(LuxonError); +/** + * @private + */ + +var InvalidArgumentError = +/*#__PURE__*/ +function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + + return InvalidArgumentError; +}(LuxonError); +/** + * @private + */ + +var ZoneIsAbstractError = +/*#__PURE__*/ +function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + + return ZoneIsAbstractError; +}(LuxonError); + +/** + * @private + */ +var n = "numeric", + s = "short", + l = "long"; +var DATE_SHORT = { + year: n, + month: n, + day: n +}; +var DATE_MED = { + year: n, + month: s, + day: n +}; +var DATE_FULL = { + year: n, + month: l, + day: n +}; +var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l +}; +var TIME_SIMPLE = { + hour: n, + minute: n +}; +var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n +}; +var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l +}; +var TIME_24_SIMPLE = { + hour: n, + minute: n, + hour12: false +}; +/** + * {@link toLocaleString}; format like '09:30:23', always 24-hour. + */ + +var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hour12: false +}; +/** + * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour. + */ + +var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: s +}; +/** + * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour. + */ + +var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: l +}; +/** + * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + */ + +var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n +}; +/** + * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + */ + +var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n +}; +var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n +}; +var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n +}; +var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n +}; +var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s +}; +var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l +}; +var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l +}; + +/* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. +*/ +/** + * @private + */ +// TYPES + +function isUndefined(o) { + return typeof o === "undefined"; +} +function isNumber(o) { + return typeof o === "number"; +} +function isInteger(o) { + return typeof o === "number" && o % 1 === 0; +} +function isString(o) { + return typeof o === "string"; +} +function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; +} // CAPABILITIES + +function hasIntl() { + try { + return typeof Intl !== "undefined" && Intl.DateTimeFormat; + } catch (e) { + return false; + } +} +function hasFormatToParts() { + return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); +} +function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } +} // OBJECTS AND ARRAYS + +function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; +} +function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; +} +function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); +} +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} // NUMBERS AND STRINGS + +function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; +} // x % n but takes the sign of n instead of x + +function floorMod(x, n) { + return x - n * Math.floor(x / n); +} +function padStart(input, n) { + if (n === void 0) { + n = 2; + } + + if (input.toString().length < n) { + return ("0".repeat(n) + input).slice(-n); + } else { + return input.toString(); + } +} +function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } +} +function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } +} +function roundTo(number, digits, towardZero) { + if (towardZero === void 0) { + towardZero = false; + } + + var factor = Math.pow(10, digits), + rounder = towardZero ? Math.trunc : Math.round; + return rounder(number * factor) / factor; +} // DATE BASICS + +function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} +function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } +} // covert a calendar object to a local timestamp (epoch, but with the offset baked in) + +function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + + return +d; +} +function weeksInWeekYear(weekYear) { + var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, + last = weekYear - 1, + p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; + return p1 === 4 || p2 === 3 ? 53 : 52; +} +function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > 60 ? 1900 + year : 2000 + year; +} // PARSING + +function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + + var date = new Date(ts), + intlOpts = { + hour12: false, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + var modified = Object.assign({ + timeZoneName: offsetFormat + }, intlOpts), + intl = hasIntl(); + + if (intl && hasFormatToParts()) { + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; + } else if (intl) { + // this probably doesn't work for all locales + var without = new Intl.DateTimeFormat(locale, intlOpts).format(date), + included = new Intl.DateTimeFormat(locale, modified).format(date), + diffed = included.substring(without.length), + trimmed = diffed.replace(/^[, \u200e]+/, ""); + return trimmed; + } else { + return null; + } +} // signedOffset('-5', '30') -> -330 + +function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); // don't || this because we want to preserve -0 + + if (Number.isNaN(offHour)) { + offHour = 0; + } + + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; +} // COERCION + +function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; +} +function normalizeObject(obj, normalizer, nonUnitKeys) { + var normalized = {}; + + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + if (nonUnitKeys.indexOf(u) >= 0) continue; + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + + return normalized; +} +function formatOffset(offset, format) { + var hours = Math.trunc(offset / 60), + minutes = Math.abs(offset % 60), + sign = hours >= 0 && !Object.is(hours, -0) ? "+" : "-", + base = "" + sign + Math.abs(hours); + + switch (format) { + case "short": + return "" + sign + padStart(Math.abs(hours), 2) + ":" + padStart(minutes, 2); + + case "narrow": + return minutes > 0 ? base + ":" + minutes : base; + + case "techie": + return "" + sign + padStart(Math.abs(hours), 2) + padStart(minutes, 2); + + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } +} +function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); +} +var ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; + +function stringify(obj) { + return JSON.stringify(obj, Object.keys(obj).sort()); +} +/** + * @private + */ + + +var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; +function months(length) { + switch (length) { + case "narrow": + return monthsNarrow; + + case "short": + return monthsShort; + + case "long": + return monthsLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + + default: + return null; + } +} +var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; +var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; +var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; +function weekdays(length) { + switch (length) { + case "narrow": + return weekdaysNarrow; + + case "short": + return weekdaysShort; + + case "long": + return weekdaysLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + + default: + return null; + } +} +var meridiems = ["AM", "PM"]; +var erasLong = ["Before Christ", "Anno Domini"]; +var erasShort = ["BC", "AD"]; +var erasNarrow = ["B", "A"]; +function eras(length) { + switch (length) { + case "narrow": + return erasNarrow; + + case "short": + return erasShort; + + case "long": + return erasLong; + + default: + return null; + } +} +function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; +} +function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; +} +function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; +} +function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; +} +function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + + if (narrow === void 0) { + narrow = false; + } + + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + + case 0: + return isDay ? "today" : "this " + units[unit][0]; + + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; +} +function formatString(knownFormat) { + // these all have the offsets removed because we don't have access to them + // without all the intl stuff this is backfilling + var filtered = pick(knownFormat, ["weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "hour12"]), + key = stringify(filtered), + dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; + + switch (key) { + case stringify(DATE_SHORT): + return "M/d/yyyy"; + + case stringify(DATE_MED): + return "LLL d, yyyy"; + + case stringify(DATE_FULL): + return "LLLL d, yyyy"; + + case stringify(DATE_HUGE): + return "EEEE, LLLL d, yyyy"; + + case stringify(TIME_SIMPLE): + return "h:mm a"; + + case stringify(TIME_WITH_SECONDS): + return "h:mm:ss a"; + + case stringify(TIME_WITH_SHORT_OFFSET): + return "h:mm a"; + + case stringify(TIME_WITH_LONG_OFFSET): + return "h:mm a"; + + case stringify(TIME_24_SIMPLE): + return "HH:mm"; + + case stringify(TIME_24_WITH_SECONDS): + return "HH:mm:ss"; + + case stringify(TIME_24_WITH_SHORT_OFFSET): + return "HH:mm"; + + case stringify(TIME_24_WITH_LONG_OFFSET): + return "HH:mm"; + + case stringify(DATETIME_SHORT): + return "M/d/yyyy, h:mm a"; + + case stringify(DATETIME_MED): + return "LLL d, yyyy, h:mm a"; + + case stringify(DATETIME_FULL): + return "LLLL d, yyyy, h:mm a"; + + case stringify(DATETIME_HUGE): + return dateTimeHuge; + + case stringify(DATETIME_SHORT_WITH_SECONDS): + return "M/d/yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_SECONDS): + return "LLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_WEEKDAY): + return "EEE, d LLL yyyy, h:mm a"; + + case stringify(DATETIME_FULL_WITH_SECONDS): + return "LLLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_HUGE_WITH_SECONDS): + return "EEEE, LLLL d, yyyy, h:mm:ss a"; + + default: + return dateTimeHuge; + } +} + +function stringifyTokens(splits, tokenToString) { + var s = ""; + + for (var _iterator = splits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var token = _ref; + + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + + return s; +} + +var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS +}; +/** + * @private + */ + +var Formatter = +/*#__PURE__*/ +function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + + return new Formatter(locale, opts); + }; + + Formatter.parseFormat = function parseFormat(fmt) { + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + + if (c === "'") { + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: false, + val: currentFull + }); + } + + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + return splits; + }; + + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + var _proto = Formatter.prototype; + + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + + var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTime = function formatDateTime(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.formatToParts(); + }; + + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.resolvedOptions(); + }; + + _proto.num = function num(n, p) { + if (p === void 0) { + p = 0; + } + + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + var opts = Object.assign({}, this.opts); + + if (p > 0) { + opts.padTo = p; + } + + return this.loc.numberFormatter(opts).format(n); + }; + + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hour12: true + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + + case "u": // falls through + + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + + case "s": + return _this.num(dt.second); + + case "ss": + return _this.num(dt.second, 2); + // minutes + + case "m": + return _this.num(dt.minute); + + case "mm": + return _this.num(dt.minute, 2); + // hours + + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + + case "H": + return _this.num(dt.hour); + + case "HH": + return _this.num(dt.hour, 2); + // offset + + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + + case "a": + return meridiem(); + // dates + + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + + case "c": + // like 1 + return _this.num(dt.weekday); + + case "ccc": + // like 'Tues' + return weekday("short", true); + + case "cccc": + // like 'Tuesday' + return weekday("long", true); + + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + + case "E": + // like 1 + return _this.num(dt.weekday); + + case "EEE": + // like 'Tues' + return weekday("short", false); + + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + + case "LLL": + // like Jan + return month("short", true); + + case "LLLL": + // like January + return month("long", true); + + case "LLLLL": + // like J + return month("narrow", true); + // months - format + + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + + case "MMM": + // like Jan + return month("short", false); + + case "MMMM": + // like January + return month("long", false); + + case "MMMMM": + // like J + return month("narrow", false); + // years + + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + + case "G": + // like AD + return era("short"); + + case "GG": + // like Anno Domini + return era("long"); + + case "GGGGG": + return era("narrow"); + + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + + case "kkkk": + return _this.num(dt.weekYear, 4); + + case "W": + return _this.num(dt.weekNumber); + + case "WW": + return _this.num(dt.weekNumber, 2); + + case "o": + return _this.num(dt.ordinal); + + case "ooo": + return _this.num(dt.ordinal, 3); + + case "q": + // like 1 + return _this.num(dt.quarter); + + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + + case "x": + return _this.num(dt.ts); + + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + return "hour"; + + case "d": + return "day"; + + case "M": + return "month"; + + case "y": + return "year"; + + default: + return null; + } + }, + tokenToString = function tokenToString(lildur) { + return function (token) { + var mapped = tokenToField(token); + + if (mapped) { + return _this2.num(lildur.get(mapped), token.length); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref2) { + var literal = _ref2.literal, + val = _ref2.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })); + + return stringifyTokens(tokens, tokenToString(collapsed)); + }; + + return Formatter; +}(); + +var Invalid = +/*#__PURE__*/ +function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + var _proto = Invalid.prototype; + + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + + return Invalid; +}(); + +/** + * @interface + */ + +var Zone = +/*#__PURE__*/ +function () { + function Zone() {} + + var _proto = Zone.prototype; + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + ; + + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + ; + + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + ; + + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + ; + + _createClass(Zone, [{ + key: "type", + + /** + * The type of zone + * @abstract + * @type {string} + */ + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * The name of this zone. + * @abstract + * @type {string} + */ + + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + + }, { + key: "universal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + + return Zone; +}(); + +var singleton = null; +/** + * Represents the local zone for this Javascript environment. + * @implements {Zone} + */ + +var LocalZone = +/*#__PURE__*/ +function (_Zone) { + _inheritsLoose(LocalZone, _Zone); + + function LocalZone() { + return _Zone.apply(this, arguments) || this; + } + + var _proto = LocalZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "local"; + } + /** @override **/ + ; + + _createClass(LocalZone, [{ + key: "type", + + /** @override **/ + get: function get() { + return "local"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + if (hasIntl()) { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } else return "local"; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + + /** + * Get a singleton instance of the local zone + * @return {LocalZone} + */ + get: function get() { + if (singleton === null) { + singleton = new LocalZone(); + } + + return singleton; + } + }]); + + return LocalZone; +}(Zone); + +var matchingRegex = RegExp("^" + ianaRegex.source + "$"); +var dtfCache = {}; + +function makeDTF(zone) { + if (!dtfCache[zone]) { + dtfCache[zone] = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zone, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" + }); + } + + return dtfCache[zone]; +} + +var typeToPos = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5 +}; + +function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fHour = parsed[4], + fMinute = parsed[5], + fSecond = parsed[6]; + return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; +} + +function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date), + filled = []; + + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value, + pos = typeToPos[type]; + + if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + + return filled; +} + +var ianaZoneCache = {}; +/** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + +var IANAZone = +/*#__PURE__*/ +function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + if (!ianaZoneCache[name]) { + ianaZoneCache[name] = new IANAZone(name); + } + + return ianaZoneCache[name]; + } + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + ; + + IANAZone.resetCache = function resetCache() { + ianaZoneCache = {}; + dtfCache = {}; + } + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Fantasia/Castle") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return !!(s && s.match(matchingRegex)); + } + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidZone = function isValidZone(zone) { + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + } // Etc/GMT+8 -> -480 + + /** @ignore */ + ; + + IANAZone.parseGMTOffset = function parseGMTOffset(specifier) { + if (specifier) { + var match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); + + if (match) { + return -60 * parseInt(match[1]); + } + } + + return null; + }; + + function IANAZone(name) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.zoneName = name; + /** @private **/ + + _this.valid = IANAZone.isValidZone(name); + return _this; + } + /** @override **/ + + + var _proto = IANAZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + var date = new Date(ts), + dtf = makeDTF(this.name), + _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + hour = _ref2[3], + minute = _ref2[4], + second = _ref2[5], + adjustedHour = hour === 24 ? 0 : hour; + + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + /** @override **/ + ; + + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + + return IANAZone; +}(Zone); + +var singleton$1 = null; +/** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + +var FixedOffsetZone = +/*#__PURE__*/ +function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + ; + + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + + return null; + }; + + _createClass(FixedOffsetZone, null, [{ + key: "utcInstance", + + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + get: function get() { + if (singleton$1 === null) { + singleton$1 = new FixedOffsetZone(0); + } + + return singleton$1; + } + }]); + + function FixedOffsetZone(offset) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.fixed = offset; + return _this; + } + /** @override **/ + + + var _proto = FixedOffsetZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return this.name; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + /** @override **/ + ; + + /** @override **/ + _proto.offset = function offset() { + return this.fixed; + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + /** @override **/ + ; + + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + }, { + key: "universal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }]); + + return FixedOffsetZone; +}(Zone); + +/** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + +var InvalidZone = +/*#__PURE__*/ +function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + + function InvalidZone(zoneName) { + var _this; + + _this = _Zone.call(this) || this; + /** @private */ + + _this.zoneName = zoneName; + return _this; + } + /** @override **/ + + + var _proto = InvalidZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset() { + return ""; + } + /** @override **/ + ; + + _proto.offset = function offset() { + return NaN; + } + /** @override **/ + ; + + _proto.equals = function equals() { + return false; + } + /** @override **/ + ; + + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + + return InvalidZone; +}(Zone); + +/** + * @private + */ +function normalizeZone(input, defaultZone) { + var offset; + + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "local") return defaultZone;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) { + // handle Etc/GMT-4, which V8 chokes on + return FixedOffsetZone.instance(offset); + } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } +} + +var now = function now() { + return Date.now(); +}, + defaultZone = null, + // not setting this directly to LocalZone.instance bc loading order issues +defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + throwOnInvalid = false; +/** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + + +var Settings = +/*#__PURE__*/ +function () { + function Settings() {} + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + }; + + _createClass(Settings, null, [{ + key: "now", + + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + get: function get() { + return now; + } + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + , + set: function set(n) { + now = n; + } + /** + * Get the default time zone to create DateTimes in. + * @type {string} + */ + + }, { + key: "defaultZoneName", + get: function get() { + return Settings.defaultZone.name; + } + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * @type {string} + */ + , + set: function set(z) { + if (!z) { + defaultZone = null; + } else { + defaultZone = normalizeZone(z); + } + } + /** + * Get the default time zone object to create DateTimes in. Does not affect existing instances. + * @type {Zone} + */ + + }, { + key: "defaultZone", + get: function get() { + return defaultZone || LocalZone.instance; + } + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(locale) { + defaultLocale = locale; + } + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + , + set: function set(t) { + throwOnInvalid = t; + } + }]); + + return Settings; +}(); + +var intlDTCache = {}; + +function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache[key]; + + if (!dtf) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache[key] = dtf; + } + + return dtf; +} + +var intlNumCache = {}; + +function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache[key]; + + if (!inf) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache[key] = inf; + } + + return inf; +} + +var intlRelCache = {}; + +function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var _opts = opts, + base = _opts.base, + cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, ["base"]); // exclude `base` from the options + + + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache[key]; + + if (!inf) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache[key] = inf; + } + + return inf; +} + +var sysLocaleCache = null; + +function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else if (hasIntl()) { + var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; // node sometimes defaults to "und". Override that because that is dumb + + sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; + return sysLocaleCache; + } else { + sysLocaleCache = "en-US"; + return sysLocaleCache; + } +} + +function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + var uIndex = localeStr.indexOf("-u-"); + + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var smaller = localeStr.substring(0, uIndex); + + try { + options = getCachedDTF(localeStr).resolvedOptions(); + } catch (e) { + options = getCachedDTF(smaller).resolvedOptions(); + } + + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; // return the smaller one so that we can append the calendar and numbering overrides to it + + return [smaller, numberingSystem, calendar]; + } +} + +function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (hasIntl()) { + if (outputCalendar || numberingSystem) { + localeStr += "-u"; + + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + + return localeStr; + } else { + return localeStr; + } + } else { + return []; + } +} + +function mapMonths(f) { + var ms = []; + + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2016, i, 1); + ms.push(f(dt)); + } + + return ms; +} + +function mapWeekdays(f) { + var ms = []; + + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + + return ms; +} + +function listStuff(loc, length, defaultOK, englishFn, intlFn) { + var mode = loc.listingMode(defaultOK); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } +} + +function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; + } +} +/** + * @private + */ + + +var PolyNumberFormatter = +/*#__PURE__*/ +function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + if (!forceSimple && hasIntl()) { + var intlOpts = { + useGrouping: false + }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + var _proto = PolyNumberFormatter.prototype; + + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + + return padStart(_fixed, this.padTo); + } + }; + + return PolyNumberFormatter; +}(); +/** + * @private + */ + + +var PolyDateFormatter = +/*#__PURE__*/ +function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.hasIntl = hasIntl(); + var z; + + if (dt.zone.universal && this.hasIntl) { + // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter, + // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374. + // So we have to make do. Two cases: + // 1. The format options tell us to show the zone. We can't do that, so the best + // we can do is format the date in UTC. + // 2. The format options don't tell us to show the zone. Then we can adjust them + // the time and tell the formatter to show it to us in UTC, so that the time is right + // and the bad zone doesn't show up. + // We can clean all this up when Chrome fixes this. + z = "UTC"; + + if (opts.timeZoneName) { + this.dt = dt; + } else { + this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000); + } + } else if (dt.zone.type === "local") { + this.dt = dt; + } else { + this.dt = dt; + z = dt.zone.name; + } + + if (this.hasIntl) { + var intlOpts = Object.assign({}, this.opts); + + if (z) { + intlOpts.timeZone = z; + } + + this.dtf = getCachedDTF(intl, intlOpts); + } + } + + var _proto2 = PolyDateFormatter.prototype; + + _proto2.format = function format() { + if (this.hasIntl) { + return this.dtf.format(this.dt.toJSDate()); + } else { + var tokenFormat = formatString(this.opts), + loc = Locale.create("en-US"); + return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); + } + }; + + _proto2.formatToParts = function formatToParts() { + if (this.hasIntl && hasFormatToParts()) { + return this.dtf.formatToParts(this.dt.toJSDate()); + } else { + // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings + // and IMO it's too weird to have an uncanny valley like that + return []; + } + }; + + _proto2.resolvedOptions = function resolvedOptions() { + if (this.hasIntl) { + return this.dtf.resolvedOptions(); + } else { + return { + locale: "en-US", + numberingSystem: "latn", + outputCalendar: "gregory" + }; + } + }; + + return PolyDateFormatter; +}(); +/** + * @private + */ + + +var PolyRelFormatter = +/*#__PURE__*/ +function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = Object.assign({ + style: "long" + }, opts); + + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + var _proto3 = PolyRelFormatter.prototype; + + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + + return PolyRelFormatter; +}(); +/** + * @private + */ + + +var Locale = +/*#__PURE__*/ +function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); + }; + + Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + + var specifiedLocale = locale || Settings.defaultLocale, + // the system locale is useful for human readable strings but annoying for parsing/formatting known formats + localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), + numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, + outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); + }; + + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache = {}; + intlNumCache = {}; + intlRelCache = {}; + }; + + Locale.fromObject = function fromObject(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + outputCalendar = _ref.outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar); + }; + + function Locale(locale, numbering, outputCalendar, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + var _proto4 = Locale.prototype; + + _proto4.listingMode = function listingMode(defaultOK) { + if (defaultOK === void 0) { + defaultOK = true; + } + + var intl = hasIntl(), + hasFTP = intl && hasFormatToParts(), + isActuallyEn = this.isEnglish(), + hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + + if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { + return "error"; + } else if (!hasFTP || isActuallyEn && hasNoWeirdness) { + return "en"; + } else { + return "intl"; + } + }; + + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false); + } + }; + + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: true + })); + }; + + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: false + })); + }; + + _proto4.months = function months$1(length, format, defaultOK) { + var _this = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, months, function () { + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this.monthsCache[formatStr][length]) { + _this.monthsCache[formatStr][length] = mapMonths(function (dt) { + return _this.extract(dt, intl, "month"); + }); + } + + return _this.monthsCache[formatStr][length]; + }); + }; + + _proto4.weekdays = function weekdays$1(length, format, defaultOK) { + var _this2 = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this2.weekdaysCache[formatStr][length]) { + _this2.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this2.extract(dt, intl, "weekday"); + }); + } + + return _this2.weekdaysCache[formatStr][length]; + }); + }; + + _proto4.meridiems = function meridiems$1(defaultOK) { + var _this3 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, undefined, defaultOK, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this3.meridiemCache) { + var intl = { + hour: "numeric", + hour12: true + }; + _this3.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this3.extract(dt, intl, "dayperiod"); + }); + } + + return _this3.meridiemCache; + }); + }; + + _proto4.eras = function eras$1(length, defaultOK) { + var _this4 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, eras, function () { + var intl = { + era: length + }; // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + + if (!_this4.eraCache[length]) { + _this4.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this4.extract(dt, intl, "era"); + }); + } + + return _this4.eraCache[length]; + }); + }; + + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); + }; + + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + }]); + + return Locale; +}(); + +/* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + +function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); +} + +function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + + return [Object.assign(mergedVals, val), mergedZone || zone, next]; + }, [{}, null, 1]).slice(0, 2); + }; +} + +function parse(s) { + if (s == null) { + return [null, null]; + } + + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + + if (m) { + return extractor(m); + } + } + + return [null, null]; +} + +function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + + return function (match, cursor) { + var ret = {}; + var i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + + return [ret, null, cursor + i]; + }; +} // ISO and SQL parsing + + +var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, + isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/, + isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + offsetRegex.source + "?"), + isoTimeExtensionRegex = RegExp("(?:T" + isoTimeRegex.source + ")?"), + isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, + isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, + isoOrdinalRegex = /(\d{4})-?(\d{3})/, + extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), + extractISOOrdinalData = simpleParse("year", "ordinal"), + sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, + // dumbed-down version of the ISO one +sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"), + sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); + +function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); +} + +function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; +} + +function extractISOTime(match, cursor) { + var item = { + hour: int(match, cursor, 0), + minute: int(match, cursor + 1, 0), + second: int(match, cursor + 2, 0), + millisecond: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; +} + +function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; +} + +function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; +} // ISO duration parsing + + +var isoDuration = /^P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})(?:[.,](-?\d{1,9}))?S)?)?)$/; + +function extractISODuration(match) { + var yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + return [{ + years: parseInteger(yearStr), + months: parseInteger(monthStr), + weeks: parseInteger(weekStr), + days: parseInteger(dayStr), + hours: parseInteger(hourStr), + minutes: parseInteger(minuteStr), + seconds: parseInteger(secondStr), + milliseconds: parseMillis(millisecondsStr) + }]; +} // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York +// and not just that we're in -240 *right now*. But since I don't think these are used that often +// I'm just going to ignore that + + +var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; + +function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; +} // RFC 2822/5322 + + +var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + +function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; +} + +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); +} // http date + + +var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + +function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); +var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); +var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); +var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); +var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset); +var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset); +var extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime); +var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); +/** + * @private + */ + +function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); +} +function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); +} +function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); +} +function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); +} +var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); +var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); +var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); +var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); +function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); +} + +var INVALID = "Invalid Duration"; // unit conversion constants + +var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } +}, + casualMatrix = Object.assign({ + years: { + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } +}, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = Object.assign({ + years: { + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } +}, lowOrderMatrix); // units ordered by size + +var orderedUnits = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; +var reverseUnits = orderedUnits.slice(0).reverse(); // clone really means "create another instance just like this one, but with these changes" + +function clone(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + + // deep merge for vals + var conf = { + values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy + }; + return new Duration(conf); +} + +function antiTrunc(n) { + return n < 0 ? Math.floor(n) : Math.ceil(n); +} // NB: mutates parameters + + +function convert(matrix, fromMap, fromUnit, toMap, toUnit) { + var conv = matrix[toUnit][fromUnit], + raw = fromMap[fromUnit] / conv, + sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), + // ok, so this is wild, but see the matrix in the tests + added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); + toMap[toUnit] += added; + fromMap[fromUnit] -= added * conv; +} // NB: mutates parameters + + +function normalizeValues(matrix, vals) { + reverseUnits.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + convert(matrix, vals, previous, vals, current); + } + + return current; + } else { + return previous; + } + }, null); +} +/** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. + * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + + +var Duration = +/*#__PURE__*/ +function () { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + /** + * @access private + */ + + this.values = config.values; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.matrix = accurate ? accurateMatrix : casualMatrix; + /** + * @access private + */ + + this.isLuxonDuration = true; + } + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject(Object.assign({ + milliseconds: count + }, opts)); + } + /** + * Create a Duration from a Javascript object with keys like 'years' and 'hours. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {string} [obj.locale='en-US'] - the locale to use + * @param {string} obj.numberingSystem - the numbering system to use + * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + Duration.fromObject = function fromObject(obj) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit, ["locale", "numberingSystem", "conversionAccuracy", "zone" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this + ]), + loc: Locale.fromObject(obj), + conversionAccuracy: obj.conversionAccuracy + }); + } + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + ; + + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + + if (parsed) { + var obj = Object.assign(parsed, opts); + return Duration.fromObject(obj); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + ; + + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + /** + * @private + */ + ; + + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + ; + + var _proto = Duration.prototype; + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = Object.assign({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID; + } + /** + * Returns a Javascript object with this Duration's values. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.values); + + if (opts.includeConfig) { + base.conversionAccuracy = this.conversionAccuracy; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + ; + + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.toISO(); + } + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.as("milliseconds"); + } + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration), + result = {}; + + for (var _iterator = orderedUnits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var k = _ref; + + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone(this, { + values: result + }, true); + } + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return this.plus(dur.negate()); + } + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + ; + + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + + for (var _i2 = 0, _Object$keys = Object.keys(this.values); _i2 < _Object$keys.length; _i2++) { + var k = _Object$keys[_i2]; + result[k] = asNumber(fn(this.values[k], k)); + } + + return clone(this, { + values: result + }, true); + } + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).years //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).months //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).days //=> 3 + * @return {number} + */ + ; + + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, [])); + return clone(this, { + values: mixed + }); + } + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + ; + + _proto.reconfigure = function reconfigure(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + locale = _ref2.locale, + numberingSystem = _ref2.numberingSystem, + conversionAccuracy = _ref2.conversionAccuracy; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }), + opts = { + loc: loc + }; + + if (conversionAccuracy) { + opts.conversionAccuracy = conversionAccuracy; + } + + return clone(this, opts); + } + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + ; + + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + /** + * Reduce this Duration to its canonical representation in its current units. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @return {Duration} + */ + ; + + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone(this, { + values: vals + }, true); + } + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + ; + + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + normalizeValues(this.matrix, vals); + + for (var _iterator2 = orderedUnits, _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i3 >= _iterator2.length) break; + _ref3 = _iterator2[_i3++]; + } else { + _i3 = _iterator2.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var k = _ref3; + + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; // anything we haven't boiled down yet should get boiled to this unit + + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } // plus anything that's already in this unit + + + if (isNumber(vals[k])) { + own += vals[k]; + } + + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = own - i; // we'd like to absorb these fractions in another unit + // plus anything further down the chain that should be rolled up in to this + + for (var down in vals) { + if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { + convert(this.matrix, vals, down, built, k); + } + } // otherwise, keep it in the wings to boil it later + + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + + + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + return clone(this, { + values: built + }, true).normalize(); + } + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + ; + + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + + for (var _i4 = 0, _Object$keys2 = Object.keys(this.values); _i4 < _Object$keys2.length; _i4++) { + var k = _Object$keys2[_i4]; + negated[k] = -this.values[k]; + } + + return clone(this, { + values: negated + }, true); + } + /** + * Get the years. + * @type {number} + */ + ; + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + for (var _iterator3 = orderedUnits, _isArray3 = Array.isArray(_iterator3), _i5 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref4; + + if (_isArray3) { + if (_i5 >= _iterator3.length) break; + _ref4 = _iterator3[_i5++]; + } else { + _i5 = _iterator3.next(); + if (_i5.done) break; + _ref4 = _i5.value; + } + + var u = _ref4; + + if (this.values[u] !== other.values[u]) { + return false; + } + } + + return true; + }; + + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + /** + * Get the quarters. + * @type {number} + */ + + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + /** + * Get the months. + * @type {number} + */ + + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + /** + * Get the weeks + * @type {number} + */ + + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + /** + * Get the days. + * @type {number} + */ + + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + /** + * Get the hours. + * @type {number} + */ + + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + /** + * Get the minutes. + * @type {number} + */ + + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + /** + * Get the seconds. + * @return {number} + */ + + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + /** + * Get the milliseconds. + * @return {number} + */ + + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Duration; +}(); +function friendlyDuration(durationish) { + if (isNumber(durationish)) { + return Duration.fromMillis(durationish); + } else if (Duration.isDuration(durationish)) { + return durationish; + } else if (typeof durationish === "object") { + return Duration.fromObject(durationish); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationish + " of type " + typeof durationish); + } +} + +var INVALID$1 = "Invalid Interval"; // checks if the start is equal to or before the end + +function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } +} +/** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. + * * **Accessors** Use {@link start} and {@link end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}. + * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs} + * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. + */ + + +var Interval = +/*#__PURE__*/ +function () { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + + this.e = config.end; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.isLuxonInterval = true; + } + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + + + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + ; + + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.after = function after(start, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.before = function before(end, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + ; + + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + + if (s && e) { + var start = DateTime.fromISO(s, opts), + end = DateTime.fromISO(e, opts); + + if (start.isValid && end.isValid) { + return Interval.fromDateTimes(start, end); + } + + if (start.isValid) { + var dur = Duration.fromISO(e, opts); + + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (end.isValid) { + var _dur = Duration.fromISO(s, opts); + + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + /** + * Returns the start of the Interval + * @type {DateTime} + */ + ; + + var _proto = Interval.prototype; + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @return {number} + */ + ; + + _proto.count = function count(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (!this.isValid) return NaN; + var start = this.start.startOf(unit), + end = this.end.startOf(unit); + return Math.floor(end.diff(start, unit).get(unit)) + 1; + } + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false; + } + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + ; + + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + ; + + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + /** + * Split this Interval at each of the specified DateTimes + * @param {...[DateTime]} dateTimes - the unit of time to count. + * @return {[Interval]} + */ + ; + + _proto.splitAt = function splitAt() { + var _this = this; + + if (!this.isValid) return []; + + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(), + results = []; + var s = this.s, + i = 0; + + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {[Interval]} + */ + ; + + _proto.splitBy = function splitBy(duration) { + var dur = friendlyDuration(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + var s = this.s, + added, + next; + var results = []; + + while (s < this.e) { + added = s.plus(dur); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + } + + return results; + } + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {[Interval]} + */ + ; + + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + /** + * Return whether this Interval engulfs the start and end of the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s > e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + + if (final) { + found.push(final); + } + + return found; + } + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.xor = function xor(intervals) { + var _Array$prototype; + + var start = null, + currentCount = 0; + + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + + for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var i = _ref3; + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {[Interval]} + */ + ; + + _proto.difference = function difference() { + var _this2 = this; + + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + ; + + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + /** + * Returns a string representation of this Interval formatted according to the specified format string. + * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. + * @param {Object} opts - options + * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref4 = _temp2 === void 0 ? {} : _temp2, + _ref4$separator = _ref4.separator, + separator = _ref4$separator === void 0 ? " – " : _ref4$separator; + + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + ; + + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + + return this.e.diff(this.s, unit, opts); + } + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + ; + + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + /** + * Returns the end of the Interval + * @type {DateTime} + */ + + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Interval; +}(); + +/** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + +var Info = +/*#__PURE__*/ +function () { + function Info() {} + + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + + var proto = DateTime.local().setZone(zone).set({ + month: 12 + }); + return !zone.universal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + ; + + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); + } + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone.isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + ; + + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {[string]} + */ + ; + + Info.months = function months(length, _temp) { + if (length === void 0) { + length = "long"; + } + + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$numberingSystem = _ref.numberingSystem, + numberingSystem = _ref$numberingSystem === void 0 ? null : _ref$numberingSystem, + _ref$outputCalendar = _ref.outputCalendar, + outputCalendar = _ref$outputCalendar === void 0 ? "gregory" : _ref$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length); + } + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {[string]} + */ + ; + + Info.monthsFormat = function monthsFormat(length, _temp2) { + if (length === void 0) { + length = "long"; + } + + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$numberingSystem = _ref2.numberingSystem, + numberingSystem = _ref2$numberingSystem === void 0 ? null : _ref2$numberingSystem, + _ref2$outputCalendar = _ref2.outputCalendar, + outputCalendar = _ref2$outputCalendar === void 0 ? "gregory" : _ref2$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length, true); + } + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {[string]} + */ + ; + + Info.weekdays = function weekdays(length, _temp3) { + if (length === void 0) { + length = "long"; + } + + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$numberingSystem = _ref3.numberingSystem, + numberingSystem = _ref3$numberingSystem === void 0 ? null : _ref3$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length); + } + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @return {[string]} + */ + ; + + Info.weekdaysFormat = function weekdaysFormat(length, _temp4) { + if (length === void 0) { + length = "long"; + } + + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length, true); + } + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {[string]} + */ + ; + + Info.meridiems = function meridiems(_temp5) { + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale; + + return Locale.create(locale).meridiems(); + } + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {[string]} + */ + ; + + Info.eras = function eras(length, _temp6) { + if (length === void 0) { + length = "short"; + } + + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale; + + return Locale.create(locale, null, "gregory").eras(length); + } + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case. + * Keys: + * * `zones`: whether this environment supports IANA timezones + * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing + * * `intl`: whether this environment supports general internationalization + * * `relative`: whether this environment supports relative time formatting + * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false } + * @return {Object} + */ + ; + + Info.features = function features() { + var intl = false, + intlTokens = false, + zones = false, + relative = false; + + if (hasIntl()) { + intl = true; + intlTokens = hasFormatToParts(); + relative = hasRelative(); + + try { + zones = new Intl.DateTimeFormat("en", { + timeZone: "America/New_York" + }).resolvedOptions().timeZone === "America/New_York"; + } catch (e) { + zones = false; + } + } + + return { + intl: intl, + intlTokens: intlTokens, + zones: zones, + relative: relative + }; + }; + + return Info; +}(); + +function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + + return Math.floor(Duration.fromMillis(ms).as("days")); +} + +function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var lowestOrder, highWater; + + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + + if (units.indexOf(unit) >= 0) { + var _cursor$plus; + + lowestOrder = unit; + var delta = differ(cursor, later); + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[unit] = delta, _cursor$plus)); + + if (highWater > later) { + var _cursor$plus2; + + cursor = cursor.plus((_cursor$plus2 = {}, _cursor$plus2[unit] = delta - 1, _cursor$plus2)); + delta -= 1; + } else { + cursor = highWater; + } + + results[unit] = delta; + } + } + + return [cursor, results, highWater, lowestOrder]; +} + +function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus3; + + highWater = cursor.plus((_cursor$plus3 = {}, _cursor$plus3[lowestOrder] = 1, _cursor$plus3)); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + var duration = Duration.fromObject(Object.assign(results, opts)); + + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } +} + +var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" +}; +var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] +}; // eslint-disable-next-line + +var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); +function parseDigits(str) { + var value = parseInt(str, 10); + + if (isNaN(value)) { + value = ""; + + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + + return parseInt(value, 10); + } else { + return value; + } +} +function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + + if (append === void 0) { + append = ""; + } + + return new RegExp("" + numberingSystems[numberingSystem || "latn"] + append); +} + +var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + +function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; +} + +function fixListRegex(s) { + // make dots optional and also make them literal + return s.replace(/\./, "\\.?"); +} + +function stripInsensitivities(s) { + return s.replace(/\./, "").toLowerCase(); +} + +function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } +} + +function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; +} + +function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; +} + +function escapeToken(value) { + // eslint-disable-next-line no-useless-escape + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} + +function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short", false), 0); + + case "GG": + return oneOf(loc.eras("long", false), 0); + // years + + case "y": + return intUnit(oneToSix); + + case "yy": + return intUnit(twoToFour, untruncateYear); + + case "yyyy": + return intUnit(four); + + case "yyyyy": + return intUnit(fourToSix); + + case "yyyyyy": + return intUnit(six); + // months + + case "M": + return intUnit(oneOrTwo); + + case "MM": + return intUnit(two); + + case "MMM": + return oneOf(loc.months("short", true, false), 1); + + case "MMMM": + return oneOf(loc.months("long", true, false), 1); + + case "L": + return intUnit(oneOrTwo); + + case "LL": + return intUnit(two); + + case "LLL": + return oneOf(loc.months("short", false, false), 1); + + case "LLLL": + return oneOf(loc.months("long", false, false), 1); + // dates + + case "d": + return intUnit(oneOrTwo); + + case "dd": + return intUnit(two); + // ordinals + + case "o": + return intUnit(oneToThree); + + case "ooo": + return intUnit(three); + // time + + case "HH": + return intUnit(two); + + case "H": + return intUnit(oneOrTwo); + + case "hh": + return intUnit(two); + + case "h": + return intUnit(oneOrTwo); + + case "mm": + return intUnit(two); + + case "m": + return intUnit(oneOrTwo); + + case "q": + return intUnit(oneOrTwo); + + case "qq": + return intUnit(two); + + case "s": + return intUnit(oneOrTwo); + + case "ss": + return intUnit(two); + + case "S": + return intUnit(oneToThree); + + case "SSS": + return intUnit(three); + + case "u": + return simple(oneToNine); + // meridiem + + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + + case "kkkk": + return intUnit(four); + + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + + case "W": + return intUnit(oneOrTwo); + + case "WW": + return intUnit(two); + // weekdays + + case "E": + case "c": + return intUnit(one); + + case "EEE": + return oneOf(loc.weekdays("short", false, false), 1); + + case "EEEE": + return oneOf(loc.weekdays("long", false, false), 1); + + case "ccc": + return oneOf(loc.weekdays("short", true, false), 1); + + case "cccc": + return oneOf(loc.weekdays("long", true, false), 1); + // offset/zone + + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + + default: + return literal(t); + } + }; + + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; +} + +var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour: { + numeric: "h", + "2-digit": "hh" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + } +}; + +function tokenForPart(part, locale, formatOpts) { + var type = part.type, + value = part.value; + + if (type === "literal") { + return { + literal: true, + val: value + }; + } + + var style = formatOpts[type]; + var val = partTypeStyleToTokenVal[type]; + + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val: val + }; + } + + return undefined; +} + +function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; +} + +function match(input, regex, handlers) { + var matches = input.match(regex); + + if (matches) { + var all = {}; + var matchIndex = 1; + + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + + matchIndex += groups; + } + } + + return [matches, all]; + } else { + return [matches, {}]; + } +} + +function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + case "H": + return "hour"; + + case "d": + return "day"; + + case "o": + return "ordinal"; + + case "L": + case "M": + return "month"; + + case "y": + return "year"; + + case "E": + case "c": + return "weekday"; + + case "W": + return "weekNumber"; + + case "k": + return "weekYear"; + + case "q": + return "quarter"; + + default: + return null; + } + }; + + var zone; + + if (!isUndefined(matches.Z)) { + zone = new FixedOffsetZone(matches.Z); + } else if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } else { + zone = null; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + return [vals, zone]; +} + +var dummyDateTimeCache = null; + +function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; +} + +function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + + if (!formatOpts) { + return token; + } + + var formatter = Formatter.create(locale, formatOpts); + var parts = formatter.formatDateTimeParts(getDummyDateTime()); + var tokens = parts.map(function (p) { + return tokenForPart(p, locale, formatOpts); + }); + + if (tokens.includes(undefined)) { + return token; + } + + return tokens; +} + +function expandMacroTokens(tokens, locale) { + var _Array$prototype; + + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); +} +/** + * @private + */ + + +function explainFromTokens(locale, input, format) { + var tokens = expandMacroTokens(Formatter.parseFormat(format), locale), + units = tokens.map(function (t) { + return unitForToken(t, locale); + }), + disqualifyingUnit = units.find(function (t) { + return t.invalidReason; + }); + + if (disqualifyingUnit) { + return { + input: input, + tokens: tokens, + invalidReason: disqualifyingUnit.invalidReason + }; + } else { + var _buildRegex = buildRegex(units), + regexString = _buildRegex[0], + handlers = _buildRegex[1], + regex = RegExp(regexString, "i"), + _match = match(input, regex, handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null], + result = _ref6[0], + zone = _ref6[1]; + + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + + return { + input: input, + tokens: tokens, + regex: regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone + }; + } +} +function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + invalidReason = _explainFromTokens.invalidReason; + + return [result, zone, invalidReason]; +} + +var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + +function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); +} + +function dayOfWeek(year, month, day) { + var js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); + return js === 0 ? 7 : js; +} + +function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; +} + +function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; +} +/** + * @private + */ + + +function gregorianToWeek(gregObj) { + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = dayOfWeek(year, month, day); + var weekNumber = Math.floor((ordinal - weekday + 10) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear); + } else if (weekNumber > weeksInWeekYear(year)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return Object.assign({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); +} +function weekToGregorian(weekData) { + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(weekData)); +} +function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day, + ordinal = computeOrdinal(year, month, day); + return Object.assign({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); +} +function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal, + _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); +} +function hasInvalidWeekData(obj) { + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.week); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; +} +function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; +} +function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; +} +function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; +} + +var INVALID$2 = "Invalid DateTime"; +var MAX_DATE = 8.64e15; + +function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); +} // we cache week data on the DT object and this intermediates the cache + + +function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + + return dt.weekData; +} // clone really means, "make a new object with these modifications". all "setters" really use this +// to create a new object while only changing some of the properties + + +function clone$1(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(Object.assign({}, current, alts, { + old: current + })); +} // find the right offset a given local time. The o input is our guess, which determines which +// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + + +function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts + + var o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done + + if (o === o2) { + return [utcGuess, o]; + } // If not, change the ts by the difference in the offset + + + utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done + + var o3 = tz.offset(utcGuess); + + if (o2 === o3) { + return [utcGuess, o2]; + } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + + + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; +} // convert an epoch timestamp into a calendar object with the given offset + + +function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; +} // convert a calendar object to a epoch timestamp + + +function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); +} // create a new DT instance by adding a duration, adjusting for DSTs + + +function adjustTime(inst, dur) { + var _dur; + + var keys = Object.keys(dur.values); + + if (keys.indexOf("milliseconds") === -1) { + keys.push("milliseconds"); + } + + dur = (_dur = dur).shiftTo.apply(_dur, keys); + var oPre = inst.o, + year = inst.c.year + dur.years, + month = inst.c.month + dur.months + dur.quarters * 3, + c = Object.assign({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7 + }), + millisToAdd = Duration.fromObject({ + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + + if (millisToAdd !== 0) { + ts += millisToAdd; // that could have changed the offset by going over a DST, but we want to keep the ts the same + + o = inst.zone.offset(ts); + } + + return { + ts: ts, + o: o + }; +} // helper useful in turning the results of parsing into real dates +// by handling the zone options + + +function parseDataToDateTime(parsed, parsedZone, opts, format, text) { + var setZone = opts.setZone, + zone = opts.zone; + + if (parsed && Object.keys(parsed).length !== 0) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(Object.assign(parsed, opts, { + zone: interpretationZone, + // setZone is a valid option in the calling methods, but not in fromObject + setZone: undefined + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } +} // if you want to output a technical format (e.g. RFC 2822), this helper +// helps handle the details + + +function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; +} // technical time formats (e.g. the time part of ISO 8601), take some options +// and this commonizes their handling + + +function toTechTimeFormat(dt, _ref) { + var _ref$suppressSeconds = _ref.suppressSeconds, + suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds, + _ref$suppressMillisec = _ref.suppressMilliseconds, + suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec, + includeOffset = _ref.includeOffset, + _ref$includeZone = _ref.includeZone, + includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone, + _ref$spaceZone = _ref.spaceZone, + spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone, + _ref$format = _ref.format, + format = _ref$format === void 0 ? "extended" : _ref$format; + var fmt = format === "basic" ? "HHmm" : "HH:mm"; + + if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { + fmt += format === "basic" ? "ss" : ":ss"; + + if (!suppressMilliseconds || dt.millisecond !== 0) { + fmt += ".SSS"; + } + } + + if ((includeZone || includeOffset) && spaceZone) { + fmt += " "; + } + + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += format === "basic" ? "ZZZ" : "ZZ"; + } + + return toTechFormat(dt, fmt); +} // defaults for unspecified units in the supported calendars + + +var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}; // Units in the supported calendars, sorted by bigness + +var orderedUnits$1 = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; // standardize case and plurality in units + +function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; +} // this is a dumbed down version of fromObject() that runs about 60% faster +// but doesn't do any validation, makes a bunch of assumptions about what units +// are present, and so on. + + +function quickDT(obj, zone) { + // assume we have the higher-order units + for (var _iterator = orderedUnits$1, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var u = _ref2; + + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + + if (invalid) { + return DateTime.invalid(invalid); + } + + var tsNow = Settings.now(), + offsetProvis = zone.offset(tsNow), + _objToTS = objToTS(obj, offsetProvis, zone), + ts = _objToTS[0], + o = _objToTS[1]; + + return new DateTime({ + ts: ts, + zone: zone, + o: o + }); +} + +function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, true); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (var _iterator2 = opts.units, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var unit = _ref3; + var count = differ(unit); + + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + + return format(0, opts.units[opts.units.length - 1]); +} +/** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, + * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. + * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + + +var DateTime = +/*#__PURE__*/ +function () { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + var _ref4 = [config.old.c, config.old.o]; + c = _ref4[0]; + o = _ref4[1]; + } else { + var ot = zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + /** + * @access private + */ + + + this._zone = zone; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.invalid = invalid; + /** + * @access private + */ + + this.weekData = null; + /** + * @access private + */ + + this.c = c; + /** + * @access private + */ + + this.o = o; + /** + * @access private + */ + + this.isLuxonDateTime = true; + } // CONSTRUCT + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + + + DateTime.local = function local(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now() + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, Settings.defaultZone); + } + } + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @return {DateTime} + */ + ; + + DateTime.utc = function utc(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now(), + zone: FixedOffsetZone.utcInstance + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, FixedOffsetZone.utcInstance); + } + } + /** + * Create a DateTime from a Javascript Date object. Uses the default zone. + * @param {Date} date - a Javascript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + ; + + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + + var ts = isDate(date) ? date.valueOf() : NaN; + + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @return {DateTime} + */ + ; + + DateTime.fromObject = function fromObject(obj) { + var zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + var tsNow = Settings.now(), + offsetProvis = zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit, ["zone", "locale", "outputCalendar", "numberingSystem"]), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber, + loc = Locale.fromObject(obj); // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; // configure ourselves to deal with gregorian dates or week stuff + + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits$1; + defaultValues = defaultUnitValues; + } // set default values for missing stuff + + + var foundFirst = false; + + for (var _iterator3 = units, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref5; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref5 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref5 = _i3.value; + } + + var u = _ref5; + var v = normalized[u]; + + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } // make sure the values we have are in range + + + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } // compute the actual time + + + var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); // gregorian data + weekday serves only to validate + + + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + + return inst; + } + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + ; + + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + ; + + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + ; + + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + invalid = _parseFromTokens[2]; + + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text); + } + } + /** + * @deprecated use fromFormat instead + */ + ; + + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return DateTime.fromFormat(text, fmt, opts); + } + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + ; + + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + ; + + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + /** + * Check if an object is a DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + ; + + var _proto = DateTime.prototype; + + _proto.get = function get(unit) { + return this[unit]; + } + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + ; + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOpts = function resolvedLocaleOpts(opts) { + if (opts === void 0) { + opts = {}; + } + + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + ; + + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + + if (opts === void 0) { + opts = {}; + } + + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + ; + + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + ; + + _proto.setZone = function setZone(zone, _temp) { + var _ref6 = _temp === void 0 ? {} : _temp, + _ref6$keepLocalTime = _ref6.keepLocalTime, + keepLocalTime = _ref6$keepLocalTime === void 0 ? false : _ref6$keepLocalTime, + _ref6$keepCalendarTim = _ref6.keepCalendarTime, + keepCalendarTime = _ref6$keepCalendarTim === void 0 ? false : _ref6$keepCalendarTim; + + zone = normalizeZone(zone, Settings.defaultZone); + + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + + newTS = _objToTS3[0]; + } + + return clone$1(this, { + ts: newTS, + zone: zone + }); + } + } + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + ; + + _proto.reconfigure = function reconfigure(_temp2) { + var _ref7 = _temp2 === void 0 ? {} : _temp2, + locale = _ref7.locale, + numberingSystem = _ref7.numberingSystem, + outputCalendar = _ref7.outputCalendar; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone$1(this, { + loc: loc + }); + } + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + ; + + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnit, []), + settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday); + var mixed; + + if (settingWeekStuff) { + mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + } else { + mixed = Object.assign(this.toObject(), normalized); // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + + return clone$1(this, { + ts: ts, + o: o + }); + } + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.local().plus(123) //~> in 123 milliseconds + * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return clone$1(this, adjustTime(this, dur)); + } + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration).negate(); + return clone$1(this, adjustTime(this, dur)); + } + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + ; + + _proto.startOf = function startOf(unit) { + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + + case "quarters": + case "months": + o.day = 1; + // falls through + + case "weeks": + case "days": + o.hour = 0; + // falls through + + case "hours": + o.minute = 0; + // falls through + + case "minutes": + o.second = 0; + // falls through + + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + o.weekday = 1; + } + + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + ; + + _proto.endOf = function endOf(unit) { + var _this$plus; + + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this; + } // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options + * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$2; + } + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @example DateTime.local().toLocaleString(); //=> 4/20/2017 + * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' + * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' + * @return {string} + */ + ; + + _proto.toLocaleString = function toLocaleString(opts) { + if (opts === void 0) { + opts = DATE_SHORT; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID$2; + } + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.local().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + ; + + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toISODate(opts) + "T" + this.toISOTime(opts); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + ; + + _proto.toISODate = function toISODate(_temp3) { + var _ref8 = _temp3 === void 0 ? {} : _temp3, + _ref8$format = _ref8.format, + format = _ref8$format === void 0 ? "extended" : _ref8$format; + + var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; + + if (this.year > 9999) { + fmt = "+" + fmt; + } + + return toTechFormat(this, fmt); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + ; + + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(_temp4) { + var _ref9 = _temp4 === void 0 ? {} : _temp4, + _ref9$suppressMillise = _ref9.suppressMilliseconds, + suppressMilliseconds = _ref9$suppressMillise === void 0 ? false : _ref9$suppressMillise, + _ref9$suppressSeconds = _ref9.suppressSeconds, + suppressSeconds = _ref9$suppressSeconds === void 0 ? false : _ref9$suppressSeconds, + _ref9$includeOffset = _ref9.includeOffset, + includeOffset = _ref9$includeOffset === void 0 ? true : _ref9$includeOffset, + _ref9$format = _ref9.format, + format = _ref9$format === void 0 ? "extended" : _ref9$format; + + return toTechTimeFormat(this, { + suppressSeconds: suppressSeconds, + suppressMilliseconds: suppressMilliseconds, + includeOffset: includeOffset, + format: format + }); + } + /** + * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + ; + + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + ; + + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + ; + + _proto.toSQLDate = function toSQLDate() { + return toTechFormat(this, "yyyy-MM-dd"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + ; + + _proto.toSQLTime = function toSQLTime(_temp5) { + var _ref10 = _temp5 === void 0 ? {} : _temp5, + _ref10$includeOffset = _ref10.includeOffset, + includeOffset = _ref10$includeOffset === void 0 ? true : _ref10$includeOffset, + _ref10$includeZone = _ref10.includeZone, + includeZone = _ref10$includeZone === void 0 ? false : _ref10$includeZone; + + return toTechTimeFormat(this, { + includeOffset: includeOffset, + includeZone: includeZone, + spaceZone: true + }); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + ; + + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID$2; + } + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + ; + + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + ; + + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + /** + * Returns a Javascript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.c); + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns a Javascript Date equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + ; + + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid(this.invalid || otherDateTime.invalid, "created by diffing an invalid DateTime"); + } + + var durOpts = Object.assign({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + + return otherIsLater ? diffed.negate() : diffed; + } + /** + * Return the difference between this DateTime and right now. + * See {@link diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + return this.diff(DateTime.local(), unit, opts); + } + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + ; + + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + /** + * Return whether this DateTime is in the same unit of time as another DateTime + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(otherDateTime, unit) { + if (!this.isValid) return false; + + if (unit === "millisecond") { + return this.valueOf() === otherDateTime.valueOf(); + } else { + var inputMs = otherDateTime.valueOf(); + return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit); + } + } + /** + * Equality check + * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + ; + + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({ + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + return diffRelative(base, this.plus(padding), Object.assign(options, { + numeric: "always", + units: ["years", "months", "days", "hours", "minutes", "seconds"] + })); + } + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + ; + + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({ + zone: this.zone + }), this, Object.assign(options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + ; + + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + ; + + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + ; + + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + /** + * @deprecated use fromFormatExplain instead + */ + ; + + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + return DateTime.fromFormatExplain(text, fmt, options); + } // FORMAT PRESETS + + /** + * {@link toLocaleString} format like 10/14/1983 + * @type {Object} + */ + ; + + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + + }, { + key: "zone", + get: function get() { + return this._zone; + } + /** + * Get the name of the time zone. + * @type {string} + */ + + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekYear //=> 2015 + * @type {number} + */ + + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.local().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.universal : null; + } + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + /** + * {@link toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + /** + * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + /** + * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + + return DateTime; +}(); +function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } +} + +exports.DateTime = DateTime; +exports.Duration = Duration; +exports.FixedOffsetZone = FixedOffsetZone; +exports.IANAZone = IANAZone; +exports.Info = Info; +exports.Interval = Interval; +exports.InvalidZone = InvalidZone; +exports.LocalZone = LocalZone; +exports.Settings = Settings; +exports.Zone = Zone; +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/cjs-browser/luxon.js.map b/node_modules/luxon/build/cjs-browser/luxon.js.map new file mode 100644 index 0000000..a27b7c9 --- /dev/null +++ b/node_modules/luxon/build/cjs-browser/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/invalid.js","../../src/zone.js","../../src/zones/localZone.js","../../src/zones/IANAZone.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/settings.js","../../src/impl/locale.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/digits.js","../../src/impl/tokenParser.js","../../src/impl/conversions.js","../../src/datetime.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23', always 24-hour.\n */\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour.\n */\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: s\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour.\n */\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: l\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasIntl() {\n try {\n return typeof Intl !== \"undefined\" && Intl.DateTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasFormatToParts() {\n return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts);\n}\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n if (input.toString().length < n) {\n return (\"0\".repeat(n) + input).slice(-n);\n } else {\n return input.toString();\n }\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, towardZero = false) {\n const factor = 10 ** digits,\n rounder = towardZero ? Math.trunc : Math.round;\n return rounder(number * factor) / factor;\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// covert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n return +d;\n}\n\nexport function weeksInWeekYear(weekYear) {\n const p1 =\n (weekYear +\n Math.floor(weekYear / 4) -\n Math.floor(weekYear / 100) +\n Math.floor(weekYear / 400)) %\n 7,\n last = weekYear - 1,\n p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;\n return p1 === 4 || p2 === 3 ? 53 : 52;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > 60 ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hour12: false,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\"\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts),\n intl = hasIntl();\n\n if (intl && hasFormatToParts()) {\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find(m => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n } else if (intl) {\n // this probably doesn't work for all locales\n const without = new Intl.DateTimeFormat(locale, intlOpts).format(date),\n included = new Intl.DateTimeFormat(locale, modified).format(date),\n diffed = included.substring(without.length),\n trimmed = diffed.replace(/^[, \\u200e]+/, \"\");\n return trimmed;\n } else {\n return null;\n }\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || Number.isNaN(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer, nonUnitKeys) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n if (nonUnitKeys.indexOf(u) >= 0) continue;\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(offset / 60),\n minutes = Math.abs(offset % 60),\n sign = hours >= 0 && !Object.is(hours, -0) ? \"+\" : \"-\",\n base = `${sign}${Math.abs(hours)}`;\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(Math.abs(hours), 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return minutes > 0 ? `${base}:${minutes}` : base;\n case \"techie\":\n return `${sign}${padStart(Math.abs(hours), 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n\nexport const ianaRegex = /[A-Za-z_+-]{1,256}(:?\\/[A-Za-z_+-]{1,256}(\\/[A-Za-z_+-]{1,256})?)?/;\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return monthsNarrow;\n case \"short\":\n return monthsShort;\n case \"long\":\n return monthsLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\"\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return weekdaysNarrow;\n case \"short\":\n return weekdaysShort;\n case \"long\":\n return weekdaysLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return erasNarrow;\n case \"short\":\n return erasShort;\n case \"long\":\n return erasLong;\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"]\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hour12\"\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { hasFormatToParts, padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: false, val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTime(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTimeParts(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.formatToParts();\n }\n\n resolvedOptions(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.resolvedOptions();\n }\n\n num(n, p = 0) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = Object.assign({}, this.opts);\n\n if (p > 0) {\n opts.padTo = p;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter =\n this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\" && hasFormatToParts(),\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = opts => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hour12: true }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = token => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = length =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = token => {\n // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const tokenToField = token => {\n switch (token[0]) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n default:\n return null;\n }\n },\n tokenToString = lildur => token => {\n const mapped = tokenToField(token);\n if (mapped) {\n return this.num(lildur.get(mapped), token.length);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t));\n return stringifyTokens(tokens, tokenToString(collapsed));\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","/* eslint no-unused-vars: \"off\" */\nimport { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get universal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo, hasIntl } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this Javascript environment.\n * @implements {Zone}\n */\nexport default class LocalZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {LocalZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new LocalZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"local\";\n }\n\n /** @override **/\n get name() {\n if (hasIntl()) {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n } else return \"local\";\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"local\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, ianaRegex, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst matchingRegex = RegExp(`^${ianaRegex.source}$`);\n\nlet dtfCache = {};\nfunction makeDTF(zone) {\n if (!dtfCache[zone]) {\n dtfCache[zone] = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\"\n });\n }\n return dtfCache[zone];\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date),\n filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i],\n pos = typeToPos[type];\n\n if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nlet ianaZoneCache = {};\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n if (!ianaZoneCache[name]) {\n ianaZoneCache[name] = new IANAZone(name);\n }\n return ianaZoneCache[name];\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache = {};\n dtfCache = {};\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Fantasia/Castle\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return !!(s && s.match(matchingRegex));\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n // Etc/GMT+8 -> -480\n /** @ignore */\n static parseGMTOffset(specifier) {\n if (specifier) {\n const match = specifier.match(/^Etc\\/GMT([+-]\\d{1,2})$/i);\n if (match) {\n return -60 * parseInt(match[1]);\n }\n }\n return null;\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /** @override **/\n get type() {\n return \"iana\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n const date = new Date(ts),\n dtf = makeDTF(this.name),\n [year, month, day, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date),\n // work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /** @override **/\n get isValid() {\n return this.valid;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /** @override **/\n get type() {\n return \"fixed\";\n }\n\n /** @override **/\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /** @override **/\n offsetName() {\n return this.name;\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /** @override **/\n get universal() {\n return true;\n }\n\n /** @override **/\n offset() {\n return this.fixed;\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"local\") return defaultZone;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else if ((offset = IANAZone.parseGMTOffset(input)) != null) {\n // handle Etc/GMT-4, which V8 chokes on\n return FixedOffsetZone.instance(offset);\n } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);\n else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && input.offset && typeof input.offset === \"number\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","import LocalZone from \"./zones/localZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nlet now = () => Date.now(),\n defaultZone = null, // not setting this directly to LocalZone.instance bc loading order issues\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n throwOnInvalid = false;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Get the default time zone to create DateTimes in.\n * @type {string}\n */\n static get defaultZoneName() {\n return Settings.defaultZone.name;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * @type {string}\n */\n static set defaultZoneName(z) {\n if (!z) {\n defaultZone = null;\n } else {\n defaultZone = normalizeZone(z);\n }\n }\n\n /**\n * Get the default time zone object to create DateTimes in. Does not affect existing instances.\n * @type {Zone}\n */\n static get defaultZone() {\n return defaultZone || LocalZone.instance;\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n }\n}\n","import { hasFormatToParts, hasIntl, padStart, roundTo, hasRelative } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport Formatter from \"./formatter.js\";\n\nlet intlDTCache = {};\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache[key];\n if (!dtf) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache[key] = dtf;\n }\n return dtf;\n}\n\nlet intlNumCache = {};\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache[key];\n if (!inf) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache[key] = inf;\n }\n return inf;\n}\n\nlet intlRelCache = {};\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache[key];\n if (!inf) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache[key] = inf;\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else if (hasIntl()) {\n const computedSys = new Intl.DateTimeFormat().resolvedOptions().locale;\n // node sometimes defaults to \"und\". Override that because that is dumb\n sysLocaleCache = !computedSys || computedSys === \"und\" ? \"en-US\" : computedSys;\n return sysLocaleCache;\n } else {\n sysLocaleCache = \"en-US\";\n return sysLocaleCache;\n }\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n const smaller = localeStr.substring(0, uIndex);\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n } catch (e) {\n options = getCachedDTF(smaller).resolvedOptions();\n }\n\n const { numberingSystem, calendar } = options;\n // return the smaller one so that we can append the calendar and numbering overrides to it\n return [smaller, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (hasIntl()) {\n if (outputCalendar || numberingSystem) {\n localeStr += \"-u\";\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n } else {\n return [];\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2016, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, defaultOK, englishFn, intlFn) {\n const mode = loc.listingMode(defaultOK);\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n (hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === \"latn\")\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n if (!forceSimple && hasIntl()) {\n const intlOpts = { useGrouping: false };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.hasIntl = hasIntl();\n\n let z;\n if (dt.zone.universal && this.hasIntl) {\n // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.\n // So we have to make do. Two cases:\n // 1. The format options tell us to show the zone. We can't do that, so the best\n // we can do is format the date in UTC.\n // 2. The format options don't tell us to show the zone. Then we can adjust them\n // the time and tell the formatter to show it to us in UTC, so that the time is right\n // and the bad zone doesn't show up.\n // We can clean all this up when Chrome fixes this.\n z = \"UTC\";\n if (opts.timeZoneName) {\n this.dt = dt;\n } else {\n this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);\n }\n } else if (dt.zone.type === \"local\") {\n this.dt = dt;\n } else {\n this.dt = dt;\n z = dt.zone.name;\n }\n\n if (this.hasIntl) {\n const intlOpts = Object.assign({}, this.opts);\n if (z) {\n intlOpts.timeZone = z;\n }\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n }\n\n format() {\n if (this.hasIntl) {\n return this.dtf.format(this.dt.toJSDate());\n } else {\n const tokenFormat = English.formatString(this.opts),\n loc = Locale.create(\"en-US\");\n return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat);\n }\n }\n\n formatToParts() {\n if (this.hasIntl && hasFormatToParts()) {\n return this.dtf.formatToParts(this.dt.toJSDate());\n } else {\n // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings\n // and IMO it's too weird to have an uncanny valley like that\n return [];\n }\n }\n\n resolvedOptions() {\n if (this.hasIntl) {\n return this.dtf.resolvedOptions();\n } else {\n return {\n locale: \"en-US\",\n numberingSystem: \"latn\",\n outputCalendar: \"gregory\"\n };\n }\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = Object.assign({ style: \"long\" }, opts);\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\n/**\n * @private\n */\n\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);\n }\n\n static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale,\n // the system locale is useful for human readable strings but annoying for parsing/formatting known formats\n localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale()),\n numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,\n outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache = {};\n intlNumCache = {};\n intlRelCache = {};\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar);\n }\n\n constructor(locale, numbering, outputCalendar, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode(defaultOK = true) {\n const intl = hasIntl(),\n hasFTP = intl && hasFormatToParts(),\n isActuallyEn = this.isEnglish(),\n hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n\n if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) {\n return \"error\";\n } else if (!hasFTP || (isActuallyEn && hasNoWeirdness)) {\n return \"en\";\n } else {\n return \"intl\";\n }\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: true }));\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: false }));\n }\n\n months(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.months, () => {\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n this.monthsCache[formatStr][length] = mapMonths(dt => this.extract(dt, intl, \"month\"));\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays(dt =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems(defaultOK = true) {\n return listStuff(\n this,\n undefined,\n defaultOK,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hour12: true };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n dt => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.eras, () => {\n const intl = { era: length };\n\n // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find(m => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n (hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith(\"en-us\"))\n );\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n ianaRegex,\n isUndefined\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return m =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [Object.assign(mergedVals, val), mergedZone || zone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:(Z)|([+-]\\d\\d)(?::?(\\d\\d))?)/,\n isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,9}))?)?)?/,\n isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`),\n isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`),\n isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/,\n isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/,\n isoOrdinalRegex = /(\\d{4})-?(\\d{3})/,\n extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\"),\n extractISOOrdinalData = simpleParse(\"year\", \"ordinal\"),\n sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/, // dumbed-down version of the ISO one\n sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n ),\n sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1)\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hour: int(match, cursor, 0),\n minute: int(match, cursor + 1, 0),\n second: int(match, cursor + 2, 0),\n millisecond: parseMillis(match[cursor + 3])\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO duration parsing\n\nconst isoDuration = /^P(?:(?:(-?\\d{1,9})Y)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})W)?(?:(-?\\d{1,9})D)?(?:T(?:(-?\\d{1,9})H)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})(?:[.,](-?\\d{1,9}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [\n ,\n yearStr,\n monthStr,\n weekStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr,\n millisecondsStr\n ] = match;\n\n return [\n {\n years: parseInteger(yearStr),\n months: parseInteger(monthStr),\n weeks: parseInteger(weekStr),\n days: parseInteger(dayStr),\n hours: parseInteger(hourStr),\n minutes: parseInteger(minuteStr),\n seconds: parseInteger(secondStr),\n milliseconds: parseMillis(millisecondsStr)\n }\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr)\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime);\nconst extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);\n\n/**\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOYmdTimeOffsetAndIANAZone = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nconst lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 }\n },\n casualMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n ),\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n );\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy\n };\n return new Duration(conf);\n}\n\nfunction antiTrunc(n) {\n return n < 0 ? Math.floor(n) : Math.ceil(n);\n}\n\n// NB: mutates parameters\nfunction convert(matrix, fromMap, fromUnit, toMap, toUnit) {\n const conv = matrix[toUnit][fromUnit],\n raw = fromMap[fromUnit] / conv,\n sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),\n // ok, so this is wild, but see the matrix in the tests\n added =\n !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);\n toMap[toUnit] += added;\n fromMap[fromUnit] -= added * conv;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n reverseUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n convert(matrix, vals, previous, vals, current);\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors.\n * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = accurate ? accurateMatrix : casualMatrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject(Object.assign({ milliseconds: count }, opts));\n }\n\n /**\n * Create a Duration from a Javascript object with keys like 'years' and 'hours.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {string} [obj.locale='en-US'] - the locale to use\n * @param {string} obj.numberingSystem - the numbering system to use\n * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromObject(obj) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit, [\n \"locale\",\n \"numberingSystem\",\n \"conversionAccuracy\",\n \"zone\" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this\n ]),\n loc: Locale.fromObject(obj),\n conversionAccuracy: obj.conversionAccuracy\n });\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n const obj = Object.assign(parsed, opts);\n return Duration.fromObject(obj);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\"\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = Object.assign({}, opts, {\n floor: opts.round !== false && opts.floor !== false\n });\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a Javascript object with this Duration's values.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.values);\n\n if (opts.includeConfig) {\n base.conversionAccuracy = this.conversionAccuracy;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n valueOf() {\n return this.as(\"milliseconds\");\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === \"hour\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).years //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).months //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).days //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, []));\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem }),\n opts = { loc };\n\n if (conversionAccuracy) {\n opts.conversionAccuracy = conversionAccuracy;\n }\n\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map(u => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n normalizeValues(this.matrix, vals);\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = own - i; // we'd like to absorb these fractions in another unit\n\n // plus anything further down the chain that should be rolled up in to this\n for (const down in vals) {\n if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {\n convert(this.matrix, vals, down, built, k);\n }\n }\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n return clone(this, { values: built }, true).normalize();\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n for (const u of orderedUnits) {\n if (this.values[u] !== other.values[u]) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDuration(durationish) {\n if (isNumber(durationish)) {\n return Duration.fromMillis(durationish);\n } else if (Duration.isDuration(durationish)) {\n return durationish;\n } else if (typeof durationish === \"object\") {\n return Duration.fromObject(durationish);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationish} of type ${typeof durationish}`\n );\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration, { friendlyDuration } from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}.\n * * **Accessors** Use {@link start} and {@link end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.\n * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}\n * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n const start = DateTime.fromISO(s, opts),\n end = DateTime.fromISO(e, opts);\n\n if (start.isValid && end.isValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (start.isValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (end.isValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @return {number}\n */\n count(unit = \"milliseconds\") {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit),\n end = this.end.startOf(unit);\n return Math.floor(end.diff(start, unit).get(unit)) + 1;\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...[DateTime]} dateTimes - the unit of time to count.\n * @return {[Interval]}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter(d => this.contains(d))\n .sort(),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {[Interval]}\n */\n splitBy(duration) {\n const dur = friendlyDuration(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n added,\n next;\n\n const results = [];\n while (s < this.e) {\n added = s.plus(dur);\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {[Interval]}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Return whether this Interval engulfs the start and end of the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s > e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into a equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static merge(intervals) {\n const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map(i => [{ time: i.s, type: \"s\" }, { time: i.e, type: \"e\" }]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {[Interval]}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map(i => this.intersection(i))\n .filter(i => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format string.\n * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details.\n * @param {Object} opts - options\n * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasFormatToParts, hasIntl, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.local()\n .setZone(zone)\n .set({ month: 12 });\n\n return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone.isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {[string]}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {[string]}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {[string]}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @return {[string]}\n */\n static weekdaysFormat(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {[string]}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {[string]}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `zones`: whether this environment supports IANA timezones\n * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing\n * * `intl`: whether this environment supports general internationalization\n * * `relative`: whether this environment supports relative time formatting\n * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false }\n * @return {Object}\n */\n static features() {\n let intl = false,\n intlTokens = false,\n zones = false,\n relative = false;\n\n if (hasIntl()) {\n intl = true;\n intlTokens = hasFormatToParts();\n relative = hasRelative();\n\n try {\n zones =\n new Intl.DateTimeFormat(\"en\", { timeZone: \"America/New_York\" }).resolvedOptions()\n .timeZone === \"America/New_York\";\n } catch (e) {\n zones = false;\n }\n }\n\n return { intl, intlTokens, zones, relative };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = dt =>\n dt\n .toUTC(0, { keepLocalTime: true })\n .startOf(\"day\")\n .valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n }\n ],\n [\"days\", dayDiff]\n ];\n\n const results = {};\n let lowestOrder, highWater;\n\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n let delta = differ(cursor, later);\n highWater = cursor.plus({ [unit]: delta });\n\n if (highWater > later) {\n cursor = cursor.plus({ [unit]: delta - 1 });\n delta -= 1;\n } else {\n cursor = highWater;\n }\n\n results[unit] = delta;\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function(earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n u => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(Object.assign(results, opts));\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\"\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881]\n};\n\n// eslint-disable-next-line\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n return new RegExp(`${numberingSystems[numberingSystem || \"latn\"]}${append}`);\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = i => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n return s.replace(/\\./, \"\\\\.?\");\n}\n\nfunction stripInsensitivities(s) {\n return s.replace(/\\./, \"\").toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n // eslint-disable-next-line no-useless-escape\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = t => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = t => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\", false), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\", false), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true, false), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true, false), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false, false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false, false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false, false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false, false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true, false), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true, false), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\"\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\"\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\"\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\"\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour: {\n numeric: \"h\",\n \"2-digit\": \"hh\"\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\"\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\"\n }\n};\n\nfunction tokenForPart(part, locale, formatOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n return {\n literal: true,\n val: value\n };\n }\n\n const style = formatOpts[type];\n\n let val = partTypeStyleToTokenVal[type];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = token => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone;\n if (!isUndefined(matches.Z)) {\n zone = new FixedOffsetZone(matches.Z);\n } else if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n } else {\n zone = null;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n\n if (!formatOpts) {\n return token;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const parts = formatter.formatDateTimeParts(getDummyDateTime());\n\n const tokens = parts.map(p => tokenForPart(p, locale, formatOpts));\n\n if (tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nfunction expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport function explainFromTokens(locale, input, format) {\n const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),\n units = tokens.map(t => unitForToken(t, locale)),\n disqualifyingUnit = units.find(t => t.invalidReason);\n\n if (disqualifyingUnit) {\n return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };\n } else {\n const [regexString, handlers] = buildRegex(units),\n regex = RegExp(regexString, \"i\"),\n [rawMatches, matches] = match(input, regex, handlers),\n [result, zone] = matches ? dateTimeFromMatches(matches) : [null, null];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return { input, tokens, regex, rawMatches, matches, result, zone };\n }\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, invalidReason];\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nfunction dayOfWeek(year, month, day) {\n const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay();\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex(i => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = dayOfWeek(year, month, day);\n\n let weekNumber = Math.floor((ordinal - weekday + 10) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear);\n } else if (weekNumber > weeksInWeekYear(year)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return Object.assign({ weekYear, weekNumber, weekday }, timeObject(gregObj));\n}\n\nexport function weekToGregorian(weekData) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(weekData));\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData,\n ordinal = computeOrdinal(year, month, day);\n\n return Object.assign({ year, ordinal }, timeObject(gregData));\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData,\n { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(ordinalData));\n}\n\nexport function hasInvalidWeekData(obj) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.week);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","import Duration, { friendlyDuration } from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport { parseFromTokens, explainFromTokens } from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid\n };\n return new DateTime(Object.assign({}, current, alts, { old: current }));\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds()\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const keys = Object.keys(dur.values);\n if (keys.indexOf(\"milliseconds\") === -1) {\n keys.push(\"milliseconds\");\n }\n\n dur = dur.shiftTo(...keys);\n\n const oPre = inst.o,\n year = inst.c.year + dur.years,\n month = inst.c.month + dur.months + dur.quarters * 3,\n c = Object.assign({}, inst.c, {\n year,\n month,\n day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7\n }),\n millisToAdd = Duration.fromObject({\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text) {\n const { setZone, zone } = opts;\n if (parsed && Object.keys(parsed).length !== 0) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(\n Object.assign(parsed, opts, {\n zone: interpretationZone,\n // setZone is a valid option in the calling methods, but not in fromObject\n setZone: undefined\n })\n );\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\n// technical time formats (e.g. the time part of ISO 8601), take some options\n// and this commonizes their handling\nfunction toTechTimeFormat(\n dt,\n {\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset,\n includeZone = false,\n spaceZone = false,\n format = \"extended\"\n }\n) {\n let fmt = format === \"basic\" ? \"HHmm\" : \"HH:mm\";\n\n if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {\n fmt += format === \"basic\" ? \"ss\" : \":ss\";\n if (!suppressMilliseconds || dt.millisecond !== 0) {\n fmt += \".SSS\";\n }\n }\n\n if ((includeZone || includeOffset) && spaceZone) {\n fmt += \" \";\n }\n\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += format === \"basic\" ? \"ZZZ\" : \"ZZ\";\n }\n\n return toTechFormat(dt, fmt);\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\"\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\"\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, zone) {\n // assume we have the higher-order units\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zone.offset(tsNow),\n [ts, o] = objToTS(obj, offsetProvis, zone);\n\n return new DateTime({\n ts,\n zone,\n o\n });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, true);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = unit => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end\n .startOf(unit)\n .diff(start.startOf(unit), unit)\n .get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(0, opts.units[opts.units.length - 1]);\n}\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month},\n * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors.\n * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n const ot = zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({ ts: Settings.now() });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n Settings.defaultZone\n );\n }\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z\n * @return {DateTime}\n */\n static utc(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({\n ts: Settings.now(),\n zone: FixedOffsetZone.utcInstance\n });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n FixedOffsetZone.utcInstance\n );\n }\n }\n\n /**\n * Create a DateTime from a Javascript Date object. Uses the default zone.\n * @param {Date} date - a Javascript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options)\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @return {DateTime}\n */\n static fromObject(obj) {\n const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zoneToUse.offset(tsNow),\n normalized = normalizeObject(obj, normalizeUnit, [\n \"zone\",\n \"locale\",\n \"outputCalendar\",\n \"numberingSystem\"\n ]),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber,\n loc = Locale.fromObject(obj);\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n }),\n [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is a DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.local().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.universal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOpts(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link reconfigure} and {@link setZone}.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnit, []),\n settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday);\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized));\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized));\n } else {\n mixed = Object.assign(this.toObject(), normalized);\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.local().plus(123) //~> in 123 milliseconds\n * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit) {\n if (!this.isValid) return this;\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n o.weekday = 1;\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options\n * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.local().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.local().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @example DateTime.local().toLocaleString(); //=> 4/20/2017\n * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(opts = Formats.DATE_SHORT) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.local().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @return {string}\n */\n toISO(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toISODate(opts)}T${this.toISOTime(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @return {string}\n */\n toISODate({ format = \"extended\" } = {}) {\n let fmt = format === \"basic\" ? \"yyyyMMdd\" : \"yyyy-MM-dd\";\n if (this.year > 9999) {\n fmt = \"+\" + fmt;\n }\n\n return toTechFormat(this, fmt);\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n format = \"extended\"\n } = {}) {\n return toTechTimeFormat(this, {\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n format\n });\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string}\n */\n toSQLDate() {\n return toTechFormat(this, \"yyyy-MM-dd\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false } = {}) {\n return toTechTimeFormat(this, {\n includeOffset,\n includeZone,\n spaceZone: true\n });\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a Javascript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.c);\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a Javascript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\n this.invalid || otherDateTime.invalid,\n \"created by diffing an invalid DateTime\"\n );\n }\n\n const durOpts = Object.assign(\n { locale: this.locale, numberingSystem: this.numberingSystem },\n opts\n );\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.local(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit) {\n if (!this.isValid) return false;\n if (unit === \"millisecond\") {\n return this.valueOf() === otherDateTime.valueOf();\n } else {\n const inputMs = otherDateTime.valueOf();\n return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit);\n }\n }\n\n /**\n * Equality check\n * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds down by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.local().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.local().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({ zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n return diffRelative(\n base,\n this.plus(padding),\n Object.assign(options, {\n numeric: \"always\",\n units: [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"]\n })\n );\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.local().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(\n options.base || DateTime.fromObject({ zone: this.zone }),\n this,\n Object.assign(options, {\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true\n })\n );\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n"],"names":["LuxonError","Error","InvalidDateTimeError","reason","toMessage","InvalidIntervalError","InvalidDurationError","ConflictingSpecificationError","InvalidUnitError","unit","InvalidArgumentError","ZoneIsAbstractError","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_FULL","DATE_HUGE","weekday","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hour12","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","isUndefined","o","isNumber","isInteger","isString","isDate","Object","prototype","toString","call","hasIntl","Intl","DateTimeFormat","e","hasFormatToParts","formatToParts","hasRelative","RelativeTimeFormat","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","length","undefined","reduce","best","next","pair","pick","obj","keys","a","k","hasOwnProperty","prop","integerBetween","bottom","top","floorMod","x","Math","floor","padStart","input","repeat","slice","parseInteger","string","parseInt","parseMillis","fraction","f","parseFloat","roundTo","number","digits","towardZero","factor","rounder","trunc","round","isLeapYear","daysInYear","daysInMonth","modMonth","modYear","objToLocalTS","d","Date","UTC","millisecond","setUTCFullYear","getUTCFullYear","weeksInWeekYear","weekYear","p1","last","p2","untruncateYear","parseZoneInfo","ts","offsetFormat","locale","timeZone","date","intlOpts","modified","assign","intl","parsed","find","m","type","toLowerCase","value","without","format","included","diffed","substring","trimmed","replace","signedOffset","offHourStr","offMinuteStr","offHour","Number","isNaN","offMin","offMinSigned","is","asNumber","numericValue","normalizeObject","normalizer","nonUnitKeys","normalized","u","indexOf","v","formatOffset","offset","hours","minutes","abs","sign","base","RangeError","timeObject","ianaRegex","stringify","JSON","sort","monthsLong","monthsShort","monthsNarrow","months","weekdaysLong","weekdaysShort","weekdaysNarrow","weekdays","meridiems","erasLong","erasShort","erasNarrow","eras","meridiemForDateTime","dt","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","count","numeric","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","formatString","knownFormat","filtered","key","dateTimeHuge","Formats","stringifyTokens","splits","tokenToString","token","literal","val","macroTokenToFormatOpts","D","DD","DDD","DDDD","t","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","create","opts","parseFormat","fmt","current","currentFull","bracketed","i","c","charAt","push","formatOpts","loc","systemLoc","formatWithSystemDefault","redefaultToSystem","df","dtFormatter","formatDateTime","formatDateTimeParts","resolvedOptions","num","p","forceSimple","padTo","numberFormatter","formatDateTimeFromString","knownEnglish","listingMode","useDateTimeFormatter","outputCalendar","extract","isOffsetFixed","allowZ","isValid","zone","meridiem","English","standalone","maybeMacro","era","offsetName","zoneName","weekNumber","ordinal","quarter","formatDurationFromString","dur","tokenToField","lildur","mapped","get","tokens","realTokens","found","concat","collapsed","shiftTo","map","filter","Invalid","explanation","Zone","equals","otherZone","singleton","LocalZone","getTimezoneOffset","matchingRegex","RegExp","source","dtfCache","makeDTF","typeToPos","hackyOffset","dtf","formatted","exec","fMonth","fDay","fYear","fHour","fMinute","fSecond","partsOffset","filled","pos","ianaZoneCache","IANAZone","name","resetCache","isValidSpecifier","match","isValidZone","parseGMTOffset","specifier","valid","adjustedHour","asUTC","asTS","over","FixedOffsetZone","instance","utcInstance","parseSpecifier","r","fixed","InvalidZone","NaN","normalizeZone","defaultZone","lowered","now","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","throwOnInvalid","Settings","resetCaches","Locale","z","numberingSystem","intlDTCache","getCachedDTF","locString","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","cacheKeyOpts","sysLocaleCache","systemLocale","computedSys","parseLocaleString","localeStr","uIndex","options","smaller","calendar","intlConfigString","mapMonths","ms","DateTime","utc","mapWeekdays","listStuff","defaultOK","englishFn","intlFn","mode","supportsFastNumbers","startsWith","PolyNumberFormatter","useGrouping","minimumIntegerDigits","PolyDateFormatter","universal","fromMillis","toJSDate","tokenFormat","PolyRelFormatter","isEnglish","style","rtf","fromOpts","defaultToEN","specifiedLocale","localeR","numberingSystemR","outputCalendarR","fromObject","numbering","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","monthsCache","meridiemCache","eraCache","fastNumbersCached","hasFTP","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","formatStr","field","results","matching","fastNumbers","relFormatter","other","combineRegexes","regexes","full","combineExtractors","extractors","ex","mergedVals","mergedZone","cursor","parse","patterns","regex","extractor","simpleParse","ret","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","extractISOOffset","local","fullOffset","extractIANAZone","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","milliseconds","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDataAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOYmdTimeOffsetAndIANAZone","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","clear","conf","values","conversionAccuracy","Duration","antiTrunc","ceil","convert","matrix","fromMap","fromUnit","toMap","toUnit","conv","raw","sameSign","added","normalizeValues","vals","previous","config","accurate","invalid","isLuxonDuration","normalizeUnit","fromISO","text","week","isDuration","toFormat","fmtOpts","toObject","includeConfig","toISO","toJSON","valueOf","as","plus","duration","friendlyDuration","minus","negate","mapUnits","fn","set","mixed","reconfigure","normalize","built","accumulated","lastUnit","own","ak","down","negated","durationish","validateStartEnd","start","end","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","split","isInterval","toDuration","startOf","diff","hasSame","isEmpty","isAfter","dateTime","isBefore","contains","splitAt","dateTimes","sorted","splitBy","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","b","sofar","final","xor","currentCount","ends","time","flattened","difference","toISODate","toISOTime","dateFormat","separator","invalidReason","mapEndpoints","mapFn","Info","hasDST","proto","setZone","isValidIANAZone","monthsFormat","weekdaysFormat","features","intlTokens","zones","relative","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","differ","delta","remainingMillis","lowerOrderUnits","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","parseDigits","str","code","charCodeAt","search","min","max","digitRegex","append","MISSING_FTP","intUnit","post","deser","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","join","findIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","tokenForPart","part","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatter","parts","includes","expandMacroTokens","explainFromTokens","disqualifyingUnit","regexString","rawMatches","parseFromTokens","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","js","getUTCDay","computeOrdinal","uncomputeOrdinal","table","month0","gregorianToWeek","gregObj","weekToGregorian","weekData","weekdayOfJan4","yearInDays","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","hasInvalidWeekData","validYear","validWeek","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","MAX_DATE","unsupportedZone","possiblyCachedWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","toTechTimeFormat","suppressSeconds","suppressMilliseconds","includeOffset","includeZone","spaceZone","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","quickDT","tsNow","offsetProvis","diffRelative","calendary","unchanged","ot","_zone","isLuxonDateTime","fromJSDate","zoneToUse","fromSeconds","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","higherOrderInvalid","gregorian","tsFinal","offsetFinal","fromRFC2822","fromHTTP","fromFormat","localeToUse","fromString","fromSQL","isDateTime","resolvedLocaleOpts","toLocal","keepCalendarTime","newTS","offsetGuess","asObj","setLocale","settingWeekStuff","normalizedUnit","endOf","toLocaleString","toLocaleParts","toISOWeekDate","toRFC2822","toHTTP","toSQLDate","toSQLTime","toSQL","toMillis","toSeconds","toBSON","otherDateTime","durOpts","otherIsLater","diffNow","until","inputMs","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","fromStringExplain","dateTimeish"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;IAGMA;;;;;;;;;;mBAAmBC;AAEzB;;;;;IAGaC,oBAAb;AAAA;AAAA;AAAA;;AACE,gCAAYC,MAAZ,EAAoB;AAAA,WAClB,8CAA2BA,MAAM,CAACC,SAAP,EAA3B,CADkB;AAEnB;;AAHH;AAAA,EAA0CJ,UAA1C;AAMA;;;;IAGaK,oBAAb;AAAA;AAAA;AAAA;;AACE,gCAAYF,MAAZ,EAAoB;AAAA,WAClB,+CAA2BA,MAAM,CAACC,SAAP,EAA3B,CADkB;AAEnB;;AAHH;AAAA,EAA0CJ,UAA1C;AAMA;;;;IAGaM,oBAAb;AAAA;AAAA;AAAA;;AACE,gCAAYH,MAAZ,EAAoB;AAAA,WAClB,+CAA2BA,MAAM,CAACC,SAAP,EAA3B,CADk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AC1B,aAAOA,cAAP;AACD;AAED;;;;;;;wBAIkC;AAChC,aAAOA,oBAAP;AACD;AAED;;;;;;;wBAIuC;AACrC,aAAOA,yBAAP;AACD;AAED;;;;;;;wBAIsC;AACpC,aAAOA,wBAAP;AACD;AAED;;;;;;;wBAI4B;AAC1B,aAAOA,cAAP;AACD;AAED;;;;;;;wBAIyC;AACvC,aAAOA,2BAAP;AACD;AAED;;;;;;;wBAI0B;AACxB,aAAOA,YAAP;AACD;AAED;;;;;;;wBAIuC;AACrC,aAAOA,yBAAP;AACD;AAED;;;;;;;wBAIuC;AACrC,aAAOA,yBAAP;AACD;AAED;;;;;;;wBAI2B;AACzB,aAAOA,aAAP;AACD;AAED;;;;;;;wBAIwC;AACtC,aAAOA,0BAAP;AACD;AAED;;;;;;;wBAI2B;AACzB,aAAOA,aAAP;AACD;AAED;;;;;;;wBAIwC;AACtC,aAAOA,0BAAP;AACD;;;;;AAGH,AAGO,SAASgY,gBAAT,CAA0BkT,WAA1B,EAAuC;AAC5C,MAAItgB,QAAQ,CAACoe,UAAT,CAAoBkC,WAApB,CAAJ,EAAsC;AACpC,WAAOA,WAAP;AACD,GAFD,MAEO,IAAIA,WAAW,IAAIA,WAAW,CAAC9U,OAA3B,IAAsCnhB,QAAQ,CAACi2B,WAAW,CAAC9U,OAAZ,EAAD,CAAlD,EAA2E;AAChF,WAAOxL,QAAQ,CAAC8c,UAAT,CAAoBwD,WAApB,CAAP;AACD,GAFM,MAEA,IAAIA,WAAW,IAAI,OAAOA,WAAP,KAAuB,QAA1C,EAAoD;AACzD,WAAOtgB,QAAQ,CAAC4B,UAAT,CAAoB0e,WAApB,CAAP;AACD,GAFM,MAEA;AACL,UAAM,IAAIt4B,oBAAJ,iCAC0Bs4B,WAD1B,kBACkD,OAAOA,WADzD,CAAN;AAGD;AACF;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/global/luxon.js b/node_modules/luxon/build/global/luxon.js new file mode 100644 index 0000000..12a3f71 --- /dev/null +++ b/node_modules/luxon/build/global/luxon.js @@ -0,0 +1,8350 @@ +var luxon = (function (exports) { + 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _construct(Parent, args, Class) { + if (isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); + } + + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); + } + + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; + } + + // these aren't really private, but nor are they really useful to document + + /** + * @private + */ + var LuxonError = + /*#__PURE__*/ + function (_Error) { + _inheritsLoose(LuxonError, _Error); + + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + + return LuxonError; + }(_wrapNativeSuper(Error)); + /** + * @private + */ + + + var InvalidDateTimeError = + /*#__PURE__*/ + function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + + return InvalidDateTimeError; + }(LuxonError); + /** + * @private + */ + + var InvalidIntervalError = + /*#__PURE__*/ + function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + + return InvalidIntervalError; + }(LuxonError); + /** + * @private + */ + + var InvalidDurationError = + /*#__PURE__*/ + function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + + return InvalidDurationError; + }(LuxonError); + /** + * @private + */ + + var ConflictingSpecificationError = + /*#__PURE__*/ + function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + + return ConflictingSpecificationError; + }(LuxonError); + /** + * @private + */ + + var InvalidUnitError = + /*#__PURE__*/ + function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + + return InvalidUnitError; + }(LuxonError); + /** + * @private + */ + + var InvalidArgumentError = + /*#__PURE__*/ + function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + + return InvalidArgumentError; + }(LuxonError); + /** + * @private + */ + + var ZoneIsAbstractError = + /*#__PURE__*/ + function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + + return ZoneIsAbstractError; + }(LuxonError); + + /** + * @private + */ + var n = "numeric", + s = "short", + l = "long"; + var DATE_SHORT = { + year: n, + month: n, + day: n + }; + var DATE_MED = { + year: n, + month: s, + day: n + }; + var DATE_FULL = { + year: n, + month: l, + day: n + }; + var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l + }; + var TIME_SIMPLE = { + hour: n, + minute: n + }; + var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n + }; + var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + var TIME_24_SIMPLE = { + hour: n, + minute: n, + hour12: false + }; + /** + * {@link toLocaleString}; format like '09:30:23', always 24-hour. + */ + + var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hour12: false + }; + /** + * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour. + */ + + var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: s + }; + /** + * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour. + */ + + var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: l + }; + /** + * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + */ + + var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n + }; + /** + * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + */ + + var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n + }; + var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n + }; + var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s + }; + var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l + }; + var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + + /* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. + */ + /** + * @private + */ + // TYPES + + function isUndefined(o) { + return typeof o === "undefined"; + } + function isNumber(o) { + return typeof o === "number"; + } + function isInteger(o) { + return typeof o === "number" && o % 1 === 0; + } + function isString(o) { + return typeof o === "string"; + } + function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; + } // CAPABILITIES + + function hasIntl() { + try { + return typeof Intl !== "undefined" && Intl.DateTimeFormat; + } catch (e) { + return false; + } + } + function hasFormatToParts() { + return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); + } + function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } + } // OBJECTS AND ARRAYS + + function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; + } + function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; + } + function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); + } + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } // NUMBERS AND STRINGS + + function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; + } // x % n but takes the sign of n instead of x + + function floorMod(x, n) { + return x - n * Math.floor(x / n); + } + function padStart(input, n) { + if (n === void 0) { + n = 2; + } + + if (input.toString().length < n) { + return ("0".repeat(n) + input).slice(-n); + } else { + return input.toString(); + } + } + function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } + } + function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } + } + function roundTo(number, digits, towardZero) { + if (towardZero === void 0) { + towardZero = false; + } + + var factor = Math.pow(10, digits), + rounder = towardZero ? Math.trunc : Math.round; + return rounder(number * factor) / factor; + } // DATE BASICS + + function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + } + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } + } // covert a calendar object to a local timestamp (epoch, but with the offset baked in) + + function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + + return +d; + } + function weeksInWeekYear(weekYear) { + var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, + last = weekYear - 1, + p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; + return p1 === 4 || p2 === 3 ? 53 : 52; + } + function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > 60 ? 1900 + year : 2000 + year; + } // PARSING + + function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + + var date = new Date(ts), + intlOpts = { + hour12: false, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + var modified = Object.assign({ + timeZoneName: offsetFormat + }, intlOpts), + intl = hasIntl(); + + if (intl && hasFormatToParts()) { + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; + } else if (intl) { + // this probably doesn't work for all locales + var without = new Intl.DateTimeFormat(locale, intlOpts).format(date), + included = new Intl.DateTimeFormat(locale, modified).format(date), + diffed = included.substring(without.length), + trimmed = diffed.replace(/^[, \u200e]+/, ""); + return trimmed; + } else { + return null; + } + } // signedOffset('-5', '30') -> -330 + + function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); // don't || this because we want to preserve -0 + + if (Number.isNaN(offHour)) { + offHour = 0; + } + + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; + } // COERCION + + function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; + } + function normalizeObject(obj, normalizer, nonUnitKeys) { + var normalized = {}; + + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + if (nonUnitKeys.indexOf(u) >= 0) continue; + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + + return normalized; + } + function formatOffset(offset, format) { + var hours = Math.trunc(offset / 60), + minutes = Math.abs(offset % 60), + sign = hours >= 0 && !Object.is(hours, -0) ? "+" : "-", + base = "" + sign + Math.abs(hours); + + switch (format) { + case "short": + return "" + sign + padStart(Math.abs(hours), 2) + ":" + padStart(minutes, 2); + + case "narrow": + return minutes > 0 ? base + ":" + minutes : base; + + case "techie": + return "" + sign + padStart(Math.abs(hours), 2) + padStart(minutes, 2); + + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } + } + function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); + } + var ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; + + function stringify(obj) { + return JSON.stringify(obj, Object.keys(obj).sort()); + } + /** + * @private + */ + + + var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + function months(length) { + switch (length) { + case "narrow": + return monthsNarrow; + + case "short": + return monthsShort; + + case "long": + return monthsLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + + default: + return null; + } + } + var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; + var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + function weekdays(length) { + switch (length) { + case "narrow": + return weekdaysNarrow; + + case "short": + return weekdaysShort; + + case "long": + return weekdaysLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + + default: + return null; + } + } + var meridiems = ["AM", "PM"]; + var erasLong = ["Before Christ", "Anno Domini"]; + var erasShort = ["BC", "AD"]; + var erasNarrow = ["B", "A"]; + function eras(length) { + switch (length) { + case "narrow": + return erasNarrow; + + case "short": + return erasShort; + + case "long": + return erasLong; + + default: + return null; + } + } + function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; + } + function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; + } + function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; + } + function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; + } + function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + + if (narrow === void 0) { + narrow = false; + } + + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + + case 0: + return isDay ? "today" : "this " + units[unit][0]; + + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; + } + function formatString(knownFormat) { + // these all have the offsets removed because we don't have access to them + // without all the intl stuff this is backfilling + var filtered = pick(knownFormat, ["weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "hour12"]), + key = stringify(filtered), + dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; + + switch (key) { + case stringify(DATE_SHORT): + return "M/d/yyyy"; + + case stringify(DATE_MED): + return "LLL d, yyyy"; + + case stringify(DATE_FULL): + return "LLLL d, yyyy"; + + case stringify(DATE_HUGE): + return "EEEE, LLLL d, yyyy"; + + case stringify(TIME_SIMPLE): + return "h:mm a"; + + case stringify(TIME_WITH_SECONDS): + return "h:mm:ss a"; + + case stringify(TIME_WITH_SHORT_OFFSET): + return "h:mm a"; + + case stringify(TIME_WITH_LONG_OFFSET): + return "h:mm a"; + + case stringify(TIME_24_SIMPLE): + return "HH:mm"; + + case stringify(TIME_24_WITH_SECONDS): + return "HH:mm:ss"; + + case stringify(TIME_24_WITH_SHORT_OFFSET): + return "HH:mm"; + + case stringify(TIME_24_WITH_LONG_OFFSET): + return "HH:mm"; + + case stringify(DATETIME_SHORT): + return "M/d/yyyy, h:mm a"; + + case stringify(DATETIME_MED): + return "LLL d, yyyy, h:mm a"; + + case stringify(DATETIME_FULL): + return "LLLL d, yyyy, h:mm a"; + + case stringify(DATETIME_HUGE): + return dateTimeHuge; + + case stringify(DATETIME_SHORT_WITH_SECONDS): + return "M/d/yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_SECONDS): + return "LLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_WEEKDAY): + return "EEE, d LLL yyyy, h:mm a"; + + case stringify(DATETIME_FULL_WITH_SECONDS): + return "LLLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_HUGE_WITH_SECONDS): + return "EEEE, LLLL d, yyyy, h:mm:ss a"; + + default: + return dateTimeHuge; + } + } + + function stringifyTokens(splits, tokenToString) { + var s = ""; + + for (var _iterator = splits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var token = _ref; + + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + + return s; + } + + var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS + }; + /** + * @private + */ + + var Formatter = + /*#__PURE__*/ + function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + + return new Formatter(locale, opts); + }; + + Formatter.parseFormat = function parseFormat(fmt) { + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + + if (c === "'") { + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: false, + val: currentFull + }); + } + + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + return splits; + }; + + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + var _proto = Formatter.prototype; + + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + + var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTime = function formatDateTime(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.formatToParts(); + }; + + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.resolvedOptions(); + }; + + _proto.num = function num(n, p) { + if (p === void 0) { + p = 0; + } + + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + var opts = Object.assign({}, this.opts); + + if (p > 0) { + opts.padTo = p; + } + + return this.loc.numberFormatter(opts).format(n); + }; + + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hour12: true + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + + case "u": // falls through + + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + + case "s": + return _this.num(dt.second); + + case "ss": + return _this.num(dt.second, 2); + // minutes + + case "m": + return _this.num(dt.minute); + + case "mm": + return _this.num(dt.minute, 2); + // hours + + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + + case "H": + return _this.num(dt.hour); + + case "HH": + return _this.num(dt.hour, 2); + // offset + + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + + case "a": + return meridiem(); + // dates + + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + + case "c": + // like 1 + return _this.num(dt.weekday); + + case "ccc": + // like 'Tues' + return weekday("short", true); + + case "cccc": + // like 'Tuesday' + return weekday("long", true); + + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + + case "E": + // like 1 + return _this.num(dt.weekday); + + case "EEE": + // like 'Tues' + return weekday("short", false); + + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + + case "LLL": + // like Jan + return month("short", true); + + case "LLLL": + // like January + return month("long", true); + + case "LLLLL": + // like J + return month("narrow", true); + // months - format + + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + + case "MMM": + // like Jan + return month("short", false); + + case "MMMM": + // like January + return month("long", false); + + case "MMMMM": + // like J + return month("narrow", false); + // years + + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + + case "G": + // like AD + return era("short"); + + case "GG": + // like Anno Domini + return era("long"); + + case "GGGGG": + return era("narrow"); + + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + + case "kkkk": + return _this.num(dt.weekYear, 4); + + case "W": + return _this.num(dt.weekNumber); + + case "WW": + return _this.num(dt.weekNumber, 2); + + case "o": + return _this.num(dt.ordinal); + + case "ooo": + return _this.num(dt.ordinal, 3); + + case "q": + // like 1 + return _this.num(dt.quarter); + + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + + case "x": + return _this.num(dt.ts); + + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + return "hour"; + + case "d": + return "day"; + + case "M": + return "month"; + + case "y": + return "year"; + + default: + return null; + } + }, + tokenToString = function tokenToString(lildur) { + return function (token) { + var mapped = tokenToField(token); + + if (mapped) { + return _this2.num(lildur.get(mapped), token.length); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref2) { + var literal = _ref2.literal, + val = _ref2.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })); + + return stringifyTokens(tokens, tokenToString(collapsed)); + }; + + return Formatter; + }(); + + var Invalid = + /*#__PURE__*/ + function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + var _proto = Invalid.prototype; + + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + + return Invalid; + }(); + + /** + * @interface + */ + + var Zone = + /*#__PURE__*/ + function () { + function Zone() {} + + var _proto = Zone.prototype; + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + ; + + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + ; + + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + ; + + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + ; + + _createClass(Zone, [{ + key: "type", + + /** + * The type of zone + * @abstract + * @type {string} + */ + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * The name of this zone. + * @abstract + * @type {string} + */ + + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + + }, { + key: "universal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + + return Zone; + }(); + + var singleton = null; + /** + * Represents the local zone for this Javascript environment. + * @implements {Zone} + */ + + var LocalZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(LocalZone, _Zone); + + function LocalZone() { + return _Zone.apply(this, arguments) || this; + } + + var _proto = LocalZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "local"; + } + /** @override **/ + ; + + _createClass(LocalZone, [{ + key: "type", + + /** @override **/ + get: function get() { + return "local"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + if (hasIntl()) { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } else return "local"; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + + /** + * Get a singleton instance of the local zone + * @return {LocalZone} + */ + get: function get() { + if (singleton === null) { + singleton = new LocalZone(); + } + + return singleton; + } + }]); + + return LocalZone; + }(Zone); + + var matchingRegex = RegExp("^" + ianaRegex.source + "$"); + var dtfCache = {}; + + function makeDTF(zone) { + if (!dtfCache[zone]) { + dtfCache[zone] = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zone, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" + }); + } + + return dtfCache[zone]; + } + + var typeToPos = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5 + }; + + function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fHour = parsed[4], + fMinute = parsed[5], + fSecond = parsed[6]; + return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; + } + + function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date), + filled = []; + + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value, + pos = typeToPos[type]; + + if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + + return filled; + } + + var ianaZoneCache = {}; + /** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + + var IANAZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + if (!ianaZoneCache[name]) { + ianaZoneCache[name] = new IANAZone(name); + } + + return ianaZoneCache[name]; + } + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + ; + + IANAZone.resetCache = function resetCache() { + ianaZoneCache = {}; + dtfCache = {}; + } + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Fantasia/Castle") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return !!(s && s.match(matchingRegex)); + } + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidZone = function isValidZone(zone) { + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + } // Etc/GMT+8 -> -480 + + /** @ignore */ + ; + + IANAZone.parseGMTOffset = function parseGMTOffset(specifier) { + if (specifier) { + var match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); + + if (match) { + return -60 * parseInt(match[1]); + } + } + + return null; + }; + + function IANAZone(name) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.zoneName = name; + /** @private **/ + + _this.valid = IANAZone.isValidZone(name); + return _this; + } + /** @override **/ + + + var _proto = IANAZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + var date = new Date(ts), + dtf = makeDTF(this.name), + _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + hour = _ref2[3], + minute = _ref2[4], + second = _ref2[5], + adjustedHour = hour === 24 ? 0 : hour; + + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + /** @override **/ + ; + + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + + return IANAZone; + }(Zone); + + var singleton$1 = null; + /** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + + var FixedOffsetZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + ; + + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + + return null; + }; + + _createClass(FixedOffsetZone, null, [{ + key: "utcInstance", + + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + get: function get() { + if (singleton$1 === null) { + singleton$1 = new FixedOffsetZone(0); + } + + return singleton$1; + } + }]); + + function FixedOffsetZone(offset) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.fixed = offset; + return _this; + } + /** @override **/ + + + var _proto = FixedOffsetZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return this.name; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + /** @override **/ + ; + + /** @override **/ + _proto.offset = function offset() { + return this.fixed; + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + /** @override **/ + ; + + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + }, { + key: "universal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }]); + + return FixedOffsetZone; + }(Zone); + + /** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + + var InvalidZone = + /*#__PURE__*/ + function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + + function InvalidZone(zoneName) { + var _this; + + _this = _Zone.call(this) || this; + /** @private */ + + _this.zoneName = zoneName; + return _this; + } + /** @override **/ + + + var _proto = InvalidZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset() { + return ""; + } + /** @override **/ + ; + + _proto.offset = function offset() { + return NaN; + } + /** @override **/ + ; + + _proto.equals = function equals() { + return false; + } + /** @override **/ + ; + + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + + return InvalidZone; + }(Zone); + + /** + * @private + */ + function normalizeZone(input, defaultZone) { + var offset; + + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "local") return defaultZone;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) { + // handle Etc/GMT-4, which V8 chokes on + return FixedOffsetZone.instance(offset); + } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } + } + + var now = function now() { + return Date.now(); + }, + defaultZone = null, + // not setting this directly to LocalZone.instance bc loading order issues + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + throwOnInvalid = false; + /** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + + + var Settings = + /*#__PURE__*/ + function () { + function Settings() {} + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + }; + + _createClass(Settings, null, [{ + key: "now", + + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + get: function get() { + return now; + } + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + , + set: function set(n) { + now = n; + } + /** + * Get the default time zone to create DateTimes in. + * @type {string} + */ + + }, { + key: "defaultZoneName", + get: function get() { + return Settings.defaultZone.name; + } + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * @type {string} + */ + , + set: function set(z) { + if (!z) { + defaultZone = null; + } else { + defaultZone = normalizeZone(z); + } + } + /** + * Get the default time zone object to create DateTimes in. Does not affect existing instances. + * @type {Zone} + */ + + }, { + key: "defaultZone", + get: function get() { + return defaultZone || LocalZone.instance; + } + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(locale) { + defaultLocale = locale; + } + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + , + set: function set(t) { + throwOnInvalid = t; + } + }]); + + return Settings; + }(); + + var intlDTCache = {}; + + function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache[key]; + + if (!dtf) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache[key] = dtf; + } + + return dtf; + } + + var intlNumCache = {}; + + function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache[key]; + + if (!inf) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache[key] = inf; + } + + return inf; + } + + var intlRelCache = {}; + + function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var _opts = opts, + base = _opts.base, + cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, ["base"]); // exclude `base` from the options + + + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache[key]; + + if (!inf) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache[key] = inf; + } + + return inf; + } + + var sysLocaleCache = null; + + function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else if (hasIntl()) { + var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; // node sometimes defaults to "und". Override that because that is dumb + + sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; + return sysLocaleCache; + } else { + sysLocaleCache = "en-US"; + return sysLocaleCache; + } + } + + function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + var uIndex = localeStr.indexOf("-u-"); + + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var smaller = localeStr.substring(0, uIndex); + + try { + options = getCachedDTF(localeStr).resolvedOptions(); + } catch (e) { + options = getCachedDTF(smaller).resolvedOptions(); + } + + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; // return the smaller one so that we can append the calendar and numbering overrides to it + + return [smaller, numberingSystem, calendar]; + } + } + + function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (hasIntl()) { + if (outputCalendar || numberingSystem) { + localeStr += "-u"; + + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + + return localeStr; + } else { + return localeStr; + } + } else { + return []; + } + } + + function mapMonths(f) { + var ms = []; + + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2016, i, 1); + ms.push(f(dt)); + } + + return ms; + } + + function mapWeekdays(f) { + var ms = []; + + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + + return ms; + } + + function listStuff(loc, length, defaultOK, englishFn, intlFn) { + var mode = loc.listingMode(defaultOK); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } + } + + function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; + } + } + /** + * @private + */ + + + var PolyNumberFormatter = + /*#__PURE__*/ + function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + if (!forceSimple && hasIntl()) { + var intlOpts = { + useGrouping: false + }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + var _proto = PolyNumberFormatter.prototype; + + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + + return padStart(_fixed, this.padTo); + } + }; + + return PolyNumberFormatter; + }(); + /** + * @private + */ + + + var PolyDateFormatter = + /*#__PURE__*/ + function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.hasIntl = hasIntl(); + var z; + + if (dt.zone.universal && this.hasIntl) { + // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter, + // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374. + // So we have to make do. Two cases: + // 1. The format options tell us to show the zone. We can't do that, so the best + // we can do is format the date in UTC. + // 2. The format options don't tell us to show the zone. Then we can adjust them + // the time and tell the formatter to show it to us in UTC, so that the time is right + // and the bad zone doesn't show up. + // We can clean all this up when Chrome fixes this. + z = "UTC"; + + if (opts.timeZoneName) { + this.dt = dt; + } else { + this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000); + } + } else if (dt.zone.type === "local") { + this.dt = dt; + } else { + this.dt = dt; + z = dt.zone.name; + } + + if (this.hasIntl) { + var intlOpts = Object.assign({}, this.opts); + + if (z) { + intlOpts.timeZone = z; + } + + this.dtf = getCachedDTF(intl, intlOpts); + } + } + + var _proto2 = PolyDateFormatter.prototype; + + _proto2.format = function format() { + if (this.hasIntl) { + return this.dtf.format(this.dt.toJSDate()); + } else { + var tokenFormat = formatString(this.opts), + loc = Locale.create("en-US"); + return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); + } + }; + + _proto2.formatToParts = function formatToParts() { + if (this.hasIntl && hasFormatToParts()) { + return this.dtf.formatToParts(this.dt.toJSDate()); + } else { + // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings + // and IMO it's too weird to have an uncanny valley like that + return []; + } + }; + + _proto2.resolvedOptions = function resolvedOptions() { + if (this.hasIntl) { + return this.dtf.resolvedOptions(); + } else { + return { + locale: "en-US", + numberingSystem: "latn", + outputCalendar: "gregory" + }; + } + }; + + return PolyDateFormatter; + }(); + /** + * @private + */ + + + var PolyRelFormatter = + /*#__PURE__*/ + function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = Object.assign({ + style: "long" + }, opts); + + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + var _proto3 = PolyRelFormatter.prototype; + + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + + return PolyRelFormatter; + }(); + /** + * @private + */ + + + var Locale = + /*#__PURE__*/ + function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); + }; + + Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + + var specifiedLocale = locale || Settings.defaultLocale, + // the system locale is useful for human readable strings but annoying for parsing/formatting known formats + localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), + numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, + outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); + }; + + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache = {}; + intlNumCache = {}; + intlRelCache = {}; + }; + + Locale.fromObject = function fromObject(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + outputCalendar = _ref.outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar); + }; + + function Locale(locale, numbering, outputCalendar, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + var _proto4 = Locale.prototype; + + _proto4.listingMode = function listingMode(defaultOK) { + if (defaultOK === void 0) { + defaultOK = true; + } + + var intl = hasIntl(), + hasFTP = intl && hasFormatToParts(), + isActuallyEn = this.isEnglish(), + hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + + if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { + return "error"; + } else if (!hasFTP || isActuallyEn && hasNoWeirdness) { + return "en"; + } else { + return "intl"; + } + }; + + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false); + } + }; + + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: true + })); + }; + + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: false + })); + }; + + _proto4.months = function months$1(length, format, defaultOK) { + var _this = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, months, function () { + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this.monthsCache[formatStr][length]) { + _this.monthsCache[formatStr][length] = mapMonths(function (dt) { + return _this.extract(dt, intl, "month"); + }); + } + + return _this.monthsCache[formatStr][length]; + }); + }; + + _proto4.weekdays = function weekdays$1(length, format, defaultOK) { + var _this2 = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this2.weekdaysCache[formatStr][length]) { + _this2.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this2.extract(dt, intl, "weekday"); + }); + } + + return _this2.weekdaysCache[formatStr][length]; + }); + }; + + _proto4.meridiems = function meridiems$1(defaultOK) { + var _this3 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, undefined, defaultOK, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this3.meridiemCache) { + var intl = { + hour: "numeric", + hour12: true + }; + _this3.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this3.extract(dt, intl, "dayperiod"); + }); + } + + return _this3.meridiemCache; + }); + }; + + _proto4.eras = function eras$1(length, defaultOK) { + var _this4 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, eras, function () { + var intl = { + era: length + }; // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + + if (!_this4.eraCache[length]) { + _this4.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this4.extract(dt, intl, "era"); + }); + } + + return _this4.eraCache[length]; + }); + }; + + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); + }; + + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + }]); + + return Locale; + }(); + + /* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + + function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); + } + + function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + + return [Object.assign(mergedVals, val), mergedZone || zone, next]; + }, [{}, null, 1]).slice(0, 2); + }; + } + + function parse(s) { + if (s == null) { + return [null, null]; + } + + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + + if (m) { + return extractor(m); + } + } + + return [null, null]; + } + + function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + + return function (match, cursor) { + var ret = {}; + var i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + + return [ret, null, cursor + i]; + }; + } // ISO and SQL parsing + + + var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, + isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/, + isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + offsetRegex.source + "?"), + isoTimeExtensionRegex = RegExp("(?:T" + isoTimeRegex.source + ")?"), + isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, + isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, + isoOrdinalRegex = /(\d{4})-?(\d{3})/, + extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), + extractISOOrdinalData = simpleParse("year", "ordinal"), + sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, + // dumbed-down version of the ISO one + sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"), + sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); + + function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); + } + + function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; + } + + function extractISOTime(match, cursor) { + var item = { + hour: int(match, cursor, 0), + minute: int(match, cursor + 1, 0), + second: int(match, cursor + 2, 0), + millisecond: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; + } + + function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; + } + + function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; + } // ISO duration parsing + + + var isoDuration = /^P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})(?:[.,](-?\d{1,9}))?S)?)?)$/; + + function extractISODuration(match) { + var yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + return [{ + years: parseInteger(yearStr), + months: parseInteger(monthStr), + weeks: parseInteger(weekStr), + days: parseInteger(dayStr), + hours: parseInteger(hourStr), + minutes: parseInteger(minuteStr), + seconds: parseInteger(secondStr), + milliseconds: parseMillis(millisecondsStr) + }]; + } // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York + // and not just that we're in -240 *right now*. But since I don't think these are used that often + // I'm just going to ignore that + + + var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + + function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; + } // RFC 2822/5322 + + + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + + function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); + } // http date + + + var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + + function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + + function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + + var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); + var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); + var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); + var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset); + var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset); + var extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime); + var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); + /** + * @private + */ + + function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); + } + function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); + } + function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); + } + function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); + } + var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); + var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); + } + + var INVALID = "Invalid Duration"; // unit conversion constants + + var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = Object.assign({ + years: { + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = Object.assign({ + years: { + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix); // units ordered by size + + var orderedUnits = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; + var reverseUnits = orderedUnits.slice(0).reverse(); // clone really means "create another instance just like this one, but with these changes" + + function clone(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + + // deep merge for vals + var conf = { + values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy + }; + return new Duration(conf); + } + + function antiTrunc(n) { + return n < 0 ? Math.floor(n) : Math.ceil(n); + } // NB: mutates parameters + + + function convert(matrix, fromMap, fromUnit, toMap, toUnit) { + var conv = matrix[toUnit][fromUnit], + raw = fromMap[fromUnit] / conv, + sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), + // ok, so this is wild, but see the matrix in the tests + added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); + toMap[toUnit] += added; + fromMap[fromUnit] -= added * conv; + } // NB: mutates parameters + + + function normalizeValues(matrix, vals) { + reverseUnits.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + convert(matrix, vals, previous, vals, current); + } + + return current; + } else { + return previous; + } + }, null); + } + /** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. + * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + + + var Duration = + /*#__PURE__*/ + function () { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + /** + * @access private + */ + + this.values = config.values; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.matrix = accurate ? accurateMatrix : casualMatrix; + /** + * @access private + */ + + this.isLuxonDuration = true; + } + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject(Object.assign({ + milliseconds: count + }, opts)); + } + /** + * Create a Duration from a Javascript object with keys like 'years' and 'hours. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {string} [obj.locale='en-US'] - the locale to use + * @param {string} obj.numberingSystem - the numbering system to use + * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + Duration.fromObject = function fromObject(obj) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit, ["locale", "numberingSystem", "conversionAccuracy", "zone" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this + ]), + loc: Locale.fromObject(obj), + conversionAccuracy: obj.conversionAccuracy + }); + } + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + ; + + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + + if (parsed) { + var obj = Object.assign(parsed, opts); + return Duration.fromObject(obj); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + ; + + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + /** + * @private + */ + ; + + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + ; + + var _proto = Duration.prototype; + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = Object.assign({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID; + } + /** + * Returns a Javascript object with this Duration's values. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.values); + + if (opts.includeConfig) { + base.conversionAccuracy = this.conversionAccuracy; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + ; + + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.toISO(); + } + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.as("milliseconds"); + } + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration), + result = {}; + + for (var _iterator = orderedUnits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var k = _ref; + + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone(this, { + values: result + }, true); + } + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return this.plus(dur.negate()); + } + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + ; + + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + + for (var _i2 = 0, _Object$keys = Object.keys(this.values); _i2 < _Object$keys.length; _i2++) { + var k = _Object$keys[_i2]; + result[k] = asNumber(fn(this.values[k], k)); + } + + return clone(this, { + values: result + }, true); + } + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).years //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).months //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).days //=> 3 + * @return {number} + */ + ; + + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, [])); + return clone(this, { + values: mixed + }); + } + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + ; + + _proto.reconfigure = function reconfigure(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + locale = _ref2.locale, + numberingSystem = _ref2.numberingSystem, + conversionAccuracy = _ref2.conversionAccuracy; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }), + opts = { + loc: loc + }; + + if (conversionAccuracy) { + opts.conversionAccuracy = conversionAccuracy; + } + + return clone(this, opts); + } + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + ; + + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + /** + * Reduce this Duration to its canonical representation in its current units. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @return {Duration} + */ + ; + + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone(this, { + values: vals + }, true); + } + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + ; + + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + normalizeValues(this.matrix, vals); + + for (var _iterator2 = orderedUnits, _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i3 >= _iterator2.length) break; + _ref3 = _iterator2[_i3++]; + } else { + _i3 = _iterator2.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var k = _ref3; + + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; // anything we haven't boiled down yet should get boiled to this unit + + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } // plus anything that's already in this unit + + + if (isNumber(vals[k])) { + own += vals[k]; + } + + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = own - i; // we'd like to absorb these fractions in another unit + // plus anything further down the chain that should be rolled up in to this + + for (var down in vals) { + if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { + convert(this.matrix, vals, down, built, k); + } + } // otherwise, keep it in the wings to boil it later + + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + + + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + return clone(this, { + values: built + }, true).normalize(); + } + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + ; + + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + + for (var _i4 = 0, _Object$keys2 = Object.keys(this.values); _i4 < _Object$keys2.length; _i4++) { + var k = _Object$keys2[_i4]; + negated[k] = -this.values[k]; + } + + return clone(this, { + values: negated + }, true); + } + /** + * Get the years. + * @type {number} + */ + ; + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + for (var _iterator3 = orderedUnits, _isArray3 = Array.isArray(_iterator3), _i5 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref4; + + if (_isArray3) { + if (_i5 >= _iterator3.length) break; + _ref4 = _iterator3[_i5++]; + } else { + _i5 = _iterator3.next(); + if (_i5.done) break; + _ref4 = _i5.value; + } + + var u = _ref4; + + if (this.values[u] !== other.values[u]) { + return false; + } + } + + return true; + }; + + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + /** + * Get the quarters. + * @type {number} + */ + + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + /** + * Get the months. + * @type {number} + */ + + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + /** + * Get the weeks + * @type {number} + */ + + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + /** + * Get the days. + * @type {number} + */ + + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + /** + * Get the hours. + * @type {number} + */ + + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + /** + * Get the minutes. + * @type {number} + */ + + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + /** + * Get the seconds. + * @return {number} + */ + + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + /** + * Get the milliseconds. + * @return {number} + */ + + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Duration; + }(); + function friendlyDuration(durationish) { + if (isNumber(durationish)) { + return Duration.fromMillis(durationish); + } else if (Duration.isDuration(durationish)) { + return durationish; + } else if (typeof durationish === "object") { + return Duration.fromObject(durationish); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationish + " of type " + typeof durationish); + } + } + + var INVALID$1 = "Invalid Interval"; // checks if the start is equal to or before the end + + function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } + } + /** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. + * * **Accessors** Use {@link start} and {@link end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}. + * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs} + * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. + */ + + + var Interval = + /*#__PURE__*/ + function () { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + + this.e = config.end; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.isLuxonInterval = true; + } + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + + + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + ; + + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.after = function after(start, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.before = function before(end, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + ; + + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + + if (s && e) { + var start = DateTime.fromISO(s, opts), + end = DateTime.fromISO(e, opts); + + if (start.isValid && end.isValid) { + return Interval.fromDateTimes(start, end); + } + + if (start.isValid) { + var dur = Duration.fromISO(e, opts); + + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (end.isValid) { + var _dur = Duration.fromISO(s, opts); + + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + /** + * Returns the start of the Interval + * @type {DateTime} + */ + ; + + var _proto = Interval.prototype; + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @return {number} + */ + ; + + _proto.count = function count(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (!this.isValid) return NaN; + var start = this.start.startOf(unit), + end = this.end.startOf(unit); + return Math.floor(end.diff(start, unit).get(unit)) + 1; + } + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false; + } + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + ; + + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + ; + + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + /** + * Split this Interval at each of the specified DateTimes + * @param {...[DateTime]} dateTimes - the unit of time to count. + * @return {[Interval]} + */ + ; + + _proto.splitAt = function splitAt() { + var _this = this; + + if (!this.isValid) return []; + + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(), + results = []; + var s = this.s, + i = 0; + + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {[Interval]} + */ + ; + + _proto.splitBy = function splitBy(duration) { + var dur = friendlyDuration(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + var s = this.s, + added, + next; + var results = []; + + while (s < this.e) { + added = s.plus(dur); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + } + + return results; + } + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {[Interval]} + */ + ; + + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + /** + * Return whether this Interval engulfs the start and end of the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s > e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + + if (final) { + found.push(final); + } + + return found; + } + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.xor = function xor(intervals) { + var _Array$prototype; + + var start = null, + currentCount = 0; + + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + + for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var i = _ref3; + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {[Interval]} + */ + ; + + _proto.difference = function difference() { + var _this2 = this; + + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + ; + + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + /** + * Returns a string representation of this Interval formatted according to the specified format string. + * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. + * @param {Object} opts - options + * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref4 = _temp2 === void 0 ? {} : _temp2, + _ref4$separator = _ref4.separator, + separator = _ref4$separator === void 0 ? " – " : _ref4$separator; + + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + ; + + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + + return this.e.diff(this.s, unit, opts); + } + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + ; + + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + /** + * Returns the end of the Interval + * @type {DateTime} + */ + + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Interval; + }(); + + /** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + + var Info = + /*#__PURE__*/ + function () { + function Info() {} + + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + + var proto = DateTime.local().setZone(zone).set({ + month: 12 + }); + return !zone.universal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + ; + + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); + } + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone.isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + ; + + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {[string]} + */ + ; + + Info.months = function months(length, _temp) { + if (length === void 0) { + length = "long"; + } + + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$numberingSystem = _ref.numberingSystem, + numberingSystem = _ref$numberingSystem === void 0 ? null : _ref$numberingSystem, + _ref$outputCalendar = _ref.outputCalendar, + outputCalendar = _ref$outputCalendar === void 0 ? "gregory" : _ref$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length); + } + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {[string]} + */ + ; + + Info.monthsFormat = function monthsFormat(length, _temp2) { + if (length === void 0) { + length = "long"; + } + + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$numberingSystem = _ref2.numberingSystem, + numberingSystem = _ref2$numberingSystem === void 0 ? null : _ref2$numberingSystem, + _ref2$outputCalendar = _ref2.outputCalendar, + outputCalendar = _ref2$outputCalendar === void 0 ? "gregory" : _ref2$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length, true); + } + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {[string]} + */ + ; + + Info.weekdays = function weekdays(length, _temp3) { + if (length === void 0) { + length = "long"; + } + + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$numberingSystem = _ref3.numberingSystem, + numberingSystem = _ref3$numberingSystem === void 0 ? null : _ref3$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length); + } + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @return {[string]} + */ + ; + + Info.weekdaysFormat = function weekdaysFormat(length, _temp4) { + if (length === void 0) { + length = "long"; + } + + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length, true); + } + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {[string]} + */ + ; + + Info.meridiems = function meridiems(_temp5) { + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale; + + return Locale.create(locale).meridiems(); + } + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {[string]} + */ + ; + + Info.eras = function eras(length, _temp6) { + if (length === void 0) { + length = "short"; + } + + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale; + + return Locale.create(locale, null, "gregory").eras(length); + } + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case. + * Keys: + * * `zones`: whether this environment supports IANA timezones + * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing + * * `intl`: whether this environment supports general internationalization + * * `relative`: whether this environment supports relative time formatting + * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false } + * @return {Object} + */ + ; + + Info.features = function features() { + var intl = false, + intlTokens = false, + zones = false, + relative = false; + + if (hasIntl()) { + intl = true; + intlTokens = hasFormatToParts(); + relative = hasRelative(); + + try { + zones = new Intl.DateTimeFormat("en", { + timeZone: "America/New_York" + }).resolvedOptions().timeZone === "America/New_York"; + } catch (e) { + zones = false; + } + } + + return { + intl: intl, + intlTokens: intlTokens, + zones: zones, + relative: relative + }; + }; + + return Info; + }(); + + function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + + return Math.floor(Duration.fromMillis(ms).as("days")); + } + + function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var lowestOrder, highWater; + + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + + if (units.indexOf(unit) >= 0) { + var _cursor$plus; + + lowestOrder = unit; + var delta = differ(cursor, later); + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[unit] = delta, _cursor$plus)); + + if (highWater > later) { + var _cursor$plus2; + + cursor = cursor.plus((_cursor$plus2 = {}, _cursor$plus2[unit] = delta - 1, _cursor$plus2)); + delta -= 1; + } else { + cursor = highWater; + } + + results[unit] = delta; + } + } + + return [cursor, results, highWater, lowestOrder]; + } + + function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus3; + + highWater = cursor.plus((_cursor$plus3 = {}, _cursor$plus3[lowestOrder] = 1, _cursor$plus3)); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + var duration = Duration.fromObject(Object.assign(results, opts)); + + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } + } + + var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" + }; + var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] + }; // eslint-disable-next-line + + var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + function parseDigits(str) { + var value = parseInt(str, 10); + + if (isNaN(value)) { + value = ""; + + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + + return parseInt(value, 10); + } else { + return value; + } + } + function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + + if (append === void 0) { + append = ""; + } + + return new RegExp("" + numberingSystems[numberingSystem || "latn"] + append); + } + + var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + + function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; + } + + function fixListRegex(s) { + // make dots optional and also make them literal + return s.replace(/\./, "\\.?"); + } + + function stripInsensitivities(s) { + return s.replace(/\./, "").toLowerCase(); + } + + function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } + } + + function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; + } + + function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; + } + + function escapeToken(value) { + // eslint-disable-next-line no-useless-escape + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + } + + function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short", false), 0); + + case "GG": + return oneOf(loc.eras("long", false), 0); + // years + + case "y": + return intUnit(oneToSix); + + case "yy": + return intUnit(twoToFour, untruncateYear); + + case "yyyy": + return intUnit(four); + + case "yyyyy": + return intUnit(fourToSix); + + case "yyyyyy": + return intUnit(six); + // months + + case "M": + return intUnit(oneOrTwo); + + case "MM": + return intUnit(two); + + case "MMM": + return oneOf(loc.months("short", true, false), 1); + + case "MMMM": + return oneOf(loc.months("long", true, false), 1); + + case "L": + return intUnit(oneOrTwo); + + case "LL": + return intUnit(two); + + case "LLL": + return oneOf(loc.months("short", false, false), 1); + + case "LLLL": + return oneOf(loc.months("long", false, false), 1); + // dates + + case "d": + return intUnit(oneOrTwo); + + case "dd": + return intUnit(two); + // ordinals + + case "o": + return intUnit(oneToThree); + + case "ooo": + return intUnit(three); + // time + + case "HH": + return intUnit(two); + + case "H": + return intUnit(oneOrTwo); + + case "hh": + return intUnit(two); + + case "h": + return intUnit(oneOrTwo); + + case "mm": + return intUnit(two); + + case "m": + return intUnit(oneOrTwo); + + case "q": + return intUnit(oneOrTwo); + + case "qq": + return intUnit(two); + + case "s": + return intUnit(oneOrTwo); + + case "ss": + return intUnit(two); + + case "S": + return intUnit(oneToThree); + + case "SSS": + return intUnit(three); + + case "u": + return simple(oneToNine); + // meridiem + + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + + case "kkkk": + return intUnit(four); + + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + + case "W": + return intUnit(oneOrTwo); + + case "WW": + return intUnit(two); + // weekdays + + case "E": + case "c": + return intUnit(one); + + case "EEE": + return oneOf(loc.weekdays("short", false, false), 1); + + case "EEEE": + return oneOf(loc.weekdays("long", false, false), 1); + + case "ccc": + return oneOf(loc.weekdays("short", true, false), 1); + + case "cccc": + return oneOf(loc.weekdays("long", true, false), 1); + // offset/zone + + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + + default: + return literal(t); + } + }; + + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; + } + + var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour: { + numeric: "h", + "2-digit": "hh" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + } + }; + + function tokenForPart(part, locale, formatOpts) { + var type = part.type, + value = part.value; + + if (type === "literal") { + return { + literal: true, + val: value + }; + } + + var style = formatOpts[type]; + var val = partTypeStyleToTokenVal[type]; + + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val: val + }; + } + + return undefined; + } + + function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; + } + + function match(input, regex, handlers) { + var matches = input.match(regex); + + if (matches) { + var all = {}; + var matchIndex = 1; + + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + + matchIndex += groups; + } + } + + return [matches, all]; + } else { + return [matches, {}]; + } + } + + function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + case "H": + return "hour"; + + case "d": + return "day"; + + case "o": + return "ordinal"; + + case "L": + case "M": + return "month"; + + case "y": + return "year"; + + case "E": + case "c": + return "weekday"; + + case "W": + return "weekNumber"; + + case "k": + return "weekYear"; + + case "q": + return "quarter"; + + default: + return null; + } + }; + + var zone; + + if (!isUndefined(matches.Z)) { + zone = new FixedOffsetZone(matches.Z); + } else if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } else { + zone = null; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + return [vals, zone]; + } + + var dummyDateTimeCache = null; + + function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; + } + + function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + + if (!formatOpts) { + return token; + } + + var formatter = Formatter.create(locale, formatOpts); + var parts = formatter.formatDateTimeParts(getDummyDateTime()); + var tokens = parts.map(function (p) { + return tokenForPart(p, locale, formatOpts); + }); + + if (tokens.includes(undefined)) { + return token; + } + + return tokens; + } + + function expandMacroTokens(tokens, locale) { + var _Array$prototype; + + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); + } + /** + * @private + */ + + + function explainFromTokens(locale, input, format) { + var tokens = expandMacroTokens(Formatter.parseFormat(format), locale), + units = tokens.map(function (t) { + return unitForToken(t, locale); + }), + disqualifyingUnit = units.find(function (t) { + return t.invalidReason; + }); + + if (disqualifyingUnit) { + return { + input: input, + tokens: tokens, + invalidReason: disqualifyingUnit.invalidReason + }; + } else { + var _buildRegex = buildRegex(units), + regexString = _buildRegex[0], + handlers = _buildRegex[1], + regex = RegExp(regexString, "i"), + _match = match(input, regex, handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null], + result = _ref6[0], + zone = _ref6[1]; + + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + + return { + input: input, + tokens: tokens, + regex: regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone + }; + } + } + function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + invalidReason = _explainFromTokens.invalidReason; + + return [result, zone, invalidReason]; + } + + var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + + function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); + } + + function dayOfWeek(year, month, day) { + var js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); + return js === 0 ? 7 : js; + } + + function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; + } + + function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; + } + /** + * @private + */ + + + function gregorianToWeek(gregObj) { + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = dayOfWeek(year, month, day); + var weekNumber = Math.floor((ordinal - weekday + 10) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear); + } else if (weekNumber > weeksInWeekYear(year)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return Object.assign({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); + } + function weekToGregorian(weekData) { + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(weekData)); + } + function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day, + ordinal = computeOrdinal(year, month, day); + return Object.assign({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); + } + function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal, + _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); + } + function hasInvalidWeekData(obj) { + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.week); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; + } + function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; + } + function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; + } + function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; + } + + var INVALID$2 = "Invalid DateTime"; + var MAX_DATE = 8.64e15; + + function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); + } // we cache week data on the DT object and this intermediates the cache + + + function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + + return dt.weekData; + } // clone really means, "make a new object with these modifications". all "setters" really use this + // to create a new object while only changing some of the properties + + + function clone$1(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(Object.assign({}, current, alts, { + old: current + })); + } // find the right offset a given local time. The o input is our guess, which determines which + // offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + + + function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts + + var o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done + + if (o === o2) { + return [utcGuess, o]; + } // If not, change the ts by the difference in the offset + + + utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done + + var o3 = tz.offset(utcGuess); + + if (o2 === o3) { + return [utcGuess, o2]; + } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + + + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; + } // convert an epoch timestamp into a calendar object with the given offset + + + function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; + } // convert a calendar object to a epoch timestamp + + + function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); + } // create a new DT instance by adding a duration, adjusting for DSTs + + + function adjustTime(inst, dur) { + var _dur; + + var keys = Object.keys(dur.values); + + if (keys.indexOf("milliseconds") === -1) { + keys.push("milliseconds"); + } + + dur = (_dur = dur).shiftTo.apply(_dur, keys); + var oPre = inst.o, + year = inst.c.year + dur.years, + month = inst.c.month + dur.months + dur.quarters * 3, + c = Object.assign({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7 + }), + millisToAdd = Duration.fromObject({ + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + + if (millisToAdd !== 0) { + ts += millisToAdd; // that could have changed the offset by going over a DST, but we want to keep the ts the same + + o = inst.zone.offset(ts); + } + + return { + ts: ts, + o: o + }; + } // helper useful in turning the results of parsing into real dates + // by handling the zone options + + + function parseDataToDateTime(parsed, parsedZone, opts, format, text) { + var setZone = opts.setZone, + zone = opts.zone; + + if (parsed && Object.keys(parsed).length !== 0) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(Object.assign(parsed, opts, { + zone: interpretationZone, + // setZone is a valid option in the calling methods, but not in fromObject + setZone: undefined + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } + } // if you want to output a technical format (e.g. RFC 2822), this helper + // helps handle the details + + + function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; + } // technical time formats (e.g. the time part of ISO 8601), take some options + // and this commonizes their handling + + + function toTechTimeFormat(dt, _ref) { + var _ref$suppressSeconds = _ref.suppressSeconds, + suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds, + _ref$suppressMillisec = _ref.suppressMilliseconds, + suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec, + includeOffset = _ref.includeOffset, + _ref$includeZone = _ref.includeZone, + includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone, + _ref$spaceZone = _ref.spaceZone, + spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone, + _ref$format = _ref.format, + format = _ref$format === void 0 ? "extended" : _ref$format; + var fmt = format === "basic" ? "HHmm" : "HH:mm"; + + if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { + fmt += format === "basic" ? "ss" : ":ss"; + + if (!suppressMilliseconds || dt.millisecond !== 0) { + fmt += ".SSS"; + } + } + + if ((includeZone || includeOffset) && spaceZone) { + fmt += " "; + } + + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += format === "basic" ? "ZZZ" : "ZZ"; + } + + return toTechFormat(dt, fmt); + } // defaults for unspecified units in the supported calendars + + + var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; // Units in the supported calendars, sorted by bigness + + var orderedUnits$1 = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; // standardize case and plurality in units + + function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } // this is a dumbed down version of fromObject() that runs about 60% faster + // but doesn't do any validation, makes a bunch of assumptions about what units + // are present, and so on. + + + function quickDT(obj, zone) { + // assume we have the higher-order units + for (var _iterator = orderedUnits$1, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + var u = _ref2; + + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + + if (invalid) { + return DateTime.invalid(invalid); + } + + var tsNow = Settings.now(), + offsetProvis = zone.offset(tsNow), + _objToTS = objToTS(obj, offsetProvis, zone), + ts = _objToTS[0], + o = _objToTS[1]; + + return new DateTime({ + ts: ts, + zone: zone, + o: o + }); + } + + function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, true); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (var _iterator2 = opts.units, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + var unit = _ref3; + var count = differ(unit); + + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + + return format(0, opts.units[opts.units.length - 1]); + } + /** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, + * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. + * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + + + var DateTime = + /*#__PURE__*/ + function () { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + var _ref4 = [config.old.c, config.old.o]; + c = _ref4[0]; + o = _ref4[1]; + } else { + var ot = zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + /** + * @access private + */ + + + this._zone = zone; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.invalid = invalid; + /** + * @access private + */ + + this.weekData = null; + /** + * @access private + */ + + this.c = c; + /** + * @access private + */ + + this.o = o; + /** + * @access private + */ + + this.isLuxonDateTime = true; + } // CONSTRUCT + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + + + DateTime.local = function local(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now() + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, Settings.defaultZone); + } + } + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @return {DateTime} + */ + ; + + DateTime.utc = function utc(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now(), + zone: FixedOffsetZone.utcInstance + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, FixedOffsetZone.utcInstance); + } + } + /** + * Create a DateTime from a Javascript Date object. Uses the default zone. + * @param {Date} date - a Javascript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + ; + + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + + var ts = isDate(date) ? date.valueOf() : NaN; + + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @return {DateTime} + */ + ; + + DateTime.fromObject = function fromObject(obj) { + var zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + var tsNow = Settings.now(), + offsetProvis = zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit, ["zone", "locale", "outputCalendar", "numberingSystem"]), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber, + loc = Locale.fromObject(obj); // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; // configure ourselves to deal with gregorian dates or week stuff + + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits$1; + defaultValues = defaultUnitValues; + } // set default values for missing stuff + + + var foundFirst = false; + + for (var _iterator3 = units, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref5; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref5 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref5 = _i3.value; + } + + var u = _ref5; + var v = normalized[u]; + + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } // make sure the values we have are in range + + + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } // compute the actual time + + + var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); // gregorian data + weekday serves only to validate + + + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + + return inst; + } + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + ; + + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + ; + + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + ; + + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + invalid = _parseFromTokens[2]; + + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text); + } + } + /** + * @deprecated use fromFormat instead + */ + ; + + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return DateTime.fromFormat(text, fmt, opts); + } + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + ; + + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + ; + + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + /** + * Check if an object is a DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + ; + + var _proto = DateTime.prototype; + + _proto.get = function get(unit) { + return this[unit]; + } + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + ; + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOpts = function resolvedLocaleOpts(opts) { + if (opts === void 0) { + opts = {}; + } + + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + ; + + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + + if (opts === void 0) { + opts = {}; + } + + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + ; + + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + ; + + _proto.setZone = function setZone(zone, _temp) { + var _ref6 = _temp === void 0 ? {} : _temp, + _ref6$keepLocalTime = _ref6.keepLocalTime, + keepLocalTime = _ref6$keepLocalTime === void 0 ? false : _ref6$keepLocalTime, + _ref6$keepCalendarTim = _ref6.keepCalendarTime, + keepCalendarTime = _ref6$keepCalendarTim === void 0 ? false : _ref6$keepCalendarTim; + + zone = normalizeZone(zone, Settings.defaultZone); + + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + + newTS = _objToTS3[0]; + } + + return clone$1(this, { + ts: newTS, + zone: zone + }); + } + } + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + ; + + _proto.reconfigure = function reconfigure(_temp2) { + var _ref7 = _temp2 === void 0 ? {} : _temp2, + locale = _ref7.locale, + numberingSystem = _ref7.numberingSystem, + outputCalendar = _ref7.outputCalendar; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone$1(this, { + loc: loc + }); + } + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + ; + + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnit, []), + settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday); + var mixed; + + if (settingWeekStuff) { + mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + } else { + mixed = Object.assign(this.toObject(), normalized); // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + + return clone$1(this, { + ts: ts, + o: o + }); + } + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.local().plus(123) //~> in 123 milliseconds + * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return clone$1(this, adjustTime(this, dur)); + } + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration).negate(); + return clone$1(this, adjustTime(this, dur)); + } + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + ; + + _proto.startOf = function startOf(unit) { + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + + case "quarters": + case "months": + o.day = 1; + // falls through + + case "weeks": + case "days": + o.hour = 0; + // falls through + + case "hours": + o.minute = 0; + // falls through + + case "minutes": + o.second = 0; + // falls through + + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + o.weekday = 1; + } + + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + ; + + _proto.endOf = function endOf(unit) { + var _this$plus; + + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this; + } // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options + * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$2; + } + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @example DateTime.local().toLocaleString(); //=> 4/20/2017 + * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' + * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' + * @return {string} + */ + ; + + _proto.toLocaleString = function toLocaleString(opts) { + if (opts === void 0) { + opts = DATE_SHORT; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID$2; + } + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.local().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + ; + + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toISODate(opts) + "T" + this.toISOTime(opts); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + ; + + _proto.toISODate = function toISODate(_temp3) { + var _ref8 = _temp3 === void 0 ? {} : _temp3, + _ref8$format = _ref8.format, + format = _ref8$format === void 0 ? "extended" : _ref8$format; + + var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; + + if (this.year > 9999) { + fmt = "+" + fmt; + } + + return toTechFormat(this, fmt); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + ; + + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(_temp4) { + var _ref9 = _temp4 === void 0 ? {} : _temp4, + _ref9$suppressMillise = _ref9.suppressMilliseconds, + suppressMilliseconds = _ref9$suppressMillise === void 0 ? false : _ref9$suppressMillise, + _ref9$suppressSeconds = _ref9.suppressSeconds, + suppressSeconds = _ref9$suppressSeconds === void 0 ? false : _ref9$suppressSeconds, + _ref9$includeOffset = _ref9.includeOffset, + includeOffset = _ref9$includeOffset === void 0 ? true : _ref9$includeOffset, + _ref9$format = _ref9.format, + format = _ref9$format === void 0 ? "extended" : _ref9$format; + + return toTechTimeFormat(this, { + suppressSeconds: suppressSeconds, + suppressMilliseconds: suppressMilliseconds, + includeOffset: includeOffset, + format: format + }); + } + /** + * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + ; + + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + ; + + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + ; + + _proto.toSQLDate = function toSQLDate() { + return toTechFormat(this, "yyyy-MM-dd"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + ; + + _proto.toSQLTime = function toSQLTime(_temp5) { + var _ref10 = _temp5 === void 0 ? {} : _temp5, + _ref10$includeOffset = _ref10.includeOffset, + includeOffset = _ref10$includeOffset === void 0 ? true : _ref10$includeOffset, + _ref10$includeZone = _ref10.includeZone, + includeZone = _ref10$includeZone === void 0 ? false : _ref10$includeZone; + + return toTechTimeFormat(this, { + includeOffset: includeOffset, + includeZone: includeZone, + spaceZone: true + }); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + ; + + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID$2; + } + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + ; + + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + ; + + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + /** + * Returns a Javascript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.c); + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns a Javascript Date equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + ; + + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid(this.invalid || otherDateTime.invalid, "created by diffing an invalid DateTime"); + } + + var durOpts = Object.assign({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + + return otherIsLater ? diffed.negate() : diffed; + } + /** + * Return the difference between this DateTime and right now. + * See {@link diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + return this.diff(DateTime.local(), unit, opts); + } + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + ; + + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + /** + * Return whether this DateTime is in the same unit of time as another DateTime + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(otherDateTime, unit) { + if (!this.isValid) return false; + + if (unit === "millisecond") { + return this.valueOf() === otherDateTime.valueOf(); + } else { + var inputMs = otherDateTime.valueOf(); + return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit); + } + } + /** + * Equality check + * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + ; + + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({ + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + return diffRelative(base, this.plus(padding), Object.assign(options, { + numeric: "always", + units: ["years", "months", "days", "hours", "minutes", "seconds"] + })); + } + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + ; + + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({ + zone: this.zone + }), this, Object.assign(options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + ; + + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + ; + + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + ; + + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + /** + * @deprecated use fromFormatExplain instead + */ + ; + + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + return DateTime.fromFormatExplain(text, fmt, options); + } // FORMAT PRESETS + + /** + * {@link toLocaleString} format like 10/14/1983 + * @type {Object} + */ + ; + + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + + }, { + key: "zone", + get: function get() { + return this._zone; + } + /** + * Get the name of the time zone. + * @type {string} + */ + + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekYear //=> 2015 + * @type {number} + */ + + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.local().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.universal : null; + } + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + /** + * {@link toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + /** + * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + /** + * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + + return DateTime; + }(); + function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } + } + + exports.DateTime = DateTime; + exports.Duration = Duration; + exports.FixedOffsetZone = FixedOffsetZone; + exports.IANAZone = IANAZone; + exports.Info = Info; + exports.Interval = Interval; + exports.InvalidZone = InvalidZone; + exports.LocalZone = LocalZone; + exports.Settings = Settings; + exports.Zone = Zone; + + return exports; + +}({})); +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/global/luxon.js.map b/node_modules/luxon/build/global/luxon.js.map new file mode 100644 index 0000000..8247d08 --- /dev/null +++ b/node_modules/luxon/build/global/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/invalid.js","../../src/zone.js","../../src/zones/localZone.js","../../src/zones/IANAZone.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/settings.js","../../src/impl/locale.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/digits.js","../../src/impl/tokenParser.js","../../src/impl/conversions.js","../../src/datetime.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23', always 24-hour.\n */\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour.\n */\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: s\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour.\n */\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: l\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasIntl() {\n try {\n return typeof Intl !== \"undefined\" && Intl.DateTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasFormatToParts() {\n return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts);\n}\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n if (input.toString().length < n) {\n return (\"0\".repeat(n) + input).slice(-n);\n } else {\n return input.toString();\n }\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, towardZero = false) {\n const factor = 10 ** digits,\n rounder = towardZero ? Math.trunc : Math.round;\n return rounder(number * factor) / factor;\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// covert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n return +d;\n}\n\nexport function weeksInWeekYear(weekYear) {\n const p1 =\n (weekYear +\n Math.floor(weekYear / 4) -\n Math.floor(weekYear / 100) +\n Math.floor(weekYear / 400)) %\n 7,\n last = weekYear - 1,\n p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;\n return p1 === 4 || p2 === 3 ? 53 : 52;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > 60 ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hour12: false,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\"\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts),\n intl = hasIntl();\n\n if (intl && hasFormatToParts()) {\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find(m => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n } else if (intl) {\n // this probably doesn't work for all locales\n const without = new Intl.DateTimeFormat(locale, intlOpts).format(date),\n included = new Intl.DateTimeFormat(locale, modified).format(date),\n diffed = included.substring(without.length),\n trimmed = diffed.replace(/^[, \\u200e]+/, \"\");\n return trimmed;\n } else {\n return null;\n }\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || Number.isNaN(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer, nonUnitKeys) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n if (nonUnitKeys.indexOf(u) >= 0) continue;\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(offset / 60),\n minutes = Math.abs(offset % 60),\n sign = hours >= 0 && !Object.is(hours, -0) ? \"+\" : \"-\",\n base = `${sign}${Math.abs(hours)}`;\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(Math.abs(hours), 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return minutes > 0 ? `${base}:${minutes}` : base;\n case \"techie\":\n return `${sign}${padStart(Math.abs(hours), 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n\nexport const ianaRegex = /[A-Za-z_+-]{1,256}(:?\\/[A-Za-z_+-]{1,256}(\\/[A-Za-z_+-]{1,256})?)?/;\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return monthsNarrow;\n case \"short\":\n return monthsShort;\n case \"long\":\n return monthsLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\"\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return weekdaysNarrow;\n case \"short\":\n return weekdaysShort;\n case \"long\":\n return weekdaysLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return erasNarrow;\n case \"short\":\n return erasShort;\n case \"long\":\n return erasLong;\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"]\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hour12\"\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { hasFormatToParts, padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: false, val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTime(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTimeParts(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.formatToParts();\n }\n\n resolvedOptions(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.resolvedOptions();\n }\n\n num(n, p = 0) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = Object.assign({}, this.opts);\n\n if (p > 0) {\n opts.padTo = p;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter =\n this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\" && hasFormatToParts(),\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = opts => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hour12: true }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = token => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = length =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = token => {\n // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const tokenToField = token => {\n switch (token[0]) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n default:\n return null;\n }\n },\n tokenToString = lildur => token => {\n const mapped = tokenToField(token);\n if (mapped) {\n return this.num(lildur.get(mapped), token.length);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t));\n return stringifyTokens(tokens, tokenToString(collapsed));\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","/* eslint no-unused-vars: \"off\" */\nimport { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get universal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo, hasIntl } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this Javascript environment.\n * @implements {Zone}\n */\nexport default class LocalZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {LocalZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new LocalZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"local\";\n }\n\n /** @override **/\n get name() {\n if (hasIntl()) {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n } else return \"local\";\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"local\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, ianaRegex, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst matchingRegex = RegExp(`^${ianaRegex.source}$`);\n\nlet dtfCache = {};\nfunction makeDTF(zone) {\n if (!dtfCache[zone]) {\n dtfCache[zone] = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\"\n });\n }\n return dtfCache[zone];\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date),\n filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i],\n pos = typeToPos[type];\n\n if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nlet ianaZoneCache = {};\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n if (!ianaZoneCache[name]) {\n ianaZoneCache[name] = new IANAZone(name);\n }\n return ianaZoneCache[name];\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache = {};\n dtfCache = {};\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Fantasia/Castle\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return !!(s && s.match(matchingRegex));\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n // Etc/GMT+8 -> -480\n /** @ignore */\n static parseGMTOffset(specifier) {\n if (specifier) {\n const match = specifier.match(/^Etc\\/GMT([+-]\\d{1,2})$/i);\n if (match) {\n return -60 * parseInt(match[1]);\n }\n }\n return null;\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /** @override **/\n get type() {\n return \"iana\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n const date = new Date(ts),\n dtf = makeDTF(this.name),\n [year, month, day, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date),\n // work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /** @override **/\n get isValid() {\n return this.valid;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /** @override **/\n get type() {\n return \"fixed\";\n }\n\n /** @override **/\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /** @override **/\n offsetName() {\n return this.name;\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /** @override **/\n get universal() {\n return true;\n }\n\n /** @override **/\n offset() {\n return this.fixed;\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"local\") return defaultZone;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else if ((offset = IANAZone.parseGMTOffset(input)) != null) {\n // handle Etc/GMT-4, which V8 chokes on\n return FixedOffsetZone.instance(offset);\n } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);\n else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && input.offset && typeof input.offset === \"number\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","import LocalZone from \"./zones/localZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nlet now = () => Date.now(),\n defaultZone = null, // not setting this directly to LocalZone.instance bc loading order issues\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n throwOnInvalid = false;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Get the default time zone to create DateTimes in.\n * @type {string}\n */\n static get defaultZoneName() {\n return Settings.defaultZone.name;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * @type {string}\n */\n static set defaultZoneName(z) {\n if (!z) {\n defaultZone = null;\n } else {\n defaultZone = normalizeZone(z);\n }\n }\n\n /**\n * Get the default time zone object to create DateTimes in. Does not affect existing instances.\n * @type {Zone}\n */\n static get defaultZone() {\n return defaultZone || LocalZone.instance;\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n }\n}\n","import { hasFormatToParts, hasIntl, padStart, roundTo, hasRelative } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport Formatter from \"./formatter.js\";\n\nlet intlDTCache = {};\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache[key];\n if (!dtf) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache[key] = dtf;\n }\n return dtf;\n}\n\nlet intlNumCache = {};\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache[key];\n if (!inf) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache[key] = inf;\n }\n return inf;\n}\n\nlet intlRelCache = {};\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache[key];\n if (!inf) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache[key] = inf;\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else if (hasIntl()) {\n const computedSys = new Intl.DateTimeFormat().resolvedOptions().locale;\n // node sometimes defaults to \"und\". Override that because that is dumb\n sysLocaleCache = !computedSys || computedSys === \"und\" ? \"en-US\" : computedSys;\n return sysLocaleCache;\n } else {\n sysLocaleCache = \"en-US\";\n return sysLocaleCache;\n }\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n const smaller = localeStr.substring(0, uIndex);\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n } catch (e) {\n options = getCachedDTF(smaller).resolvedOptions();\n }\n\n const { numberingSystem, calendar } = options;\n // return the smaller one so that we can append the calendar and numbering overrides to it\n return [smaller, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (hasIntl()) {\n if (outputCalendar || numberingSystem) {\n localeStr += \"-u\";\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n } else {\n return [];\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2016, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, defaultOK, englishFn, intlFn) {\n const mode = loc.listingMode(defaultOK);\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n (hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === \"latn\")\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n if (!forceSimple && hasIntl()) {\n const intlOpts = { useGrouping: false };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.hasIntl = hasIntl();\n\n let z;\n if (dt.zone.universal && this.hasIntl) {\n // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.\n // So we have to make do. Two cases:\n // 1. The format options tell us to show the zone. We can't do that, so the best\n // we can do is format the date in UTC.\n // 2. The format options don't tell us to show the zone. Then we can adjust them\n // the time and tell the formatter to show it to us in UTC, so that the time is right\n // and the bad zone doesn't show up.\n // We can clean all this up when Chrome fixes this.\n z = \"UTC\";\n if (opts.timeZoneName) {\n this.dt = dt;\n } else {\n this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);\n }\n } else if (dt.zone.type === \"local\") {\n this.dt = dt;\n } else {\n this.dt = dt;\n z = dt.zone.name;\n }\n\n if (this.hasIntl) {\n const intlOpts = Object.assign({}, this.opts);\n if (z) {\n intlOpts.timeZone = z;\n }\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n }\n\n format() {\n if (this.hasIntl) {\n return this.dtf.format(this.dt.toJSDate());\n } else {\n const tokenFormat = English.formatString(this.opts),\n loc = Locale.create(\"en-US\");\n return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat);\n }\n }\n\n formatToParts() {\n if (this.hasIntl && hasFormatToParts()) {\n return this.dtf.formatToParts(this.dt.toJSDate());\n } else {\n // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings\n // and IMO it's too weird to have an uncanny valley like that\n return [];\n }\n }\n\n resolvedOptions() {\n if (this.hasIntl) {\n return this.dtf.resolvedOptions();\n } else {\n return {\n locale: \"en-US\",\n numberingSystem: \"latn\",\n outputCalendar: \"gregory\"\n };\n }\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = Object.assign({ style: \"long\" }, opts);\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\n/**\n * @private\n */\n\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);\n }\n\n static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale,\n // the system locale is useful for human readable strings but annoying for parsing/formatting known formats\n localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale()),\n numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,\n outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache = {};\n intlNumCache = {};\n intlRelCache = {};\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar);\n }\n\n constructor(locale, numbering, outputCalendar, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode(defaultOK = true) {\n const intl = hasIntl(),\n hasFTP = intl && hasFormatToParts(),\n isActuallyEn = this.isEnglish(),\n hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n\n if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) {\n return \"error\";\n } else if (!hasFTP || (isActuallyEn && hasNoWeirdness)) {\n return \"en\";\n } else {\n return \"intl\";\n }\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: true }));\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: false }));\n }\n\n months(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.months, () => {\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n this.monthsCache[formatStr][length] = mapMonths(dt => this.extract(dt, intl, \"month\"));\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays(dt =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems(defaultOK = true) {\n return listStuff(\n this,\n undefined,\n defaultOK,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hour12: true };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n dt => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.eras, () => {\n const intl = { era: length };\n\n // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find(m => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n (hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith(\"en-us\"))\n );\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n ianaRegex,\n isUndefined\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return m =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [Object.assign(mergedVals, val), mergedZone || zone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:(Z)|([+-]\\d\\d)(?::?(\\d\\d))?)/,\n isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,9}))?)?)?/,\n isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`),\n isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`),\n isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/,\n isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/,\n isoOrdinalRegex = /(\\d{4})-?(\\d{3})/,\n extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\"),\n extractISOOrdinalData = simpleParse(\"year\", \"ordinal\"),\n sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/, // dumbed-down version of the ISO one\n sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n ),\n sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1)\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hour: int(match, cursor, 0),\n minute: int(match, cursor + 1, 0),\n second: int(match, cursor + 2, 0),\n millisecond: parseMillis(match[cursor + 3])\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO duration parsing\n\nconst isoDuration = /^P(?:(?:(-?\\d{1,9})Y)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})W)?(?:(-?\\d{1,9})D)?(?:T(?:(-?\\d{1,9})H)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})(?:[.,](-?\\d{1,9}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [\n ,\n yearStr,\n monthStr,\n weekStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr,\n millisecondsStr\n ] = match;\n\n return [\n {\n years: parseInteger(yearStr),\n months: parseInteger(monthStr),\n weeks: parseInteger(weekStr),\n days: parseInteger(dayStr),\n hours: parseInteger(hourStr),\n minutes: parseInteger(minuteStr),\n seconds: parseInteger(secondStr),\n milliseconds: parseMillis(millisecondsStr)\n }\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr)\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime);\nconst extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);\n\n/**\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOYmdTimeOffsetAndIANAZone = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nconst lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 }\n },\n casualMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n ),\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n );\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy\n };\n return new Duration(conf);\n}\n\nfunction antiTrunc(n) {\n return n < 0 ? Math.floor(n) : Math.ceil(n);\n}\n\n// NB: mutates parameters\nfunction convert(matrix, fromMap, fromUnit, toMap, toUnit) {\n const conv = matrix[toUnit][fromUnit],\n raw = fromMap[fromUnit] / conv,\n sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),\n // ok, so this is wild, but see the matrix in the tests\n added =\n !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);\n toMap[toUnit] += added;\n fromMap[fromUnit] -= added * conv;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n reverseUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n convert(matrix, vals, previous, vals, current);\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors.\n * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = accurate ? accurateMatrix : casualMatrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject(Object.assign({ milliseconds: count }, opts));\n }\n\n /**\n * Create a Duration from a Javascript object with keys like 'years' and 'hours.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {string} [obj.locale='en-US'] - the locale to use\n * @param {string} obj.numberingSystem - the numbering system to use\n * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromObject(obj) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit, [\n \"locale\",\n \"numberingSystem\",\n \"conversionAccuracy\",\n \"zone\" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this\n ]),\n loc: Locale.fromObject(obj),\n conversionAccuracy: obj.conversionAccuracy\n });\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n const obj = Object.assign(parsed, opts);\n return Duration.fromObject(obj);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\"\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = Object.assign({}, opts, {\n floor: opts.round !== false && opts.floor !== false\n });\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a Javascript object with this Duration's values.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.values);\n\n if (opts.includeConfig) {\n base.conversionAccuracy = this.conversionAccuracy;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n valueOf() {\n return this.as(\"milliseconds\");\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === \"hour\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).years //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).months //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).days //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, []));\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem }),\n opts = { loc };\n\n if (conversionAccuracy) {\n opts.conversionAccuracy = conversionAccuracy;\n }\n\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map(u => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n normalizeValues(this.matrix, vals);\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = own - i; // we'd like to absorb these fractions in another unit\n\n // plus anything further down the chain that should be rolled up in to this\n for (const down in vals) {\n if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {\n convert(this.matrix, vals, down, built, k);\n }\n }\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n return clone(this, { values: built }, true).normalize();\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n for (const u of orderedUnits) {\n if (this.values[u] !== other.values[u]) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDuration(durationish) {\n if (isNumber(durationish)) {\n return Duration.fromMillis(durationish);\n } else if (Duration.isDuration(durationish)) {\n return durationish;\n } else if (typeof durationish === \"object\") {\n return Duration.fromObject(durationish);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationish} of type ${typeof durationish}`\n );\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration, { friendlyDuration } from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}.\n * * **Accessors** Use {@link start} and {@link end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.\n * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}\n * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n const start = DateTime.fromISO(s, opts),\n end = DateTime.fromISO(e, opts);\n\n if (start.isValid && end.isValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (start.isValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (end.isValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @return {number}\n */\n count(unit = \"milliseconds\") {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit),\n end = this.end.startOf(unit);\n return Math.floor(end.diff(start, unit).get(unit)) + 1;\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...[DateTime]} dateTimes - the unit of time to count.\n * @return {[Interval]}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter(d => this.contains(d))\n .sort(),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {[Interval]}\n */\n splitBy(duration) {\n const dur = friendlyDuration(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n added,\n next;\n\n const results = [];\n while (s < this.e) {\n added = s.plus(dur);\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {[Interval]}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Return whether this Interval engulfs the start and end of the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s > e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into a equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static merge(intervals) {\n const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map(i => [{ time: i.s, type: \"s\" }, { time: i.e, type: \"e\" }]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {[Interval]}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map(i => this.intersection(i))\n .filter(i => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format string.\n * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details.\n * @param {Object} opts - options\n * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasFormatToParts, hasIntl, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.local()\n .setZone(zone)\n .set({ month: 12 });\n\n return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone.isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {[string]}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {[string]}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {[string]}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @return {[string]}\n */\n static weekdaysFormat(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {[string]}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {[string]}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `zones`: whether this environment supports IANA timezones\n * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing\n * * `intl`: whether this environment supports general internationalization\n * * `relative`: whether this environment supports relative time formatting\n * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false }\n * @return {Object}\n */\n static features() {\n let intl = false,\n intlTokens = false,\n zones = false,\n relative = false;\n\n if (hasIntl()) {\n intl = true;\n intlTokens = hasFormatToParts();\n relative = hasRelative();\n\n try {\n zones =\n new Intl.DateTimeFormat(\"en\", { timeZone: \"America/New_York\" }).resolvedOptions()\n .timeZone === \"America/New_York\";\n } catch (e) {\n zones = false;\n }\n }\n\n return { intl, intlTokens, zones, relative };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = dt =>\n dt\n .toUTC(0, { keepLocalTime: true })\n .startOf(\"day\")\n .valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n }\n ],\n [\"days\", dayDiff]\n ];\n\n const results = {};\n let lowestOrder, highWater;\n\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n let delta = differ(cursor, later);\n highWater = cursor.plus({ [unit]: delta });\n\n if (highWater > later) {\n cursor = cursor.plus({ [unit]: delta - 1 });\n delta -= 1;\n } else {\n cursor = highWater;\n }\n\n results[unit] = delta;\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function(earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n u => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(Object.assign(results, opts));\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\"\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881]\n};\n\n// eslint-disable-next-line\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n return new RegExp(`${numberingSystems[numberingSystem || \"latn\"]}${append}`);\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = i => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n return s.replace(/\\./, \"\\\\.?\");\n}\n\nfunction stripInsensitivities(s) {\n return s.replace(/\\./, \"\").toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n // eslint-disable-next-line no-useless-escape\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = t => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = t => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\", false), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\", false), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true, false), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true, false), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false, false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false, false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false, false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false, false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true, false), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true, false), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\"\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\"\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\"\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\"\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour: {\n numeric: \"h\",\n \"2-digit\": \"hh\"\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\"\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\"\n }\n};\n\nfunction tokenForPart(part, locale, formatOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n return {\n literal: true,\n val: value\n };\n }\n\n const style = formatOpts[type];\n\n let val = partTypeStyleToTokenVal[type];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = token => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone;\n if (!isUndefined(matches.Z)) {\n zone = new FixedOffsetZone(matches.Z);\n } else if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n } else {\n zone = null;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n\n if (!formatOpts) {\n return token;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const parts = formatter.formatDateTimeParts(getDummyDateTime());\n\n const tokens = parts.map(p => tokenForPart(p, locale, formatOpts));\n\n if (tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nfunction expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport function explainFromTokens(locale, input, format) {\n const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),\n units = tokens.map(t => unitForToken(t, locale)),\n disqualifyingUnit = units.find(t => t.invalidReason);\n\n if (disqualifyingUnit) {\n return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };\n } else {\n const [regexString, handlers] = buildRegex(units),\n regex = RegExp(regexString, \"i\"),\n [rawMatches, matches] = match(input, regex, handlers),\n [result, zone] = matches ? dateTimeFromMatches(matches) : [null, null];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return { input, tokens, regex, rawMatches, matches, result, zone };\n }\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, invalidReason];\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nfunction dayOfWeek(year, month, day) {\n const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay();\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex(i => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = dayOfWeek(year, month, day);\n\n let weekNumber = Math.floor((ordinal - weekday + 10) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear);\n } else if (weekNumber > weeksInWeekYear(year)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return Object.assign({ weekYear, weekNumber, weekday }, timeObject(gregObj));\n}\n\nexport function weekToGregorian(weekData) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(weekData));\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData,\n ordinal = computeOrdinal(year, month, day);\n\n return Object.assign({ year, ordinal }, timeObject(gregData));\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData,\n { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(ordinalData));\n}\n\nexport function hasInvalidWeekData(obj) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.week);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","import Duration, { friendlyDuration } from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport { parseFromTokens, explainFromTokens } from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid\n };\n return new DateTime(Object.assign({}, current, alts, { old: current }));\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds()\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const keys = Object.keys(dur.values);\n if (keys.indexOf(\"milliseconds\") === -1) {\n keys.push(\"milliseconds\");\n }\n\n dur = dur.shiftTo(...keys);\n\n const oPre = inst.o,\n year = inst.c.year + dur.years,\n month = inst.c.month + dur.months + dur.quarters * 3,\n c = Object.assign({}, inst.c, {\n year,\n month,\n day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7\n }),\n millisToAdd = Duration.fromObject({\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text) {\n const { setZone, zone } = opts;\n if (parsed && Object.keys(parsed).length !== 0) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(\n Object.assign(parsed, opts, {\n zone: interpretationZone,\n // setZone is a valid option in the calling methods, but not in fromObject\n setZone: undefined\n })\n );\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\n// technical time formats (e.g. the time part of ISO 8601), take some options\n// and this commonizes their handling\nfunction toTechTimeFormat(\n dt,\n {\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset,\n includeZone = false,\n spaceZone = false,\n format = \"extended\"\n }\n) {\n let fmt = format === \"basic\" ? \"HHmm\" : \"HH:mm\";\n\n if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {\n fmt += format === \"basic\" ? \"ss\" : \":ss\";\n if (!suppressMilliseconds || dt.millisecond !== 0) {\n fmt += \".SSS\";\n }\n }\n\n if ((includeZone || includeOffset) && spaceZone) {\n fmt += \" \";\n }\n\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += format === \"basic\" ? \"ZZZ\" : \"ZZ\";\n }\n\n return toTechFormat(dt, fmt);\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\"\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\"\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, zone) {\n // assume we have the higher-order units\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zone.offset(tsNow),\n [ts, o] = objToTS(obj, offsetProvis, zone);\n\n return new DateTime({\n ts,\n zone,\n o\n });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, true);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = unit => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end\n .startOf(unit)\n .diff(start.startOf(unit), unit)\n .get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(0, opts.units[opts.units.length - 1]);\n}\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month},\n * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors.\n * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n const ot = zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({ ts: Settings.now() });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n Settings.defaultZone\n );\n }\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z\n * @return {DateTime}\n */\n static utc(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({\n ts: Settings.now(),\n zone: FixedOffsetZone.utcInstance\n });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n FixedOffsetZone.utcInstance\n );\n }\n }\n\n /**\n * Create a DateTime from a Javascript Date object. Uses the default zone.\n * @param {Date} date - a Javascript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options)\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @return {DateTime}\n */\n static fromObject(obj) {\n const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zoneToUse.offset(tsNow),\n normalized = normalizeObject(obj, normalizeUnit, [\n \"zone\",\n \"locale\",\n \"outputCalendar\",\n \"numberingSystem\"\n ]),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber,\n loc = Locale.fromObject(obj);\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n }),\n [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is a DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.local().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.universal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOpts(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link reconfigure} and {@link setZone}.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnit, []),\n settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday);\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized));\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized));\n } else {\n mixed = Object.assign(this.toObject(), normalized);\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.local().plus(123) //~> in 123 milliseconds\n * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit) {\n if (!this.isValid) return this;\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n o.weekday = 1;\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options\n * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.local().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.local().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @example DateTime.local().toLocaleString(); //=> 4/20/2017\n * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(opts = Formats.DATE_SHORT) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.local().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @return {string}\n */\n toISO(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toISODate(opts)}T${this.toISOTime(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @return {string}\n */\n toISODate({ format = \"extended\" } = {}) {\n let fmt = format === \"basic\" ? \"yyyyMMdd\" : \"yyyy-MM-dd\";\n if (this.year > 9999) {\n fmt = \"+\" + fmt;\n }\n\n return toTechFormat(this, fmt);\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n format = \"extended\"\n } = {}) {\n return toTechTimeFormat(this, {\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n format\n });\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string}\n */\n toSQLDate() {\n return toTechFormat(this, \"yyyy-MM-dd\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false } = {}) {\n return toTechTimeFormat(this, {\n includeOffset,\n includeZone,\n spaceZone: true\n });\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a Javascript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.c);\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a Javascript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\n this.invalid || otherDateTime.invalid,\n \"created by diffing an invalid DateTime\"\n );\n }\n\n const durOpts = Object.assign(\n { locale: this.locale, numberingSystem: this.numberingSystem },\n opts\n );\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.local(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit) {\n if (!this.isValid) return false;\n if (unit === \"millisecond\") {\n return this.valueOf() === otherDateTime.valueOf();\n } else {\n const inputMs = otherDateTime.valueOf();\n return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit);\n }\n }\n\n /**\n * Equality check\n * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds down by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.local().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.local().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({ zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n return diffRelative(\n base,\n this.plus(padding),\n Object.assign(options, {\n numeric: \"always\",\n units: [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"]\n })\n );\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.local().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(\n options.base || DateTime.fromObject({ zone: this.zone }),\n this,\n Object.assign(options, {\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true\n })\n );\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n"],"names":["LuxonError","Error","InvalidDateTimeError","reason","toMessage","InvalidIntervalError","InvalidDurationError","ConflictingSpecificationError","InvalidUnitError","unit","InvalidArgumentError","ZoneIsAbstractError","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_FULL","DATE_HUGE","weekday","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hour12","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","isUndefined","o","isNumber","isInteger","isString","isDate","Object","prototype","toString","call","hasIntl","Intl","DateTimeFormat","e","hasFormatToParts","formatToParts","hasRelative","RelativeTimeFormat","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","length","undefined","reduce","best","next","pair","pick","obj","keys","a","k","hasOwnProperty","prop","integerBetween","bottom","top","floorMod","x","Math","floor","padStart","input","repeat","slice","parseInteger","string","parseInt","parseMillis","fraction","f","parseFloat","roundTo","number","digits","towardZero","factor","rounder","trunc","round","isLeapYear","daysInYear","daysInMonth","modMonth","modYear","objToLocalTS","d","Date","UTC","millisecond","setUTCFullYear","getUTCFullYear","weeksInWeekYear","weekYear","p1","last","p2","untruncateYear","parseZoneInfo","ts","offsetFormat","locale","timeZone","date","intlOpts","modified","assign","intl","parsed","find","m","type","toLowerCase","value","without","format","included","diffed","substring","trimmed","replace","signedOffset","offHourStr","offMinuteStr","offHour","Number","isNaN","offMin","offMinSigned","is","asNumber","numericValue","normalizeObject","normalizer","nonUnitKeys","normalized","u","indexOf","v","formatOffset","offset","hours","minutes","abs","sign","base","RangeError","timeObject","ianaRegex","stringify","JSON","sort","monthsLong","monthsShort","monthsNarrow","months","weekdaysLong","weekdaysShort","weekdaysNarrow","weekdays","meridiems","erasLong","erasShort","erasNarrow","eras","meridiemForDateTime","dt","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","count","numeric","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","formatString","knownFormat","filtered","key","dateTimeHuge","Formats","stringifyTokens","splits","tokenToString","token","literal","val","macroTokenToFormatOpts","D","DD","DDD","DDDD","t","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","create","opts","parseFormat","fmt","current","currentFull","bracketed","i","c","charAt","push","formatOpts","loc","systemLoc","formatWithSystemDefault","redefaultToSystem","df","dtFormatter","formatDateTime","formatDateTimeParts","resolvedOptions","num","p","forceSimple","padTo","numberFormatter","formatDateTimeFromString","knownEnglish","listingMode","useDateTimeFormatter","outputCalendar","extract","isOffsetFixed","allowZ","isValid","zone","meridiem","English","standalone","maybeMacro","era","offsetName","zoneName","weekNumber","ordinal","quarter","formatDurationFromString","dur","tokenToField","lildur","mapped","get","tokens","realTokens","found","concat","collapsed","shiftTo","map","filter","Invalid","explanation","Zone","equals","otherZone","singleton","LocalZone","getTimezoneOffset","matchingRegex","RegExp","source","dtfCache","makeDTF","typeToPos","hackyOffset","dtf","formatted","exec","fMonth","fDay","fYear","fHour","fMinute","fSecond","partsOffset","filled","pos","ianaZoneCache","IANAZone","name","resetCache","isValidSpecifier","match","isValidZone","parseGMTOffset","specifier","valid","adjustedHour","asUTC","asTS","over","FixedOffsetZone","instance","utcInstance","parseSpecifier","r","fixed","InvalidZone","NaN","normalizeZone","defaultZone","lowered","now","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","throwOnInvalid","Settings","resetCaches","Locale","z","numberingSystem","intlDTCache","getCachedDTF","locString","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","cacheKeyOpts","sysLocaleCache","systemLocale","computedSys","parseLocaleString","localeStr","uIndex","options","smaller","calendar","intlConfigString","mapMonths","ms","DateTime","utc","mapWeekdays","listStuff","defaultOK","englishFn","intlFn","mode","supportsFastNumbers","startsWith","PolyNumberFormatter","useGrouping","minimumIntegerDigits","PolyDateFormatter","universal","fromMillis","toJSDate","tokenFormat","PolyRelFormatter","isEnglish","style","rtf","fromOpts","defaultToEN","specifiedLocale","localeR","numberingSystemR","outputCalendarR","fromObject","numbering","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","monthsCache","meridiemCache","eraCache","fastNumbersCached","hasFTP","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","formatStr","field","results","matching","fastNumbers","relFormatter","other","combineRegexes","regexes","full","combineExtractors","extractors","ex","mergedVals","mergedZone","cursor","parse","patterns","regex","extractor","simpleParse","ret","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","extractISOOffset","local","fullOffset","extractIANAZone","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","milliseconds","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDataAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOYmdTimeOffsetAndIANAZone","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","clear","conf","values","conversionAccuracy","Duration","antiTrunc","ceil","convert","matrix","fromMap","fromUnit","toMap","toUnit","conv","raw","sameSign","added","normalizeValues","vals","previous","config","accurate","invalid","isLuxonDuration","normalizeUnit","fromISO","text","week","isDuration","toFormat","fmtOpts","toObject","includeConfig","toISO","toJSON","valueOf","as","plus","duration","friendlyDuration","minus","negate","mapUnits","fn","set","mixed","reconfigure","normalize","built","accumulated","lastUnit","own","ak","down","negated","durationish","validateStartEnd","start","end","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","split","isInterval","toDuration","startOf","diff","hasSame","isEmpty","isAfter","dateTime","isBefore","contains","splitAt","dateTimes","sorted","splitBy","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","b","sofar","final","xor","currentCount","ends","time","flattened","difference","toISODate","toISOTime","dateFormat","separator","invalidReason","mapEndpoints","mapFn","Info","hasDST","proto","setZone","isValidIANAZone","monthsFormat","weekdaysFormat","features","intlTokens","zones","relative","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","differ","delta","remainingMillis","lowerOrderUnits","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","parseDigits","str","code","charCodeAt","search","min","max","digitRegex","append","MISSING_FTP","intUnit","post","deser","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","join","findIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","tokenForPart","part","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatter","parts","includes","expandMacroTokens","explainFromTokens","disqualifyingUnit","regexString","rawMatches","parseFromTokens","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","js","getUTCDay","computeOrdinal","uncomputeOrdinal","table","month0","gregorianToWeek","gregObj","weekToGregorian","weekData","weekdayOfJan4","yearInDays","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","hasInvalidWeekData","validYear","validWeek","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","MAX_DATE","unsupportedZone","possiblyCachedWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","toTechTimeFormat","suppressSeconds","suppressMilliseconds","includeOffset","includeZone","spaceZone","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","quickDT","tsNow","offsetProvis","diffRelative","calendary","unchanged","ot","_zone","isLuxonDateTime","fromJSDate","zoneToUse","fromSeconds","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","higherOrderInvalid","gregorian","tsFinal","offsetFinal","fromRFC2822","fromHTTP","fromFormat","localeToUse","fromString","fromSQL","isDateTime","resolvedLocaleOpts","toLocal","keepCalendarTime","newTS","offsetGuess","asObj","setLocale","settingWeekStuff","normalizedUnit","endOf","toLocaleString","toLocaleParts","toISOWeekDate","toRFC2822","toHTTP","toSQLDate","toSQLTime","toSQL","toMillis","toSeconds","toBSON","otherDateTime","durOpts","otherIsLater","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EACD;EAED;;;;;;;0BAIwC;EACtC,aAAOA,0BAAP;EACD;;;;;AAGH,EAGO,SAASgY,gBAAT,CAA0BkT,WAA1B,EAAuC;EAC5C,MAAItgB,QAAQ,CAACoe,UAAT,CAAoBkC,WAApB,CAAJ,EAAsC;EACpC,WAAOA,WAAP;EACD,GAFD,MAEO,IAAIA,WAAW,IAAIA,WAAW,CAAC9U,OAA3B,IAAsCnhB,QAAQ,CAACi2B,WAAW,CAAC9U,OAAZ,EAAD,CAAlD,EAA2E;EAChF,WAAOxL,QAAQ,CAAC8c,UAAT,CAAoBwD,WAApB,CAAP;EACD,GAFM,MAEA,IAAIA,WAAW,IAAI,OAAOA,WAAP,KAAuB,QAA1C,EAAoD;EACzD,WAAOtgB,QAAQ,CAAC4B,UAAT,CAAoB0e,WAApB,CAAP;EACD,GAFM,MAEA;EACL,UAAM,IAAIt4B,oBAAJ,iCAC0Bs4B,WAD1B,kBACkD,OAAOA,WADzD,CAAN;EAGD;EACF;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/global/luxon.min.js b/node_modules/luxon/build/global/luxon.min.js new file mode 100644 index 0000000..862037a --- /dev/null +++ b/node_modules/luxon/build/global/luxon.min.js @@ -0,0 +1 @@ +var luxon=function(e){"use strict";function r(e,t){for(var n=0;n=r.length)break;o=r[a++]}else{if((a=r.next()).done)break;o=a.value}o.literal?n+=o.val:n+=t(o.val)}return n}var Ee={D:p,DD:w,DDD:k,DDDD:b,t:O,tt:S,ttt:T,tttt:M,T:N,TT:D,TTT:E,TTTT:I,f:V,ff:Z,fff:A,ffff:_,F:F,FF:C,FFF:z,FFFF:q},Ie=function(){function h(e,t){this.opts=t,this.loc=e,this.systemLoc=null}h.create=function(e,t){return void 0===t&&(t={}),new h(e,t)},h.parseFormat=function(e){for(var t=null,n="",r=!1,i=[],a=0;a=r.length)break;o=r[a++]}else{if((a=r.next()).done)break;o=a.value}var s=o;(G(t.values,s)||G(this.values,s))&&(n[s]=t.get(s)+this.get(s))}return en(this,{values:n},!0)},e.minus=function(e){if(!this.isValid)return this;var t=an(e);return this.plus(t.negate())},e.mapUnits=function(e){if(!this.isValid)return this;for(var t={},n=0,r=Object.keys(this.values);n=s.length)break;l=s[c++]}else{if((c=s.next()).done)break;l=c.value}var f=l;if(0<=t.indexOf(f)){r=f;var d=0;for(var h in a)d+=this.matrix[h][f]*a[h],a[h]=0;U(o[f])&&(d+=o[f]);var m=Math.trunc(d);for(var y in i[f]=m,a[f]=d-m,o)Kt.indexOf(y)>Kt.indexOf(f)&&tn(this.matrix,o,y,i,f)}else U(o[f])&&(a[f]=o[f])}for(var v in a)0!==a[v]&&(i[r]+=v===r?a[v]:a[v]/this.matrix[r][v]);return en(this,{values:i},!0).normalize()},e.negate=function(){if(!this.isValid)return this;for(var e={},t=0,n=Object.keys(this.values);t=t.length)break;i=t[r++]}else{if((r=t.next()).done)break;i=r.value}if(this.values[i]!==e.values[i])return!1}return!0},i(g,[{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"years",get:function(){return this.isValid?this.values.years||0:NaN}},{key:"quarters",get:function(){return this.isValid?this.values.quarters||0:NaN}},{key:"months",get:function(){return this.isValid?this.values.months||0:NaN}},{key:"weeks",get:function(){return this.isValid?this.values.weeks||0:NaN}},{key:"days",get:function(){return this.isValid?this.values.days||0:NaN}},{key:"hours",get:function(){return this.isValid?this.values.hours||0:NaN}},{key:"minutes",get:function(){return this.isValid?this.values.minutes||0:NaN}},{key:"seconds",get:function(){return this.isValid?this.values.seconds||0:NaN}},{key:"milliseconds",get:function(){return this.isValid?this.values.milliseconds||0:NaN}},{key:"isValid",get:function(){return null===this.invalid}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),g}();function an(e){if(U(e))return rn.fromMillis(e);if(rn.isDuration(e))return e;if("object"==typeof e)return rn.fromObject(e);throw new h("Unknown duration argument "+e+" of type "+typeof e)}var on="Invalid Interval";var sn=function(){function l(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}l.invalid=function(e,t){if(void 0===t&&(t=null),!e)throw new h("need to specify a reason the Interval is invalid");var n=e instanceof Ve?e:new Ve(e,t);if($e.throwOnInvalid)throw new f(n);return new l({invalid:n})},l.fromDateTimes=function(e,t){var n,r,i=or(e),a=or(t),o=(r=a,(n=i)&&n.isValid?r&&r.isValid?re},e.isBefore=function(e){return!!this.isValid&&this.e<=e},e.contains=function(e){return!!this.isValid&&(this.s<=e&&this.e>e)},e.set=function(e){var t=void 0===e?{}:e,n=t.start,r=t.end;return this.isValid?l.fromDateTimes(n||this.s,r||this.e):this},e.splitAt=function(){var t=this;if(!this.isValid)return[];for(var e=arguments.length,n=new Array(e),r=0;r+this.e?this.e:u;a.push(l.fromDateTimes(o,c)),o=c,s+=1}return a},e.splitBy=function(e){var t=an(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];for(var n,r,i=this.s,a=[];i+this.e?this.e:n,a.push(l.fromDateTimes(i,r)),i=r;return a},e.divideEqually=function(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]},e.overlaps=function(e){return this.e>e.s&&this.s=e.e)},e.equals=function(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))},e.intersection=function(e){if(!this.isValid)return this;var t=this.s>e.s?this.s:e.s,n=this.ee.e?this.e:e.e;return l.fromDateTimes(t,n)},l.merge=function(e){var t=e.sort(function(e,t){return e.s-t.s}).reduce(function(e,t){var n=e[0],r=e[1];return r?r.overlaps(t)||r.abutsStart(t)?[n,r.union(t)]:[n.concat([r]),t]:[n,t]},[[],null]),n=t[0],r=t[1];return r&&n.push(r),n},l.xor=function(e){var t,n=null,r=0,i=[],a=e.map(function(e){return[{time:e.s,type:"s"},{time:e.e,type:"e"}]}),o=(t=Array.prototype).concat.apply(t,a).sort(function(e,t){return e.time-t.time}),s=Array.isArray(o),u=0;for(o=s?o:o[Symbol.iterator]();;){var c;if(s){if(u>=o.length)break;c=o[u++]}else{if((u=o.next()).done)break;c=u.value}n=1===(r+="s"===c.type?1:-1)?c.time:(n&&+n!=+c.time&&i.push(l.fromDateTimes(n,c.time)),null)}return l.merge(i)},e.difference=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;rie(n)?(t=n+1,s=1):t=n,Object.assign({weekYear:t,weekNumber:s,weekday:o},fe(e))}function Zn(e){var t,n=e.weekYear,r=e.weekNumber,i=e.weekday,a=Vn(n,1,4),o=te(n),s=7*r+i-a-3;s<1?s+=te(t=n-1):o=n.length)break;a=n[i++]}else{if((i=n.next()).done)break;a=i.value}H(e[a])&&(e[a]=Bn[a])}var o=An(e)||zn(e);if(o)return ar.invalid(o);var s=$e.now(),u=Pn(e,t.offset(s),t),c=u[0],l=u[1];return new ar({ts:c,zone:t,o:l})}function ir(t,n,r){function e(e,t){return e=X(e,a||r.calendary?0:2,!0),n.loc.clone(r).relFormatter(r).format(e,t)}function i(e){return r.calendary?n.hasSame(t,e)?0:n.startOf(e).diff(t.startOf(e),e).get(e):n.diff(t,e).get(e)}var a=!!H(r.round)||r.round;if(r.unit)return e(i(r.unit),r.unit);var o=r.units,s=Array.isArray(o),u=0;for(o=s?o:o[Symbol.iterator]();;){var c;if(s){if(u>=o.length)break;c=o[u++]}else{if((u=o.next()).done)break;c=u.value}var l=c,f=i(l);if(1<=Math.abs(f))return e(f,l)}return e(0,r.units[r.units.length-1])}var ar=function(){function L(e){var t=e.zone||$e.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Ve("invalid input"):null)||(t.isValid?null:qn(t));this.ts=H(e.ts)?$e.now():e.ts;var r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t)){var a=[e.old.c,e.old.o];r=a[0],i=a[1]}else{var o=t.offset(this.ts);r=Wn(this.ts,o),r=(n=Number.isNaN(r.year)?new Ve("invalid input"):null)?null:r,i=n?null:o}this._zone=t,this.loc=e.loc||ot.create(),this.invalid=n,this.weekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}L.local=function(e,t,n,r,i,a,o){return H(e)?new L({ts:$e.now()}):rr({year:e,month:t,day:n,hour:r,minute:i,second:a,millisecond:o},$e.defaultZone)},L.utc=function(e,t,n,r,i,a,o){return H(e)?new L({ts:$e.now(),zone:qe.utcInstance}):rr({year:e,month:t,day:n,hour:r,minute:i,second:a,millisecond:o},qe.utcInstance)},L.fromJSDate=function(e,t){void 0===t&&(t={});var n,r=(n=e,"[object Date]"===Object.prototype.toString.call(n)?e.valueOf():NaN);if(Number.isNaN(r))return L.invalid("invalid input");var i=Ue(t.zone,$e.defaultZone);return i.isValid?new L({ts:r,zone:i,loc:ot.fromObject(t)}):L.invalid(qn(i))},L.fromMillis=function(e,t){if(void 0===t&&(t={}),U(e))return e<-864e13||864e13=v.length)break;w=v[p++]}else{if((p=v.next()).done)break;w=p.value}var k=w;H(i[k])?i[k]=y?d[k]:m[k]:y=!0}var b,O,S,T,M,N,D,E=(h?(M=R((T=i).weekYear),N=$(T.weekNumber,1,ie(T.weekYear)),D=$(T.weekday,1,7),M?N?!D&&In("weekday",T.weekday):In("week",T.week):In("weekYear",T.weekYear)):a?(O=R((b=i).year),S=$(b.ordinal,1,te(b.year)),O?!S&&In("ordinal",b.ordinal):In("year",b.year)):An(i))||zn(i);if(E)return L.invalid(E);var I=Pn(h?Zn(i):a?jn(i):i,r,t),V=new L({ts:I[0],zone:t,o:I[1],loc:l});return i.weekday&&u&&e.weekday!==V.weekday?L.invalid("mismatched weekday","you can't specify both a weekday of "+i.weekday+" and a date of "+V.toISO()):V},L.fromISO=function(e,t){void 0===t&&(t={});var n=ct(e,[Ct,_t],[jt,qt],[At,Ht],[zt,Ut]);return Yn(n[0],n[1],t,"ISO 8601",e)},L.fromRFC2822=function(e,t){void 0===t&&(t={});var n=ct(e.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim(),[Et,It]);return Yn(n[0],n[1],t,"RFC 2822",e)},L.fromHTTP=function(e,t){void 0===t&&(t={});var n=ct(e,[Vt,Ft],[Lt,Ft],[xt,Zt]);return Yn(n[0],n[1],t,"HTTP",t)},L.fromFormat=function(e,t,n){if(void 0===n&&(n={}),H(e)||H(t))throw new h("fromFormat requires an input string and a format");var r,i=n.locale,a=void 0===i?null:i,o=n.numberingSystem,s=void 0===o?null:o,u=ot.fromOpts({locale:a,numberingSystem:s,defaultToEN:!0}),c=[(r=Nn(u,e,t)).result,r.zone,r.invalidReason],l=c[0],f=c[1],d=c[2];return d?L.invalid(d):Yn(l,f,n,"format "+t,e)},L.fromString=function(e,t,n){return void 0===n&&(n={}),L.fromFormat(e,t,n)},L.fromSQL=function(e,t){void 0===t&&(t={});var n=ct(e,[Rt,Pt],[Wt,Jt]);return Yn(n[0],n[1],t,"SQL",e)},L.invalid=function(e,t){if(void 0===t&&(t=null),!e)throw new h("need to specify a reason the DateTime is invalid");var n=e instanceof Ve?e:new Ve(e,t);if($e.throwOnInvalid)throw new c(n);return new L({invalid:n})},L.isDateTime=function(e){return e&&e.isLuxonDateTime||!1};var e=L.prototype;return e.get=function(e){return this[e]},e.resolvedLocaleOpts=function(e){void 0===e&&(e={});var t=Ie.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t.locale,numberingSystem:t.numberingSystem,outputCalendar:t.calendar}},e.toUTC=function(e,t){return void 0===e&&(e=0),void 0===t&&(t={}),this.setZone(qe.instance(e),t)},e.toLocal=function(){return this.setZone($e.defaultZone)},e.setZone=function(e,t){var n=void 0===t?{}:t,r=n.keepLocalTime,i=void 0!==r&&r,a=n.keepCalendarTime,o=void 0!==a&&a;if((e=Ue(e,$e.defaultZone)).equals(this.zone))return this;if(e.isValid){var s=this.ts;if(i||o){var u=e.offset(this.ts);s=Pn(this.toObject(),u,e)[0]}return Un(this,{ts:s,zone:e})}return L.invalid(qn(e))},e.reconfigure=function(e){var t=void 0===e?{}:e,n=t.locale,r=t.numberingSystem,i=t.outputCalendar,a=this.loc.clone({locale:n,numberingSystem:r,outputCalendar:i});return Un(this,{loc:a})},e.setLocale=function(e){return this.reconfigure({locale:e})},e.set=function(e){if(!this.isValid)return this;var t,n=ce(e,nr,[]);!H(n.weekYear)||!H(n.weekNumber)||!H(n.weekday)?t=Zn(Object.assign(Fn(this.c),n)):H(n.ordinal)?(t=Object.assign(this.toObject(),n),H(n.day)&&(t.day=Math.min(ne(t.year,t.month),t.day))):t=jn(Object.assign(Cn(this.c),n));var r=Pn(t,this.o,this.zone);return Un(this,{ts:r[0],o:r[1]})},e.plus=function(e){return this.isValid?Un(this,Jn(this,an(e))):this},e.minus=function(e){return this.isValid?Un(this,Jn(this,an(e).negate())):this},e.startOf=function(e){if(!this.isValid)return this;var t={},n=rn.normalizeUnit(e);switch(n){case"years":t.month=1;case"quarters":case"months":t.day=1;case"weeks":case"days":t.hour=0;case"hours":t.minute=0;case"minutes":t.second=0;case"seconds":t.millisecond=0}if("weeks"===n&&(t.weekday=1),"quarters"===n){var r=Math.ceil(this.month/3);t.month=3*(r-1)+1}return this.set(t)},e.endOf=function(e){var t;return this.isValid?this.plus(((t={})[e]=1,t)).startOf(e).minus(1):this},e.toFormat=function(e,t){return void 0===t&&(t={}),this.isValid?Ie.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):_n},e.toLocaleString=function(e){return void 0===e&&(e=p),this.isValid?Ie.create(this.loc.clone(e),e).formatDateTime(this):_n},e.toLocaleParts=function(e){return void 0===e&&(e={}),this.isValid?Ie.create(this.loc.clone(e),e).formatDateTimeParts(this):[]},e.toISO=function(e){return void 0===e&&(e={}),this.isValid?this.toISODate(e)+"T"+this.toISOTime(e):null},e.toISODate=function(e){var t=(void 0===e?{}:e).format,n="basic"===(void 0===t?"extended":t)?"yyyyMMdd":"yyyy-MM-dd";return 9999this.valueOf(),s=ln(o?this:e,o?e:this,a,i);return o?s.negate():s},e.diffNow=function(e,t){return void 0===e&&(e="milliseconds"),void 0===t&&(t={}),this.diff(L.local(),e,t)},e.until=function(e){return this.isValid?sn.fromDateTimes(this,e):this},e.hasSame=function(e,t){if(!this.isValid)return!1;if("millisecond"===t)return this.valueOf()===e.valueOf();var n=e.valueOf();return this.startOf(t)<=n&&n<=this.endOf(t)},e.equals=function(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)},e.toRelative=function(e){if(void 0===e&&(e={}),!this.isValid)return null;var t=e.base||L.fromObject({zone:this.zone}),n=e.padding?thisthis.set({month:1}).offset||this.offset>this.set({month:5}).offset)}},{key:"isInLeapYear",get:function(){return ee(this.year)}},{key:"daysInMonth",get:function(){return ne(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?te(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?ie(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return p}},{key:"DATE_MED",get:function(){return w}},{key:"DATE_FULL",get:function(){return k}},{key:"DATE_HUGE",get:function(){return b}},{key:"TIME_SIMPLE",get:function(){return O}},{key:"TIME_WITH_SECONDS",get:function(){return S}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return T}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return M}},{key:"TIME_24_SIMPLE",get:function(){return N}},{key:"TIME_24_WITH_SECONDS",get:function(){return D}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return E}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return I}},{key:"DATETIME_SHORT",get:function(){return V}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return F}},{key:"DATETIME_MED",get:function(){return Z}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return C}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return j}},{key:"DATETIME_FULL",get:function(){return A}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return z}},{key:"DATETIME_HUGE",get:function(){return _}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return q}}]),L}();function or(e){if(ar.isDateTime(e))return e;if(e&&e.valueOf&&U(e.valueOf()))return ar.fromJSDate(e);if(e&&"object"==typeof e)return ar.fromObject(e);throw new h("Unknown datetime argument: "+e+", of type "+typeof e)}return e.DateTime=ar,e.Duration=rn,e.FixedOffsetZone=qe,e.IANAZone=ze,e.Info=un,e.Interval=sn,e.InvalidZone=He,e.LocalZone=Fe,e.Settings=$e,e.Zone=Le,e}({}); \ No newline at end of file diff --git a/node_modules/luxon/build/global/luxon.min.js.map b/node_modules/luxon/build/global/luxon.min.js.map new file mode 100644 index 0000000..2a4cf8f --- /dev/null +++ b/node_modules/luxon/build/global/luxon.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["0"],"names":["luxon","exports","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","Constructor","protoProps","staticProps","prototype","_inheritsLoose","subClass","superClass","create","constructor","__proto__","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","_setPrototypeOf","p","_construct","Parent","args","Class","Reflect","construct","sham","Proxy","Date","toString","call","e","isNativeReflectConstruct","a","push","apply","instance","Function","bind","arguments","_wrapNativeSuper","_cache","Map","undefined","fn","indexOf","TypeError","has","get","set","Wrapper","this","value","LuxonError","_Error","Error","InvalidDateTimeError","_LuxonError","reason","toMessage","InvalidIntervalError","_LuxonError2","InvalidDurationError","_LuxonError3","ConflictingSpecificationError","_LuxonError4","InvalidUnitError","_LuxonError5","unit","InvalidArgumentError","_LuxonError6","ZoneIsAbstractError","_LuxonError7","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_FULL","DATE_HUGE","weekday","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hour12","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","isUndefined","isNumber","isInteger","hasIntl","Intl","DateTimeFormat","hasFormatToParts","formatToParts","hasRelative","RelativeTimeFormat","bestBy","arr","by","compare","reduce","best","next","pair","pick","obj","keys","k","hasOwnProperty","prop","integerBetween","thing","bottom","top","padStart","input","repeat","slice","parseInteger","string","parseInt","parseMillis","fraction","f","parseFloat","Math","floor","roundTo","number","digits","towardZero","factor","pow","trunc","round","isLeapYear","daysInYear","daysInMonth","x","modMonth","objToLocalTS","d","UTC","millisecond","setUTCFullYear","getUTCFullYear","weeksInWeekYear","weekYear","p1","last","p2","untruncateYear","parseZoneInfo","ts","offsetFormat","locale","timeZone","date","intlOpts","modified","assign","intl","parsed","find","m","type","toLowerCase","without","format","substring","replace","signedOffset","offHourStr","offMinuteStr","offHour","Number","isNaN","offMin","is","asNumber","numericValue","normalizeObject","normalizer","nonUnitKeys","normalized","u","v","formatOffset","offset","hours","minutes","abs","sign","base","RangeError","timeObject","ianaRegex","stringify","JSON","sort","monthsLong","monthsShort","monthsNarrow","months","weekdaysLong","weekdaysShort","weekdaysNarrow","weekdays","meridiems","erasLong","erasShort","erasNarrow","eras","stringifyTokens","splits","tokenToString","_iterator","_isArray","Array","isArray","_i","Symbol","iterator","_ref","done","literal","val","_macroTokenToFormatOpts","D","DD","DDD","DDDD","t","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","formatOpts","opts","loc","systemLoc","parseFormat","fmt","current","currentFull","bracketed","c","charAt","macroTokenToFormatOpts","token","_proto","formatWithSystemDefault","dt","redefaultToSystem","dtFormatter","formatDateTime","formatDateTimeParts","resolvedOptions","num","forceSimple","padTo","numberFormatter","formatDateTimeFromString","extract","_this","isOffsetFixed","allowZ","isValid","zone","meridiem","knownEnglish","standalone","era","listingMode","useDateTimeFormatter","outputCalendar","offsetName","zoneName","weekNumber","ordinal","quarter","formatDurationFromString","dur","tokenToField","lildur","_this2","tokens","realTokens","found","_ref2","concat","collapsed","shiftTo","map","filter","mapped","Invalid","explanation","Zone","equals","singleton","LocalZone","_Zone","getTimezoneOffset","otherZone","matchingRegex","RegExp","source","dtfCache","typeToPos","ianaZoneCache","IANAZone","name","valid","isValidZone","resetCache","isValidSpecifier","match","parseGMTOffset","specifier","formatted","fMonth","fDay","dtf","filled","_formatted$i","pos","partsOffset","exec","asTS","over","singleton$1","FixedOffsetZone","fixed","utcInstance","parseSpecifier","r","InvalidZone","NaN","normalizeZone","defaultZone","lowered","now","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","throwOnInvalid","Settings","resetCaches","Locale","z","numberingSystem","intlDTCache","getCachedDTF","locString","intlNumCache","intlRelCache","getCachedRTF","cacheKeyOpts","excluded","sourceKeys","_objectWithoutPropertiesLoose","inf","sysLocaleCache","listStuff","defaultOK","englishFn","intlFn","mode","PolyNumberFormatter","useGrouping","minimumIntegerDigits","NumberFormat","getCachedINF","PolyDateFormatter","universal","DateTime","fromMillis","_proto2","toJSDate","tokenFormat","knownFormat","dateTimeHuge","formatString","PolyRelFormatter","isEnglish","style","rtf","_proto3","count","numeric","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","formatRelativeTime","numbering","specifiedLocale","localeStr","_parseLocaleString","uIndex","options","smaller","calendar","parseLocaleString","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","monthsCache","meridiemCache","eraCache","fastNumbersCached","fromOpts","defaultToEN","computedSys","systemLocale","fromObject","_temp","_proto4","hasFTP","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","formatStr","ms","utc","mapMonths","mapWeekdays","_this3","_this4","field","matching","fastNumbers","relFormatter","startsWith","other","combineRegexes","_len","regexes","_key","full","combineExtractors","_len2","extractors","_key2","ex","mergedVals","mergedZone","cursor","_ex","parse","_len3","patterns","_key3","_patterns","_patterns$_i","regex","extractor","simpleParse","_len4","_key4","ret","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","extractISOWeekData","extractISOOrdinalData","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","extractISOTime","extractISOOffset","local","fullOffset","extractIANAZone","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","milliseconds","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDataAndTime","extractISOTimeAndOffset","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOYmdTimeOffsetAndIANAZone","extractISOTimeOffsetAndIANAZone","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","clear","conf","values","conversionAccuracy","Duration","convert","matrix","fromMap","fromUnit","toMap","toUnit","conv","raw","added","ceil","normalizeValues","vals","previous","config","accurate","invalid","isLuxonDuration","normalizeUnit","fromISO","text","week","isDuration","toFormat","fmtOpts","toObject","includeConfig","toISO","toJSON","valueOf","as","plus","duration","friendlyDuration","minus","negate","mapUnits","_i2","_Object$keys","reconfigure","normalize","lastUnit","built","accumulated","_iterator2","_isArray2","_i3","_ref3","own","ak","down","negated","_i4","_Object$keys2","_iterator3","_isArray3","_i5","_ref4","durationish","INVALID$1","Interval","start","end","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","_split","split","_dur","isInterval","toDuration","startOf","diff","hasSame","isEmpty","isAfter","dateTime","isBefore","contains","splitAt","dateTimes","sorted","results","splitBy","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","_intervals$sort$reduc","b","item","sofar","final","xor","_Array$prototype","currentCount","ends","time","difference","toISODate","toISOTime","dateFormat","_temp2","_ref4$separator","separator","invalidReason","mapEndpoints","mapFn","Info","hasDST","proto","setZone","isValidIANAZone","_ref$locale","_ref$numberingSystem","_ref$outputCalendar","monthsFormat","_ref2$locale","_ref2$numberingSystem","_ref2$outputCalendar","_temp3","_ref3$locale","_ref3$numberingSystem","weekdaysFormat","_temp4","_ref4$locale","_ref4$numberingSystem","_temp5","_ref5$locale","_temp6","_ref6$locale","features","intlTokens","zones","relative","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","_diff","_highOrderDiffs","lowestOrder","highWater","_differs","_differs$_i","differ","_cursor$plus","_cursor$plus2","delta","highOrderDiffs","remainingMillis","lowerOrderUnits","_cursor$plus3","_Duration$fromMillis","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","digitRegex","append","MISSING_FTP","intUnit","post","deser","str","code","charCodeAt","search","_numberingSystemsUTF","min","max","parseDigits","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","join","findIndex","groups","simple","unitForToken","_ref5","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","2-digit","short","long","dayperiod","dayPeriod","dummyDateTimeCache","maybeExpandMacroToken","part","tokenForPart","includes","explainFromTokens","disqualifyingUnit","matches","_buildRegex","handlers","_match","all","matchIndex","h","rawMatches","_ref6","Z","q","M","G","y","S","toField","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","js","getUTCDay","computeOrdinal","uncomputeOrdinal","table","month0","gregorianToWeek","gregObj","weekToGregorian","weekData","weekdayOfJan4","yearInDays","_uncomputeOrdinal","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","_uncomputeOrdinal2","hasInvalidGregorianData","validYear","validMonth","validDay","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","INVALID$2","unsupportedZone","possiblyCachedWeekData","clone$1","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","_fixOffset","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","toTechTimeFormat","_ref$suppressSeconds","suppressSeconds","_ref$suppressMillisec","suppressMilliseconds","includeOffset","_ref$includeZone","includeZone","_ref$spaceZone","spaceZone","_ref$format","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedUnits$1","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","quickDT","tsNow","_objToTS","diffRelative","calendary","ot","_zone","isLuxonDateTime","fromJSDate","zoneToUse","fromSeconds","offsetProvis","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","defaultValues","useWeekData","objNow","foundFirst","validOrdinal","validWeek","validWeekday","_objToTS2","_parseISODate","fromRFC2822","_parseRFC2822Date","trim","fromHTTP","_parseHTTPDate","fromFormat","_explainFromTokens","_opts$locale","_opts$numberingSystem","localeToUse","_parseFromTokens","fromString","fromSQL","_parseSQL","isDateTime","resolvedLocaleOpts","_Formatter$create$res","toLocal","_ref6$keepLocalTime","_ref6$keepCalendarTim","keepCalendarTime","newTS","offsetGuess","_ref7","setLocale","mixed","_objToTS4","normalizedUnit","endOf","_this$plus","toLocaleString","toLocaleParts","_ref8$format","toISOWeekDate","_ref9","_ref9$suppressMillise","_ref9$suppressSeconds","_ref9$includeOffset","_ref9$format","toRFC2822","toHTTP","toSQLDate","toSQLTime","_ref10","_ref10$includeOffset","_ref10$includeZone","toSQL","toMillis","toSeconds","toBSON","otherDateTime","durOpts","otherIsLater","diffed","diffNow","until","inputMs","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","_options$locale","_options$numberingSys","fromStringExplain","dateTimeish"],"mappings":"AAAA,IAAIA,MAAS,SAAUC,GACrB,aAEA,SAASC,EAAkBC,EAAQC,GACjC,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAIlD,SAASO,EAAaC,EAAaC,EAAYC,GAG7C,OAFID,GAAYd,EAAkBa,EAAYG,UAAWF,GACrDC,GAAaf,EAAkBa,EAAaE,GACzCF,EAGT,SAASI,EAAeC,EAAUC,GAChCD,EAASF,UAAYP,OAAOW,OAAOD,EAAWH,YAC9CE,EAASF,UAAUK,YAAcH,GACxBI,UAAYH,EAGvB,SAASI,EAAgBC,GAIvB,OAHAD,EAAkBd,OAAOgB,eAAiBhB,OAAOiB,eAAiB,SAAyBF,GACzF,OAAOA,EAAEF,WAAab,OAAOiB,eAAeF,KAEvBA,GAGzB,SAASG,EAAgBH,EAAGI,GAM1B,OALAD,EAAkBlB,OAAOgB,gBAAkB,SAAyBD,EAAGI,GAErE,OADAJ,EAAEF,UAAYM,EACPJ,IAGcA,EAAGI,GAgB5B,SAASC,EAAWC,EAAQC,EAAMC,GAchC,OAVEH,EAjBJ,WACE,GAAuB,oBAAZI,SAA4BA,QAAQC,YAC3CD,QAAQC,UAAUC,KAAtB,CACA,GAAqB,mBAAVC,MAAsB,OAAO,EAExC,IAEE,OADAC,KAAKrB,UAAUsB,SAASC,KAAKN,QAAQC,UAAUG,KAAM,GAAI,eAAzDA,EAEA,MAAOG,GACP,SAKEC,GACWR,QAAQC,UAER,SAAoBJ,EAA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ACDlG,IAAK,4BACL8C,IAAK,WACH,OAAOqD,IAOR,CACDnG,IAAK,gBACL8C,IAAK,WACH,OAAOsD,IAOR,CACDpG,IAAK,6BACL8C,IAAK,WACH,OAAOuD,IAOR,CACDrG,IAAK,gBACL8C,IAAK,WACH,OAAOwD,IAOR,CACDtG,IAAK,6BACL8C,IAAK,WACH,OAAOyD,MAIJ8S,EAvhET,GAyhEA,SAAS+O,GAAiB2W,GACxB,GAAI1lB,GAASuiB,WAAWmD,GACtB,OAAOA,EACF,GAAIA,GAAeA,EAAYhZ,SAAWtf,EAASs4B,EAAYhZ,WACpE,OAAO1M,GAASugB,WAAWmF,GACtB,GAAIA,GAAsC,iBAAhBA,EAC/B,OAAO1lB,GAASmD,WAAWuiB,GAE3B,MAAM,IAAI56B,EAAqB,8BAAgC46B,EAAc,oBAAsBA,GAevG,OAXA3/B,EAAQia,SAAWA,GACnBja,EAAQ8kB,SAAWA,GACnB9kB,EAAQqX,gBAAkBA,GAC1BrX,EAAQgW,SAAWA,GACnBhW,EAAQqsB,KAAOA,GACfrsB,EAAQ0oB,SAAWA,GACnB1oB,EAAQ0X,YAAcA,GACtB1X,EAAQsV,UAAYA,GACpBtV,EAAQoY,SAAWA,GACnBpY,EAAQmV,KAAOA,GAERnV,EA1pQG,CA4pQV","file":"build/global/luxon.js"} \ No newline at end of file diff --git a/node_modules/luxon/build/node/luxon.js b/node_modules/luxon/build/node/luxon.js new file mode 100644 index 0000000..5d41ee9 --- /dev/null +++ b/node_modules/luxon/build/node/luxon.js @@ -0,0 +1,7305 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +// these aren't really private, but nor are they really useful to document + +/** + * @private + */ +class LuxonError extends Error {} +/** + * @private + */ + + +class InvalidDateTimeError extends LuxonError { + constructor(reason) { + super(`Invalid DateTime: ${reason.toMessage()}`); + } + +} +/** + * @private + */ + +class InvalidIntervalError extends LuxonError { + constructor(reason) { + super(`Invalid Interval: ${reason.toMessage()}`); + } + +} +/** + * @private + */ + +class InvalidDurationError extends LuxonError { + constructor(reason) { + super(`Invalid Duration: ${reason.toMessage()}`); + } + +} +/** + * @private + */ + +class ConflictingSpecificationError extends LuxonError {} +/** + * @private + */ + +class InvalidUnitError extends LuxonError { + constructor(unit) { + super(`Invalid unit ${unit}`); + } + +} +/** + * @private + */ + +class InvalidArgumentError extends LuxonError {} +/** + * @private + */ + +class ZoneIsAbstractError extends LuxonError { + constructor() { + super("Zone is an abstract class"); + } + +} + +/** + * @private + */ +const n = "numeric", + s = "short", + l = "long"; +const DATE_SHORT = { + year: n, + month: n, + day: n +}; +const DATE_MED = { + year: n, + month: s, + day: n +}; +const DATE_FULL = { + year: n, + month: l, + day: n +}; +const DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l +}; +const TIME_SIMPLE = { + hour: n, + minute: n +}; +const TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n +}; +const TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +const TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l +}; +const TIME_24_SIMPLE = { + hour: n, + minute: n, + hour12: false +}; +/** + * {@link toLocaleString}; format like '09:30:23', always 24-hour. + */ + +const TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hour12: false +}; +/** + * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour. + */ + +const TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: s +}; +/** + * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour. + */ + +const TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: l +}; +/** + * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + */ + +const DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n +}; +/** + * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + */ + +const DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n +}; +const DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n +}; +const DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n +}; +const DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n +}; +const DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s +}; +const DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +const DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l +}; +const DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l +}; + +/* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. +*/ +/** + * @private + */ +// TYPES + +function isUndefined(o) { + return typeof o === "undefined"; +} +function isNumber(o) { + return typeof o === "number"; +} +function isInteger(o) { + return typeof o === "number" && o % 1 === 0; +} +function isString(o) { + return typeof o === "string"; +} +function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; +} // CAPABILITIES + +function hasIntl() { + try { + return typeof Intl !== "undefined" && Intl.DateTimeFormat; + } catch (e) { + return false; + } +} +function hasFormatToParts() { + return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); +} +function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } +} // OBJECTS AND ARRAYS + +function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; +} +function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + + return arr.reduce((best, next) => { + const pair = [by(next), next]; + + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; +} +function pick(obj, keys) { + return keys.reduce((a, k) => { + a[k] = obj[k]; + return a; + }, {}); +} +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} // NUMBERS AND STRINGS + +function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; +} // x % n but takes the sign of n instead of x + +function floorMod(x, n) { + return x - n * Math.floor(x / n); +} +function padStart(input, n = 2) { + if (input.toString().length < n) { + return ("0".repeat(n) + input).slice(-n); + } else { + return input.toString(); + } +} +function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } +} +function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + const f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } +} +function roundTo(number, digits, towardZero = false) { + const factor = Math.pow(10, digits), + rounder = towardZero ? Math.trunc : Math.round; + return rounder(number * factor) / factor; +} // DATE BASICS + +function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} +function daysInMonth(year, month) { + const modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } +} // covert a calendar object to a local timestamp (epoch, but with the offset baked in) + +function objToLocalTS(obj) { + let d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + + return +d; +} +function weeksInWeekYear(weekYear) { + const p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, + last = weekYear - 1, + p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; + return p1 === 4 || p2 === 3 ? 53 : 52; +} +function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > 60 ? 1900 + year : 2000 + year; +} // PARSING + +function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) { + const date = new Date(ts), + intlOpts = { + hour12: false, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + const modified = Object.assign({ + timeZoneName: offsetFormat + }, intlOpts), + intl = hasIntl(); + + if (intl && hasFormatToParts()) { + const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(m => m.type.toLowerCase() === "timezonename"); + return parsed ? parsed.value : null; + } else if (intl) { + // this probably doesn't work for all locales + const without = new Intl.DateTimeFormat(locale, intlOpts).format(date), + included = new Intl.DateTimeFormat(locale, modified).format(date), + diffed = included.substring(without.length), + trimmed = diffed.replace(/^[, \u200e]+/, ""); + return trimmed; + } else { + return null; + } +} // signedOffset('-5', '30') -> -330 + +function signedOffset(offHourStr, offMinuteStr) { + let offHour = parseInt(offHourStr, 10); // don't || this because we want to preserve -0 + + if (Number.isNaN(offHour)) { + offHour = 0; + } + + const offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; +} // COERCION + +function asNumber(value) { + const numericValue = Number(value); + if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError(`Invalid unit value ${value}`); + return numericValue; +} +function normalizeObject(obj, normalizer, nonUnitKeys) { + const normalized = {}; + + for (const u in obj) { + if (hasOwnProperty(obj, u)) { + if (nonUnitKeys.indexOf(u) >= 0) continue; + const v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + + return normalized; +} +function formatOffset(offset, format) { + const hours = Math.trunc(offset / 60), + minutes = Math.abs(offset % 60), + sign = hours >= 0 && !Object.is(hours, -0) ? "+" : "-", + base = `${sign}${Math.abs(hours)}`; + + switch (format) { + case "short": + return `${sign}${padStart(Math.abs(hours), 2)}:${padStart(minutes, 2)}`; + + case "narrow": + return minutes > 0 ? `${base}:${minutes}` : base; + + case "techie": + return `${sign}${padStart(Math.abs(hours), 2)}${padStart(minutes, 2)}`; + + default: + throw new RangeError(`Value format ${format} is out of range for property format`); + } +} +function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); +} +const ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; + +function stringify(obj) { + return JSON.stringify(obj, Object.keys(obj).sort()); +} +/** + * @private + */ + + +const monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +const monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; +function months(length) { + switch (length) { + case "narrow": + return monthsNarrow; + + case "short": + return monthsShort; + + case "long": + return monthsLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + + default: + return null; + } +} +const weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; +const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; +const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; +function weekdays(length) { + switch (length) { + case "narrow": + return weekdaysNarrow; + + case "short": + return weekdaysShort; + + case "long": + return weekdaysLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + + default: + return null; + } +} +const meridiems = ["AM", "PM"]; +const erasLong = ["Before Christ", "Anno Domini"]; +const erasShort = ["BC", "AD"]; +const erasNarrow = ["B", "A"]; +function eras(length) { + switch (length) { + case "narrow": + return erasNarrow; + + case "short": + return erasShort; + + case "long": + return erasLong; + + default: + return null; + } +} +function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; +} +function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; +} +function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; +} +function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; +} +function formatRelativeTime(unit, count, numeric = "always", narrow = false) { + const units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + const isDay = unit === "days"; + + switch (count) { + case 1: + return isDay ? "tomorrow" : `next ${units[unit][0]}`; + + case -1: + return isDay ? "yesterday" : `last ${units[unit][0]}`; + + case 0: + return isDay ? "today" : `this ${units[unit][0]}`; + + } + } + + const isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`; +} +function formatString(knownFormat) { + // these all have the offsets removed because we don't have access to them + // without all the intl stuff this is backfilling + const filtered = pick(knownFormat, ["weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "hour12"]), + key = stringify(filtered), + dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; + + switch (key) { + case stringify(DATE_SHORT): + return "M/d/yyyy"; + + case stringify(DATE_MED): + return "LLL d, yyyy"; + + case stringify(DATE_FULL): + return "LLLL d, yyyy"; + + case stringify(DATE_HUGE): + return "EEEE, LLLL d, yyyy"; + + case stringify(TIME_SIMPLE): + return "h:mm a"; + + case stringify(TIME_WITH_SECONDS): + return "h:mm:ss a"; + + case stringify(TIME_WITH_SHORT_OFFSET): + return "h:mm a"; + + case stringify(TIME_WITH_LONG_OFFSET): + return "h:mm a"; + + case stringify(TIME_24_SIMPLE): + return "HH:mm"; + + case stringify(TIME_24_WITH_SECONDS): + return "HH:mm:ss"; + + case stringify(TIME_24_WITH_SHORT_OFFSET): + return "HH:mm"; + + case stringify(TIME_24_WITH_LONG_OFFSET): + return "HH:mm"; + + case stringify(DATETIME_SHORT): + return "M/d/yyyy, h:mm a"; + + case stringify(DATETIME_MED): + return "LLL d, yyyy, h:mm a"; + + case stringify(DATETIME_FULL): + return "LLLL d, yyyy, h:mm a"; + + case stringify(DATETIME_HUGE): + return dateTimeHuge; + + case stringify(DATETIME_SHORT_WITH_SECONDS): + return "M/d/yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_SECONDS): + return "LLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_WEEKDAY): + return "EEE, d LLL yyyy, h:mm a"; + + case stringify(DATETIME_FULL_WITH_SECONDS): + return "LLLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_HUGE_WITH_SECONDS): + return "EEEE, LLLL d, yyyy, h:mm:ss a"; + + default: + return dateTimeHuge; + } +} + +function stringifyTokens(splits, tokenToString) { + let s = ""; + + for (const token of splits) { + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + + return s; +} + +const macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS +}; +/** + * @private + */ + +class Formatter { + static create(locale, opts = {}) { + return new Formatter(locale, opts); + } + + static parseFormat(fmt) { + let current = null, + currentFull = "", + bracketed = false; + const splits = []; + + for (let i = 0; i < fmt.length; i++) { + const c = fmt.charAt(i); + + if (c === "'") { + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: false, + val: currentFull + }); + } + + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + return splits; + } + + static macroTokenToFormatOpts(token) { + return macroTokenToFormatOpts[token]; + } + + constructor(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + + const df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + } + + formatDateTime(dt, opts = {}) { + const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + } + + formatDateTimeParts(dt, opts = {}) { + const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.formatToParts(); + } + + resolvedOptions(dt, opts = {}) { + const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.resolvedOptions(); + } + + num(n, p = 0) { + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + const opts = Object.assign({}, this.opts); + + if (p > 0) { + opts.padTo = p; + } + + return this.loc.numberFormatter(opts).format(n); + } + + formatDateTimeFromString(dt, fmt) { + const knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), + string = (opts, extract) => this.loc.extract(dt, opts, extract), + formatOffset = opts => { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hour12: true + }, "dayperiod"), + month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"), + weekday = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"), + maybeMacro = token => { + const formatOpts = Formatter.macroTokenToFormatOpts(token); + + if (formatOpts) { + return this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = length => knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"), + tokenToString = token => { + // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles + switch (token) { + // ms + case "S": + return this.num(dt.millisecond); + + case "u": // falls through + + case "SSS": + return this.num(dt.millisecond, 3); + // seconds + + case "s": + return this.num(dt.second); + + case "ss": + return this.num(dt.second, 2); + // minutes + + case "m": + return this.num(dt.minute); + + case "mm": + return this.num(dt.minute, 2); + // hours + + case "h": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + + case "hh": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + + case "H": + return this.num(dt.hour); + + case "HH": + return this.num(dt.hour, 2); + // offset + + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: this.opts.allowZ + }); + + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: this.opts.allowZ + }); + + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: this.opts.allowZ + }); + + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: this.loc.locale + }); + + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: this.loc.locale + }); + // zone + + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + + case "a": + return meridiem(); + // dates + + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : this.num(dt.day); + + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : this.num(dt.day, 2); + // weekdays - standalone + + case "c": + // like 1 + return this.num(dt.weekday); + + case "ccc": + // like 'Tues' + return weekday("short", true); + + case "cccc": + // like 'Tuesday' + return weekday("long", true); + + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + + case "E": + // like 1 + return this.num(dt.weekday); + + case "EEE": + // like 'Tues' + return weekday("short", false); + + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : this.num(dt.month); + + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : this.num(dt.month, 2); + + case "LLL": + // like Jan + return month("short", true); + + case "LLLL": + // like January + return month("long", true); + + case "LLLLL": + // like J + return month("narrow", true); + // months - format + + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : this.num(dt.month); + + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : this.num(dt.month, 2); + + case "MMM": + // like Jan + return month("short", false); + + case "MMMM": + // like January + return month("long", false); + + case "MMMMM": + // like J + return month("narrow", false); + // years + + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : this.num(dt.year); + + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : this.num(dt.year.toString().slice(-2), 2); + + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : this.num(dt.year, 4); + + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : this.num(dt.year, 6); + // eras + + case "G": + // like AD + return era("short"); + + case "GG": + // like Anno Domini + return era("long"); + + case "GGGGG": + return era("narrow"); + + case "kk": + return this.num(dt.weekYear.toString().slice(-2), 2); + + case "kkkk": + return this.num(dt.weekYear, 4); + + case "W": + return this.num(dt.weekNumber); + + case "WW": + return this.num(dt.weekNumber, 2); + + case "o": + return this.num(dt.ordinal); + + case "ooo": + return this.num(dt.ordinal, 3); + + case "q": + // like 1 + return this.num(dt.quarter); + + case "qq": + // like 01 + return this.num(dt.quarter, 2); + + case "X": + return this.num(Math.floor(dt.ts / 1000)); + + case "x": + return this.num(dt.ts); + + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + } + + formatDurationFromString(dur, fmt) { + const tokenToField = token => { + switch (token[0]) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + return "hour"; + + case "d": + return "day"; + + case "M": + return "month"; + + case "y": + return "year"; + + default: + return null; + } + }, + tokenToString = lildur => token => { + const mapped = tokenToField(token); + + if (mapped) { + return this.num(lildur.get(mapped), token.length); + } else { + return token; + } + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce((found, { + literal, + val + }) => literal ? found : found.concat(val), []), + collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t)); + + return stringifyTokens(tokens, tokenToString(collapsed)); + } + +} + +class Invalid { + constructor(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + toMessage() { + if (this.explanation) { + return `${this.reason}: ${this.explanation}`; + } else { + return this.reason; + } + } + +} + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +/* eslint no-unused-vars: "off" */ +/** + * @interface + */ + +class Zone { + /** + * The type of zone + * @abstract + * @type {string} + */ + get type() { + throw new ZoneIsAbstractError(); + } + /** + * The name of this zone. + * @abstract + * @type {string} + */ + + + get name() { + throw new ZoneIsAbstractError(); + } + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + + + get universal() { + throw new ZoneIsAbstractError(); + } + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + + + offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + + + formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + + + offset(ts) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + + + equals(otherZone) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + + + get isValid() { + throw new ZoneIsAbstractError(); + } + +} + +let singleton = null; +/** + * Represents the local zone for this Javascript environment. + * @implements {Zone} + */ + +class LocalZone extends Zone { + /** + * Get a singleton instance of the local zone + * @return {LocalZone} + */ + static get instance() { + if (singleton === null) { + singleton = new LocalZone(); + } + + return singleton; + } + /** @override **/ + + + get type() { + return "local"; + } + /** @override **/ + + + get name() { + if (hasIntl()) { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } else return "local"; + } + /** @override **/ + + + get universal() { + return false; + } + /** @override **/ + + + offsetName(ts, { + format, + locale + }) { + return parseZoneInfo(ts, format, locale); + } + /** @override **/ + + + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + + + offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + /** @override **/ + + + equals(otherZone) { + return otherZone.type === "local"; + } + /** @override **/ + + + get isValid() { + return true; + } + +} + +const matchingRegex = RegExp(`^${ianaRegex.source}$`); +let dtfCache = {}; + +function makeDTF(zone) { + if (!dtfCache[zone]) { + dtfCache[zone] = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zone, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" + }); + } + + return dtfCache[zone]; +} + +const typeToPos = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5 +}; + +function hackyOffset(dtf, date) { + const formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), + [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed; + return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; +} + +function partsOffset(dtf, date) { + const formatted = dtf.formatToParts(date), + filled = []; + + for (let i = 0; i < formatted.length; i++) { + const { + type, + value + } = formatted[i], + pos = typeToPos[type]; + + if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + + return filled; +} + +let ianaZoneCache = {}; +/** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + +class IANAZone extends Zone { + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + static create(name) { + if (!ianaZoneCache[name]) { + ianaZoneCache[name] = new IANAZone(name); + } + + return ianaZoneCache[name]; + } + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + + + static resetCache() { + ianaZoneCache = {}; + dtfCache = {}; + } + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Fantasia/Castle") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @return {boolean} + */ + + + static isValidSpecifier(s) { + return !!(s && s.match(matchingRegex)); + } + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + + + static isValidZone(zone) { + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + } // Etc/GMT+8 -> -480 + + /** @ignore */ + + + static parseGMTOffset(specifier) { + if (specifier) { + const match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); + + if (match) { + return -60 * parseInt(match[1]); + } + } + + return null; + } + + constructor(name) { + super(); + /** @private **/ + + this.zoneName = name; + /** @private **/ + + this.valid = IANAZone.isValidZone(name); + } + /** @override **/ + + + get type() { + return "iana"; + } + /** @override **/ + + + get name() { + return this.zoneName; + } + /** @override **/ + + + get universal() { + return false; + } + /** @override **/ + + + offsetName(ts, { + format, + locale + }) { + return parseZoneInfo(ts, format, locale, this.name); + } + /** @override **/ + + + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + + + offset(ts) { + const date = new Date(ts), + dtf = makeDTF(this.name), + [year, month, day, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + // work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + adjustedHour = hour === 24 ? 0 : hour; + const asUTC = objToLocalTS({ + year, + month, + day, + hour: adjustedHour, + minute, + second, + millisecond: 0 + }); + let asTS = +date; + const over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + /** @override **/ + + + equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + /** @override **/ + + + get isValid() { + return this.valid; + } + +} + +let singleton$1 = null; +/** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + +class FixedOffsetZone extends Zone { + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + static get utcInstance() { + if (singleton$1 === null) { + singleton$1 = new FixedOffsetZone(0); + } + + return singleton$1; + } + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + + + static instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + + + static parseSpecifier(s) { + if (s) { + const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + + return null; + } + + constructor(offset) { + super(); + /** @private **/ + + this.fixed = offset; + } + /** @override **/ + + + get type() { + return "fixed"; + } + /** @override **/ + + + get name() { + return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`; + } + /** @override **/ + + + offsetName() { + return this.name; + } + /** @override **/ + + + formatOffset(ts, format) { + return formatOffset(this.fixed, format); + } + /** @override **/ + + + get universal() { + return true; + } + /** @override **/ + + + offset() { + return this.fixed; + } + /** @override **/ + + + equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + /** @override **/ + + + get isValid() { + return true; + } + +} + +/** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + +class InvalidZone extends Zone { + constructor(zoneName) { + super(); + /** @private */ + + this.zoneName = zoneName; + } + /** @override **/ + + + get type() { + return "invalid"; + } + /** @override **/ + + + get name() { + return this.zoneName; + } + /** @override **/ + + + get universal() { + return false; + } + /** @override **/ + + + offsetName() { + return null; + } + /** @override **/ + + + formatOffset() { + return ""; + } + /** @override **/ + + + offset() { + return NaN; + } + /** @override **/ + + + equals() { + return false; + } + /** @override **/ + + + get isValid() { + return false; + } + +} + +/** + * @private + */ +function normalizeZone(input, defaultZone) { + let offset; + + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + const lowered = input.toLowerCase(); + if (lowered === "local") return defaultZone;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) { + // handle Etc/GMT-4, which V8 chokes on + return FixedOffsetZone.instance(offset); + } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } +} + +let now = () => Date.now(), + defaultZone = null, + // not setting this directly to LocalZone.instance bc loading order issues +defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + throwOnInvalid = false; +/** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + + +class Settings { + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + static get now() { + return now; + } + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + + + static set now(n) { + now = n; + } + /** + * Get the default time zone to create DateTimes in. + * @type {string} + */ + + + static get defaultZoneName() { + return Settings.defaultZone.name; + } + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * @type {string} + */ + + + static set defaultZoneName(z) { + if (!z) { + defaultZone = null; + } else { + defaultZone = normalizeZone(z); + } + } + /** + * Get the default time zone object to create DateTimes in. Does not affect existing instances. + * @type {Zone} + */ + + + static get defaultZone() { + return defaultZone || LocalZone.instance; + } + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + + static get defaultLocale() { + return defaultLocale; + } + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + + static set defaultLocale(locale) { + defaultLocale = locale; + } + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + + static get defaultNumberingSystem() { + return defaultNumberingSystem; + } + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + + static set defaultNumberingSystem(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + + static get defaultOutputCalendar() { + return defaultOutputCalendar; + } + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + + static set defaultOutputCalendar(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + + + static get throwOnInvalid() { + return throwOnInvalid; + } + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + + + static set throwOnInvalid(t) { + throwOnInvalid = t; + } + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + + + static resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + } + +} + +let intlDTCache = {}; + +function getCachedDTF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let dtf = intlDTCache[key]; + + if (!dtf) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache[key] = dtf; + } + + return dtf; +} + +let intlNumCache = {}; + +function getCachedINF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let inf = intlNumCache[key]; + + if (!inf) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache[key] = inf; + } + + return inf; +} + +let intlRelCache = {}; + +function getCachedRTF(locString, opts = {}) { + const cacheKeyOpts = _objectWithoutPropertiesLoose(opts, ["base"]); // exclude `base` from the options + + + const key = JSON.stringify([locString, cacheKeyOpts]); + let inf = intlRelCache[key]; + + if (!inf) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache[key] = inf; + } + + return inf; +} + +let sysLocaleCache = null; + +function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else if (hasIntl()) { + const computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; // node sometimes defaults to "und". Override that because that is dumb + + sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; + return sysLocaleCache; + } else { + sysLocaleCache = "en-US"; + return sysLocaleCache; + } +} + +function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + const uIndex = localeStr.indexOf("-u-"); + + if (uIndex === -1) { + return [localeStr]; + } else { + let options; + const smaller = localeStr.substring(0, uIndex); + + try { + options = getCachedDTF(localeStr).resolvedOptions(); + } catch (e) { + options = getCachedDTF(smaller).resolvedOptions(); + } + + const { + numberingSystem, + calendar + } = options; // return the smaller one so that we can append the calendar and numbering overrides to it + + return [smaller, numberingSystem, calendar]; + } +} + +function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (hasIntl()) { + if (outputCalendar || numberingSystem) { + localeStr += "-u"; + + if (outputCalendar) { + localeStr += `-ca-${outputCalendar}`; + } + + if (numberingSystem) { + localeStr += `-nu-${numberingSystem}`; + } + + return localeStr; + } else { + return localeStr; + } + } else { + return []; + } +} + +function mapMonths(f) { + const ms = []; + + for (let i = 1; i <= 12; i++) { + const dt = DateTime.utc(2016, i, 1); + ms.push(f(dt)); + } + + return ms; +} + +function mapWeekdays(f) { + const ms = []; + + for (let i = 1; i <= 7; i++) { + const dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + + return ms; +} + +function listStuff(loc, length, defaultOK, englishFn, intlFn) { + const mode = loc.listingMode(defaultOK); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } +} + +function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; + } +} +/** + * @private + */ + + +class PolyNumberFormatter { + constructor(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + if (!forceSimple && hasIntl()) { + const intlOpts = { + useGrouping: false + }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + format(i) { + if (this.inf) { + const fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + const fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(fixed, this.padTo); + } + } + +} +/** + * @private + */ + + +class PolyDateFormatter { + constructor(dt, intl, opts) { + this.opts = opts; + this.hasIntl = hasIntl(); + let z; + + if (dt.zone.universal && this.hasIntl) { + // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter, + // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374. + // So we have to make do. Two cases: + // 1. The format options tell us to show the zone. We can't do that, so the best + // we can do is format the date in UTC. + // 2. The format options don't tell us to show the zone. Then we can adjust them + // the time and tell the formatter to show it to us in UTC, so that the time is right + // and the bad zone doesn't show up. + // We can clean all this up when Chrome fixes this. + z = "UTC"; + + if (opts.timeZoneName) { + this.dt = dt; + } else { + this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000); + } + } else if (dt.zone.type === "local") { + this.dt = dt; + } else { + this.dt = dt; + z = dt.zone.name; + } + + if (this.hasIntl) { + const intlOpts = Object.assign({}, this.opts); + + if (z) { + intlOpts.timeZone = z; + } + + this.dtf = getCachedDTF(intl, intlOpts); + } + } + + format() { + if (this.hasIntl) { + return this.dtf.format(this.dt.toJSDate()); + } else { + const tokenFormat = formatString(this.opts), + loc = Locale.create("en-US"); + return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); + } + } + + formatToParts() { + if (this.hasIntl && hasFormatToParts()) { + return this.dtf.formatToParts(this.dt.toJSDate()); + } else { + // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings + // and IMO it's too weird to have an uncanny valley like that + return []; + } + } + + resolvedOptions() { + if (this.hasIntl) { + return this.dtf.resolvedOptions(); + } else { + return { + locale: "en-US", + numberingSystem: "latn", + outputCalendar: "gregory" + }; + } + } + +} +/** + * @private + */ + + +class PolyRelFormatter { + constructor(intl, isEnglish, opts) { + this.opts = Object.assign({ + style: "long" + }, opts); + + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + } + + formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + } + +} +/** + * @private + */ + + +class Locale { + static fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); + } + + static create(locale, numberingSystem, outputCalendar, defaultToEN = false) { + const specifiedLocale = locale || Settings.defaultLocale, + // the system locale is useful for human readable strings but annoying for parsing/formatting known formats + localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), + numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, + outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); + } + + static resetCache() { + sysLocaleCache = null; + intlDTCache = {}; + intlNumCache = {}; + intlRelCache = {}; + } + + static fromObject({ + locale, + numberingSystem, + outputCalendar + } = {}) { + return Locale.create(locale, numberingSystem, outputCalendar); + } + + constructor(locale, numbering, outputCalendar, specifiedLocale) { + const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale); + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + get fastNumbers() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + + listingMode(defaultOK = true) { + const intl = hasIntl(), + hasFTP = intl && hasFormatToParts(), + isActuallyEn = this.isEnglish(), + hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + + if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { + return "error"; + } else if (!hasFTP || isActuallyEn && hasNoWeirdness) { + return "en"; + } else { + return "intl"; + } + } + + clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false); + } + } + + redefaultToEN(alts = {}) { + return this.clone(Object.assign({}, alts, { + defaultToEN: true + })); + } + + redefaultToSystem(alts = {}) { + return this.clone(Object.assign({}, alts, { + defaultToEN: false + })); + } + + months(length, format = false, defaultOK = true) { + return listStuff(this, length, defaultOK, months, () => { + const intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + + if (!this.monthsCache[formatStr][length]) { + this.monthsCache[formatStr][length] = mapMonths(dt => this.extract(dt, intl, "month")); + } + + return this.monthsCache[formatStr][length]; + }); + } + + weekdays(length, format = false, defaultOK = true) { + return listStuff(this, length, defaultOK, weekdays, () => { + const intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + + if (!this.weekdaysCache[formatStr][length]) { + this.weekdaysCache[formatStr][length] = mapWeekdays(dt => this.extract(dt, intl, "weekday")); + } + + return this.weekdaysCache[formatStr][length]; + }); + } + + meridiems(defaultOK = true) { + return listStuff(this, undefined, defaultOK, () => meridiems, () => { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!this.meridiemCache) { + const intl = { + hour: "numeric", + hour12: true + }; + this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(dt => this.extract(dt, intl, "dayperiod")); + } + + return this.meridiemCache; + }); + } + + eras(length, defaultOK = true) { + return listStuff(this, length, defaultOK, eras, () => { + const intl = { + era: length + }; // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + + if (!this.eraCache[length]) { + this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt => this.extract(dt, intl, "era")); + } + + return this.eraCache[length]; + }); + } + + extract(dt, intlOpts, field) { + const df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(m => m.type.toLowerCase() === field); + return matching ? matching.value : null; + } + + numberFormatter(opts = {}) { + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + } + + dtFormatter(dt, intlOpts = {}) { + return new PolyDateFormatter(dt, this.intl, intlOpts); + } + + relFormatter(opts = {}) { + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + } + + isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); + } + + equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + } + +} + +/* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + +function combineRegexes(...regexes) { + const full = regexes.reduce((f, r) => f + r.source, ""); + return RegExp(`^${full}$`); +} + +function combineExtractors(...extractors) { + return m => extractors.reduce(([mergedVals, mergedZone, cursor], ex) => { + const [val, zone, next] = ex(m, cursor); + return [Object.assign(mergedVals, val), mergedZone || zone, next]; + }, [{}, null, 1]).slice(0, 2); +} + +function parse(s, ...patterns) { + if (s == null) { + return [null, null]; + } + + for (const [regex, extractor] of patterns) { + const m = regex.exec(s); + + if (m) { + return extractor(m); + } + } + + return [null, null]; +} + +function simpleParse(...keys) { + return (match, cursor) => { + const ret = {}; + let i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + + return [ret, null, cursor + i]; + }; +} // ISO and SQL parsing + + +const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, + isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/, + isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`), + isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`), + isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, + isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, + isoOrdinalRegex = /(\d{4})-?(\d{3})/, + extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), + extractISOOrdinalData = simpleParse("year", "ordinal"), + sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, + // dumbed-down version of the ISO one +sqlTimeRegex = RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`), + sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); + +function int(match, pos, fallback) { + const m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); +} + +function extractISOYmd(match, cursor) { + const item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; +} + +function extractISOTime(match, cursor) { + const item = { + hour: int(match, cursor, 0), + minute: int(match, cursor + 1, 0), + second: int(match, cursor + 2, 0), + millisecond: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; +} + +function extractISOOffset(match, cursor) { + const local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; +} + +function extractIANAZone(match, cursor) { + const zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; +} // ISO duration parsing + + +const isoDuration = /^P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})(?:[.,](-?\d{1,9}))?S)?)?)$/; + +function extractISODuration(match) { + const [, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match; + return [{ + years: parseInteger(yearStr), + months: parseInteger(monthStr), + weeks: parseInteger(weekStr), + days: parseInteger(dayStr), + hours: parseInteger(hourStr), + minutes: parseInteger(minuteStr), + seconds: parseInteger(secondStr), + milliseconds: parseMillis(millisecondsStr) + }]; +} // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York +// and not just that we're in -240 *right now*. But since I don't think these are used that often +// I'm just going to ignore that + + +const obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; + +function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + const result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; +} // RFC 2822/5322 + + +const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + +function extractRFC2822(match) { + const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr, obsOffset, milOffset, offHourStr, offMinuteStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + let offset; + + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; +} + +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); +} // http date + + +const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + +function extractRFC1123Or850(match) { + const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +function extractASCII(match) { + const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); +const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); +const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); +const isoTimeCombinedRegex = combineRegexes(isoTimeRegex); +const extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset); +const extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset); +const extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime); +const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); +/** + * @private + */ + +function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); +} +function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); +} +function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); +} +function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); +} +const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); +const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); +const extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); +const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); +function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); +} + +const INVALID = "Invalid Duration"; // unit conversion constants + +const lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } +}, + casualMatrix = Object.assign({ + years: { + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } +}, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = Object.assign({ + years: { + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } +}, lowOrderMatrix); // units ordered by size + +const orderedUnits = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; +const reverseUnits = orderedUnits.slice(0).reverse(); // clone really means "create another instance just like this one, but with these changes" + +function clone(dur, alts, clear = false) { + // deep merge for vals + const conf = { + values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy + }; + return new Duration(conf); +} + +function antiTrunc(n) { + return n < 0 ? Math.floor(n) : Math.ceil(n); +} // NB: mutates parameters + + +function convert(matrix, fromMap, fromUnit, toMap, toUnit) { + const conv = matrix[toUnit][fromUnit], + raw = fromMap[fromUnit] / conv, + sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), + // ok, so this is wild, but see the matrix in the tests + added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); + toMap[toUnit] += added; + fromMap[fromUnit] -= added * conv; +} // NB: mutates parameters + + +function normalizeValues(matrix, vals) { + reverseUnits.reduce((previous, current) => { + if (!isUndefined(vals[current])) { + if (previous) { + convert(matrix, vals, previous, vals, current); + } + + return current; + } else { + return previous; + } + }, null); +} +/** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. + * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + + +class Duration { + /** + * @private + */ + constructor(config) { + const accurate = config.conversionAccuracy === "longterm" || false; + /** + * @access private + */ + + this.values = config.values; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.matrix = accurate ? accurateMatrix : casualMatrix; + /** + * @access private + */ + + this.isLuxonDuration = true; + } + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + static fromMillis(count, opts) { + return Duration.fromObject(Object.assign({ + milliseconds: count + }, opts)); + } + /** + * Create a Duration from a Javascript object with keys like 'years' and 'hours. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {string} [obj.locale='en-US'] - the locale to use + * @param {string} obj.numberingSystem - the numbering system to use + * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + static fromObject(obj) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}`); + } + + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit, ["locale", "numberingSystem", "conversionAccuracy", "zone" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this + ]), + loc: Locale.fromObject(obj), + conversionAccuracy: obj.conversionAccuracy + }); + } + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + + + static fromISO(text, opts) { + const [parsed] = parseISODuration(text); + + if (parsed) { + const obj = Object.assign(parsed, opts); + return Duration.fromObject(obj); + } else { + return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + } + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + + + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid + }); + } + } + /** + * @private + */ + + + static normalizeUnit(unit) { + const normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + + + static isDuration(o) { + return o && o.isLuxonDuration || false; + } + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + + + get locale() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + + + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + + + toFormat(fmt, opts = {}) { + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + const fmtOpts = Object.assign({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID; + } + /** + * Returns a Javascript object with this Duration's values. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + + + toObject(opts = {}) { + if (!this.isValid) return {}; + const base = Object.assign({}, this.values); + + if (opts.includeConfig) { + base.conversionAccuracy = this.conversionAccuracy; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + + + toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + let s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + + + toJSON() { + return this.toISO(); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + + + toString() { + return this.toISO(); + } + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + + + valueOf() { + return this.as("milliseconds"); + } + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + + + plus(duration) { + if (!this.isValid) return this; + const dur = friendlyDuration(duration), + result = {}; + + for (const k of orderedUnits) { + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone(this, { + values: result + }, true); + } + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + + + minus(duration) { + if (!this.isValid) return this; + const dur = friendlyDuration(duration); + return this.plus(dur.negate()); + } + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + + + mapUnits(fn) { + if (!this.isValid) return this; + const result = {}; + + for (const k of Object.keys(this.values)) { + result[k] = asNumber(fn(this.values[k], k)); + } + + return clone(this, { + values: result + }, true); + } + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).years //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).months //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).days //=> 3 + * @return {number} + */ + + + get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + + + set(values) { + if (!this.isValid) return this; + const mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, [])); + return clone(this, { + values: mixed + }); + } + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + + + reconfigure({ + locale, + numberingSystem, + conversionAccuracy + } = {}) { + const loc = this.loc.clone({ + locale, + numberingSystem + }), + opts = { + loc + }; + + if (conversionAccuracy) { + opts.conversionAccuracy = conversionAccuracy; + } + + return clone(this, opts); + } + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + + + as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + /** + * Reduce this Duration to its canonical representation in its current units. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @return {Duration} + */ + + + normalize() { + if (!this.isValid) return this; + const vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone(this, { + values: vals + }, true); + } + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + + + shiftTo(...units) { + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map(u => Duration.normalizeUnit(u)); + const built = {}, + accumulated = {}, + vals = this.toObject(); + let lastUnit; + normalizeValues(this.matrix, vals); + + for (const k of orderedUnits) { + if (units.indexOf(k) >= 0) { + lastUnit = k; + let own = 0; // anything we haven't boiled down yet should get boiled to this unit + + for (const ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } // plus anything that's already in this unit + + + if (isNumber(vals[k])) { + own += vals[k]; + } + + const i = Math.trunc(own); + built[k] = i; + accumulated[k] = own - i; // we'd like to absorb these fractions in another unit + // plus anything further down the chain that should be rolled up in to this + + for (const down in vals) { + if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { + convert(this.matrix, vals, down, built, k); + } + } // otherwise, keep it in the wings to boil it later + + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + + + for (const key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + return clone(this, { + values: built + }, true).normalize(); + } + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + + + negate() { + if (!this.isValid) return this; + const negated = {}; + + for (const k of Object.keys(this.values)) { + negated[k] = -this.values[k]; + } + + return clone(this, { + values: negated + }, true); + } + /** + * Get the years. + * @type {number} + */ + + + get years() { + return this.isValid ? this.values.years || 0 : NaN; + } + /** + * Get the quarters. + * @type {number} + */ + + + get quarters() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + /** + * Get the months. + * @type {number} + */ + + + get months() { + return this.isValid ? this.values.months || 0 : NaN; + } + /** + * Get the weeks + * @type {number} + */ + + + get weeks() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + /** + * Get the days. + * @type {number} + */ + + + get days() { + return this.isValid ? this.values.days || 0 : NaN; + } + /** + * Get the hours. + * @type {number} + */ + + + get hours() { + return this.isValid ? this.values.hours || 0 : NaN; + } + /** + * Get the minutes. + * @type {number} + */ + + + get minutes() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + /** + * Get the seconds. + * @return {number} + */ + + + get seconds() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + /** + * Get the milliseconds. + * @return {number} + */ + + + get milliseconds() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + + + get isValid() { + return this.invalid === null; + } + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + + + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + + + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + + + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + for (const u of orderedUnits) { + if (this.values[u] !== other.values[u]) { + return false; + } + } + + return true; + } + +} +/** + * @private + */ + +function friendlyDuration(durationish) { + if (isNumber(durationish)) { + return Duration.fromMillis(durationish); + } else if (Duration.isDuration(durationish)) { + return durationish; + } else if (typeof durationish === "object") { + return Duration.fromObject(durationish); + } else { + throw new InvalidArgumentError(`Unknown duration argument ${durationish} of type ${typeof durationish}`); + } +} + +const INVALID$1 = "Invalid Interval"; // checks if the start is equal to or before the end + +function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`); + } else { + return null; + } +} +/** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. + * * **Accessors** Use {@link start} and {@link end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}. + * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs} + * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. + */ + + +class Interval { + /** + * @private + */ + constructor(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + + this.e = config.end; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.isLuxonInterval = true; + } + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + + + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid + }); + } + } + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + + + static fromDateTimes(start, end) { + const builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + const validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + + + static after(start, duration) { + const dur = friendlyDuration(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + + + static before(end, duration) { + const dur = friendlyDuration(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + + + static fromISO(text, opts) { + const [s, e] = (text || "").split("/", 2); + + if (s && e) { + const start = DateTime.fromISO(s, opts), + end = DateTime.fromISO(e, opts); + + if (start.isValid && end.isValid) { + return Interval.fromDateTimes(start, end); + } + + if (start.isValid) { + const dur = Duration.fromISO(e, opts); + + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (end.isValid) { + const dur = Duration.fromISO(s, opts); + + if (dur.isValid) { + return Interval.before(end, dur); + } + } + } + + return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + + + static isInterval(o) { + return o && o.isLuxonInterval || false; + } + /** + * Returns the start of the Interval + * @type {DateTime} + */ + + + get start() { + return this.isValid ? this.s : null; + } + /** + * Returns the end of the Interval + * @type {DateTime} + */ + + + get end() { + return this.isValid ? this.e : null; + } + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + + + get isValid() { + return this.invalidReason === null; + } + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + + + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + + + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + + + length(unit = "milliseconds") { + return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN; + } + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @return {number} + */ + + + count(unit = "milliseconds") { + if (!this.isValid) return NaN; + const start = this.start.startOf(unit), + end = this.end.startOf(unit); + return Math.floor(end.diff(start, unit).get(unit)) + 1; + } + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + + + hasSame(unit) { + return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false; + } + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + + + isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + + + isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + + + isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + + + contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + + + set({ + start, + end + } = {}) { + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + /** + * Split this Interval at each of the specified DateTimes + * @param {...[DateTime]} dateTimes - the unit of time to count. + * @return {[Interval]} + */ + + + splitAt(...dateTimes) { + if (!this.isValid) return []; + const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort(), + results = []; + let { + s + } = this, + i = 0; + + while (s < this.e) { + const added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {[Interval]} + */ + + + splitBy(duration) { + const dur = friendlyDuration(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + let { + s + } = this, + added, + next; + const results = []; + + while (s < this.e) { + added = s.plus(dur); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + } + + return results; + } + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {[Interval]} + */ + + + divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + + + overlaps(other) { + return this.e > other.s && this.s < other.e; + } + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + + + abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + + + abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + /** + * Return whether this Interval engulfs the start and end of the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + + + engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + + + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + + + intersection(other) { + if (!this.isValid) return this; + const s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s > e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + + + union(other) { + if (!this.isValid) return this; + const s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + + + static merge(intervals) { + const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(([sofar, current], item) => { + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]); + + if (final) { + found.push(final); + } + + return found; + } + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + + + static xor(intervals) { + let start = null, + currentCount = 0; + const results = [], + ends = intervals.map(i => [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]), + flattened = Array.prototype.concat(...ends), + arr = flattened.sort((a, b) => a.time - b.time); + + for (const i of arr) { + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {[Interval]} + */ + + + difference(...intervals) { + return Interval.xor([this].concat(intervals)).map(i => this.intersection(i)).filter(i => i && !i.isEmpty()); + } + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + + + toString() { + if (!this.isValid) return INVALID$1; + return `[${this.s.toISO()} – ${this.e.toISO()})`; + } + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + + + toISO(opts) { + if (!this.isValid) return INVALID$1; + return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`; + } + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + + + toISODate() { + if (!this.isValid) return INVALID$1; + return `${this.s.toISODate()}/${this.e.toISODate()}`; + } + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + + + toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`; + } + /** + * Returns a string representation of this Interval formatted according to the specified format string. + * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. + * @param {Object} opts - options + * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations + * @return {string} + */ + + + toFormat(dateFormat, { + separator = " – " + } = {}) { + if (!this.isValid) return INVALID$1; + return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`; + } + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + + + toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + + return this.e.diff(this.s, unit, opts); + } + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + + + mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + } + +} + +/** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + +class Info { + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + static hasDST(zone = Settings.defaultZone) { + const proto = DateTime.local().setZone(zone).set({ + month: 12 + }); + return !zone.universal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + + + static isValidIANAZone(zone) { + return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); + } + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone.isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + + + static normalizeZone(input) { + return normalizeZone(input, Settings.defaultZone); + } + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {[string]} + */ + + + static months(length = "long", { + locale = null, + numberingSystem = null, + outputCalendar = "gregory" + } = {}) { + return Locale.create(locale, numberingSystem, outputCalendar).months(length); + } + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {[string]} + */ + + + static monthsFormat(length = "long", { + locale = null, + numberingSystem = null, + outputCalendar = "gregory" + } = {}) { + return Locale.create(locale, numberingSystem, outputCalendar).months(length, true); + } + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {[string]} + */ + + + static weekdays(length = "long", { + locale = null, + numberingSystem = null + } = {}) { + return Locale.create(locale, numberingSystem, null).weekdays(length); + } + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @return {[string]} + */ + + + static weekdaysFormat(length = "long", { + locale = null, + numberingSystem = null + } = {}) { + return Locale.create(locale, numberingSystem, null).weekdays(length, true); + } + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {[string]} + */ + + + static meridiems({ + locale = null + } = {}) { + return Locale.create(locale).meridiems(); + } + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {[string]} + */ + + + static eras(length = "short", { + locale = null + } = {}) { + return Locale.create(locale, null, "gregory").eras(length); + } + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case. + * Keys: + * * `zones`: whether this environment supports IANA timezones + * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing + * * `intl`: whether this environment supports general internationalization + * * `relative`: whether this environment supports relative time formatting + * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false } + * @return {Object} + */ + + + static features() { + let intl = false, + intlTokens = false, + zones = false, + relative = false; + + if (hasIntl()) { + intl = true; + intlTokens = hasFormatToParts(); + relative = hasRelative(); + + try { + zones = new Intl.DateTimeFormat("en", { + timeZone: "America/New_York" + }).resolvedOptions().timeZone === "America/New_York"; + } catch (e) { + zones = false; + } + } + + return { + intl, + intlTokens, + zones, + relative + }; + } + +} + +function dayDiff(earlier, later) { + const utcDayStart = dt => dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(), + ms = utcDayStart(later) - utcDayStart(earlier); + + return Math.floor(Duration.fromMillis(ms).as("days")); +} + +function highOrderDiffs(cursor, later, units) { + const differs = [["years", (a, b) => b.year - a.year], ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12], ["weeks", (a, b) => { + const days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + const results = {}; + let lowestOrder, highWater; + + for (const [unit, differ] of differs) { + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + let delta = differ(cursor, later); + highWater = cursor.plus({ + [unit]: delta + }); + + if (highWater > later) { + cursor = cursor.plus({ + [unit]: delta - 1 + }); + delta -= 1; + } else { + cursor = highWater; + } + + results[unit] = delta; + } + } + + return [cursor, results, highWater, lowestOrder]; +} + +function diff (earlier, later, units, opts) { + let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units); + const remainingMillis = later - cursor; + const lowerOrderUnits = units.filter(u => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + highWater = cursor.plus({ + [lowestOrder]: 1 + }); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + const duration = Duration.fromObject(Object.assign(results, opts)); + + if (lowerOrderUnits.length > 0) { + return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration); + } else { + return duration; + } +} + +const numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" +}; +const numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] +}; // eslint-disable-next-line + +const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); +function parseDigits(str) { + let value = parseInt(str, 10); + + if (isNaN(value)) { + value = ""; + + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (const key in numberingSystemsUTF16) { + const [min, max] = numberingSystemsUTF16[key]; + + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + + return parseInt(value, 10); + } else { + return value; + } +} +function digitRegex({ + numberingSystem +}, append = "") { + return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`); +} + +const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + +function intUnit(regex, post = i => i) { + return { + regex, + deser: ([s]) => post(parseDigits(s)) + }; +} + +function fixListRegex(s) { + // make dots optional and also make them literal + return s.replace(/\./, "\\.?"); +} + +function stripInsensitivities(s) { + return s.replace(/\./, "").toLowerCase(); +} + +function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: ([s]) => strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex + }; + } +} + +function offset(regex, groups) { + return { + regex, + deser: ([, h, m]) => signedOffset(h, m), + groups + }; +} + +function simple(regex) { + return { + regex, + deser: ([s]) => s + }; +} + +function escapeToken(value) { + // eslint-disable-next-line no-useless-escape + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} + +function unitForToken(token, loc) { + const one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = t => ({ + regex: RegExp(escapeToken(t.val)), + deser: ([s]) => s, + literal: true + }), + unitate = t => { + if (token.literal) { + return literal(t); + } + + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short", false), 0); + + case "GG": + return oneOf(loc.eras("long", false), 0); + // years + + case "y": + return intUnit(oneToSix); + + case "yy": + return intUnit(twoToFour, untruncateYear); + + case "yyyy": + return intUnit(four); + + case "yyyyy": + return intUnit(fourToSix); + + case "yyyyyy": + return intUnit(six); + // months + + case "M": + return intUnit(oneOrTwo); + + case "MM": + return intUnit(two); + + case "MMM": + return oneOf(loc.months("short", true, false), 1); + + case "MMMM": + return oneOf(loc.months("long", true, false), 1); + + case "L": + return intUnit(oneOrTwo); + + case "LL": + return intUnit(two); + + case "LLL": + return oneOf(loc.months("short", false, false), 1); + + case "LLLL": + return oneOf(loc.months("long", false, false), 1); + // dates + + case "d": + return intUnit(oneOrTwo); + + case "dd": + return intUnit(two); + // ordinals + + case "o": + return intUnit(oneToThree); + + case "ooo": + return intUnit(three); + // time + + case "HH": + return intUnit(two); + + case "H": + return intUnit(oneOrTwo); + + case "hh": + return intUnit(two); + + case "h": + return intUnit(oneOrTwo); + + case "mm": + return intUnit(two); + + case "m": + return intUnit(oneOrTwo); + + case "q": + return intUnit(oneOrTwo); + + case "qq": + return intUnit(two); + + case "s": + return intUnit(oneOrTwo); + + case "ss": + return intUnit(two); + + case "S": + return intUnit(oneToThree); + + case "SSS": + return intUnit(three); + + case "u": + return simple(oneToNine); + // meridiem + + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + + case "kkkk": + return intUnit(four); + + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + + case "W": + return intUnit(oneOrTwo); + + case "WW": + return intUnit(two); + // weekdays + + case "E": + case "c": + return intUnit(one); + + case "EEE": + return oneOf(loc.weekdays("short", false, false), 1); + + case "EEEE": + return oneOf(loc.weekdays("long", false, false), 1); + + case "ccc": + return oneOf(loc.weekdays("short", true, false), 1); + + case "cccc": + return oneOf(loc.weekdays("long", true, false), 1); + // offset/zone + + case "Z": + case "ZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2); + + case "ZZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + + default: + return literal(t); + } + }; + + const unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; +} + +const partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour: { + numeric: "h", + "2-digit": "hh" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + } +}; + +function tokenForPart(part, locale, formatOpts) { + const { + type, + value + } = part; + + if (type === "literal") { + return { + literal: true, + val: value + }; + } + + const style = formatOpts[type]; + let val = partTypeStyleToTokenVal[type]; + + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val + }; + } + + return undefined; +} + +function buildRegex(units) { + const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, ""); + return [`^${re}$`, units]; +} + +function match(input, regex, handlers) { + const matches = input.match(regex); + + if (matches) { + const all = {}; + let matchIndex = 1; + + for (const i in handlers) { + if (hasOwnProperty(handlers, i)) { + const h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + + matchIndex += groups; + } + } + + return [matches, all]; + } else { + return [matches, {}]; + } +} + +function dateTimeFromMatches(matches) { + const toField = token => { + switch (token) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + case "H": + return "hour"; + + case "d": + return "day"; + + case "o": + return "ordinal"; + + case "L": + case "M": + return "month"; + + case "y": + return "year"; + + case "E": + case "c": + return "weekday"; + + case "W": + return "weekNumber"; + + case "k": + return "weekYear"; + + case "q": + return "quarter"; + + default: + return null; + } + }; + + let zone; + + if (!isUndefined(matches.Z)) { + zone = new FixedOffsetZone(matches.Z); + } else if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } else { + zone = null; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + const vals = Object.keys(matches).reduce((r, k) => { + const f = toField(k); + + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + return [vals, zone]; +} + +let dummyDateTimeCache = null; + +function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; +} + +function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + const formatOpts = Formatter.macroTokenToFormatOpts(token.val); + + if (!formatOpts) { + return token; + } + + const formatter = Formatter.create(locale, formatOpts); + const parts = formatter.formatDateTimeParts(getDummyDateTime()); + const tokens = parts.map(p => tokenForPart(p, locale, formatOpts)); + + if (tokens.includes(undefined)) { + return token; + } + + return tokens; +} + +function expandMacroTokens(tokens, locale) { + return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale))); +} +/** + * @private + */ + + +function explainFromTokens(locale, input, format) { + const tokens = expandMacroTokens(Formatter.parseFormat(format), locale), + units = tokens.map(t => unitForToken(t, locale)), + disqualifyingUnit = units.find(t => t.invalidReason); + + if (disqualifyingUnit) { + return { + input, + tokens, + invalidReason: disqualifyingUnit.invalidReason + }; + } else { + const [regexString, handlers] = buildRegex(units), + regex = RegExp(regexString, "i"), + [rawMatches, matches] = match(input, regex, handlers), + [result, zone] = matches ? dateTimeFromMatches(matches) : [null, null]; + + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + + return { + input, + tokens, + regex, + rawMatches, + matches, + result, + zone + }; + } +} +function parseFromTokens(locale, input, format) { + const { + result, + zone, + invalidReason + } = explainFromTokens(locale, input, format); + return [result, zone, invalidReason]; +} + +const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + +function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`); +} + +function dayOfWeek(year, month, day) { + const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); + return js === 0 ? 7 : js; +} + +function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; +} + +function uncomputeOrdinal(year, ordinal) { + const table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(i => i < ordinal), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day + }; +} +/** + * @private + */ + + +function gregorianToWeek(gregObj) { + const { + year, + month, + day + } = gregObj, + ordinal = computeOrdinal(year, month, day), + weekday = dayOfWeek(year, month, day); + let weekNumber = Math.floor((ordinal - weekday + 10) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear); + } else if (weekNumber > weeksInWeekYear(year)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return Object.assign({ + weekYear, + weekNumber, + weekday + }, timeObject(gregObj)); +} +function weekToGregorian(weekData) { + const { + weekYear, + weekNumber, + weekday + } = weekData, + weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), + yearInDays = daysInYear(weekYear); + let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + const { + month, + day + } = uncomputeOrdinal(year, ordinal); + return Object.assign({ + year, + month, + day + }, timeObject(weekData)); +} +function gregorianToOrdinal(gregData) { + const { + year, + month, + day + } = gregData, + ordinal = computeOrdinal(year, month, day); + return Object.assign({ + year, + ordinal + }, timeObject(gregData)); +} +function ordinalToGregorian(ordinalData) { + const { + year, + ordinal + } = ordinalData, + { + month, + day + } = uncomputeOrdinal(year, ordinal); + return Object.assign({ + year, + month, + day + }, timeObject(ordinalData)); +} +function hasInvalidWeekData(obj) { + const validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.week); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; +} +function hasInvalidOrdinalData(obj) { + const validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; +} +function hasInvalidGregorianData(obj) { + const validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; +} +function hasInvalidTimeData(obj) { + const { + hour, + minute, + second, + millisecond + } = obj; + const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; +} + +const INVALID$2 = "Invalid DateTime"; +const MAX_DATE = 8.64e15; + +function unsupportedZone(zone) { + return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`); +} // we cache week data on the DT object and this intermediates the cache + + +function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + + return dt.weekData; +} // clone really means, "make a new object with these modifications". all "setters" really use this +// to create a new object while only changing some of the properties + + +function clone$1(inst, alts) { + const current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(Object.assign({}, current, alts, { + old: current + })); +} // find the right offset a given local time. The o input is our guess, which determines which +// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + + +function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + let utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts + + const o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done + + if (o === o2) { + return [utcGuess, o]; + } // If not, change the ts by the difference in the offset + + + utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done + + const o3 = tz.offset(utcGuess); + + if (o2 === o3) { + return [utcGuess, o2]; + } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + + + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; +} // convert an epoch timestamp into a calendar object with the given offset + + +function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + const d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; +} // convert a calendar object to a epoch timestamp + + +function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); +} // create a new DT instance by adding a duration, adjusting for DSTs + + +function adjustTime(inst, dur) { + const keys = Object.keys(dur.values); + + if (keys.indexOf("milliseconds") === -1) { + keys.push("milliseconds"); + } + + dur = dur.shiftTo(...keys); + const oPre = inst.o, + year = inst.c.year + dur.years, + month = inst.c.month + dur.months + dur.quarters * 3, + c = Object.assign({}, inst.c, { + year, + month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7 + }), + millisToAdd = Duration.fromObject({ + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + let [ts, o] = fixOffset(localTS, oPre, inst.zone); + + if (millisToAdd !== 0) { + ts += millisToAdd; // that could have changed the offset by going over a DST, but we want to keep the ts the same + + o = inst.zone.offset(ts); + } + + return { + ts, + o + }; +} // helper useful in turning the results of parsing into real dates +// by handling the zone options + + +function parseDataToDateTime(parsed, parsedZone, opts, format, text) { + const { + setZone, + zone + } = opts; + + if (parsed && Object.keys(parsed).length !== 0) { + const interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(Object.assign(parsed, opts, { + zone: interpretationZone, + // setZone is a valid option in the calling methods, but not in fromObject + setZone: undefined + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)); + } +} // if you want to output a technical format (e.g. RFC 2822), this helper +// helps handle the details + + +function toTechFormat(dt, format, allowZ = true) { + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; +} // technical time formats (e.g. the time part of ISO 8601), take some options +// and this commonizes their handling + + +function toTechTimeFormat(dt, { + suppressSeconds = false, + suppressMilliseconds = false, + includeOffset, + includeZone = false, + spaceZone = false, + format = "extended" +}) { + let fmt = format === "basic" ? "HHmm" : "HH:mm"; + + if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { + fmt += format === "basic" ? "ss" : ":ss"; + + if (!suppressMilliseconds || dt.millisecond !== 0) { + fmt += ".SSS"; + } + } + + if ((includeZone || includeOffset) && spaceZone) { + fmt += " "; + } + + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += format === "basic" ? "ZZZ" : "ZZ"; + } + + return toTechFormat(dt, fmt); +} // defaults for unspecified units in the supported calendars + + +const defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}; // Units in the supported calendars, sorted by bigness + +const orderedUnits$1 = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; // standardize case and plurality in units + +function normalizeUnit(unit) { + const normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; +} // this is a dumbed down version of fromObject() that runs about 60% faster +// but doesn't do any validation, makes a bunch of assumptions about what units +// are present, and so on. + + +function quickDT(obj, zone) { + // assume we have the higher-order units + for (const u of orderedUnits$1) { + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + + if (invalid) { + return DateTime.invalid(invalid); + } + + const tsNow = Settings.now(), + offsetProvis = zone.offset(tsNow), + [ts, o] = objToTS(obj, offsetProvis, zone); + return new DateTime({ + ts, + zone, + o + }); +} + +function diffRelative(start, end, opts) { + const round = isUndefined(opts.round) ? true : opts.round, + format = (c, unit) => { + c = roundTo(c, round || opts.calendary ? 0 : 2, true); + const formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = unit => { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (const unit of opts.units) { + const count = differ(unit); + + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + + return format(0, opts.units[opts.units.length - 1]); +} +/** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, + * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. + * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + + +class DateTime { + /** + * @access private + */ + constructor(config) { + const zone = config.zone || Settings.defaultZone; + let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + let c = null, + o = null; + + if (!invalid) { + const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + [c, o] = [config.old.c, config.old.o]; + } else { + const ot = zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + /** + * @access private + */ + + + this._zone = zone; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.invalid = invalid; + /** + * @access private + */ + + this.weekData = null; + /** + * @access private + */ + + this.c = c; + /** + * @access private + */ + + this.o = o; + /** + * @access private + */ + + this.isLuxonDateTime = true; + } // CONSTRUCT + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + + + static local(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now() + }); + } else { + return quickDT({ + year, + month, + day, + hour, + minute, + second, + millisecond + }, Settings.defaultZone); + } + } + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @return {DateTime} + */ + + + static utc(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now(), + zone: FixedOffsetZone.utcInstance + }); + } else { + return quickDT({ + year, + month, + day, + hour, + minute, + second, + millisecond + }, FixedOffsetZone.utcInstance); + } + } + /** + * Create a DateTime from a Javascript Date object. Uses the default zone. + * @param {Date} date - a Javascript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + + + static fromJSDate(date, options = {}) { + const ts = isDate(date) ? date.valueOf() : NaN; + + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + const zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + + + static fromMillis(milliseconds, options = {}) { + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + + + static fromSeconds(seconds, options = {}) { + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @return {DateTime} + */ + + + static fromObject(obj) { + const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + const tsNow = Settings.now(), + offsetProvis = zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit, ["zone", "locale", "outputCalendar", "numberingSystem"]), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber, + loc = Locale.fromObject(obj); // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; // configure ourselves to deal with gregorian dates or week stuff + + let units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits$1; + defaultValues = defaultUnitValues; + } // set default values for missing stuff + + + let foundFirst = false; + + for (const u of units) { + const v = normalized[u]; + + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } // make sure the values we have are in range + + + const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } // compute the actual time + + + const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc + }); // gregorian data + weekday serves only to validate + + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`); + } + + return inst; + } + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + + + static fromISO(text, opts = {}) { + const [vals, parsedZone] = parseISODate(text); + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + + + static fromRFC2822(text, opts = {}) { + const [vals, parsedZone] = parseRFC2822Date(text); + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + + + static fromHTTP(text, opts = {}) { + const [vals, parsedZone] = parseHTTPDate(text); + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + + + static fromFormat(text, fmt, opts = {}) { + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + const { + locale = null, + numberingSystem = null + } = opts, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }), + [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt); + + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text); + } + } + /** + * @deprecated use fromFormat instead + */ + + + static fromString(text, fmt, opts = {}) { + return DateTime.fromFormat(text, fmt, opts); + } + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + + + static fromSQL(text, opts = {}) { + const [vals, parsedZone] = parseSQL(text); + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + + + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid + }); + } + } + /** + * Check if an object is a DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + + + static isDateTime(o) { + return o && o.isLuxonDateTime || false; + } // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + + + get(unit) { + return this[unit]; + } + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + + + get isValid() { + return this.invalid === null; + } + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + + + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + + + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + + + get locale() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + + + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + + + get outputCalendar() { + return this.isValid ? this.loc.outputCalendar : null; + } + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + + + get zone() { + return this._zone; + } + /** + * Get the name of the time zone. + * @type {string} + */ + + + get zoneName() { + return this.isValid ? this.zone.name : null; + } + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + + + get year() { + return this.isValid ? this.c.year : NaN; + } + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + + + get quarter() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + + + get month() { + return this.isValid ? this.c.month : NaN; + } + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + + + get day() { + return this.isValid ? this.c.day : NaN; + } + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + + + get hour() { + return this.isValid ? this.c.hour : NaN; + } + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + + + get minute() { + return this.isValid ? this.c.minute : NaN; + } + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + + + get second() { + return this.isValid ? this.c.second : NaN; + } + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + + + get millisecond() { + return this.isValid ? this.c.millisecond : NaN; + } + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekYear //=> 2015 + * @type {number} + */ + + + get weekYear() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + + + get weekNumber() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + + + get weekday() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + + + get ordinal() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + + + get monthShort() { + return this.isValid ? Info.months("short", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + + + get monthLong() { + return this.isValid ? Info.months("long", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + + + get weekdayShort() { + return this.isValid ? Info.weekdays("short", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + + + get weekdayLong() { + return this.isValid ? Info.weekdays("long", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.local().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + + + get offset() { + return this.isValid ? +this.o : NaN; + } + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + + get offsetNameShort() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + + get offsetNameLong() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + + + get isOffsetFixed() { + return this.isValid ? this.zone.universal : null; + } + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + + + get isInDST() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + + + get isInLeapYear() { + return isLeapYear(this.year); + } + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + + + get daysInMonth() { + return daysInMonth(this.year, this.month); + } + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + + + get daysInYear() { + return this.isValid ? daysInYear(this.year) : NaN; + } + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + + + get weeksInWeekYear() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + + + resolvedLocaleOpts(opts = {}) { + const { + locale, + numberingSystem, + calendar + } = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this); + return { + locale, + numberingSystem, + outputCalendar: calendar + }; + } // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + + + toUTC(offset = 0, opts = {}) { + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + + + toLocal() { + return this.setZone(Settings.defaultZone); + } + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + + + setZone(zone, { + keepLocalTime = false, + keepCalendarTime = false + } = {}) { + zone = normalizeZone(zone, Settings.defaultZone); + + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + let newTS = this.ts; + + if (keepLocalTime || keepCalendarTime) { + const offsetGuess = zone.offset(this.ts); + const asObj = this.toObject(); + [newTS] = objToTS(asObj, offsetGuess, zone); + } + + return clone$1(this, { + ts: newTS, + zone + }); + } + } + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + + + reconfigure({ + locale, + numberingSystem, + outputCalendar + } = {}) { + const loc = this.loc.clone({ + locale, + numberingSystem, + outputCalendar + }); + return clone$1(this, { + loc + }); + } + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + + + setLocale(locale) { + return this.reconfigure({ + locale + }); + } + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + + + set(values) { + if (!this.isValid) return this; + const normalized = normalizeObject(values, normalizeUnit, []), + settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday); + let mixed; + + if (settingWeekStuff) { + mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + } else { + mixed = Object.assign(this.toObject(), normalized); // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + const [ts, o] = objToTS(mixed, this.o, this.zone); + return clone$1(this, { + ts, + o + }); + } + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.local().plus(123) //~> in 123 milliseconds + * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + + + plus(duration) { + if (!this.isValid) return this; + const dur = friendlyDuration(duration); + return clone$1(this, adjustTime(this, dur)); + } + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + + + minus(duration) { + if (!this.isValid) return this; + const dur = friendlyDuration(duration).negate(); + return clone$1(this, adjustTime(this, dur)); + } + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + + + startOf(unit) { + if (!this.isValid) return this; + const o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + + case "quarters": + case "months": + o.day = 1; + // falls through + + case "weeks": + case "days": + o.hour = 0; + // falls through + + case "hours": + o.minute = 0; + // falls through + + case "minutes": + o.second = 0; + // falls through + + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + o.weekday = 1; + } + + if (normalizedUnit === "quarters") { + const q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + + + endOf(unit) { + return this.isValid ? this.plus({ + [unit]: 1 + }).startOf(unit).minus(1) : this; + } // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options + * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + + + toFormat(fmt, opts = {}) { + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$2; + } + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @example DateTime.local().toLocaleString(); //=> 4/20/2017 + * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' + * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' + * @return {string} + */ + + + toLocaleString(opts = DATE_SHORT) { + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID$2; + } + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.local().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + + + toLocaleParts(opts = {}) { + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + + + toISO(opts = {}) { + if (!this.isValid) { + return null; + } + + return `${this.toISODate(opts)}T${this.toISOTime(opts)}`; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + + + toISODate({ + format = "extended" + } = {}) { + let fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; + + if (this.year > 9999) { + fmt = "+" + fmt; + } + + return toTechFormat(this, fmt); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + + + toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @return {string} + */ + + + toISOTime({ + suppressMilliseconds = false, + suppressSeconds = false, + includeOffset = true, + format = "extended" + } = {}) { + return toTechTimeFormat(this, { + suppressSeconds, + suppressMilliseconds, + includeOffset, + format + }); + } + /** + * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + + + toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + + + toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + + + toSQLDate() { + return toTechFormat(this, "yyyy-MM-dd"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + + + toSQLTime({ + includeOffset = true, + includeZone = false + } = {}) { + return toTechTimeFormat(this, { + includeOffset, + includeZone, + spaceZone: true + }); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + + + toSQL(opts = {}) { + if (!this.isValid) { + return null; + } + + return `${this.toSQLDate()} ${this.toSQLTime(opts)}`; + } + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + + + toString() { + return this.isValid ? this.toISO() : INVALID$2; + } + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * @return {number} + */ + + + valueOf() { + return this.toMillis(); + } + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + + + toMillis() { + return this.isValid ? this.ts : NaN; + } + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + + + toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + + + toJSON() { + return this.toISO(); + } + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + + + toBSON() { + return this.toJSDate(); + } + /** + * Returns a Javascript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + + + toObject(opts = {}) { + if (!this.isValid) return {}; + const base = Object.assign({}, this.c); + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns a Javascript Date equivalent to this DateTime. + * @return {Date} + */ + + + toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + + + diff(otherDateTime, unit = "milliseconds", opts = {}) { + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid(this.invalid || otherDateTime.invalid, "created by diffing an invalid DateTime"); + } + + const durOpts = Object.assign({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + const units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = diff(earlier, later, units, durOpts); + return otherIsLater ? diffed.negate() : diffed; + } + /** + * Return the difference between this DateTime and right now. + * See {@link diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + diffNow(unit = "milliseconds", opts = {}) { + return this.diff(DateTime.local(), unit, opts); + } + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + + + until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + /** + * Return whether this DateTime is in the same unit of time as another DateTime + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day + * @return {boolean} + */ + + + hasSame(otherDateTime, unit) { + if (!this.isValid) return false; + + if (unit === "millisecond") { + return this.valueOf() === otherDateTime.valueOf(); + } else { + const inputMs = otherDateTime.valueOf(); + return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit); + } + } + /** + * Equality check + * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + + + equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + + + toRelative(options = {}) { + if (!this.isValid) return null; + const base = options.base || DateTime.fromObject({ + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + return diffRelative(base, this.plus(padding), Object.assign(options, { + numeric: "always", + units: ["years", "months", "days", "hours", "minutes", "seconds"] + })); + } + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + + + toRelativeCalendar(options = {}) { + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({ + zone: this.zone + }), this, Object.assign(options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + + + static min(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, i => i.valueOf(), Math.min); + } + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + + + static max(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, i => i.valueOf(), Math.max); + } // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + + + static fromFormatExplain(text, fmt, options = {}) { + const { + locale = null, + numberingSystem = null + } = options, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + /** + * @deprecated use fromFormatExplain instead + */ + + + static fromStringExplain(text, fmt, options = {}) { + return DateTime.fromFormatExplain(text, fmt, options); + } // FORMAT PRESETS + + /** + * {@link toLocaleString} format like 10/14/1983 + * @type {Object} + */ + + + static get DATE_SHORT() { + return DATE_SHORT; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + + + static get DATE_MED() { + return DATE_MED; + } + /** + * {@link toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + + + static get DATE_FULL() { + return DATE_FULL; + } + /** + * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + + + static get DATE_HUGE() { + return DATE_HUGE; + } + /** + * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get TIME_SIMPLE() { + return TIME_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get TIME_WITH_SECONDS() { + return TIME_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get TIME_WITH_SHORT_OFFSET() { + return TIME_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get TIME_WITH_LONG_OFFSET() { + return TIME_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + + + static get TIME_24_SIMPLE() { + return TIME_24_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + + + static get TIME_24_WITH_SECONDS() { + return TIME_24_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + + + static get TIME_24_WITH_SHORT_OFFSET() { + return TIME_24_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + + + static get TIME_24_WITH_LONG_OFFSET() { + return TIME_24_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_SHORT() { + return DATETIME_SHORT; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_SHORT_WITH_SECONDS() { + return DATETIME_SHORT_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_MED() { + return DATETIME_MED; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_MED_WITH_SECONDS() { + return DATETIME_MED_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_MED_WITH_WEEKDAY() { + return DATETIME_MED_WITH_WEEKDAY; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_FULL() { + return DATETIME_FULL; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_FULL_WITH_SECONDS() { + return DATETIME_FULL_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_HUGE() { + return DATETIME_HUGE; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + + static get DATETIME_HUGE_WITH_SECONDS() { + return DATETIME_HUGE_WITH_SECONDS; + } + +} +/** + * @private + */ + +function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`); + } +} + +exports.DateTime = DateTime; +exports.Duration = Duration; +exports.FixedOffsetZone = FixedOffsetZone; +exports.IANAZone = IANAZone; +exports.Info = Info; +exports.Interval = Interval; +exports.InvalidZone = InvalidZone; +exports.LocalZone = LocalZone; +exports.Settings = Settings; +exports.Zone = Zone; +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/node/luxon.js.map b/node_modules/luxon/build/node/luxon.js.map new file mode 100644 index 0000000..7927817 --- /dev/null +++ b/node_modules/luxon/build/node/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/invalid.js","../../src/zone.js","../../src/zones/localZone.js","../../src/zones/IANAZone.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/settings.js","../../src/impl/locale.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/digits.js","../../src/impl/tokenParser.js","../../src/impl/conversions.js","../../src/datetime.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23', always 24-hour.\n */\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hour12: false\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour.\n */\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: s\n};\n\n/**\n * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour.\n */\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hour12: false,\n timeZoneName: l\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n\n};\n\n/**\n * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n */\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l\n};\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasIntl() {\n try {\n return typeof Intl !== \"undefined\" && Intl.DateTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasFormatToParts() {\n return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts);\n}\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n if (input.toString().length < n) {\n return (\"0\".repeat(n) + input).slice(-n);\n } else {\n return input.toString();\n }\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, towardZero = false) {\n const factor = 10 ** digits,\n rounder = towardZero ? Math.trunc : Math.round;\n return rounder(number * factor) / factor;\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// covert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n return +d;\n}\n\nexport function weeksInWeekYear(weekYear) {\n const p1 =\n (weekYear +\n Math.floor(weekYear / 4) -\n Math.floor(weekYear / 100) +\n Math.floor(weekYear / 400)) %\n 7,\n last = weekYear - 1,\n p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;\n return p1 === 4 || p2 === 3 ? 53 : 52;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > 60 ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hour12: false,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\"\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts),\n intl = hasIntl();\n\n if (intl && hasFormatToParts()) {\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find(m => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n } else if (intl) {\n // this probably doesn't work for all locales\n const without = new Intl.DateTimeFormat(locale, intlOpts).format(date),\n included = new Intl.DateTimeFormat(locale, modified).format(date),\n diffed = included.substring(without.length),\n trimmed = diffed.replace(/^[, \\u200e]+/, \"\");\n return trimmed;\n } else {\n return null;\n }\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || Number.isNaN(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer, nonUnitKeys) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n if (nonUnitKeys.indexOf(u) >= 0) continue;\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(offset / 60),\n minutes = Math.abs(offset % 60),\n sign = hours >= 0 && !Object.is(hours, -0) ? \"+\" : \"-\",\n base = `${sign}${Math.abs(hours)}`;\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(Math.abs(hours), 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return minutes > 0 ? `${base}:${minutes}` : base;\n case \"techie\":\n return `${sign}${padStart(Math.abs(hours), 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n\nexport const ianaRegex = /[A-Za-z_+-]{1,256}(:?\\/[A-Za-z_+-]{1,256}(\\/[A-Za-z_+-]{1,256})?)?/;\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return monthsNarrow;\n case \"short\":\n return monthsShort;\n case \"long\":\n return monthsLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\"\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return weekdaysNarrow;\n case \"short\":\n return weekdaysShort;\n case \"long\":\n return weekdaysLong;\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return erasNarrow;\n case \"short\":\n return erasShort;\n case \"long\":\n return erasLong;\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"]\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hour12\"\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { hasFormatToParts, padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: false, val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed, val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTime(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.format();\n }\n\n formatDateTimeParts(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.formatToParts();\n }\n\n resolvedOptions(dt, opts = {}) {\n const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));\n return df.resolvedOptions();\n }\n\n num(n, p = 0) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = Object.assign({}, this.opts);\n\n if (p > 0) {\n opts.padTo = p;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter =\n this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\" && hasFormatToParts(),\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = opts => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hour12: true }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = token => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = length =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = token => {\n // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const tokenToField = token => {\n switch (token[0]) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n default:\n return null;\n }\n },\n tokenToString = lildur => token => {\n const mapped = tokenToField(token);\n if (mapped) {\n return this.num(lildur.get(mapped), token.length);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t));\n return stringifyTokens(tokens, tokenToString(collapsed));\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","/* eslint no-unused-vars: \"off\" */\nimport { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get universal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo, hasIntl } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this Javascript environment.\n * @implements {Zone}\n */\nexport default class LocalZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {LocalZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new LocalZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"local\";\n }\n\n /** @override **/\n get name() {\n if (hasIntl()) {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n } else return \"local\";\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"local\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, ianaRegex, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst matchingRegex = RegExp(`^${ianaRegex.source}$`);\n\nlet dtfCache = {};\nfunction makeDTF(zone) {\n if (!dtfCache[zone]) {\n dtfCache[zone] = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\"\n });\n }\n return dtfCache[zone];\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date),\n filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i],\n pos = typeToPos[type];\n\n if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nlet ianaZoneCache = {};\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n if (!ianaZoneCache[name]) {\n ianaZoneCache[name] = new IANAZone(name);\n }\n return ianaZoneCache[name];\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache = {};\n dtfCache = {};\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Fantasia/Castle\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return !!(s && s.match(matchingRegex));\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n // Etc/GMT+8 -> -480\n /** @ignore */\n static parseGMTOffset(specifier) {\n if (specifier) {\n const match = specifier.match(/^Etc\\/GMT([+-]\\d{1,2})$/i);\n if (match) {\n return -60 * parseInt(match[1]);\n }\n }\n return null;\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /** @override **/\n get type() {\n return \"iana\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n const date = new Date(ts),\n dtf = makeDTF(this.name),\n [year, month, day, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date),\n // work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /** @override **/\n get isValid() {\n return this.valid;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /** @override **/\n get type() {\n return \"fixed\";\n }\n\n /** @override **/\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /** @override **/\n offsetName() {\n return this.name;\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /** @override **/\n get universal() {\n return true;\n }\n\n /** @override **/\n offset() {\n return this.fixed;\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get universal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"local\") return defaultZone;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else if ((offset = IANAZone.parseGMTOffset(input)) != null) {\n // handle Etc/GMT-4, which V8 chokes on\n return FixedOffsetZone.instance(offset);\n } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);\n else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && input.offset && typeof input.offset === \"number\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","import LocalZone from \"./zones/localZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nlet now = () => Date.now(),\n defaultZone = null, // not setting this directly to LocalZone.instance bc loading order issues\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n throwOnInvalid = false;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Get the default time zone to create DateTimes in.\n * @type {string}\n */\n static get defaultZoneName() {\n return Settings.defaultZone.name;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * @type {string}\n */\n static set defaultZoneName(z) {\n if (!z) {\n defaultZone = null;\n } else {\n defaultZone = normalizeZone(z);\n }\n }\n\n /**\n * Get the default time zone object to create DateTimes in. Does not affect existing instances.\n * @type {Zone}\n */\n static get defaultZone() {\n return defaultZone || LocalZone.instance;\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n }\n}\n","import { hasFormatToParts, hasIntl, padStart, roundTo, hasRelative } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport Formatter from \"./formatter.js\";\n\nlet intlDTCache = {};\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache[key];\n if (!dtf) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache[key] = dtf;\n }\n return dtf;\n}\n\nlet intlNumCache = {};\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache[key];\n if (!inf) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache[key] = inf;\n }\n return inf;\n}\n\nlet intlRelCache = {};\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache[key];\n if (!inf) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache[key] = inf;\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else if (hasIntl()) {\n const computedSys = new Intl.DateTimeFormat().resolvedOptions().locale;\n // node sometimes defaults to \"und\". Override that because that is dumb\n sysLocaleCache = !computedSys || computedSys === \"und\" ? \"en-US\" : computedSys;\n return sysLocaleCache;\n } else {\n sysLocaleCache = \"en-US\";\n return sysLocaleCache;\n }\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n const smaller = localeStr.substring(0, uIndex);\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n } catch (e) {\n options = getCachedDTF(smaller).resolvedOptions();\n }\n\n const { numberingSystem, calendar } = options;\n // return the smaller one so that we can append the calendar and numbering overrides to it\n return [smaller, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (hasIntl()) {\n if (outputCalendar || numberingSystem) {\n localeStr += \"-u\";\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n } else {\n return [];\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2016, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, defaultOK, englishFn, intlFn) {\n const mode = loc.listingMode(defaultOK);\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n (hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === \"latn\")\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n if (!forceSimple && hasIntl()) {\n const intlOpts = { useGrouping: false };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.hasIntl = hasIntl();\n\n let z;\n if (dt.zone.universal && this.hasIntl) {\n // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.\n // So we have to make do. Two cases:\n // 1. The format options tell us to show the zone. We can't do that, so the best\n // we can do is format the date in UTC.\n // 2. The format options don't tell us to show the zone. Then we can adjust them\n // the time and tell the formatter to show it to us in UTC, so that the time is right\n // and the bad zone doesn't show up.\n // We can clean all this up when Chrome fixes this.\n z = \"UTC\";\n if (opts.timeZoneName) {\n this.dt = dt;\n } else {\n this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);\n }\n } else if (dt.zone.type === \"local\") {\n this.dt = dt;\n } else {\n this.dt = dt;\n z = dt.zone.name;\n }\n\n if (this.hasIntl) {\n const intlOpts = Object.assign({}, this.opts);\n if (z) {\n intlOpts.timeZone = z;\n }\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n }\n\n format() {\n if (this.hasIntl) {\n return this.dtf.format(this.dt.toJSDate());\n } else {\n const tokenFormat = English.formatString(this.opts),\n loc = Locale.create(\"en-US\");\n return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat);\n }\n }\n\n formatToParts() {\n if (this.hasIntl && hasFormatToParts()) {\n return this.dtf.formatToParts(this.dt.toJSDate());\n } else {\n // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings\n // and IMO it's too weird to have an uncanny valley like that\n return [];\n }\n }\n\n resolvedOptions() {\n if (this.hasIntl) {\n return this.dtf.resolvedOptions();\n } else {\n return {\n locale: \"en-US\",\n numberingSystem: \"latn\",\n outputCalendar: \"gregory\"\n };\n }\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = Object.assign({ style: \"long\" }, opts);\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\n/**\n * @private\n */\n\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);\n }\n\n static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale,\n // the system locale is useful for human readable strings but annoying for parsing/formatting known formats\n localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale()),\n numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,\n outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache = {};\n intlNumCache = {};\n intlRelCache = {};\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar);\n }\n\n constructor(locale, numbering, outputCalendar, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode(defaultOK = true) {\n const intl = hasIntl(),\n hasFTP = intl && hasFormatToParts(),\n isActuallyEn = this.isEnglish(),\n hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n\n if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) {\n return \"error\";\n } else if (!hasFTP || (isActuallyEn && hasNoWeirdness)) {\n return \"en\";\n } else {\n return \"intl\";\n }\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: true }));\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone(Object.assign({}, alts, { defaultToEN: false }));\n }\n\n months(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.months, () => {\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n this.monthsCache[formatStr][length] = mapMonths(dt => this.extract(dt, intl, \"month\"));\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays(dt =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems(defaultOK = true) {\n return listStuff(\n this,\n undefined,\n defaultOK,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hour12: true };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n dt => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length, defaultOK = true) {\n return listStuff(this, length, defaultOK, English.eras, () => {\n const intl = { era: length };\n\n // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find(m => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n (hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith(\"en-us\"))\n );\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n ianaRegex,\n isUndefined\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return m =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [Object.assign(mergedVals, val), mergedZone || zone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:(Z)|([+-]\\d\\d)(?::?(\\d\\d))?)/,\n isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,9}))?)?)?/,\n isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`),\n isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`),\n isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/,\n isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/,\n isoOrdinalRegex = /(\\d{4})-?(\\d{3})/,\n extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\"),\n extractISOOrdinalData = simpleParse(\"year\", \"ordinal\"),\n sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/, // dumbed-down version of the ISO one\n sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n ),\n sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1)\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hour: int(match, cursor, 0),\n minute: int(match, cursor + 1, 0),\n second: int(match, cursor + 2, 0),\n millisecond: parseMillis(match[cursor + 3])\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO duration parsing\n\nconst isoDuration = /^P(?:(?:(-?\\d{1,9})Y)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})W)?(?:(-?\\d{1,9})D)?(?:T(?:(-?\\d{1,9})H)?(?:(-?\\d{1,9})M)?(?:(-?\\d{1,9})(?:[.,](-?\\d{1,9}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [\n ,\n yearStr,\n monthStr,\n weekStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr,\n millisecondsStr\n ] = match;\n\n return [\n {\n years: parseInteger(yearStr),\n months: parseInteger(monthStr),\n weeks: parseInteger(weekStr),\n days: parseInteger(dayStr),\n hours: parseInteger(hourStr),\n minutes: parseInteger(minuteStr),\n seconds: parseInteger(secondStr),\n milliseconds: parseMillis(millisecondsStr)\n }\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr)\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset\n);\nconst extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime);\nconst extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);\n\n/**\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOYmdTimeOffsetAndIANAZone = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nconst lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 }\n },\n casualMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n ),\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = Object.assign(\n {\n years: {\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000\n }\n },\n lowOrderMatrix\n );\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy\n };\n return new Duration(conf);\n}\n\nfunction antiTrunc(n) {\n return n < 0 ? Math.floor(n) : Math.ceil(n);\n}\n\n// NB: mutates parameters\nfunction convert(matrix, fromMap, fromUnit, toMap, toUnit) {\n const conv = matrix[toUnit][fromUnit],\n raw = fromMap[fromUnit] / conv,\n sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),\n // ok, so this is wild, but see the matrix in the tests\n added =\n !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);\n toMap[toUnit] += added;\n fromMap[fromUnit] -= added * conv;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n reverseUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n convert(matrix, vals, previous, vals, current);\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors.\n * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = accurate ? accurateMatrix : casualMatrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject(Object.assign({ milliseconds: count }, opts));\n }\n\n /**\n * Create a Duration from a Javascript object with keys like 'years' and 'hours.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {string} [obj.locale='en-US'] - the locale to use\n * @param {string} obj.numberingSystem - the numbering system to use\n * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromObject(obj) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit, [\n \"locale\",\n \"numberingSystem\",\n \"conversionAccuracy\",\n \"zone\" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this\n ]),\n loc: Locale.fromObject(obj),\n conversionAccuracy: obj.conversionAccuracy\n });\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n const obj = Object.assign(parsed, opts);\n return Duration.fromObject(obj);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\"\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = Object.assign({}, opts, {\n floor: opts.round !== false && opts.floor !== false\n });\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a Javascript object with this Duration's values.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.values);\n\n if (opts.includeConfig) {\n base.conversionAccuracy = this.conversionAccuracy;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n valueOf() {\n return this.as(\"milliseconds\");\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = friendlyDuration(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === \"hour\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).years //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).months //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).days //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, []));\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem }),\n opts = { loc };\n\n if (conversionAccuracy) {\n opts.conversionAccuracy = conversionAccuracy;\n }\n\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map(u => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n normalizeValues(this.matrix, vals);\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = own - i; // we'd like to absorb these fractions in another unit\n\n // plus anything further down the chain that should be rolled up in to this\n for (const down in vals) {\n if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {\n convert(this.matrix, vals, down, built, k);\n }\n }\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n return clone(this, { values: built }, true).normalize();\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n for (const u of orderedUnits) {\n if (this.values[u] !== other.values[u]) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDuration(durationish) {\n if (isNumber(durationish)) {\n return Duration.fromMillis(durationish);\n } else if (Duration.isDuration(durationish)) {\n return durationish;\n } else if (typeof durationish === \"object\") {\n return Duration.fromObject(durationish);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationish} of type ${typeof durationish}`\n );\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration, { friendlyDuration } from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}.\n * * **Accessors** Use {@link start} and {@link end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.\n * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}\n * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = friendlyDuration(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n const start = DateTime.fromISO(s, opts),\n end = DateTime.fromISO(e, opts);\n\n if (start.isValid && end.isValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (start.isValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (end.isValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @return {number}\n */\n count(unit = \"milliseconds\") {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit),\n end = this.end.startOf(unit);\n return Math.floor(end.diff(start, unit).get(unit)) + 1;\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...[DateTime]} dateTimes - the unit of time to count.\n * @return {[Interval]}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter(d => this.contains(d))\n .sort(),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {[Interval]}\n */\n splitBy(duration) {\n const dur = friendlyDuration(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n added,\n next;\n\n const results = [];\n while (s < this.e) {\n added = s.plus(dur);\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {[Interval]}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Return whether this Interval engulfs the start and end of the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s > e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into a equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static merge(intervals) {\n const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {[Interval]} intervals\n * @return {[Interval]}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map(i => [{ time: i.s, type: \"s\" }, { time: i.e, type: \"e\" }]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {[Interval]}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map(i => this.intersection(i))\n .filter(i => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime.toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format string.\n * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details.\n * @param {Object} opts - options\n * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasFormatToParts, hasIntl, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.local()\n .setZone(zone)\n .set({ month: 12 });\n\n return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone.isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {[string]}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {[string]}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, outputCalendar = \"gregory\" } = {}\n ) {\n return Locale.create(locale, numberingSystem, outputCalendar).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {[string]}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @return {[string]}\n */\n static weekdaysFormat(length = \"long\", { locale = null, numberingSystem = null } = {}) {\n return Locale.create(locale, numberingSystem, null).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {[string]}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {[string]}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `zones`: whether this environment supports IANA timezones\n * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing\n * * `intl`: whether this environment supports general internationalization\n * * `relative`: whether this environment supports relative time formatting\n * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false }\n * @return {Object}\n */\n static features() {\n let intl = false,\n intlTokens = false,\n zones = false,\n relative = false;\n\n if (hasIntl()) {\n intl = true;\n intlTokens = hasFormatToParts();\n relative = hasRelative();\n\n try {\n zones =\n new Intl.DateTimeFormat(\"en\", { timeZone: \"America/New_York\" }).resolvedOptions()\n .timeZone === \"America/New_York\";\n } catch (e) {\n zones = false;\n }\n }\n\n return { intl, intlTokens, zones, relative };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = dt =>\n dt\n .toUTC(0, { keepLocalTime: true })\n .startOf(\"day\")\n .valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n }\n ],\n [\"days\", dayDiff]\n ];\n\n const results = {};\n let lowestOrder, highWater;\n\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n let delta = differ(cursor, later);\n highWater = cursor.plus({ [unit]: delta });\n\n if (highWater > later) {\n cursor = cursor.plus({ [unit]: delta - 1 });\n delta -= 1;\n } else {\n cursor = highWater;\n }\n\n results[unit] = delta;\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function(earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n u => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(Object.assign(results, opts));\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\"\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881]\n};\n\n// eslint-disable-next-line\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n return new RegExp(`${numberingSystems[numberingSystem || \"latn\"]}${append}`);\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = i => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n return s.replace(/\\./, \"\\\\.?\");\n}\n\nfunction stripInsensitivities(s) {\n return s.replace(/\\./, \"\").toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n // eslint-disable-next-line no-useless-escape\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = t => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = t => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\", false), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\", false), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true, false), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true, false), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false, false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false, false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false, false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false, false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true, false), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true, false), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\"\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\"\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\"\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\"\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour: {\n numeric: \"h\",\n \"2-digit\": \"hh\"\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\"\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\"\n }\n};\n\nfunction tokenForPart(part, locale, formatOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n return {\n literal: true,\n val: value\n };\n }\n\n const style = formatOpts[type];\n\n let val = partTypeStyleToTokenVal[type];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = token => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone;\n if (!isUndefined(matches.Z)) {\n zone = new FixedOffsetZone(matches.Z);\n } else if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n } else {\n zone = null;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n\n if (!formatOpts) {\n return token;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const parts = formatter.formatDateTimeParts(getDummyDateTime());\n\n const tokens = parts.map(p => tokenForPart(p, locale, formatOpts));\n\n if (tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nfunction expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport function explainFromTokens(locale, input, format) {\n const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),\n units = tokens.map(t => unitForToken(t, locale)),\n disqualifyingUnit = units.find(t => t.invalidReason);\n\n if (disqualifyingUnit) {\n return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };\n } else {\n const [regexString, handlers] = buildRegex(units),\n regex = RegExp(regexString, \"i\"),\n [rawMatches, matches] = match(input, regex, handlers),\n [result, zone] = matches ? dateTimeFromMatches(matches) : [null, null];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return { input, tokens, regex, rawMatches, matches, result, zone };\n }\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, invalidReason];\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nfunction dayOfWeek(year, month, day) {\n const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay();\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex(i => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = dayOfWeek(year, month, day);\n\n let weekNumber = Math.floor((ordinal - weekday + 10) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear);\n } else if (weekNumber > weeksInWeekYear(year)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return Object.assign({ weekYear, weekNumber, weekday }, timeObject(gregObj));\n}\n\nexport function weekToGregorian(weekData) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(weekData));\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData,\n ordinal = computeOrdinal(year, month, day);\n\n return Object.assign({ year, ordinal }, timeObject(gregData));\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData,\n { month, day } = uncomputeOrdinal(year, ordinal);\n\n return Object.assign({ year, month, day }, timeObject(ordinalData));\n}\n\nexport function hasInvalidWeekData(obj) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.week);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","import Duration, { friendlyDuration } from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport { parseFromTokens, explainFromTokens } from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid\n };\n return new DateTime(Object.assign({}, current, alts, { old: current }));\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds()\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const keys = Object.keys(dur.values);\n if (keys.indexOf(\"milliseconds\") === -1) {\n keys.push(\"milliseconds\");\n }\n\n dur = dur.shiftTo(...keys);\n\n const oPre = inst.o,\n year = inst.c.year + dur.years,\n month = inst.c.month + dur.months + dur.quarters * 3,\n c = Object.assign({}, inst.c, {\n year,\n month,\n day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7\n }),\n millisToAdd = Duration.fromObject({\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text) {\n const { setZone, zone } = opts;\n if (parsed && Object.keys(parsed).length !== 0) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(\n Object.assign(parsed, opts, {\n zone: interpretationZone,\n // setZone is a valid option in the calling methods, but not in fromObject\n setZone: undefined\n })\n );\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\n// technical time formats (e.g. the time part of ISO 8601), take some options\n// and this commonizes their handling\nfunction toTechTimeFormat(\n dt,\n {\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset,\n includeZone = false,\n spaceZone = false,\n format = \"extended\"\n }\n) {\n let fmt = format === \"basic\" ? \"HHmm\" : \"HH:mm\";\n\n if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {\n fmt += format === \"basic\" ? \"ss\" : \":ss\";\n if (!suppressMilliseconds || dt.millisecond !== 0) {\n fmt += \".SSS\";\n }\n }\n\n if ((includeZone || includeOffset) && spaceZone) {\n fmt += \" \";\n }\n\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += format === \"basic\" ? \"ZZZ\" : \"ZZ\";\n }\n\n return toTechFormat(dt, fmt);\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\"\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\"\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, zone) {\n // assume we have the higher-order units\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zone.offset(tsNow),\n [ts, o] = objToTS(obj, offsetProvis, zone);\n\n return new DateTime({\n ts,\n zone,\n o\n });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, true);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = unit => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end\n .startOf(unit)\n .diff(start.startOf(unit), unit)\n .get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(0, opts.units[opts.units.length - 1]);\n}\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month},\n * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors.\n * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n const ot = zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({ ts: Settings.now() });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n Settings.defaultZone\n );\n }\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z\n * @return {DateTime}\n */\n static utc(year, month, day, hour, minute, second, millisecond) {\n if (isUndefined(year)) {\n return new DateTime({\n ts: Settings.now(),\n zone: FixedOffsetZone.utcInstance\n });\n } else {\n return quickDT(\n {\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond\n },\n FixedOffsetZone.utcInstance\n );\n }\n }\n\n /**\n * Create a DateTime from a Javascript Date object. Uses the default zone.\n * @param {Date} date - a Javascript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options)\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options)\n });\n }\n }\n\n /**\n * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @return {DateTime}\n */\n static fromObject(obj) {\n const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const tsNow = Settings.now(),\n offsetProvis = zoneToUse.offset(tsNow),\n normalized = normalizeObject(obj, normalizeUnit, [\n \"zone\",\n \"locale\",\n \"outputCalendar\",\n \"numberingSystem\"\n ]),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber,\n loc = Locale.fromObject(obj);\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n }),\n [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is a DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locale: this.locale })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locale: this.locale })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.local().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.universal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOpts(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link reconfigure} and {@link setZone}.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnit, []),\n settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday);\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized));\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized));\n } else {\n mixed = Object.assign(this.toObject(), normalized);\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.local().plus(123) //~> in 123 milliseconds\n * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = friendlyDuration(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit) {\n if (!this.isValid) return this;\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n o.weekday = 1;\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options\n * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.local().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.local().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @example DateTime.local().toLocaleString(); //=> 4/20/2017\n * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'\n * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(opts = Formats.DATE_SHORT) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.local().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @return {string}\n */\n toISO(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toISODate(opts)}T${this.toISOTime(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @return {string}\n */\n toISODate({ format = \"extended\" } = {}) {\n let fmt = format === \"basic\" ? \"yyyyMMdd\" : \"yyyy-MM-dd\";\n if (this.year > 9999) {\n fmt = \"+\" + fmt;\n }\n\n return toTechFormat(this, fmt);\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n format = \"extended\"\n } = {}) {\n return toTechTimeFormat(this, {\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n format\n });\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string}\n */\n toSQLDate() {\n return toTechFormat(this, \"yyyy-MM-dd\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false } = {}) {\n return toTechTimeFormat(this, {\n includeOffset,\n includeZone,\n spaceZone: true\n });\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a Javascript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = Object.assign({}, this.c);\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a Javascript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\n this.invalid || otherDateTime.invalid,\n \"created by diffing an invalid DateTime\"\n );\n }\n\n const durOpts = Object.assign(\n { locale: this.locale, numberingSystem: this.numberingSystem },\n opts\n );\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.local(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit) {\n if (!this.isValid) return false;\n if (unit === \"millisecond\") {\n return this.valueOf() === otherDateTime.valueOf();\n } else {\n const inputMs = otherDateTime.valueOf();\n return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit);\n }\n }\n\n /**\n * Equality check\n * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds down by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.local().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.local().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({ zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n return diffRelative(\n base,\n this.plus(padding),\n Object.assign(options, {\n numeric: \"always\",\n units: [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"]\n })\n );\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.local().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(\n options.base || DateTime.fromObject({ zone: this.zone }),\n this,\n Object.assign(options, {\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true\n })\n );\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, i => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n"],"names":["LuxonError","Error","InvalidDateTimeError","constructor","reason","toMessage","InvalidIntervalError","InvalidDurationError","ConflictingSpecificationError","InvalidUnitError","unit","InvalidArgumentError","ZoneIsAbstractError","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_FULL","DATE_HUGE","weekday","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hour12","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","isUndefined","o","isNumber","isInteger","isString","isDate","Object","prototype","toString","call","hasIntl","Intl","DateTimeFormat","e","hasFormatToParts","formatToParts","hasRelative","RelativeTimeFormat","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","length","undefined","reduce","best","next","pair","pick","obj","keys","a","k","hasOwnProperty","prop","integerBetween","bottom","top","floorMod","x","Math","floor","padStart","input","repeat","slice","parseInteger","string","parseInt","parseMillis","fraction","f","parseFloat","roundTo","number","digits","towardZero","factor","rounder","trunc","round","isLeapYear","daysInYear","daysInMonth","modMonth","modYear","objToLocalTS","d","Date","UTC","millisecond","setUTCFullYear","getUTCFullYear","weeksInWeekYear","weekYear","p1","last","p2","untruncateYear","parseZoneInfo","ts","offsetFormat","locale","timeZone","date","intlOpts","modified","assign","intl","parsed","find","m","type","toLowerCase","value","without","format","included","diffed","substring","trimmed","replace","signedOffset","offHourStr","offMinuteStr","offHour","Number","isNaN","offMin","offMinSigned","is","asNumber","numericValue","normalizeObject","normalizer","nonUnitKeys","normalized","u","indexOf","v","formatOffset","offset","hours","minutes","abs","sign","base","RangeError","timeObject","ianaRegex","stringify","JSON","sort","monthsLong","monthsShort","monthsNarrow","months","weekdaysLong","weekdaysShort","weekdaysNarrow","weekdays","meridiems","erasLong","erasShort","erasNarrow","eras","meridiemForDateTime","dt","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","count","numeric","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","formatString","knownFormat","filtered","key","dateTimeHuge","Formats","stringifyTokens","splits","tokenToString","token","literal","val","macroTokenToFormatOpts","D","DD","DDD","DDDD","t","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","create","opts","parseFormat","fmt","current","currentFull","bracketed","i","c","charAt","push","formatOpts","loc","systemLoc","formatWithSystemDefault","redefaultToSystem","df","dtFormatter","formatDateTime","formatDateTimeParts","resolvedOptions","num","p","forceSimple","padTo","numberFormatter","formatDateTimeFromString","knownEnglish","listingMode","useDateTimeFormatter","outputCalendar","extract","isOffsetFixed","allowZ","isValid","zone","meridiem","English","standalone","maybeMacro","era","offsetName","zoneName","weekNumber","ordinal","quarter","formatDurationFromString","dur","tokenToField","lildur","mapped","get","tokens","realTokens","found","concat","collapsed","shiftTo","map","filter","Invalid","explanation","Zone","name","universal","equals","otherZone","singleton","LocalZone","instance","getTimezoneOffset","matchingRegex","RegExp","source","dtfCache","makeDTF","typeToPos","hackyOffset","dtf","formatted","exec","fMonth","fDay","fYear","fHour","fMinute","fSecond","partsOffset","filled","pos","ianaZoneCache","IANAZone","resetCache","isValidSpecifier","match","isValidZone","parseGMTOffset","specifier","valid","adjustedHour","asUTC","asTS","over","FixedOffsetZone","utcInstance","parseSpecifier","r","fixed","InvalidZone","NaN","normalizeZone","defaultZone","lowered","now","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","throwOnInvalid","Settings","defaultZoneName","z","numberingSystem","resetCaches","Locale","intlDTCache","getCachedDTF","locString","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","cacheKeyOpts","sysLocaleCache","systemLocale","computedSys","parseLocaleString","localeStr","uIndex","options","smaller","calendar","intlConfigString","mapMonths","ms","DateTime","utc","mapWeekdays","listStuff","defaultOK","englishFn","intlFn","mode","supportsFastNumbers","startsWith","PolyNumberFormatter","useGrouping","minimumIntegerDigits","PolyDateFormatter","fromMillis","toJSDate","tokenFormat","PolyRelFormatter","isEnglish","style","rtf","fromOpts","defaultToEN","specifiedLocale","localeR","numberingSystemR","outputCalendarR","fromObject","numbering","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","monthsCache","meridiemCache","eraCache","fastNumbersCached","fastNumbers","hasFTP","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","formatStr","field","results","matching","relFormatter","other","combineRegexes","regexes","full","combineExtractors","extractors","mergedVals","mergedZone","cursor","ex","parse","patterns","regex","extractor","simpleParse","ret","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","extractISOOffset","local","fullOffset","extractIANAZone","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","milliseconds","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDataAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOYmdTimeOffsetAndIANAZone","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","clear","conf","values","conversionAccuracy","Duration","antiTrunc","ceil","convert","matrix","fromMap","fromUnit","toMap","toUnit","conv","raw","sameSign","added","normalizeValues","vals","previous","config","accurate","invalid","isLuxonDuration","normalizeUnit","fromISO","text","week","isDuration","toFormat","fmtOpts","toObject","includeConfig","toISO","toJSON","valueOf","as","plus","duration","friendlyDuration","minus","negate","mapUnits","fn","set","mixed","reconfigure","normalize","built","accumulated","lastUnit","own","ak","down","negated","invalidReason","invalidExplanation","durationish","validateStartEnd","start","end","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","split","isInterval","toDuration","startOf","diff","hasSame","isEmpty","isAfter","dateTime","isBefore","contains","splitAt","dateTimes","sorted","splitBy","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","final","b","sofar","xor","currentCount","ends","time","flattened","difference","toISODate","toISOTime","dateFormat","separator","mapEndpoints","mapFn","Info","hasDST","proto","setZone","isValidIANAZone","monthsFormat","weekdaysFormat","features","intlTokens","zones","relative","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","differ","delta","remainingMillis","lowerOrderUnits","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","parseDigits","str","code","charCodeAt","search","min","max","digitRegex","append","MISSING_FTP","intUnit","post","deser","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","join","findIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","tokenForPart","part","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatter","parts","includes","expandMacroTokens","explainFromTokens","disqualifyingUnit","regexString","rawMatches","parseFromTokens","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","js","getUTCDay","computeOrdinal","uncomputeOrdinal","table","month0","gregorianToWeek","gregObj","weekToGregorian","weekData","weekdayOfJan4","yearInDays","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","hasInvalidWeekData","validYear","validWeek","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","MAX_DATE","unsupportedZone","possiblyCachedWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","toTechTimeFormat","suppressSeconds","suppressMilliseconds","includeOffset","includeZone","spaceZone","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","quickDT","tsNow","offsetProvis","diffRelative","calendary","unchanged","ot","_zone","isLuxonDateTime","fromJSDate","zoneToUse","fromSeconds","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","higherOrderInvalid","gregorian","tsFinal","offsetFinal","fromRFC2822","fromHTTP","fromFormat","localeToUse","fromString","fromSQL","isDateTime","monthShort","monthLong","weekdayShort","weekdayLong","offsetNameShort","offsetNameLong","isInDST","isInLeapYear","resolvedLocaleOpts","toLocal","keepCalendarTime","newTS","offsetGuess","asObj","setLocale","settingWeekStuff","normalizedUnit","endOf","toLocaleString","toLocaleParts","toISOWeekDate","toRFC2822","toHTTP","toSQLDate","toSQLTime","toSQL","toMillis","toSeconds","toBSON","otherDateTime","durOpts","otherIsLater","diffNow","until","inputMs","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","fromStringExplain","dateTimeish"],"mappings":";;;;AAAA;;AAEA;;;AAGA,MAAMA,UAAN,SAAyBC,KAAzB,CAA+B;AAE/B;;;;;AAGO,MAAMC,oBAAN,SAAmCF,UAAnC,CAA8C;AACnDG,EAAAA,WAAW,CAACC,MAAD,EAAS;AAClB,UAAO,qBAAoBA,MAAM,CAACC,SAAP,EAAmB,EAA9C;AACD;;AAHkD;AAMrD;;;;AAGO,MAAMC,oBAAN,SAAmCN,UAAnC,CAA8C;AACnDG,EAAAA,WAAW,CAACC,MAAD,EAAS;AAClB,UAAO,qBAAoBA,MAAM,CAACC,SAAP,EAAmB,EAA9C;AACD;;AAHkD;AAMrD;;;;AAGO,MAAME,oBAAN,SAAmCP,UAAnC,CAA8C;AACnDG,EAAAA,WAAW,CAACC,MAAD,EAAS;AAClB,UAAO,qBAAoBA,MAAM,CAACC,SAAP,EAAmB,EAA9C;AACD;;AAHkD;AAMrD;;;;AAGO,MAAMG,6BAAN,SAA4CR,UAA5C,CAAuD;AAE9D;;;;AAGO,MAAMS,gBAAN,SAA+BT,UAA/B,CAA0C;AAC/CG,EAAAA,WAAW,CAACO,IAAD,EAAO;AAChB,UAAO,gBAAeA,IAAK,EAA3B;AACD;;AAH8C;AAMjD;;;;AAGO,MAAMC,oBAAN,SAAmCX,UAAnC,CAA8C;AAErD;;;;AAGO,MAAMY,mBAAN,SAAkCZ,UAAlC,CAA6C;AAClDG,EAAAA,WAAW,GAAG;AACZ,UAAM,2BAAN;AACD;;AAHiD;;ACxDpD;;;AAIA,MAAMU,CAAC,GAAG,SAAV;AAAA,MACEC,CAAC,GAAG,OADN;AAAA,MAEEC,CAAC,GAAG,MAFN;AAIA,AAAO,MAAMC,UAAU,GAAG;AACxBC,EAAAA,IAAI,EAAEJ,CADkB;AAExBK,EAAAA,KAAK,EAAEL,CAFiB;AAGxBM,EAAA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,QAAQ,CAAC2B,UAAT,CAAoBmf,WAApB,CAAP;AACD,GAFM,MAEA;AACL,UAAM,IAAIh5B,oBAAJ,CACH,8BAA6Bg5B,WAAY,aAAY,OAAOA,WAAY,EADrE,CAAN;AAGD;AACF;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/readme.md b/node_modules/luxon/build/readme.md new file mode 100644 index 0000000..0f48ea9 --- /dev/null +++ b/node_modules/luxon/build/readme.md @@ -0,0 +1 @@ +This contains Luxon's tiny website. Use `npm run site` command to copy it to the build directory. diff --git a/node_modules/luxon/changelog.md b/node_modules/luxon/changelog.md new file mode 100644 index 0000000..448b2f9 --- /dev/null +++ b/node_modules/luxon/changelog.md @@ -0,0 +1,482 @@ +# Changelog + +## 1.22.0 + + * Fix setZone's handling of pre-1970 dates with milisecond components + * Fix keepLocalTime for large jumps near the target zone's DST + * Fix cache perf for toRelative() + +## 1.21.3 + + * Fix parsing of meridiems in macro tokens in newer versions of v8 + +## 1.21.2 + + * Fix bug in Chrome Canary that threw off time zone calculations + +## 1.21.1 + + * Fix for quarter parsing + * Some documentation updates + +## 1.21.0 + + * Added quarter support to the parser + * Fix some rounding issues in ISO formatting + +## 1.20.0 + + * Added Duration#mapUnits + * added Interval#toISODate and Interval#toISOTime + * Some documentation fixes + +## 1.19.3 + + * Cache offset values + * Fix handling of negative sub 1-hour offsets + +## 1.19.2 + + * Speculative fix for Node 6 + +## 1.19.1 + + * Fix Intl.DateTimeFormat usage for polyfills + +## 1.19.0 + + * Interval#splitAt now ignores input dates outside the interval + * Don't allow decimals in DateTime creation + +## 1.18.2 + + * Fix handling of decimals in DateTime#plus and #minus + +## 1.18.1 + + * Fix validity when adding or subtracting time that exceeds Date max/min boundaries + +## 1.18.0 + + * Add support for macro tokens in the parser + +## 1.17.2 + + * Fix issue with `toRelative` using `style: short` with plural days + +## 1.17.1 + + * Reject out-of-range numbers in DateTime.fromMillis + * Reject 0s in ISO date inputs + +## 1.17.0 + + * DateTime.min and DateTime.max throw if they get the wrong kind of arguments + * Fixed throwOnInvalid logic for Interval + * Added `DATETIME_MED_WITH_WEEKDAY` preset + +## 1.16.1 + + * Catch errors trying to use Intl in weird versions of IE 11 + +## 1.16.0 + + * Fixed locale default logic for `DateTime#toFormat("ZZZZ") + +## 1.15.0 + + * Added `formatOffset` to Zones + +## 1.14.0 + + * Allow the zone argument to Interval.fromISO with duration components + * Ignore the zone argument to Duration factory methods + +## 1.13.3 + + * Fix keepLocalTime calculations that span offset changes + +## 1.13.2 + + * Fixed ISO formatting for dates > 999 + +## 1.13.1 + + * Performance improvements for regex parsing + +## 1.13.0 + + * Support numberSystem in fromFormat + * Fix validity for bad initial zone specifiers + +## 1.12.1 + + * Fix cross-month diffs in some scenarios + * Fix time zone parsing when the time zone isn't at the end + * Memoize IANA zone creation + +## 1.12.0 + + * Add some explicit CDN support to the NPM package + * Add week token to duration ISO support + * Lots of cleanup and test coverage changes + +## 1.11.4 + + * `setZone("local")` now returns the defaultZone if it is set + * Fixes for the polyfilled build + +## 1.11.3 + + * Allow 24:00 in ISO (and other) strings + * Fix some bugs with the typecheck functions like `DateTime.isDateTime()` + +## 1.11.2 + + * Fixed handling of some characters in fromFormat literal sections + * Hanlde string values in object arguments to DateTime methods + * Fixed toRelativeCalendar's handling of zones in the base date + +## 1.11.1 + + * Fix DateTime#plus() when spanning across AD 100 + +## 1.11.0 + + * Fix low-year handling for IANA zones + * `DateTime#toLocal()` now uses the default locale + * Fix zero duration formatting + * Many documentation fixes + +## 1.10.0 + +- Fix endOf("day") during DSTs (#399) +- Add `Interval#mapEndpoints (#400) +- Add `DateTime#zone` and `Info.normalizeZone` (#404) + +## 1.9.0 + +- Add `DateTime#toRelative` and `DateTime#toRelativeCalendar` + +## 1.8.3 + +- Allow "UTC" in the zone position of `fromSQL` +- Force `isDateTime` and `isDuration` to return booleans in all cases + +## 1.8.2 + +- Trim leading \u200e characters from offset names in Edge 16 and 17 + +## 1.8.1 + +- Add `DateTime.fromSeconds` and `DateTime#toSeconds` + +## 1.7.1 + +- Floor the seconds instead of rounding them when outputting the 'X' format +- Change the options to toLocale to override the configuration (the previous options were essentially ignored) + +## 1.6.2 + +- Fixing merge error that resulted in bad error messages + +## 1.6.0 + +- **midly breaking** Rework negative durations +- Fix handling weekdays at the end of leap week years +- Add isDuration, isDateTime, and isInterval +- Fix handling of Luxon object arguments passed from other execution contexts + +## 1.5.0 + +- Improved error message +- Added DateTime#invalidExplanation, Duration#invalidExplanation, Interval#invalidExplanation to provide more details on invalid objects + +## 1.4.6 + +- Cache Intl objects for an 85x speed up on basic operations using non-en locales + +## 1.4.5 + +- Fix minified builds + +## 1.4.4 + +- Fix hour formatting in RFC822 strings +- Interval.fromISO accepts formats with durations + +## 1.4.3 + +Removal accidentally-introduced runtime dependency + +## 1.4.2 + +- Handle locale strings with BCP 47 extensions. Especially helpful for environments with funky default locales +- Support for [weekYear]-W[weekNumber] ISO 8601 strings + +## 1.4.1 + +- Empty diffs now have all the asked-for units in them, set at 0 +- Duration operations perserve the superset of units + +## 1.4.0 + +- Add x and X to toFormat for formatting Epoch seconds and Epoch milliseconds +- Parser allows a wider range of IANA zone specifiers +- BREAKING: Etc/GMT+10 is now interpreted as UTC-10, per spec + +## 1.3.3 + +Documentation fixes + +## 1.3.2 + +- DateTime.fromMillis will throw if passed a non-number +- Fixes for type checking across JS contexts + +## 1.3.1 + +- Include milliseconds in Duration#toISO +- Avoid deprecation warning from DateTime#inspect in Node 10 + +## 1.3.0 + +- **mildly breaking change** Duration.toFormat now floors its outputs instead of rounding them (see #224) +- Added 'floor' option to Duration.toFormat and deprecated the 'round' option +- Added `Dateime.toBSON` +- Fixed infinite loop when passing invalid or zero-length durations to Interval#splitBy +- Added better error handling to Duration.fromObject() + +## 1.2.1 + +- 222x speed-up in DateTime creation for non-en locales +- Added `DateTime#toMillis` alias for `DateTime#valueOf` +- Fixed types on zone exports + +## 1.2.0 + +- Export Zone classes +- Fix `endOf` and `startOf` for quarters +- Change `toFormat("Z")` to return a number for UTC +- Allow "GTM" as an argument to `setZone` + +## 1.1.0 + +- Support for zone names with more than two components +- Fixed long-term-accurate conversions for months +- Added `weeksInWeekYear` + +## 1.0.0 + +- The big one-oh. No changes from 0.5.8. + +## 0.5.8 + +- Large perf improvements for `DateTime#toFormat()`, when using non-intl numbers + +## 0.5.7 + +- Added AMD build to the NPM package +- Large performance improvements to technical formatting (e.g. `DateTime#toISO`) + +## 0.5.6 + +- Refactor internals +- Added support for fractional seconds in `Duration.fromISO` +- Added browser global to the NPM package + +## 0.5.5 + +- Best-we-can-do fix for `DateTime#toLocaleString()` for fixed-offset zones when showing the zone name in the output +- Fixed `Duration#shiftTo` for unormalized Durations that need a rollup cascade + +## 0.5.4 + +- Fix default locales in Node +- Fix prototype to help with React inspection +- Improve REPL output for Durations in Node + +## 0.5.3 + +- Remove errant ICU runtime dep (again) + +## 0.5.2 + +- Remove comments from minified builds (introduced by 0.5.1) + +## 0.5.1 + +- Fixed minified builds (oops) +- Fix computation of fractional parts of diffs + +## 0.5.0 + +- `isBefore()` returns true for the end of the interval, consistent with being half-open +- `zoneName` now rturns `null` for invalid DateTimes +- Added quarter support +- Adding a month to Jan 31 gives Feb 28/29 + +## 0.4.0 + +- Always round down to the nearest millisecond when parsing + +## 0.3.1 + +- Fixed `toLocaleString` for fixed-offset zones in the absence of Intl +- Added `Info.isValidIANAZone` +- Made malformed zone specifiers result in invalid DateTime instances + +## 0.3.0 + +- Rename DateTime.fromString to DateTime.fromFormat (leaving deprecated DateTime.fromString) +- Rename DateTime.fromStringExplain to DateTime.fromFormatExplain (leaving deprecated DateTime.fromStringExplain) +- Support Etc/GMT IANA zones +- Perf fixes for zones +- Rework build infrastructure + +## 0.2.12 + +- Fix DateTime.fromObject's handling of default zones +- Change `keepCalendarTime` to `keepLocalTime` + +## 0.2.11 + +- Handle no arguments in `DateTime.min` and `DateTime.max` +- Documentation fixes + +## 0.2.10 + +- Fix bug where Durations could sometimes mutate + +## 0.2.9 + +- Fix `DateTime.fromMillis(0)` more thoroughly + +## 0.2.8 + +- Fix sourcemaps + +## 0.2.7 + +- Fix `DateTime.fromMillis(0)` + +## 0.2.6 + +- Fix 'h' and 'hh' `toFormat` tokens for midnight + +## 0.2.5 + +- Better `shiftTo` behavior for durations with floating point components + +## 0.2.4 + +- Fix `toHTTP` to use 24-hour hours +- Tighten up regular expressions +- Various documentation fixes + +## 0.2.3 + +- Fixes for `diff` with multiple units + +## 0.2.2 + +- Fixes for `fromSQL`, `toSQL`, `toSQLTime`, and `toSQLDate` +- Add `includeOffset` option to `toISO` and `toISOTime` + +## 0.2.1 + +- Add `module` field to package.json + +## 0.2.0 + +- Remove polyfills from main builds +- Update compilation toolchain to target builds more exactly +- Fix IE in polyfill build + +## 0.1.0 + +- Add `.fromSQL`, `#toSQL`, `#toSQLTime`, `#toSQLDate` +- Fix AM/PM parsing +- Major perf improvements +- Default to system locale when using macro formats in `#toFormat` +- `.fromISO` accepts standalone times +- See https://github.com/moment/luxon/issues/93 for important news concerning field accessibility + +## 0.0.22 + +- Add 'u' formatting and parsing +- Add 'y', 'yyyyy', and 'yyyyyy' parsing tokens +- Add 'yyyyyy' formatting token +- Better error messages for missing arguments to `DateTime.fromString` + +## 0.0.21 + +- Fix zones for Edge + +## 0.0.20 + +- Fix `fromISO` to accept various levels of subsecond precision + +## 0.0.19 + +- Fixed parsing for ordinals +- Made parsing stricter + +## 0.0.18 + +- Fixed formatting for non-hour aligned fixed-offset zones +- Fixed longterm conversion accuracy option in diffs +- Fixed invalid handling in `Interval#set` + +## 0.0.17 + +- Fixing formatting for fixed-offset zones + +## 0.0.16 + +- Fixes for IE 9 & 10 + +## 0.0.15 + +- Fixing busted release 0.0.14 + +## 0.0.13 + +- toLocaleString() and others default to the system's locale +- support for ISO week durations in `Duration.fromISO` + +## 0.0.12 + +- Improve non-Intl fallbacks for toLocaleString +- Fix `offsetNameShort` and `offsetNameLong` for non-Intl environments +- Added `weekdayShort`, `weekdayLong`, `monthShort`, `monthLong` DateTime getters + +## 0.0.10 + +- Only include build dir in NPM module + +## 0.0.9 + +- Move to Moment Github org + +## 0.0.8 + +- The local zone can now report its IANA name +- Fixed parsing bug for `yy` and `kk` +- Improved test coverage + +## 0.0.7 + +- Added `toLocaleParts` +- Slightly more friendly month/weekday parsing +- Default locale setting + +## 0.0.6 + +- Stricter `toJSDate` +- `fromISO` now supports `year` and `year-month` formats +- More graceful degradation in the absence of platform features + +## 0.0.5 + +Experimental, but now broadly useful. diff --git a/node_modules/luxon/license.md b/node_modules/luxon/license.md new file mode 100644 index 0000000..2d560a6 --- /dev/null +++ b/node_modules/luxon/license.md @@ -0,0 +1,7 @@ +Copyright 2019 JS Foundation and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/luxon/package.json b/node_modules/luxon/package.json new file mode 100644 index 0000000..0a69040 --- /dev/null +++ b/node_modules/luxon/package.json @@ -0,0 +1,129 @@ +{ + "_from": "luxon@1.22.2", + "_id": "luxon@1.22.2", + "_inBundle": false, + "_integrity": "sha512-vq6eSaOOw1fKob+JXwfu0e3/UFUT4G4HTFRJab7dch8J1OdOGW/vXqCiJsY7rm2In+5gKNYx0EtnYT0Tc5V4Qw==", + "_location": "/luxon", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "luxon@1.22.2", + "name": "luxon", + "escapedName": "luxon", + "rawSpec": "1.22.2", + "saveSpec": null, + "fetchSpec": "1.22.2" + }, + "_requiredBy": [ + "/docker-hub-utils" + ], + "_resolved": "https://registry.npmjs.org/luxon/-/luxon-1.22.2.tgz", + "_shasum": "799d65cc1ed0ba85b4cb3f7dd38fc08a8d1a6750", + "_spec": "luxon@1.22.2", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils", + "author": { + "name": "Isaac Cambron" + }, + "browser": "build/cjs-browser/luxon.js", + "bugs": { + "url": "https://github.com/moment/luxon/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Immutable date wrapper", + "devDependencies": { + "@babel/core": "^7.8.4", + "@babel/node": "^7.8.4", + "@babel/plugin-external-helpers": "^7.8.3", + "@babel/preset-env": "^7.8.4", + "@rollup/plugin-commonjs": "latest", + "@rollup/plugin-node-resolve": "latest", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "latest", + "babel-jest": "^25.1.0", + "benchmark": "latest", + "codecov": ">= 3.6.5", + "core-js": "latest", + "esdoc": "^1.1.0", + "esdoc-standard-plugin": "latest", + "eslint": "6.4.0", + "eslint-config-defaults": "latest", + "eslint-config-prettier": "6.3.0", + "eslint-config-standard": "^14.1.0", + "eslint-plugin-babel": "latest", + "eslint-plugin-import": "^2.20.1", + "eslint-plugin-node": "10.0.0", + "eslint-plugin-prettier": "3.1.1", + "eslint-plugin-promise": "latest", + "eslint-plugin-react": "^7.18.3", + "eslint-plugin-standard": "^4.0.1", + "fs-extra": "^6.0.1", + "full-icu": "^1.3.0", + "husky": "^4.2.1", + "jest": "^25.1.0", + "lint-staged": "^10.0.7", + "prettier": "1.14.3", + "rollup": "^1.31.0", + "rollup-plugin-babel": "latest", + "rollup-plugin-babel-minify": "^6.2.0", + "uglify-js": "^3.7.7" + }, + "engines": { + "node": "*" + }, + "files": [ + "build/node/luxon.js", + "build/node/luxon.js.map", + "build/cjs-browser/luxon.js", + "build/cjs-browser/luxon.js.map", + "build/amd/luxon.js", + "build/amd/luxon.js.map", + "build/global/luxon.js", + "build/global/luxon.js.map", + "build/global/luxon.min.js", + "build/global/luxon.min.js.map", + "src" + ], + "homepage": "https://github.com/moment/luxon#readme", + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "jsdelivr": "build/global/luxon.min.js", + "keywords": [ + "date", + "immutable" + ], + "license": "MIT", + "lint-staged": { + "*.{js,json}": [ + "prettier --write" + ] + }, + "main": "build/node/luxon.js", + "module": "src/luxon.js", + "name": "luxon", + "repository": { + "type": "git", + "url": "git+https://github.com/moment/luxon.git" + }, + "scripts": { + "benchmark": "babel-node benchmarks/datetime.js", + "build": "babel-node tasks/buildAll.js", + "build-global": "babel-node tasks/buildGlobal.js", + "build-node": "babel-node tasks/buildNode.js", + "check-doc-coverage": "babel-node tasks/docCoverage", + "codecov": "codecov", + "docs": "esdoc -c docs/index.js", + "format": "prettier --write 'src/**/*.js' 'test/**/*.js' 'benchmarks/*.js'", + "jest": "jest", + "lint": "eslint --quiet src test benchmarks", + "lint!": "npm run format && npm run lint", + "site": "cp -r site/** build/", + "test": "jest --coverage" + }, + "unpkg": "build/global/luxon.min.js", + "version": "1.22.2" +} diff --git a/node_modules/luxon/src/datetime.js b/node_modules/luxon/src/datetime.js new file mode 100644 index 0000000..c123b85 --- /dev/null +++ b/node_modules/luxon/src/datetime.js @@ -0,0 +1,2114 @@ +import Duration, { friendlyDuration } from "./duration.js"; +import Interval from "./interval.js"; +import Settings from "./settings.js"; +import Info from "./info.js"; +import Formatter from "./impl/formatter.js"; +import FixedOffsetZone from "./zones/fixedOffsetZone.js"; +import Locale from "./impl/locale.js"; +import { + isUndefined, + maybeArray, + isDate, + isNumber, + bestBy, + daysInMonth, + daysInYear, + isLeapYear, + weeksInWeekYear, + normalizeObject, + roundTo, + objToLocalTS +} from "./impl/util.js"; +import { normalizeZone } from "./impl/zoneUtil.js"; +import diff from "./impl/diff.js"; +import { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from "./impl/regexParser.js"; +import { parseFromTokens, explainFromTokens } from "./impl/tokenParser.js"; +import { + gregorianToWeek, + weekToGregorian, + gregorianToOrdinal, + ordinalToGregorian, + hasInvalidGregorianData, + hasInvalidWeekData, + hasInvalidOrdinalData, + hasInvalidTimeData +} from "./impl/conversions.js"; +import * as Formats from "./impl/formats.js"; +import { + InvalidArgumentError, + ConflictingSpecificationError, + InvalidUnitError, + InvalidDateTimeError +} from "./errors.js"; +import Invalid from "./impl/invalid.js"; + +const INVALID = "Invalid DateTime"; +const MAX_DATE = 8.64e15; + +function unsupportedZone(zone) { + return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`); +} + +// we cache week data on the DT object and this intermediates the cache +function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + return dt.weekData; +} + +// clone really means, "make a new object with these modifications". all "setters" really use this +// to create a new object while only changing some of the properties +function clone(inst, alts) { + const current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(Object.assign({}, current, alts, { old: current })); +} + +// find the right offset a given local time. The o input is our guess, which determines which +// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) +function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + let utcGuess = localTS - o * 60 * 1000; + + // Test whether the zone matches the offset for this ts + const o2 = tz.offset(utcGuess); + + // If so, offset didn't change and we're done + if (o === o2) { + return [utcGuess, o]; + } + + // If not, change the ts by the difference in the offset + utcGuess -= (o2 - o) * 60 * 1000; + + // If that gives us the local time we want, we're done + const o3 = tz.offset(utcGuess); + if (o2 === o3) { + return [utcGuess, o2]; + } + + // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; +} + +// convert an epoch timestamp into a calendar object with the given offset +function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + + const d = new Date(ts); + + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; +} + +// convert a calendar object to a epoch timestamp +function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); +} + +// create a new DT instance by adding a duration, adjusting for DSTs +function adjustTime(inst, dur) { + const keys = Object.keys(dur.values); + if (keys.indexOf("milliseconds") === -1) { + keys.push("milliseconds"); + } + + dur = dur.shiftTo(...keys); + + const oPre = inst.o, + year = inst.c.year + dur.years, + month = inst.c.month + dur.months + dur.quarters * 3, + c = Object.assign({}, inst.c, { + year, + month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7 + }), + millisToAdd = Duration.fromObject({ + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + + let [ts, o] = fixOffset(localTS, oPre, inst.zone); + + if (millisToAdd !== 0) { + ts += millisToAdd; + // that could have changed the offset by going over a DST, but we want to keep the ts the same + o = inst.zone.offset(ts); + } + + return { ts, o }; +} + +// helper useful in turning the results of parsing into real dates +// by handling the zone options +function parseDataToDateTime(parsed, parsedZone, opts, format, text) { + const { setZone, zone } = opts; + if (parsed && Object.keys(parsed).length !== 0) { + const interpretationZone = parsedZone || zone, + inst = DateTime.fromObject( + Object.assign(parsed, opts, { + zone: interpretationZone, + // setZone is a valid option in the calling methods, but not in fromObject + setZone: undefined + }) + ); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid( + new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`) + ); + } +} + +// if you want to output a technical format (e.g. RFC 2822), this helper +// helps handle the details +function toTechFormat(dt, format, allowZ = true) { + return dt.isValid + ? Formatter.create(Locale.create("en-US"), { + allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) + : null; +} + +// technical time formats (e.g. the time part of ISO 8601), take some options +// and this commonizes their handling +function toTechTimeFormat( + dt, + { + suppressSeconds = false, + suppressMilliseconds = false, + includeOffset, + includeZone = false, + spaceZone = false, + format = "extended" + } +) { + let fmt = format === "basic" ? "HHmm" : "HH:mm"; + + if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { + fmt += format === "basic" ? "ss" : ":ss"; + if (!suppressMilliseconds || dt.millisecond !== 0) { + fmt += ".SSS"; + } + } + + if ((includeZone || includeOffset) && spaceZone) { + fmt += " "; + } + + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += format === "basic" ? "ZZZ" : "ZZ"; + } + + return toTechFormat(dt, fmt); +} + +// defaults for unspecified units in the supported calendars +const defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; + +// Units in the supported calendars, sorted by bigness +const orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = [ + "weekYear", + "weekNumber", + "weekday", + "hour", + "minute", + "second", + "millisecond" + ], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; + +// standardize case and plurality in units +function normalizeUnit(unit) { + const normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + + if (!normalized) throw new InvalidUnitError(unit); + + return normalized; +} + +// this is a dumbed down version of fromObject() that runs about 60% faster +// but doesn't do any validation, makes a bunch of assumptions about what units +// are present, and so on. +function quickDT(obj, zone) { + // assume we have the higher-order units + for (const u of orderedUnits) { + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } + + const tsNow = Settings.now(), + offsetProvis = zone.offset(tsNow), + [ts, o] = objToTS(obj, offsetProvis, zone); + + return new DateTime({ + ts, + zone, + o + }); +} + +function diffRelative(start, end, opts) { + const round = isUndefined(opts.round) ? true : opts.round, + format = (c, unit) => { + c = roundTo(c, round || opts.calendary ? 0 : 2, true); + const formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = unit => { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end + .startOf(unit) + .diff(start.startOf(unit), unit) + .get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (const unit of opts.units) { + const count = differ(unit); + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + return format(0, opts.units[opts.units.length - 1]); +} + +/** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, + * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. + * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ +export default class DateTime { + /** + * @access private + */ + constructor(config) { + const zone = config.zone || Settings.defaultZone; + + let invalid = + config.invalid || + (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || + (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + + let c = null, + o = null; + if (!invalid) { + const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + [c, o] = [config.old.c, config.old.o]; + } else { + const ot = zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + + /** + * @access private + */ + this._zone = zone; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.invalid = invalid; + /** + * @access private + */ + this.weekData = null; + /** + * @access private + */ + this.c = c; + /** + * @access private + */ + this.o = o; + /** + * @access private + */ + this.isLuxonDateTime = true; + } + + // CONSTRUCT + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + static local(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ ts: Settings.now() }); + } else { + return quickDT( + { + year, + month, + day, + hour, + minute, + second, + millisecond + }, + Settings.defaultZone + ); + } + } + + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @return {DateTime} + */ + static utc(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now(), + zone: FixedOffsetZone.utcInstance + }); + } else { + return quickDT( + { + year, + month, + day, + hour, + minute, + second, + millisecond + }, + FixedOffsetZone.utcInstance + ); + } + } + + /** + * Create a DateTime from a Javascript Date object. Uses the default zone. + * @param {Date} date - a Javascript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + static fromJSDate(date, options = {}) { + const ts = isDate(date) ? date.valueOf() : NaN; + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + const zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromMillis(milliseconds, options = {}) { + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError( + `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}` + ); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromSeconds(seconds, options = {}) { + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @return {DateTime} + */ + static fromObject(obj) { + const zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + const tsNow = Settings.now(), + offsetProvis = zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit, [ + "zone", + "locale", + "outputCalendar", + "numberingSystem" + ]), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber, + loc = Locale.fromObject(obj); + + // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError( + "Can't mix weekYear/weekNumber units with year/month/day or ordinals" + ); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor); + + // configure ourselves to deal with gregorian dates or week stuff + let units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits; + defaultValues = defaultUnitValues; + } + + // set default values for missing stuff + let foundFirst = false; + for (const u of units) { + const v = normalized[u]; + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } + + // make sure the values we have are in range + const higherOrderInvalid = useWeekData + ? hasInvalidWeekData(normalized) + : containsOrdinal + ? hasInvalidOrdinalData(normalized) + : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } + + // compute the actual time + const gregorian = useWeekData + ? weekToGregorian(normalized) + : containsOrdinal + ? ordinalToGregorian(normalized) + : normalized, + [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc + }); + + // gregorian data + weekday serves only to validate + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid( + "mismatched weekday", + `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}` + ); + } + + return inst; + } + + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + static fromISO(text, opts = {}) { + const [vals, parsedZone] = parseISODate(text); + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + static fromRFC2822(text, opts = {}) { + const [vals, parsedZone] = parseRFC2822Date(text); + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + static fromHTTP(text, opts = {}) { + const [vals, parsedZone] = parseHTTPDate(text); + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromFormat(text, fmt, opts = {}) { + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + const { locale = null, numberingSystem = null } = opts, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }), + [vals, parsedZone, invalid] = parseFromTokens(localeToUse, text, fmt); + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text); + } + } + + /** + * @deprecated use fromFormat instead + */ + static fromString(text, fmt, opts = {}) { + return DateTime.fromFormat(text, fmt, opts); + } + + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + static fromSQL(text, opts = {}) { + const [vals, parsedZone] = parseSQL(text); + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ invalid }); + } + } + + /** + * Check if an object is a DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDateTime(o) { + return (o && o.isLuxonDateTime) || false; + } + + // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + get(unit) { + return this[unit]; + } + + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + get isValid() { + return this.invalid === null; + } + + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + get outputCalendar() { + return this.isValid ? this.loc.outputCalendar : null; + } + + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + get zone() { + return this._zone; + } + + /** + * Get the name of the time zone. + * @type {string} + */ + get zoneName() { + return this.isValid ? this.zone.name : null; + } + + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + get year() { + return this.isValid ? this.c.year : NaN; + } + + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + get quarter() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + get month() { + return this.isValid ? this.c.month : NaN; + } + + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + get day() { + return this.isValid ? this.c.day : NaN; + } + + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + get hour() { + return this.isValid ? this.c.hour : NaN; + } + + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + get minute() { + return this.isValid ? this.c.minute : NaN; + } + + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + get second() { + return this.isValid ? this.c.second : NaN; + } + + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + get millisecond() { + return this.isValid ? this.c.millisecond : NaN; + } + + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekYear //=> 2015 + * @type {number} + */ + get weekYear() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + get weekNumber() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + get weekday() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + get ordinal() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + get monthShort() { + return this.isValid ? Info.months("short", { locale: this.locale })[this.month - 1] : null; + } + + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + get monthLong() { + return this.isValid ? Info.months("long", { locale: this.locale })[this.month - 1] : null; + } + + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + get weekdayShort() { + return this.isValid ? Info.weekdays("short", { locale: this.locale })[this.weekday - 1] : null; + } + + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + get weekdayLong() { + return this.isValid ? Info.weekdays("long", { locale: this.locale })[this.weekday - 1] : null; + } + + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.local().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + get offset() { + return this.isValid ? +this.o : NaN; + } + + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameShort() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameLong() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + get isOffsetFixed() { + return this.isValid ? this.zone.universal : null; + } + + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + get isInDST() { + if (this.isOffsetFixed) { + return false; + } else { + return ( + this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset + ); + } + } + + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + get isInLeapYear() { + return isLeapYear(this.year); + } + + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + get daysInMonth() { + return daysInMonth(this.year, this.month); + } + + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + get daysInYear() { + return this.isValid ? daysInYear(this.year) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + get weeksInWeekYear() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + resolvedLocaleOpts(opts = {}) { + const { locale, numberingSystem, calendar } = Formatter.create( + this.loc.clone(opts), + opts + ).resolvedOptions(this); + return { locale, numberingSystem, outputCalendar: calendar }; + } + + // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + toUTC(offset = 0, opts = {}) { + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + toLocal() { + return this.setZone(Settings.defaultZone); + } + + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) { + zone = normalizeZone(zone, Settings.defaultZone); + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + let newTS = this.ts; + if (keepLocalTime || keepCalendarTime) { + const offsetGuess = zone.offset(this.ts); + const asObj = this.toObject(); + [newTS] = objToTS(asObj, offsetGuess, zone); + } + return clone(this, { ts: newTS, zone }); + } + } + + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + reconfigure({ locale, numberingSystem, outputCalendar } = {}) { + const loc = this.loc.clone({ locale, numberingSystem, outputCalendar }); + return clone(this, { loc }); + } + + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + setLocale(locale) { + return this.reconfigure({ locale }); + } + + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + set(values) { + if (!this.isValid) return this; + + const normalized = normalizeObject(values, normalizeUnit, []), + settingWeekStuff = + !isUndefined(normalized.weekYear) || + !isUndefined(normalized.weekNumber) || + !isUndefined(normalized.weekday); + + let mixed; + if (settingWeekStuff) { + mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + } else { + mixed = Object.assign(this.toObject(), normalized); + + // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + const [ts, o] = objToTS(mixed, this.o, this.zone); + return clone(this, { ts, o }); + } + + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.local().plus(123) //~> in 123 milliseconds + * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + plus(duration) { + if (!this.isValid) return this; + const dur = friendlyDuration(duration); + return clone(this, adjustTime(this, dur)); + } + + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + minus(duration) { + if (!this.isValid) return this; + const dur = friendlyDuration(duration).negate(); + return clone(this, adjustTime(this, dur)); + } + + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + startOf(unit) { + if (!this.isValid) return this; + const o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + case "quarters": + case "months": + o.day = 1; + // falls through + case "weeks": + case "days": + o.hour = 0; + // falls through + case "hours": + o.minute = 0; + // falls through + case "minutes": + o.second = 0; + // falls through + case "seconds": + o.millisecond = 0; + break; + case "milliseconds": + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + o.weekday = 1; + } + + if (normalizedUnit === "quarters") { + const q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + endOf(unit) { + return this.isValid + ? this.plus({ [unit]: 1 }) + .startOf(unit) + .minus(1) + : this; + } + + // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options + * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + toFormat(fmt, opts = {}) { + return this.isValid + ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) + : INVALID; + } + + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @example DateTime.local().toLocaleString(); //=> 4/20/2017 + * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' + * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' + * @return {string} + */ + toLocaleString(opts = Formats.DATE_SHORT) { + return this.isValid + ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) + : INVALID; + } + + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.local().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + toLocaleParts(opts = {}) { + return this.isValid + ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) + : []; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + toISO(opts = {}) { + if (!this.isValid) { + return null; + } + + return `${this.toISODate(opts)}T${this.toISOTime(opts)}`; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + toISODate({ format = "extended" } = {}) { + let fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; + if (this.year > 9999) { + fmt = "+" + fmt; + } + + return toTechFormat(this, fmt); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @return {string} + */ + toISOTime({ + suppressMilliseconds = false, + suppressSeconds = false, + includeOffset = true, + format = "extended" + } = {}) { + return toTechTimeFormat(this, { + suppressSeconds, + suppressMilliseconds, + includeOffset, + format + }); + } + + /** + * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + toSQLDate() { + return toTechFormat(this, "yyyy-MM-dd"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + toSQLTime({ includeOffset = true, includeZone = false } = {}) { + return toTechTimeFormat(this, { + includeOffset, + includeZone, + spaceZone: true + }); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + toSQL(opts = {}) { + if (!this.isValid) { + return null; + } + + return `${this.toSQLDate()} ${this.toSQLTime(opts)}`; + } + + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + toString() { + return this.isValid ? this.toISO() : INVALID; + } + + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + toMillis() { + return this.isValid ? this.ts : NaN; + } + + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + toBSON() { + return this.toJSDate(); + } + + /** + * Returns a Javascript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + toObject(opts = {}) { + if (!this.isValid) return {}; + + const base = Object.assign({}, this.c); + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns a Javascript Date equivalent to this DateTime. + * @return {Date} + */ + toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + + // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + diff(otherDateTime, unit = "milliseconds", opts = {}) { + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid( + this.invalid || otherDateTime.invalid, + "created by diffing an invalid DateTime" + ); + } + + const durOpts = Object.assign( + { locale: this.locale, numberingSystem: this.numberingSystem }, + opts + ); + + const units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = diff(earlier, later, units, durOpts); + + return otherIsLater ? diffed.negate() : diffed; + } + + /** + * Return the difference between this DateTime and right now. + * See {@link diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + diffNow(unit = "milliseconds", opts = {}) { + return this.diff(DateTime.local(), unit, opts); + } + + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + + /** + * Return whether this DateTime is in the same unit of time as another DateTime + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day + * @return {boolean} + */ + hasSame(otherDateTime, unit) { + if (!this.isValid) return false; + if (unit === "millisecond") { + return this.valueOf() === otherDateTime.valueOf(); + } else { + const inputMs = otherDateTime.valueOf(); + return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit); + } + } + + /** + * Equality check + * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + equals(other) { + return ( + this.isValid && + other.isValid && + this.valueOf() === other.valueOf() && + this.zone.equals(other.zone) && + this.loc.equals(other.loc) + ); + } + + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + toRelative(options = {}) { + if (!this.isValid) return null; + const base = options.base || DateTime.fromObject({ zone: this.zone }), + padding = options.padding ? (this < base ? -options.padding : options.padding) : 0; + return diffRelative( + base, + this.plus(padding), + Object.assign(options, { + numeric: "always", + units: ["years", "months", "days", "hours", "minutes", "seconds"] + }) + ); + } + + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + toRelativeCalendar(options = {}) { + if (!this.isValid) return null; + + return diffRelative( + options.base || DateTime.fromObject({ zone: this.zone }), + this, + Object.assign(options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + }) + ); + } + + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + static min(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + return bestBy(dateTimes, i => i.valueOf(), Math.min); + } + + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + static max(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + return bestBy(dateTimes, i => i.valueOf(), Math.max); + } + + // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + static fromFormatExplain(text, fmt, options = {}) { + const { locale = null, numberingSystem = null } = options, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + + /** + * @deprecated use fromFormatExplain instead + */ + static fromStringExplain(text, fmt, options = {}) { + return DateTime.fromFormatExplain(text, fmt, options); + } + + // FORMAT PRESETS + + /** + * {@link toLocaleString} format like 10/14/1983 + * @type {Object} + */ + static get DATE_SHORT() { + return Formats.DATE_SHORT; + } + + /** + * {@link toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED() { + return Formats.DATE_MED; + } + + /** + * {@link toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + static get DATE_FULL() { + return Formats.DATE_FULL; + } + + /** + * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + static get DATE_HUGE() { + return Formats.DATE_HUGE; + } + + /** + * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_SIMPLE() { + return Formats.TIME_SIMPLE; + } + + /** + * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SECONDS() { + return Formats.TIME_WITH_SECONDS; + } + + /** + * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SHORT_OFFSET() { + return Formats.TIME_WITH_SHORT_OFFSET; + } + + /** + * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_LONG_OFFSET() { + return Formats.TIME_WITH_LONG_OFFSET; + } + + /** + * {@link toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + static get TIME_24_SIMPLE() { + return Formats.TIME_24_SIMPLE; + } + + /** + * {@link toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SECONDS() { + return Formats.TIME_24_WITH_SECONDS; + } + + /** + * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SHORT_OFFSET() { + return Formats.TIME_24_WITH_SHORT_OFFSET; + } + + /** + * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_LONG_OFFSET() { + return Formats.TIME_24_WITH_LONG_OFFSET; + } + + /** + * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT() { + return Formats.DATETIME_SHORT; + } + + /** + * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT_WITH_SECONDS() { + return Formats.DATETIME_SHORT_WITH_SECONDS; + } + + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED() { + return Formats.DATETIME_MED; + } + + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_SECONDS() { + return Formats.DATETIME_MED_WITH_SECONDS; + } + + /** + * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_WEEKDAY() { + return Formats.DATETIME_MED_WITH_WEEKDAY; + } + + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL() { + return Formats.DATETIME_FULL; + } + + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL_WITH_SECONDS() { + return Formats.DATETIME_FULL_WITH_SECONDS; + } + + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE() { + return Formats.DATETIME_HUGE; + } + + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE_WITH_SECONDS() { + return Formats.DATETIME_HUGE_WITH_SECONDS; + } +} + +/** + * @private + */ +export function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError( + `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}` + ); + } +} diff --git a/node_modules/luxon/src/duration.js b/node_modules/luxon/src/duration.js new file mode 100644 index 0000000..ad973ea --- /dev/null +++ b/node_modules/luxon/src/duration.js @@ -0,0 +1,788 @@ +import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from "./errors.js"; +import Formatter from "./impl/formatter.js"; +import Invalid from "./impl/invalid.js"; +import Locale from "./impl/locale.js"; +import { parseISODuration } from "./impl/regexParser.js"; +import { + asNumber, + hasOwnProperty, + isNumber, + isUndefined, + normalizeObject, + roundTo +} from "./impl/util.js"; +import Settings from "./settings.js"; + +const INVALID = "Invalid Duration"; + +// unit conversion constants +const lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 }, + minutes: { seconds: 60, milliseconds: 60 * 1000 }, + seconds: { milliseconds: 1000 } + }, + casualMatrix = Object.assign( + { + years: { + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, + lowOrderMatrix + ), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = Object.assign( + { + years: { + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: (daysInYearAccurate * 24) / 4, + minutes: (daysInYearAccurate * 24 * 60) / 4, + seconds: (daysInYearAccurate * 24 * 60 * 60) / 4, + milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, + lowOrderMatrix + ); + +// units ordered by size +const orderedUnits = [ + "years", + "quarters", + "months", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds" +]; + +const reverseUnits = orderedUnits.slice(0).reverse(); + +// clone really means "create another instance just like this one, but with these changes" +function clone(dur, alts, clear = false) { + // deep merge for vals + const conf = { + values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy + }; + return new Duration(conf); +} + +function antiTrunc(n) { + return n < 0 ? Math.floor(n) : Math.ceil(n); +} + +// NB: mutates parameters +function convert(matrix, fromMap, fromUnit, toMap, toUnit) { + const conv = matrix[toUnit][fromUnit], + raw = fromMap[fromUnit] / conv, + sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), + // ok, so this is wild, but see the matrix in the tests + added = + !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); + toMap[toUnit] += added; + fromMap[fromUnit] -= added * conv; +} + +// NB: mutates parameters +function normalizeValues(matrix, vals) { + reverseUnits.reduce((previous, current) => { + if (!isUndefined(vals[current])) { + if (previous) { + convert(matrix, vals, previous, vals, current); + } + return current; + } else { + return previous; + } + }, null); +} + +/** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. + * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ +export default class Duration { + /** + * @private + */ + constructor(config) { + const accurate = config.conversionAccuracy === "longterm" || false; + /** + * @access private + */ + this.values = config.values; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.matrix = accurate ? accurateMatrix : casualMatrix; + /** + * @access private + */ + this.isLuxonDuration = true; + } + + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + static fromMillis(count, opts) { + return Duration.fromObject(Object.assign({ milliseconds: count }, opts)); + } + + /** + * Create a Duration from a Javascript object with keys like 'years' and 'hours. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {string} [obj.locale='en-US'] - the locale to use + * @param {string} obj.numberingSystem - the numbering system to use + * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + static fromObject(obj) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError( + `Duration.fromObject: argument expected to be an object, got ${ + obj === null ? "null" : typeof obj + }` + ); + } + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit, [ + "locale", + "numberingSystem", + "conversionAccuracy", + "zone" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this + ]), + loc: Locale.fromObject(obj), + conversionAccuracy: obj.conversionAccuracy + }); + } + + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + static fromISO(text, opts) { + const [parsed] = parseISODuration(text); + if (parsed) { + const obj = Object.assign(parsed, opts); + return Duration.fromObject(obj); + } else { + return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + } + + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ invalid }); + } + } + + /** + * @private + */ + static normalizeUnit(unit) { + const normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + + if (!normalized) throw new InvalidUnitError(unit); + + return normalized; + } + + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDuration(o) { + return (o && o.isLuxonDuration) || false; + } + + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + toFormat(fmt, opts = {}) { + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + const fmtOpts = Object.assign({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid + ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) + : INVALID; + } + + /** + * Returns a Javascript object with this Duration's values. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + toObject(opts = {}) { + if (!this.isValid) return {}; + + const base = Object.assign({}, this.values); + + if (opts.includeConfig) { + base.conversionAccuracy = this.conversionAccuracy; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + + let s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) + s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) + // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + toString() { + return this.toISO(); + } + + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + valueOf() { + return this.as("milliseconds"); + } + + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + plus(duration) { + if (!this.isValid) return this; + + const dur = friendlyDuration(duration), + result = {}; + + for (const k of orderedUnits) { + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone(this, { values: result }, true); + } + + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + minus(duration) { + if (!this.isValid) return this; + + const dur = friendlyDuration(duration); + return this.plus(dur.negate()); + } + + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + mapUnits(fn) { + if (!this.isValid) return this; + const result = {}; + for (const k of Object.keys(this.values)) { + result[k] = asNumber(fn(this.values[k], k)); + } + return clone(this, { values: result }, true); + } + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).years //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).months //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).days //=> 3 + * @return {number} + */ + get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + set(values) { + if (!this.isValid) return this; + + const mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, [])); + return clone(this, { values: mixed }); + } + + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + reconfigure({ locale, numberingSystem, conversionAccuracy } = {}) { + const loc = this.loc.clone({ locale, numberingSystem }), + opts = { loc }; + + if (conversionAccuracy) { + opts.conversionAccuracy = conversionAccuracy; + } + + return clone(this, opts); + } + + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + + /** + * Reduce this Duration to its canonical representation in its current units. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @return {Duration} + */ + normalize() { + if (!this.isValid) return this; + const vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone(this, { values: vals }, true); + } + + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + shiftTo(...units) { + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map(u => Duration.normalizeUnit(u)); + + const built = {}, + accumulated = {}, + vals = this.toObject(); + let lastUnit; + + normalizeValues(this.matrix, vals); + + for (const k of orderedUnits) { + if (units.indexOf(k) >= 0) { + lastUnit = k; + + let own = 0; + + // anything we haven't boiled down yet should get boiled to this unit + for (const ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } + + // plus anything that's already in this unit + if (isNumber(vals[k])) { + own += vals[k]; + } + + const i = Math.trunc(own); + built[k] = i; + accumulated[k] = own - i; // we'd like to absorb these fractions in another unit + + // plus anything further down the chain that should be rolled up in to this + for (const down in vals) { + if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { + convert(this.matrix, vals, down, built, k); + } + } + // otherwise, keep it in the wings to boil it later + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } + + // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + for (const key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += + key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + return clone(this, { values: built }, true).normalize(); + } + + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + negate() { + if (!this.isValid) return this; + const negated = {}; + for (const k of Object.keys(this.values)) { + negated[k] = -this.values[k]; + } + return clone(this, { values: negated }, true); + } + + /** + * Get the years. + * @type {number} + */ + get years() { + return this.isValid ? this.values.years || 0 : NaN; + } + + /** + * Get the quarters. + * @type {number} + */ + get quarters() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + + /** + * Get the months. + * @type {number} + */ + get months() { + return this.isValid ? this.values.months || 0 : NaN; + } + + /** + * Get the weeks + * @type {number} + */ + get weeks() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + + /** + * Get the days. + * @type {number} + */ + get days() { + return this.isValid ? this.values.days || 0 : NaN; + } + + /** + * Get the hours. + * @type {number} + */ + get hours() { + return this.isValid ? this.values.hours || 0 : NaN; + } + + /** + * Get the minutes. + * @type {number} + */ + get minutes() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + + /** + * Get the seconds. + * @return {number} + */ + get seconds() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + + /** + * Get the milliseconds. + * @return {number} + */ + get milliseconds() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + get isValid() { + return this.invalid === null; + } + + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + for (const u of orderedUnits) { + if (this.values[u] !== other.values[u]) { + return false; + } + } + return true; + } +} + +/** + * @private + */ +export function friendlyDuration(durationish) { + if (isNumber(durationish)) { + return Duration.fromMillis(durationish); + } else if (Duration.isDuration(durationish)) { + return durationish; + } else if (typeof durationish === "object") { + return Duration.fromObject(durationish); + } else { + throw new InvalidArgumentError( + `Unknown duration argument ${durationish} of type ${typeof durationish}` + ); + } +} diff --git a/node_modules/luxon/src/errors.js b/node_modules/luxon/src/errors.js new file mode 100644 index 0000000..c1f363e --- /dev/null +++ b/node_modules/luxon/src/errors.js @@ -0,0 +1,61 @@ +// these aren't really private, but nor are they really useful to document + +/** + * @private + */ +class LuxonError extends Error {} + +/** + * @private + */ +export class InvalidDateTimeError extends LuxonError { + constructor(reason) { + super(`Invalid DateTime: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +export class InvalidIntervalError extends LuxonError { + constructor(reason) { + super(`Invalid Interval: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +export class InvalidDurationError extends LuxonError { + constructor(reason) { + super(`Invalid Duration: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +export class ConflictingSpecificationError extends LuxonError {} + +/** + * @private + */ +export class InvalidUnitError extends LuxonError { + constructor(unit) { + super(`Invalid unit ${unit}`); + } +} + +/** + * @private + */ +export class InvalidArgumentError extends LuxonError {} + +/** + * @private + */ +export class ZoneIsAbstractError extends LuxonError { + constructor() { + super("Zone is an abstract class"); + } +} diff --git a/node_modules/luxon/src/impl/conversions.js b/node_modules/luxon/src/impl/conversions.js new file mode 100644 index 0000000..cbe7172 --- /dev/null +++ b/node_modules/luxon/src/impl/conversions.js @@ -0,0 +1,157 @@ +import { + integerBetween, + isLeapYear, + timeObject, + daysInYear, + daysInMonth, + weeksInWeekYear, + isInteger +} from "./util.js"; +import Invalid from "./invalid.js"; + +const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + +function unitOutOfRange(unit, value) { + return new Invalid( + "unit out of range", + `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid` + ); +} + +function dayOfWeek(year, month, day) { + const js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); + return js === 0 ? 7 : js; +} + +function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; +} + +function uncomputeOrdinal(year, ordinal) { + const table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(i => i < ordinal), + day = ordinal - table[month0]; + return { month: month0 + 1, day }; +} + +/** + * @private + */ + +export function gregorianToWeek(gregObj) { + const { year, month, day } = gregObj, + ordinal = computeOrdinal(year, month, day), + weekday = dayOfWeek(year, month, day); + + let weekNumber = Math.floor((ordinal - weekday + 10) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear); + } else if (weekNumber > weeksInWeekYear(year)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return Object.assign({ weekYear, weekNumber, weekday }, timeObject(gregObj)); +} + +export function weekToGregorian(weekData) { + const { weekYear, weekNumber, weekday } = weekData, + weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), + yearInDays = daysInYear(weekYear); + + let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + const { month, day } = uncomputeOrdinal(year, ordinal); + + return Object.assign({ year, month, day }, timeObject(weekData)); +} + +export function gregorianToOrdinal(gregData) { + const { year, month, day } = gregData, + ordinal = computeOrdinal(year, month, day); + + return Object.assign({ year, ordinal }, timeObject(gregData)); +} + +export function ordinalToGregorian(ordinalData) { + const { year, ordinal } = ordinalData, + { month, day } = uncomputeOrdinal(year, ordinal); + + return Object.assign({ year, month, day }, timeObject(ordinalData)); +} + +export function hasInvalidWeekData(obj) { + const validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.week); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; +} + +export function hasInvalidOrdinalData(obj) { + const validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; +} + +export function hasInvalidGregorianData(obj) { + const validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; +} + +export function hasInvalidTimeData(obj) { + const { hour, minute, second, millisecond } = obj; + const validHour = + integerBetween(hour, 0, 23) || + (hour === 24 && minute === 0 && second === 0 && millisecond === 0), + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; +} diff --git a/node_modules/luxon/src/impl/diff.js b/node_modules/luxon/src/impl/diff.js new file mode 100644 index 0000000..57246dc --- /dev/null +++ b/node_modules/luxon/src/impl/diff.js @@ -0,0 +1,79 @@ +import Duration from "../duration.js"; + +function dayDiff(earlier, later) { + const utcDayStart = dt => + dt + .toUTC(0, { keepLocalTime: true }) + .startOf("day") + .valueOf(), + ms = utcDayStart(later) - utcDayStart(earlier); + return Math.floor(Duration.fromMillis(ms).as("days")); +} + +function highOrderDiffs(cursor, later, units) { + const differs = [ + ["years", (a, b) => b.year - a.year], + ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12], + [ + "weeks", + (a, b) => { + const days = dayDiff(a, b); + return (days - (days % 7)) / 7; + } + ], + ["days", dayDiff] + ]; + + const results = {}; + let lowestOrder, highWater; + + for (const [unit, differ] of differs) { + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + + let delta = differ(cursor, later); + highWater = cursor.plus({ [unit]: delta }); + + if (highWater > later) { + cursor = cursor.plus({ [unit]: delta - 1 }); + delta -= 1; + } else { + cursor = highWater; + } + + results[unit] = delta; + } + } + + return [cursor, results, highWater, lowestOrder]; +} + +export default function(earlier, later, units, opts) { + let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units); + + const remainingMillis = later - cursor; + + const lowerOrderUnits = units.filter( + u => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0 + ); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + highWater = cursor.plus({ [lowestOrder]: 1 }); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + const duration = Duration.fromObject(Object.assign(results, opts)); + + if (lowerOrderUnits.length > 0) { + return Duration.fromMillis(remainingMillis, opts) + .shiftTo(...lowerOrderUnits) + .plus(duration); + } else { + return duration; + } +} diff --git a/node_modules/luxon/src/impl/digits.js b/node_modules/luxon/src/impl/digits.js new file mode 100644 index 0000000..0d081c2 --- /dev/null +++ b/node_modules/luxon/src/impl/digits.js @@ -0,0 +1,76 @@ +const numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" +}; + +const numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] +}; + +// eslint-disable-next-line +const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + +export function parseDigits(str) { + let value = parseInt(str, 10); + if (isNaN(value)) { + value = ""; + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (const key in numberingSystemsUTF16) { + const [min, max] = numberingSystemsUTF16[key]; + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + return parseInt(value, 10); + } else { + return value; + } +} + +export function digitRegex({ numberingSystem }, append = "") { + return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`); +} diff --git a/node_modules/luxon/src/impl/english.js b/node_modules/luxon/src/impl/english.js new file mode 100644 index 0000000..100d579 --- /dev/null +++ b/node_modules/luxon/src/impl/english.js @@ -0,0 +1,231 @@ +import * as Formats from "./formats.js"; +import { pick } from "./util.js"; + +function stringify(obj) { + return JSON.stringify(obj, Object.keys(obj).sort()); +} + +/** + * @private + */ + +export const monthsLong = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; + +export const monthsShort = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" +]; + +export const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + +export function months(length) { + switch (length) { + case "narrow": + return monthsNarrow; + case "short": + return monthsShort; + case "long": + return monthsLong; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } +} + +export const weekdaysLong = [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" +]; + +export const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + +export const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + +export function weekdays(length) { + switch (length) { + case "narrow": + return weekdaysNarrow; + case "short": + return weekdaysShort; + case "long": + return weekdaysLong; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } +} + +export const meridiems = ["AM", "PM"]; + +export const erasLong = ["Before Christ", "Anno Domini"]; + +export const erasShort = ["BC", "AD"]; + +export const erasNarrow = ["B", "A"]; + +export function eras(length) { + switch (length) { + case "narrow": + return erasNarrow; + case "short": + return erasShort; + case "long": + return erasLong; + default: + return null; + } +} + +export function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; +} + +export function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; +} + +export function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; +} + +export function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; +} + +export function formatRelativeTime(unit, count, numeric = "always", narrow = false) { + const units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + + const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + const isDay = unit === "days"; + switch (count) { + case 1: + return isDay ? "tomorrow" : `next ${units[unit][0]}`; + case -1: + return isDay ? "yesterday" : `last ${units[unit][0]}`; + case 0: + return isDay ? "today" : `this ${units[unit][0]}`; + default: // fall through + } + } + + const isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow + ? singular + ? lilUnits[1] + : lilUnits[2] || lilUnits[1] + : singular + ? units[unit][0] + : unit; + return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`; +} + +export function formatString(knownFormat) { + // these all have the offsets removed because we don't have access to them + // without all the intl stuff this is backfilling + const filtered = pick(knownFormat, [ + "weekday", + "era", + "year", + "month", + "day", + "hour", + "minute", + "second", + "timeZoneName", + "hour12" + ]), + key = stringify(filtered), + dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; + switch (key) { + case stringify(Formats.DATE_SHORT): + return "M/d/yyyy"; + case stringify(Formats.DATE_MED): + return "LLL d, yyyy"; + case stringify(Formats.DATE_FULL): + return "LLLL d, yyyy"; + case stringify(Formats.DATE_HUGE): + return "EEEE, LLLL d, yyyy"; + case stringify(Formats.TIME_SIMPLE): + return "h:mm a"; + case stringify(Formats.TIME_WITH_SECONDS): + return "h:mm:ss a"; + case stringify(Formats.TIME_WITH_SHORT_OFFSET): + return "h:mm a"; + case stringify(Formats.TIME_WITH_LONG_OFFSET): + return "h:mm a"; + case stringify(Formats.TIME_24_SIMPLE): + return "HH:mm"; + case stringify(Formats.TIME_24_WITH_SECONDS): + return "HH:mm:ss"; + case stringify(Formats.TIME_24_WITH_SHORT_OFFSET): + return "HH:mm"; + case stringify(Formats.TIME_24_WITH_LONG_OFFSET): + return "HH:mm"; + case stringify(Formats.DATETIME_SHORT): + return "M/d/yyyy, h:mm a"; + case stringify(Formats.DATETIME_MED): + return "LLL d, yyyy, h:mm a"; + case stringify(Formats.DATETIME_FULL): + return "LLLL d, yyyy, h:mm a"; + case stringify(Formats.DATETIME_HUGE): + return dateTimeHuge; + case stringify(Formats.DATETIME_SHORT_WITH_SECONDS): + return "M/d/yyyy, h:mm:ss a"; + case stringify(Formats.DATETIME_MED_WITH_SECONDS): + return "LLL d, yyyy, h:mm:ss a"; + case stringify(Formats.DATETIME_MED_WITH_WEEKDAY): + return "EEE, d LLL yyyy, h:mm a"; + case stringify(Formats.DATETIME_FULL_WITH_SECONDS): + return "LLLL d, yyyy, h:mm:ss a"; + case stringify(Formats.DATETIME_HUGE_WITH_SECONDS): + return "EEEE, LLLL d, yyyy, h:mm:ss a"; + default: + return dateTimeHuge; + } +} diff --git a/node_modules/luxon/src/impl/formats.js b/node_modules/luxon/src/impl/formats.js new file mode 100644 index 0000000..8c66b9a --- /dev/null +++ b/node_modules/luxon/src/impl/formats.js @@ -0,0 +1,184 @@ +/** + * @private + */ + +const n = "numeric", + s = "short", + l = "long"; + +export const DATE_SHORT = { + year: n, + month: n, + day: n +}; + +export const DATE_MED = { + year: n, + month: s, + day: n +}; + +export const DATE_FULL = { + year: n, + month: l, + day: n +}; + +export const DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l +}; + +export const TIME_SIMPLE = { + hour: n, + minute: n +}; + +export const TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n +}; + +export const TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s +}; + +export const TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l +}; + +export const TIME_24_SIMPLE = { + hour: n, + minute: n, + hour12: false +}; + +/** + * {@link toLocaleString}; format like '09:30:23', always 24-hour. + */ +export const TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hour12: false +}; + +/** + * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour. + */ +export const TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: s +}; + +/** + * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour. + */ +export const TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: l +}; + +/** + * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + */ +export const DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n +}; + +/** + * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + */ +export const DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n +}; + +export const DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n +}; + +export const DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n +}; + +export const DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n +}; + +export const DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s +}; + +export const DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s +}; + +export const DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l +}; + +export const DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l +}; diff --git a/node_modules/luxon/src/impl/formatter.js b/node_modules/luxon/src/impl/formatter.js new file mode 100644 index 0000000..98872f9 --- /dev/null +++ b/node_modules/luxon/src/impl/formatter.js @@ -0,0 +1,386 @@ +import * as English from "./english.js"; +import * as Formats from "./formats.js"; +import { hasFormatToParts, padStart } from "./util.js"; + +function stringifyTokens(splits, tokenToString) { + let s = ""; + for (const token of splits) { + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + return s; +} + +const macroTokenToFormatOpts = { + D: Formats.DATE_SHORT, + DD: Formats.DATE_MED, + DDD: Formats.DATE_FULL, + DDDD: Formats.DATE_HUGE, + t: Formats.TIME_SIMPLE, + tt: Formats.TIME_WITH_SECONDS, + ttt: Formats.TIME_WITH_SHORT_OFFSET, + tttt: Formats.TIME_WITH_LONG_OFFSET, + T: Formats.TIME_24_SIMPLE, + TT: Formats.TIME_24_WITH_SECONDS, + TTT: Formats.TIME_24_WITH_SHORT_OFFSET, + TTTT: Formats.TIME_24_WITH_LONG_OFFSET, + f: Formats.DATETIME_SHORT, + ff: Formats.DATETIME_MED, + fff: Formats.DATETIME_FULL, + ffff: Formats.DATETIME_HUGE, + F: Formats.DATETIME_SHORT_WITH_SECONDS, + FF: Formats.DATETIME_MED_WITH_SECONDS, + FFF: Formats.DATETIME_FULL_WITH_SECONDS, + FFFF: Formats.DATETIME_HUGE_WITH_SECONDS +}; + +/** + * @private + */ + +export default class Formatter { + static create(locale, opts = {}) { + return new Formatter(locale, opts); + } + + static parseFormat(fmt) { + let current = null, + currentFull = "", + bracketed = false; + const splits = []; + for (let i = 0; i < fmt.length; i++) { + const c = fmt.charAt(i); + if (c === "'") { + if (currentFull.length > 0) { + splits.push({ literal: bracketed, val: currentFull }); + } + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ literal: false, val: currentFull }); + } + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ literal: bracketed, val: currentFull }); + } + + return splits; + } + + static macroTokenToFormatOpts(token) { + return macroTokenToFormatOpts[token]; + } + + constructor(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + const df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + } + + formatDateTime(dt, opts = {}) { + const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + } + + formatDateTimeParts(dt, opts = {}) { + const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.formatToParts(); + } + + resolvedOptions(dt, opts = {}) { + const df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.resolvedOptions(); + } + + num(n, p = 0) { + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + const opts = Object.assign({}, this.opts); + + if (p > 0) { + opts.padTo = p; + } + + return this.loc.numberFormatter(opts).format(n); + } + + formatDateTimeFromString(dt, fmt) { + const knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = + this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), + string = (opts, extract) => this.loc.extract(dt, opts, extract), + formatOffset = opts => { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = () => + knownEnglish + ? English.meridiemForDateTime(dt) + : string({ hour: "numeric", hour12: true }, "dayperiod"), + month = (length, standalone) => + knownEnglish + ? English.monthForDateTime(dt, length) + : string(standalone ? { month: length } : { month: length, day: "numeric" }, "month"), + weekday = (length, standalone) => + knownEnglish + ? English.weekdayForDateTime(dt, length) + : string( + standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" }, + "weekday" + ), + maybeMacro = token => { + const formatOpts = Formatter.macroTokenToFormatOpts(token); + if (formatOpts) { + return this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = length => + knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, "era"), + tokenToString = token => { + // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles + switch (token) { + // ms + case "S": + return this.num(dt.millisecond); + case "u": + // falls through + case "SSS": + return this.num(dt.millisecond, 3); + // seconds + case "s": + return this.num(dt.second); + case "ss": + return this.num(dt.second, 2); + // minutes + case "m": + return this.num(dt.minute); + case "mm": + return this.num(dt.minute, 2); + // hours + case "h": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + case "hh": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + case "H": + return this.num(dt.hour); + case "HH": + return this.num(dt.hour, 2); + // offset + case "Z": + // like +6 + return formatOffset({ format: "narrow", allowZ: this.opts.allowZ }); + case "ZZ": + // like +06:00 + return formatOffset({ format: "short", allowZ: this.opts.allowZ }); + case "ZZZ": + // like +0600 + return formatOffset({ format: "techie", allowZ: this.opts.allowZ }); + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale }); + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { format: "long", locale: this.loc.locale }); + // zone + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + case "a": + return meridiem(); + // dates + case "d": + return useDateTimeFormatter ? string({ day: "numeric" }, "day") : this.num(dt.day); + case "dd": + return useDateTimeFormatter ? string({ day: "2-digit" }, "day") : this.num(dt.day, 2); + // weekdays - standalone + case "c": + // like 1 + return this.num(dt.weekday); + case "ccc": + // like 'Tues' + return weekday("short", true); + case "cccc": + // like 'Tuesday' + return weekday("long", true); + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + case "E": + // like 1 + return this.num(dt.weekday); + case "EEE": + // like 'Tues' + return weekday("short", false); + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + case "L": + // like 1 + return useDateTimeFormatter + ? string({ month: "numeric", day: "numeric" }, "month") + : this.num(dt.month); + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter + ? string({ month: "2-digit", day: "numeric" }, "month") + : this.num(dt.month, 2); + case "LLL": + // like Jan + return month("short", true); + case "LLLL": + // like January + return month("long", true); + case "LLLLL": + // like J + return month("narrow", true); + // months - format + case "M": + // like 1 + return useDateTimeFormatter + ? string({ month: "numeric" }, "month") + : this.num(dt.month); + case "MM": + // like 01 + return useDateTimeFormatter + ? string({ month: "2-digit" }, "month") + : this.num(dt.month, 2); + case "MMM": + // like Jan + return month("short", false); + case "MMMM": + // like January + return month("long", false); + case "MMMMM": + // like J + return month("narrow", false); + // years + case "y": + // like 2014 + return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year); + case "yy": + // like 14 + return useDateTimeFormatter + ? string({ year: "2-digit" }, "year") + : this.num(dt.year.toString().slice(-2), 2); + case "yyyy": + // like 0012 + return useDateTimeFormatter + ? string({ year: "numeric" }, "year") + : this.num(dt.year, 4); + case "yyyyyy": + // like 000012 + return useDateTimeFormatter + ? string({ year: "numeric" }, "year") + : this.num(dt.year, 6); + // eras + case "G": + // like AD + return era("short"); + case "GG": + // like Anno Domini + return era("long"); + case "GGGGG": + return era("narrow"); + case "kk": + return this.num(dt.weekYear.toString().slice(-2), 2); + case "kkkk": + return this.num(dt.weekYear, 4); + case "W": + return this.num(dt.weekNumber); + case "WW": + return this.num(dt.weekNumber, 2); + case "o": + return this.num(dt.ordinal); + case "ooo": + return this.num(dt.ordinal, 3); + case "q": + // like 1 + return this.num(dt.quarter); + case "qq": + // like 01 + return this.num(dt.quarter, 2); + case "X": + return this.num(Math.floor(dt.ts / 1000)); + case "x": + return this.num(dt.ts); + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + } + + formatDurationFromString(dur, fmt) { + const tokenToField = token => { + switch (token[0]) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + return "hour"; + case "d": + return "day"; + case "M": + return "month"; + case "y": + return "year"; + default: + return null; + } + }, + tokenToString = lildur => token => { + const mapped = tokenToField(token); + if (mapped) { + return this.num(lildur.get(mapped), token.length); + } else { + return token; + } + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce( + (found, { literal, val }) => (literal ? found : found.concat(val)), + [] + ), + collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t)); + return stringifyTokens(tokens, tokenToString(collapsed)); + } +} diff --git a/node_modules/luxon/src/impl/invalid.js b/node_modules/luxon/src/impl/invalid.js new file mode 100644 index 0000000..2a2c95b --- /dev/null +++ b/node_modules/luxon/src/impl/invalid.js @@ -0,0 +1,14 @@ +export default class Invalid { + constructor(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + toMessage() { + if (this.explanation) { + return `${this.reason}: ${this.explanation}`; + } else { + return this.reason; + } + } +} diff --git a/node_modules/luxon/src/impl/locale.js b/node_modules/luxon/src/impl/locale.js new file mode 100644 index 0000000..0f797b1 --- /dev/null +++ b/node_modules/luxon/src/impl/locale.js @@ -0,0 +1,469 @@ +import { hasFormatToParts, hasIntl, padStart, roundTo, hasRelative } from "./util.js"; +import * as English from "./english.js"; +import Settings from "../settings.js"; +import DateTime from "../datetime.js"; +import Formatter from "./formatter.js"; + +let intlDTCache = {}; +function getCachedDTF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let dtf = intlDTCache[key]; + if (!dtf) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache[key] = dtf; + } + return dtf; +} + +let intlNumCache = {}; +function getCachedINF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let inf = intlNumCache[key]; + if (!inf) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache[key] = inf; + } + return inf; +} + +let intlRelCache = {}; +function getCachedRTF(locString, opts = {}) { + const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options + const key = JSON.stringify([locString, cacheKeyOpts]); + let inf = intlRelCache[key]; + if (!inf) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache[key] = inf; + } + return inf; +} + +let sysLocaleCache = null; +function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else if (hasIntl()) { + const computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; + // node sometimes defaults to "und". Override that because that is dumb + sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; + return sysLocaleCache; + } else { + sysLocaleCache = "en-US"; + return sysLocaleCache; + } +} + +function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + + const uIndex = localeStr.indexOf("-u-"); + if (uIndex === -1) { + return [localeStr]; + } else { + let options; + const smaller = localeStr.substring(0, uIndex); + try { + options = getCachedDTF(localeStr).resolvedOptions(); + } catch (e) { + options = getCachedDTF(smaller).resolvedOptions(); + } + + const { numberingSystem, calendar } = options; + // return the smaller one so that we can append the calendar and numbering overrides to it + return [smaller, numberingSystem, calendar]; + } +} + +function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (hasIntl()) { + if (outputCalendar || numberingSystem) { + localeStr += "-u"; + + if (outputCalendar) { + localeStr += `-ca-${outputCalendar}`; + } + + if (numberingSystem) { + localeStr += `-nu-${numberingSystem}`; + } + return localeStr; + } else { + return localeStr; + } + } else { + return []; + } +} + +function mapMonths(f) { + const ms = []; + for (let i = 1; i <= 12; i++) { + const dt = DateTime.utc(2016, i, 1); + ms.push(f(dt)); + } + return ms; +} + +function mapWeekdays(f) { + const ms = []; + for (let i = 1; i <= 7; i++) { + const dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + return ms; +} + +function listStuff(loc, length, defaultOK, englishFn, intlFn) { + const mode = loc.listingMode(defaultOK); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } +} + +function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return ( + loc.numberingSystem === "latn" || + !loc.locale || + loc.locale.startsWith("en") || + (hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn") + ); + } +} + +/** + * @private + */ + +class PolyNumberFormatter { + constructor(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + if (!forceSimple && hasIntl()) { + const intlOpts = { useGrouping: false }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + format(i) { + if (this.inf) { + const fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + const fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(fixed, this.padTo); + } + } +} + +/** + * @private + */ + +class PolyDateFormatter { + constructor(dt, intl, opts) { + this.opts = opts; + this.hasIntl = hasIntl(); + + let z; + if (dt.zone.universal && this.hasIntl) { + // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter, + // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374. + // So we have to make do. Two cases: + // 1. The format options tell us to show the zone. We can't do that, so the best + // we can do is format the date in UTC. + // 2. The format options don't tell us to show the zone. Then we can adjust them + // the time and tell the formatter to show it to us in UTC, so that the time is right + // and the bad zone doesn't show up. + // We can clean all this up when Chrome fixes this. + z = "UTC"; + if (opts.timeZoneName) { + this.dt = dt; + } else { + this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000); + } + } else if (dt.zone.type === "local") { + this.dt = dt; + } else { + this.dt = dt; + z = dt.zone.name; + } + + if (this.hasIntl) { + const intlOpts = Object.assign({}, this.opts); + if (z) { + intlOpts.timeZone = z; + } + this.dtf = getCachedDTF(intl, intlOpts); + } + } + + format() { + if (this.hasIntl) { + return this.dtf.format(this.dt.toJSDate()); + } else { + const tokenFormat = English.formatString(this.opts), + loc = Locale.create("en-US"); + return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); + } + } + + formatToParts() { + if (this.hasIntl && hasFormatToParts()) { + return this.dtf.formatToParts(this.dt.toJSDate()); + } else { + // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings + // and IMO it's too weird to have an uncanny valley like that + return []; + } + } + + resolvedOptions() { + if (this.hasIntl) { + return this.dtf.resolvedOptions(); + } else { + return { + locale: "en-US", + numberingSystem: "latn", + outputCalendar: "gregory" + }; + } + } +} + +/** + * @private + */ +class PolyRelFormatter { + constructor(intl, isEnglish, opts) { + this.opts = Object.assign({ style: "long" }, opts); + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + } + + formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + } +} + +/** + * @private + */ + +export default class Locale { + static fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); + } + + static create(locale, numberingSystem, outputCalendar, defaultToEN = false) { + const specifiedLocale = locale || Settings.defaultLocale, + // the system locale is useful for human readable strings but annoying for parsing/formatting known formats + localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), + numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, + outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); + } + + static resetCache() { + sysLocaleCache = null; + intlDTCache = {}; + intlNumCache = {}; + intlRelCache = {}; + } + + static fromObject({ locale, numberingSystem, outputCalendar } = {}) { + return Locale.create(locale, numberingSystem, outputCalendar); + } + + constructor(locale, numbering, outputCalendar, specifiedLocale) { + const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale); + + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + + this.weekdaysCache = { format: {}, standalone: {} }; + this.monthsCache = { format: {}, standalone: {} }; + this.meridiemCache = null; + this.eraCache = {}; + + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + get fastNumbers() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + + listingMode(defaultOK = true) { + const intl = hasIntl(), + hasFTP = intl && hasFormatToParts(), + isActuallyEn = this.isEnglish(), + hasNoWeirdness = + (this.numberingSystem === null || this.numberingSystem === "latn") && + (this.outputCalendar === null || this.outputCalendar === "gregory"); + + if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { + return "error"; + } else if (!hasFTP || (isActuallyEn && hasNoWeirdness)) { + return "en"; + } else { + return "intl"; + } + } + + clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create( + alts.locale || this.specifiedLocale, + alts.numberingSystem || this.numberingSystem, + alts.outputCalendar || this.outputCalendar, + alts.defaultToEN || false + ); + } + } + + redefaultToEN(alts = {}) { + return this.clone(Object.assign({}, alts, { defaultToEN: true })); + } + + redefaultToSystem(alts = {}) { + return this.clone(Object.assign({}, alts, { defaultToEN: false })); + } + + months(length, format = false, defaultOK = true) { + return listStuff(this, length, defaultOK, English.months, () => { + const intl = format ? { month: length, day: "numeric" } : { month: length }, + formatStr = format ? "format" : "standalone"; + if (!this.monthsCache[formatStr][length]) { + this.monthsCache[formatStr][length] = mapMonths(dt => this.extract(dt, intl, "month")); + } + return this.monthsCache[formatStr][length]; + }); + } + + weekdays(length, format = false, defaultOK = true) { + return listStuff(this, length, defaultOK, English.weekdays, () => { + const intl = format + ? { weekday: length, year: "numeric", month: "long", day: "numeric" } + : { weekday: length }, + formatStr = format ? "format" : "standalone"; + if (!this.weekdaysCache[formatStr][length]) { + this.weekdaysCache[formatStr][length] = mapWeekdays(dt => + this.extract(dt, intl, "weekday") + ); + } + return this.weekdaysCache[formatStr][length]; + }); + } + + meridiems(defaultOK = true) { + return listStuff( + this, + undefined, + defaultOK, + () => English.meridiems, + () => { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!this.meridiemCache) { + const intl = { hour: "numeric", hour12: true }; + this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map( + dt => this.extract(dt, intl, "dayperiod") + ); + } + + return this.meridiemCache; + } + ); + } + + eras(length, defaultOK = true) { + return listStuff(this, length, defaultOK, English.eras, () => { + const intl = { era: length }; + + // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + if (!this.eraCache[length]) { + this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt => + this.extract(dt, intl, "era") + ); + } + + return this.eraCache[length]; + }); + } + + extract(dt, intlOpts, field) { + const df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(m => m.type.toLowerCase() === field); + return matching ? matching.value : null; + } + + numberFormatter(opts = {}) { + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + } + + dtFormatter(dt, intlOpts = {}) { + return new PolyDateFormatter(dt, this.intl, intlOpts); + } + + relFormatter(opts = {}) { + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + } + + isEnglish() { + return ( + this.locale === "en" || + this.locale.toLowerCase() === "en-us" || + (hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")) + ); + } + + equals(other) { + return ( + this.locale === other.locale && + this.numberingSystem === other.numberingSystem && + this.outputCalendar === other.outputCalendar + ); + } +} diff --git a/node_modules/luxon/src/impl/regexParser.js b/node_modules/luxon/src/impl/regexParser.js new file mode 100644 index 0000000..bdb9762 --- /dev/null +++ b/node_modules/luxon/src/impl/regexParser.js @@ -0,0 +1,315 @@ +import { + untruncateYear, + signedOffset, + parseInteger, + parseMillis, + ianaRegex, + isUndefined +} from "./util.js"; +import * as English from "./english.js"; +import FixedOffsetZone from "../zones/fixedOffsetZone.js"; +import IANAZone from "../zones/IANAZone.js"; + +/* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + +function combineRegexes(...regexes) { + const full = regexes.reduce((f, r) => f + r.source, ""); + return RegExp(`^${full}$`); +} + +function combineExtractors(...extractors) { + return m => + extractors + .reduce( + ([mergedVals, mergedZone, cursor], ex) => { + const [val, zone, next] = ex(m, cursor); + return [Object.assign(mergedVals, val), mergedZone || zone, next]; + }, + [{}, null, 1] + ) + .slice(0, 2); +} + +function parse(s, ...patterns) { + if (s == null) { + return [null, null]; + } + + for (const [regex, extractor] of patterns) { + const m = regex.exec(s); + if (m) { + return extractor(m); + } + } + return [null, null]; +} + +function simpleParse(...keys) { + return (match, cursor) => { + const ret = {}; + let i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + return [ret, null, cursor + i]; + }; +} + +// ISO and SQL parsing +const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, + isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/, + isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${offsetRegex.source}?`), + isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`), + isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, + isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, + isoOrdinalRegex = /(\d{4})-?(\d{3})/, + extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), + extractISOOrdinalData = simpleParse("year", "ordinal"), + sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, // dumbed-down version of the ISO one + sqlTimeRegex = RegExp( + `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?` + ), + sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); + +function int(match, pos, fallback) { + const m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); +} + +function extractISOYmd(match, cursor) { + const item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + + return [item, null, cursor + 3]; +} + +function extractISOTime(match, cursor) { + const item = { + hour: int(match, cursor, 0), + minute: int(match, cursor + 1, 0), + second: int(match, cursor + 2, 0), + millisecond: parseMillis(match[cursor + 3]) + }; + + return [item, null, cursor + 4]; +} + +function extractISOOffset(match, cursor) { + const local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; +} + +function extractIANAZone(match, cursor) { + const zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; +} + +// ISO duration parsing + +const isoDuration = /^P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})(?:[.,](-?\d{1,9}))?S)?)?)$/; + +function extractISODuration(match) { + const [ + , + yearStr, + monthStr, + weekStr, + dayStr, + hourStr, + minuteStr, + secondStr, + millisecondsStr + ] = match; + + return [ + { + years: parseInteger(yearStr), + months: parseInteger(monthStr), + weeks: parseInteger(weekStr), + days: parseInteger(dayStr), + hours: parseInteger(hourStr), + minutes: parseInteger(minuteStr), + seconds: parseInteger(secondStr), + milliseconds: parseMillis(millisecondsStr) + } + ]; +} + +// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York +// and not just that we're in -240 *right now*. But since I don't think these are used that often +// I'm just going to ignore that +const obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; + +function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + const result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: English.monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + + if (secondStr) result.second = parseInteger(secondStr); + if (weekdayStr) { + result.weekday = + weekdayStr.length > 3 + ? English.weekdaysLong.indexOf(weekdayStr) + 1 + : English.weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; +} + +// RFC 2822/5322 +const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + +function extractRFC2822(match) { + const [ + , + weekdayStr, + dayStr, + monthStr, + yearStr, + hourStr, + minuteStr, + secondStr, + obsOffset, + milOffset, + offHourStr, + offMinuteStr + ] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + + let offset; + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; +} + +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s + .replace(/\([^)]*\)|[\n\t]/g, " ") + .replace(/(\s\s+)/g, " ") + .trim(); +} + +// http date + +const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + +function extractRFC1123Or850(match) { + const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +function extractASCII(match) { + const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); +const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); +const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); +const isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + +const extractISOYmdTimeAndOffset = combineExtractors( + extractISOYmd, + extractISOTime, + extractISOOffset +); +const extractISOWeekTimeAndOffset = combineExtractors( + extractISOWeekData, + extractISOTime, + extractISOOffset +); +const extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime); +const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); + +/** + * @private + */ + +export function parseISODate(s) { + return parse( + s, + [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], + [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], + [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime], + [isoTimeCombinedRegex, extractISOTimeAndOffset] + ); +} + +export function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); +} + +export function parseHTTPDate(s) { + return parse( + s, + [rfc1123, extractRFC1123Or850], + [rfc850, extractRFC1123Or850], + [ascii, extractASCII] + ); +} + +export function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); +} + +const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); +const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + +const extractISOYmdTimeOffsetAndIANAZone = combineExtractors( + extractISOYmd, + extractISOTime, + extractISOOffset, + extractIANAZone +); +const extractISOTimeOffsetAndIANAZone = combineExtractors( + extractISOTime, + extractISOOffset, + extractIANAZone +); + +export function parseSQL(s) { + return parse( + s, + [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], + [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone] + ); +} diff --git a/node_modules/luxon/src/impl/tokenParser.js b/node_modules/luxon/src/impl/tokenParser.js new file mode 100644 index 0000000..88560ae --- /dev/null +++ b/node_modules/luxon/src/impl/tokenParser.js @@ -0,0 +1,416 @@ +import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from "./util.js"; +import Formatter from "./formatter.js"; +import FixedOffsetZone from "../zones/fixedOffsetZone.js"; +import IANAZone from "../zones/IANAZone.js"; +import DateTime from "../datetime.js"; +import { digitRegex, parseDigits } from "./digits.js"; +import { ConflictingSpecificationError } from "../errors.js"; + +const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + +function intUnit(regex, post = i => i) { + return { regex, deser: ([s]) => post(parseDigits(s)) }; +} + +function fixListRegex(s) { + // make dots optional and also make them literal + return s.replace(/\./, "\\.?"); +} + +function stripInsensitivities(s) { + return s.replace(/\./, "").toLowerCase(); +} + +function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: ([s]) => + strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex + }; + } +} + +function offset(regex, groups) { + return { regex, deser: ([, h, m]) => signedOffset(h, m), groups }; +} + +function simple(regex) { + return { regex, deser: ([s]) => s }; +} + +function escapeToken(value) { + // eslint-disable-next-line no-useless-escape + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} + +function unitForToken(token, loc) { + const one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = t => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }), + unitate = t => { + if (token.literal) { + return literal(t); + } + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short", false), 0); + case "GG": + return oneOf(loc.eras("long", false), 0); + // years + case "y": + return intUnit(oneToSix); + case "yy": + return intUnit(twoToFour, untruncateYear); + case "yyyy": + return intUnit(four); + case "yyyyy": + return intUnit(fourToSix); + case "yyyyyy": + return intUnit(six); + // months + case "M": + return intUnit(oneOrTwo); + case "MM": + return intUnit(two); + case "MMM": + return oneOf(loc.months("short", true, false), 1); + case "MMMM": + return oneOf(loc.months("long", true, false), 1); + case "L": + return intUnit(oneOrTwo); + case "LL": + return intUnit(two); + case "LLL": + return oneOf(loc.months("short", false, false), 1); + case "LLLL": + return oneOf(loc.months("long", false, false), 1); + // dates + case "d": + return intUnit(oneOrTwo); + case "dd": + return intUnit(two); + // ordinals + case "o": + return intUnit(oneToThree); + case "ooo": + return intUnit(three); + // time + case "HH": + return intUnit(two); + case "H": + return intUnit(oneOrTwo); + case "hh": + return intUnit(two); + case "h": + return intUnit(oneOrTwo); + case "mm": + return intUnit(two); + case "m": + return intUnit(oneOrTwo); + case "q": + return intUnit(oneOrTwo); + case "qq": + return intUnit(two); + case "s": + return intUnit(oneOrTwo); + case "ss": + return intUnit(two); + case "S": + return intUnit(oneToThree); + case "SSS": + return intUnit(three); + case "u": + return simple(oneToNine); + // meridiem + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + case "kkkk": + return intUnit(four); + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + case "W": + return intUnit(oneOrTwo); + case "WW": + return intUnit(two); + // weekdays + case "E": + case "c": + return intUnit(one); + case "EEE": + return oneOf(loc.weekdays("short", false, false), 1); + case "EEEE": + return oneOf(loc.weekdays("long", false, false), 1); + case "ccc": + return oneOf(loc.weekdays("short", true, false), 1); + case "cccc": + return oneOf(loc.weekdays("long", true, false), 1); + // offset/zone + case "Z": + case "ZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2); + case "ZZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + default: + return literal(t); + } + }; + + const unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + + unit.token = token; + + return unit; +} + +const partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour: { + numeric: "h", + "2-digit": "hh" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + } +}; + +function tokenForPart(part, locale, formatOpts) { + const { type, value } = part; + + if (type === "literal") { + return { + literal: true, + val: value + }; + } + + const style = formatOpts[type]; + + let val = partTypeStyleToTokenVal[type]; + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val + }; + } + + return undefined; +} + +function buildRegex(units) { + const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, ""); + return [`^${re}$`, units]; +} + +function match(input, regex, handlers) { + const matches = input.match(regex); + + if (matches) { + const all = {}; + let matchIndex = 1; + for (const i in handlers) { + if (hasOwnProperty(handlers, i)) { + const h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + matchIndex += groups; + } + } + return [matches, all]; + } else { + return [matches, {}]; + } +} + +function dateTimeFromMatches(matches) { + const toField = token => { + switch (token) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + + let zone; + if (!isUndefined(matches.Z)) { + zone = new FixedOffsetZone(matches.Z); + } else if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } else { + zone = null; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + const vals = Object.keys(matches).reduce((r, k) => { + const f = toField(k); + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + + return [vals, zone]; +} + +let dummyDateTimeCache = null; + +function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; +} + +function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + const formatOpts = Formatter.macroTokenToFormatOpts(token.val); + + if (!formatOpts) { + return token; + } + + const formatter = Formatter.create(locale, formatOpts); + const parts = formatter.formatDateTimeParts(getDummyDateTime()); + + const tokens = parts.map(p => tokenForPart(p, locale, formatOpts)); + + if (tokens.includes(undefined)) { + return token; + } + + return tokens; +} + +function expandMacroTokens(tokens, locale) { + return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale))); +} + +/** + * @private + */ + +export function explainFromTokens(locale, input, format) { + const tokens = expandMacroTokens(Formatter.parseFormat(format), locale), + units = tokens.map(t => unitForToken(t, locale)), + disqualifyingUnit = units.find(t => t.invalidReason); + + if (disqualifyingUnit) { + return { input, tokens, invalidReason: disqualifyingUnit.invalidReason }; + } else { + const [regexString, handlers] = buildRegex(units), + regex = RegExp(regexString, "i"), + [rawMatches, matches] = match(input, regex, handlers), + [result, zone] = matches ? dateTimeFromMatches(matches) : [null, null]; + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError( + "Can't include meridiem when specifying 24-hour format" + ); + } + return { input, tokens, regex, rawMatches, matches, result, zone }; + } +} + +export function parseFromTokens(locale, input, format) { + const { result, zone, invalidReason } = explainFromTokens(locale, input, format); + return [result, zone, invalidReason]; +} diff --git a/node_modules/luxon/src/impl/util.js b/node_modules/luxon/src/impl/util.js new file mode 100644 index 0000000..19d0c1e --- /dev/null +++ b/node_modules/luxon/src/impl/util.js @@ -0,0 +1,287 @@ +/* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. +*/ + +import { InvalidArgumentError } from "../errors.js"; + +/** + * @private + */ + +// TYPES + +export function isUndefined(o) { + return typeof o === "undefined"; +} + +export function isNumber(o) { + return typeof o === "number"; +} + +export function isInteger(o) { + return typeof o === "number" && o % 1 === 0; +} + +export function isString(o) { + return typeof o === "string"; +} + +export function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; +} + +// CAPABILITIES + +export function hasIntl() { + try { + return typeof Intl !== "undefined" && Intl.DateTimeFormat; + } catch (e) { + return false; + } +} + +export function hasFormatToParts() { + return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); +} + +export function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } +} + +// OBJECTS AND ARRAYS + +export function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; +} + +export function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + return arr.reduce((best, next) => { + const pair = [by(next), next]; + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; +} + +export function pick(obj, keys) { + return keys.reduce((a, k) => { + a[k] = obj[k]; + return a; + }, {}); +} + +export function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +// NUMBERS AND STRINGS + +export function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; +} + +// x % n but takes the sign of n instead of x +export function floorMod(x, n) { + return x - n * Math.floor(x / n); +} + +export function padStart(input, n = 2) { + if (input.toString().length < n) { + return ("0".repeat(n) + input).slice(-n); + } else { + return input.toString(); + } +} + +export function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } +} + +export function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + const f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } +} + +export function roundTo(number, digits, towardZero = false) { + const factor = 10 ** digits, + rounder = towardZero ? Math.trunc : Math.round; + return rounder(number * factor) / factor; +} + +// DATE BASICS + +export function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} + +export function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} + +export function daysInMonth(year, month) { + const modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } +} + +// covert a calendar object to a local timestamp (epoch, but with the offset baked in) +export function objToLocalTS(obj) { + let d = Date.UTC( + obj.year, + obj.month - 1, + obj.day, + obj.hour, + obj.minute, + obj.second, + obj.millisecond + ); + + // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + return +d; +} + +export function weeksInWeekYear(weekYear) { + const p1 = + (weekYear + + Math.floor(weekYear / 4) - + Math.floor(weekYear / 100) + + Math.floor(weekYear / 400)) % + 7, + last = weekYear - 1, + p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; + return p1 === 4 || p2 === 3 ? 53 : 52; +} + +export function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > 60 ? 1900 + year : 2000 + year; +} + +// PARSING + +export function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) { + const date = new Date(ts), + intlOpts = { + hour12: false, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + const modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts), + intl = hasIntl(); + + if (intl && hasFormatToParts()) { + const parsed = new Intl.DateTimeFormat(locale, modified) + .formatToParts(date) + .find(m => m.type.toLowerCase() === "timezonename"); + return parsed ? parsed.value : null; + } else if (intl) { + // this probably doesn't work for all locales + const without = new Intl.DateTimeFormat(locale, intlOpts).format(date), + included = new Intl.DateTimeFormat(locale, modified).format(date), + diffed = included.substring(without.length), + trimmed = diffed.replace(/^[, \u200e]+/, ""); + return trimmed; + } else { + return null; + } +} + +// signedOffset('-5', '30') -> -330 +export function signedOffset(offHourStr, offMinuteStr) { + let offHour = parseInt(offHourStr, 10); + + // don't || this because we want to preserve -0 + if (Number.isNaN(offHour)) { + offHour = 0; + } + + const offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; +} + +// COERCION + +export function asNumber(value) { + const numericValue = Number(value); + if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) + throw new InvalidArgumentError(`Invalid unit value ${value}`); + return numericValue; +} + +export function normalizeObject(obj, normalizer, nonUnitKeys) { + const normalized = {}; + for (const u in obj) { + if (hasOwnProperty(obj, u)) { + if (nonUnitKeys.indexOf(u) >= 0) continue; + const v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + return normalized; +} + +export function formatOffset(offset, format) { + const hours = Math.trunc(offset / 60), + minutes = Math.abs(offset % 60), + sign = hours >= 0 && !Object.is(hours, -0) ? "+" : "-", + base = `${sign}${Math.abs(hours)}`; + + switch (format) { + case "short": + return `${sign}${padStart(Math.abs(hours), 2)}:${padStart(minutes, 2)}`; + case "narrow": + return minutes > 0 ? `${base}:${minutes}` : base; + case "techie": + return `${sign}${padStart(Math.abs(hours), 2)}${padStart(minutes, 2)}`; + default: + throw new RangeError(`Value format ${format} is out of range for property format`); + } +} + +export function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); +} + +export const ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; diff --git a/node_modules/luxon/src/impl/zoneUtil.js b/node_modules/luxon/src/impl/zoneUtil.js new file mode 100644 index 0000000..c45e828 --- /dev/null +++ b/node_modules/luxon/src/impl/zoneUtil.js @@ -0,0 +1,36 @@ +/** + * @private + */ + +import Zone from "../zone.js"; +import IANAZone from "../zones/IANAZone.js"; +import FixedOffsetZone from "../zones/fixedOffsetZone.js"; +import InvalidZone from "../zones/invalidZone.js"; + +import { isUndefined, isString, isNumber } from "./util.js"; + +export function normalizeZone(input, defaultZone) { + let offset; + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + const lowered = input.toLowerCase(); + if (lowered === "local") return defaultZone; + else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance; + else if ((offset = IANAZone.parseGMTOffset(input)) != null) { + // handle Etc/GMT-4, which V8 chokes on + return FixedOffsetZone.instance(offset); + } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input); + else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } +} diff --git a/node_modules/luxon/src/info.js b/node_modules/luxon/src/info.js new file mode 100644 index 0000000..59e4f42 --- /dev/null +++ b/node_modules/luxon/src/info.js @@ -0,0 +1,186 @@ +import DateTime from "./datetime.js"; +import Settings from "./settings.js"; +import Locale from "./impl/locale.js"; +import IANAZone from "./zones/IANAZone.js"; +import { normalizeZone } from "./impl/zoneUtil.js"; + +import { hasFormatToParts, hasIntl, hasRelative } from "./impl/util.js"; + +/** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ +export default class Info { + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + static hasDST(zone = Settings.defaultZone) { + const proto = DateTime.local() + .setZone(zone) + .set({ month: 12 }); + + return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset; + } + + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + static isValidIANAZone(zone) { + return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); + } + + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone.isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + static normalizeZone(input) { + return normalizeZone(input, Settings.defaultZone); + } + + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {[string]} + */ + static months( + length = "long", + { locale = null, numberingSystem = null, outputCalendar = "gregory" } = {} + ) { + return Locale.create(locale, numberingSystem, outputCalendar).months(length); + } + + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {[string]} + */ + static monthsFormat( + length = "long", + { locale = null, numberingSystem = null, outputCalendar = "gregory" } = {} + ) { + return Locale.create(locale, numberingSystem, outputCalendar).months(length, true); + } + + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {[string]} + */ + static weekdays(length = "long", { locale = null, numberingSystem = null } = {}) { + return Locale.create(locale, numberingSystem, null).weekdays(length); + } + + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @return {[string]} + */ + static weekdaysFormat(length = "long", { locale = null, numberingSystem = null } = {}) { + return Locale.create(locale, numberingSystem, null).weekdays(length, true); + } + + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {[string]} + */ + static meridiems({ locale = null } = {}) { + return Locale.create(locale).meridiems(); + } + + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {[string]} + */ + static eras(length = "short", { locale = null } = {}) { + return Locale.create(locale, null, "gregory").eras(length); + } + + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case. + * Keys: + * * `zones`: whether this environment supports IANA timezones + * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing + * * `intl`: whether this environment supports general internationalization + * * `relative`: whether this environment supports relative time formatting + * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false } + * @return {Object} + */ + static features() { + let intl = false, + intlTokens = false, + zones = false, + relative = false; + + if (hasIntl()) { + intl = true; + intlTokens = hasFormatToParts(); + relative = hasRelative(); + + try { + zones = + new Intl.DateTimeFormat("en", { timeZone: "America/New_York" }).resolvedOptions() + .timeZone === "America/New_York"; + } catch (e) { + zones = false; + } + } + + return { intl, intlTokens, zones, relative }; + } +} diff --git a/node_modules/luxon/src/interval.js b/node_modules/luxon/src/interval.js new file mode 100644 index 0000000..ff5f16e --- /dev/null +++ b/node_modules/luxon/src/interval.js @@ -0,0 +1,588 @@ +import DateTime, { friendlyDateTime } from "./datetime.js"; +import Duration, { friendlyDuration } from "./duration.js"; +import Settings from "./settings.js"; +import { InvalidArgumentError, InvalidIntervalError } from "./errors.js"; +import Invalid from "./impl/invalid.js"; + +const INVALID = "Invalid Interval"; + +// checks if the start is equal to or before the end +function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid( + "end before start", + `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}` + ); + } else { + return null; + } +} + +/** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. + * * **Accessors** Use {@link start} and {@link end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}. + * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs} + * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. + */ +export default class Interval { + /** + * @private + */ + constructor(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + this.e = config.end; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.isLuxonInterval = true; + } + + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ invalid }); + } + } + + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + static fromDateTimes(start, end) { + const builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + + const validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static after(start, duration) { + const dur = friendlyDuration(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static before(end, duration) { + const dur = friendlyDuration(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + static fromISO(text, opts) { + const [s, e] = (text || "").split("/", 2); + if (s && e) { + const start = DateTime.fromISO(s, opts), + end = DateTime.fromISO(e, opts); + + if (start.isValid && end.isValid) { + return Interval.fromDateTimes(start, end); + } + + if (start.isValid) { + const dur = Duration.fromISO(e, opts); + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (end.isValid) { + const dur = Duration.fromISO(s, opts); + if (dur.isValid) { + return Interval.before(end, dur); + } + } + } + return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isInterval(o) { + return (o && o.isLuxonInterval) || false; + } + + /** + * Returns the start of the Interval + * @type {DateTime} + */ + get start() { + return this.isValid ? this.s : null; + } + + /** + * Returns the end of the Interval + * @type {DateTime} + */ + get end() { + return this.isValid ? this.e : null; + } + + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + get isValid() { + return this.invalidReason === null; + } + + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + length(unit = "milliseconds") { + return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN; + } + + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @return {number} + */ + count(unit = "milliseconds") { + if (!this.isValid) return NaN; + const start = this.start.startOf(unit), + end = this.end.startOf(unit); + return Math.floor(end.diff(start, unit).get(unit)) + 1; + } + + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + hasSame(unit) { + return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false; + } + + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + set({ start, end } = {}) { + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + + /** + * Split this Interval at each of the specified DateTimes + * @param {...[DateTime]} dateTimes - the unit of time to count. + * @return {[Interval]} + */ + splitAt(...dateTimes) { + if (!this.isValid) return []; + const sorted = dateTimes + .map(friendlyDateTime) + .filter(d => this.contains(d)) + .sort(), + results = []; + let { s } = this, + i = 0; + + while (s < this.e) { + const added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {[Interval]} + */ + splitBy(duration) { + const dur = friendlyDuration(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + let { s } = this, + added, + next; + + const results = []; + while (s < this.e) { + added = s.plus(dur); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + } + + return results; + } + + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {[Interval]} + */ + divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + overlaps(other) { + return this.e > other.s && this.s < other.e; + } + + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + + /** + * Return whether this Interval engulfs the start and end of the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + intersection(other) { + if (!this.isValid) return this; + const s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s > e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + union(other) { + if (!this.isValid) return this; + const s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + static merge(intervals) { + const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce( + ([sofar, current], item) => { + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, + [[], null] + ); + if (final) { + found.push(final); + } + return found; + } + + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + static xor(intervals) { + let start = null, + currentCount = 0; + const results = [], + ends = intervals.map(i => [{ time: i.s, type: "s" }, { time: i.e, type: "e" }]), + flattened = Array.prototype.concat(...ends), + arr = flattened.sort((a, b) => a.time - b.time); + + for (const i of arr) { + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {[Interval]} + */ + difference(...intervals) { + return Interval.xor([this].concat(intervals)) + .map(i => this.intersection(i)) + .filter(i => i && !i.isEmpty()); + } + + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + toString() { + if (!this.isValid) return INVALID; + return `[${this.s.toISO()} – ${this.e.toISO()})`; + } + + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + toISO(opts) { + if (!this.isValid) return INVALID; + return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`; + } + + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + toISODate() { + if (!this.isValid) return INVALID; + return `${this.s.toISODate()}/${this.e.toISODate()}`; + } + + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + toISOTime(opts) { + if (!this.isValid) return INVALID; + return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`; + } + + /** + * Returns a string representation of this Interval formatted according to the specified format string. + * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. + * @param {Object} opts - options + * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations + * @return {string} + */ + toFormat(dateFormat, { separator = " – " } = {}) { + if (!this.isValid) return INVALID; + return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`; + } + + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + return this.e.diff(this.s, unit, opts); + } + + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + } +} diff --git a/node_modules/luxon/src/luxon.js b/node_modules/luxon/src/luxon.js new file mode 100644 index 0000000..31b9738 --- /dev/null +++ b/node_modules/luxon/src/luxon.js @@ -0,0 +1,23 @@ +import DateTime from "./datetime.js"; +import Duration from "./duration.js"; +import Interval from "./interval.js"; +import Info from "./info.js"; +import Zone from "./zone.js"; +import FixedOffsetZone from "./zones/fixedOffsetZone.js"; +import IANAZone from "./zones/IANAZone.js"; +import InvalidZone from "./zones/invalidZone.js"; +import LocalZone from "./zones/localZone.js"; +import Settings from "./settings.js"; + +export { + DateTime, + Duration, + Interval, + Info, + Zone, + FixedOffsetZone, + IANAZone, + InvalidZone, + LocalZone, + Settings +}; diff --git a/node_modules/luxon/src/luxonFilled.js b/node_modules/luxon/src/luxonFilled.js new file mode 100644 index 0000000..5145b18 --- /dev/null +++ b/node_modules/luxon/src/luxonFilled.js @@ -0,0 +1,13 @@ +/* eslint import/no-extraneous-dependencies: off */ + +import "core-js/features/symbol"; +import "core-js/features/symbol/iterator"; +import "core-js/features/object"; +import "core-js/features/number/is-nan"; +import "core-js/features/array"; +import "core-js/features/string/virtual/starts-with"; +import "core-js/features/string/virtual/repeat"; +import "core-js/features/math/trunc"; +import "core-js/features/math/sign"; + +export * from "./luxon.js"; diff --git a/node_modules/luxon/src/settings.js b/node_modules/luxon/src/settings.js new file mode 100644 index 0000000..57f68e9 --- /dev/null +++ b/node_modules/luxon/src/settings.js @@ -0,0 +1,137 @@ +import LocalZone from "./zones/localZone.js"; +import IANAZone from "./zones/IANAZone.js"; +import Locale from "./impl/locale.js"; + +import { normalizeZone } from "./impl/zoneUtil.js"; + +let now = () => Date.now(), + defaultZone = null, // not setting this directly to LocalZone.instance bc loading order issues + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + throwOnInvalid = false; + +/** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ +export default class Settings { + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + static get now() { + return now; + } + + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + static set now(n) { + now = n; + } + + /** + * Get the default time zone to create DateTimes in. + * @type {string} + */ + static get defaultZoneName() { + return Settings.defaultZone.name; + } + + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * @type {string} + */ + static set defaultZoneName(z) { + if (!z) { + defaultZone = null; + } else { + defaultZone = normalizeZone(z); + } + } + + /** + * Get the default time zone object to create DateTimes in. Does not affect existing instances. + * @type {Zone} + */ + static get defaultZone() { + return defaultZone || LocalZone.instance; + } + + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultLocale() { + return defaultLocale; + } + + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultLocale(locale) { + defaultLocale = locale; + } + + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultNumberingSystem() { + return defaultNumberingSystem; + } + + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultNumberingSystem(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultOutputCalendar() { + return defaultOutputCalendar; + } + + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultOutputCalendar(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static get throwOnInvalid() { + return throwOnInvalid; + } + + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static set throwOnInvalid(t) { + throwOnInvalid = t; + } + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + } +} diff --git a/node_modules/luxon/src/zone.js b/node_modules/luxon/src/zone.js new file mode 100644 index 0000000..8a5d070 --- /dev/null +++ b/node_modules/luxon/src/zone.js @@ -0,0 +1,88 @@ +/* eslint no-unused-vars: "off" */ +import { ZoneIsAbstractError } from "./errors.js"; + +/** + * @interface + */ +export default class Zone { + /** + * The type of zone + * @abstract + * @type {string} + */ + get type() { + throw new ZoneIsAbstractError(); + } + + /** + * The name of this zone. + * @abstract + * @type {string} + */ + get name() { + throw new ZoneIsAbstractError(); + } + + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + get universal() { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(ts) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + get isValid() { + throw new ZoneIsAbstractError(); + } +} diff --git a/node_modules/luxon/src/zones/IANAZone.js b/node_modules/luxon/src/zones/IANAZone.js new file mode 100644 index 0000000..e2ad296 --- /dev/null +++ b/node_modules/luxon/src/zones/IANAZone.js @@ -0,0 +1,188 @@ +import { formatOffset, parseZoneInfo, isUndefined, ianaRegex, objToLocalTS } from "../impl/util.js"; +import Zone from "../zone.js"; + +const matchingRegex = RegExp(`^${ianaRegex.source}$`); + +let dtfCache = {}; +function makeDTF(zone) { + if (!dtfCache[zone]) { + dtfCache[zone] = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zone, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" + }); + } + return dtfCache[zone]; +} + +const typeToPos = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5 +}; + +function hackyOffset(dtf, date) { + const formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), + [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed; + return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; +} + +function partsOffset(dtf, date) { + const formatted = dtf.formatToParts(date), + filled = []; + for (let i = 0; i < formatted.length; i++) { + const { type, value } = formatted[i], + pos = typeToPos[type]; + + if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + return filled; +} + +let ianaZoneCache = {}; +/** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ +export default class IANAZone extends Zone { + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + static create(name) { + if (!ianaZoneCache[name]) { + ianaZoneCache[name] = new IANAZone(name); + } + return ianaZoneCache[name]; + } + + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCache() { + ianaZoneCache = {}; + dtfCache = {}; + } + + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Fantasia/Castle") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @return {boolean} + */ + static isValidSpecifier(s) { + return !!(s && s.match(matchingRegex)); + } + + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + static isValidZone(zone) { + try { + new Intl.DateTimeFormat("en-US", { timeZone: zone }).format(); + return true; + } catch (e) { + return false; + } + } + + // Etc/GMT+8 -> -480 + /** @ignore */ + static parseGMTOffset(specifier) { + if (specifier) { + const match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); + if (match) { + return -60 * parseInt(match[1]); + } + } + return null; + } + + constructor(name) { + super(); + /** @private **/ + this.zoneName = name; + /** @private **/ + this.valid = IANAZone.isValidZone(name); + } + + /** @override **/ + get type() { + return "iana"; + } + + /** @override **/ + get name() { + return this.zoneName; + } + + /** @override **/ + get universal() { + return false; + } + + /** @override **/ + offsetName(ts, { format, locale }) { + return parseZoneInfo(ts, format, locale, this.name); + } + + /** @override **/ + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/ + offset(ts) { + const date = new Date(ts), + dtf = makeDTF(this.name), + [year, month, day, hour, minute, second] = dtf.formatToParts + ? partsOffset(dtf, date) + : hackyOffset(dtf, date), + // work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + adjustedHour = hour === 24 ? 0 : hour; + + const asUTC = objToLocalTS({ + year, + month, + day, + hour: adjustedHour, + minute, + second, + millisecond: 0 + }); + + let asTS = +date; + const over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + + /** @override **/ + equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + + /** @override **/ + get isValid() { + return this.valid; + } +} diff --git a/node_modules/luxon/src/zones/fixedOffsetZone.js b/node_modules/luxon/src/zones/fixedOffsetZone.js new file mode 100644 index 0000000..364e065 --- /dev/null +++ b/node_modules/luxon/src/zones/fixedOffsetZone.js @@ -0,0 +1,94 @@ +import { formatOffset, signedOffset } from "../impl/util.js"; +import Zone from "../zone.js"; + +let singleton = null; + +/** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ +export default class FixedOffsetZone extends Zone { + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + static get utcInstance() { + if (singleton === null) { + singleton = new FixedOffsetZone(0); + } + return singleton; + } + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + static instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + static parseSpecifier(s) { + if (s) { + const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + return null; + } + + constructor(offset) { + super(); + /** @private **/ + this.fixed = offset; + } + + /** @override **/ + get type() { + return "fixed"; + } + + /** @override **/ + get name() { + return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`; + } + + /** @override **/ + offsetName() { + return this.name; + } + + /** @override **/ + formatOffset(ts, format) { + return formatOffset(this.fixed, format); + } + + /** @override **/ + get universal() { + return true; + } + + /** @override **/ + offset() { + return this.fixed; + } + + /** @override **/ + equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + + /** @override **/ + get isValid() { + return true; + } +} diff --git a/node_modules/luxon/src/zones/invalidZone.js b/node_modules/luxon/src/zones/invalidZone.js new file mode 100644 index 0000000..d7b7104 --- /dev/null +++ b/node_modules/luxon/src/zones/invalidZone.js @@ -0,0 +1,53 @@ +import Zone from "../zone.js"; + +/** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ +export default class InvalidZone extends Zone { + constructor(zoneName) { + super(); + /** @private */ + this.zoneName = zoneName; + } + + /** @override **/ + get type() { + return "invalid"; + } + + /** @override **/ + get name() { + return this.zoneName; + } + + /** @override **/ + get universal() { + return false; + } + + /** @override **/ + offsetName() { + return null; + } + + /** @override **/ + formatOffset() { + return ""; + } + + /** @override **/ + offset() { + return NaN; + } + + /** @override **/ + equals() { + return false; + } + + /** @override **/ + get isValid() { + return false; + } +} diff --git a/node_modules/luxon/src/zones/localZone.js b/node_modules/luxon/src/zones/localZone.js new file mode 100644 index 0000000..b8cbcdc --- /dev/null +++ b/node_modules/luxon/src/zones/localZone.js @@ -0,0 +1,63 @@ +import { formatOffset, parseZoneInfo, hasIntl } from "../impl/util.js"; +import Zone from "../zone.js"; + +let singleton = null; + +/** + * Represents the local zone for this Javascript environment. + * @implements {Zone} + */ +export default class LocalZone extends Zone { + /** + * Get a singleton instance of the local zone + * @return {LocalZone} + */ + static get instance() { + if (singleton === null) { + singleton = new LocalZone(); + } + return singleton; + } + + /** @override **/ + get type() { + return "local"; + } + + /** @override **/ + get name() { + if (hasIntl()) { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } else return "local"; + } + + /** @override **/ + get universal() { + return false; + } + + /** @override **/ + offsetName(ts, { format, locale }) { + return parseZoneInfo(ts, format, locale); + } + + /** @override **/ + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/ + offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + + /** @override **/ + equals(otherZone) { + return otherZone.type === "local"; + } + + /** @override **/ + get isValid() { + return true; + } +} diff --git a/node_modules/map-obj/index.d.ts b/node_modules/map-obj/index.d.ts new file mode 100644 index 0000000..50b5e17 --- /dev/null +++ b/node_modules/map-obj/index.d.ts @@ -0,0 +1,106 @@ +declare namespace mapObject { + type Mapper< + SourceObjectType extends {[key: string]: any}, + MappedObjectKeyType extends string, + MappedObjectValueType + > = ( + sourceKey: keyof SourceObjectType, + sourceValue: SourceObjectType[keyof SourceObjectType], + source: SourceObjectType + ) => [MappedObjectKeyType, MappedObjectValueType]; + + interface Options { + /** + Recurse nested objects and objects in arrays. + + @default false + */ + deep?: boolean; + + /** + Target object to map properties on to. + + @default {} + */ + target?: {[key: string]: any}; + } + + interface DeepOptions extends Options { + deep: true; + } + + interface TargetOptions extends Options { + target: TargetObjectType; + } +} + +/** +Map object keys and values into a new object. + +@param source - Source object to copy properties from. +@param mapper - Mapping function. + +@example +``` +import mapObject = require('map-obj'); + +const newObject = mapObject({foo: 'bar'}, (key, value) => [value, key]); +//=> {bar: 'foo'} +``` +*/ +declare function mapObject< + SourceObjectType extends object, + TargetObjectType extends {[key: string]: any}, + MappedObjectKeyType extends string, + MappedObjectValueType +>( + source: SourceObjectType, + mapper: mapObject.Mapper< + SourceObjectType, + MappedObjectKeyType, + MappedObjectValueType + >, + options: mapObject.DeepOptions & mapObject.TargetOptions +): TargetObjectType & {[key: string]: unknown}; +declare function mapObject< + SourceObjectType extends object, + MappedObjectKeyType extends string, + MappedObjectValueType +>( + source: SourceObjectType, + mapper: mapObject.Mapper< + SourceObjectType, + MappedObjectKeyType, + MappedObjectValueType + >, + options: mapObject.DeepOptions +): {[key: string]: unknown}; +declare function mapObject< + SourceObjectType extends {[key: string]: any}, + TargetObjectType extends {[key: string]: any}, + MappedObjectKeyType extends string, + MappedObjectValueType +>( + source: SourceObjectType, + mapper: mapObject.Mapper< + SourceObjectType, + MappedObjectKeyType, + MappedObjectValueType + >, + options: mapObject.TargetOptions +): TargetObjectType & {[K in MappedObjectKeyType]: MappedObjectValueType}; +declare function mapObject< + SourceObjectType extends {[key: string]: any}, + MappedObjectKeyType extends string, + MappedObjectValueType +>( + source: SourceObjectType, + mapper: mapObject.Mapper< + SourceObjectType, + MappedObjectKeyType, + MappedObjectValueType + >, + options?: mapObject.Options +): {[K in MappedObjectKeyType]: MappedObjectValueType}; + +export = mapObject; diff --git a/node_modules/map-obj/index.js b/node_modules/map-obj/index.js new file mode 100644 index 0000000..4f1e4be --- /dev/null +++ b/node_modules/map-obj/index.js @@ -0,0 +1,54 @@ +'use strict'; + +const isObject = value => typeof value === 'object' && value !== null; + +// Customized for this use-case +const isObjectCustom = value => + isObject(value) && + !(value instanceof RegExp) && + !(value instanceof Error) && + !(value instanceof Date); + +const mapObject = (object, mapper, options, isSeen = new WeakMap()) => { + options = { + deep: false, + target: {}, + ...options + }; + + if (isSeen.has(object)) { + return isSeen.get(object); + } + + isSeen.set(object, options.target); + + const {target} = options; + delete options.target; + + const mapArray = array => array.map(element => isObjectCustom(element) ? mapObject(element, mapper, options, isSeen) : element); + if (Array.isArray(object)) { + return mapArray(object); + } + + for (const [key, value] of Object.entries(object)) { + let [newKey, newValue] = mapper(key, value, object); + + if (options.deep && isObjectCustom(newValue)) { + newValue = Array.isArray(newValue) ? + mapArray(newValue) : + mapObject(newValue, mapper, options, isSeen); + } + + target[newKey] = newValue; + } + + return target; +}; + +module.exports = (object, mapper, options) => { + if (!isObject(object)) { + throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`); + } + + return mapObject(object, mapper, options); +}; diff --git a/node_modules/map-obj/license b/node_modules/map-obj/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/map-obj/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/map-obj/package.json b/node_modules/map-obj/package.json new file mode 100644 index 0000000..1ad5406 --- /dev/null +++ b/node_modules/map-obj/package.json @@ -0,0 +1,74 @@ +{ + "_from": "map-obj@^4.0.0", + "_id": "map-obj@4.1.0", + "_inBundle": false, + "_integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==", + "_location": "/map-obj", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "map-obj@^4.0.0", + "name": "map-obj", + "escapedName": "map-obj", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/camelcase-keys" + ], + "_resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz", + "_shasum": "b91221b542734b9f14256c0132c897c5d7256fd5", + "_spec": "map-obj@^4.0.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/camelcase-keys", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/map-obj/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Map object keys and values into a new object", + "devDependencies": { + "ava": "^2.0.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/map-obj#readme", + "keywords": [ + "map", + "object", + "key", + "keys", + "value", + "values", + "iterate", + "iterator", + "rename", + "modify", + "deep", + "recurse", + "recursive" + ], + "license": "MIT", + "name": "map-obj", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/map-obj.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "4.1.0" +} diff --git a/node_modules/map-obj/readme.md b/node_modules/map-obj/readme.md new file mode 100644 index 0000000..cd405f5 --- /dev/null +++ b/node_modules/map-obj/readme.md @@ -0,0 +1,76 @@ +# map-obj [![Build Status](https://travis-ci.org/sindresorhus/map-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/map-obj) + +> Map object keys and values into a new object + + +## Install + +``` +$ npm install map-obj +``` + + +## Usage + +```js +const mapObject = require('map-obj'); + +const newObject = mapObject({foo: 'bar'}, (key, value) => [value, key]); +//=> {bar: 'foo'} +``` + + +## API + +### mapObject(source, mapper, options?) + +#### source + +Type: `object` + +Source object to copy properties from. + +#### mapper + +Type: `Function` + +Mapping function. + +- It has signature `mapper(sourceKey, sourceValue, source)`. +- It must return a two item array: `[targetKey, targetValue]`. + +#### options + +Type: `object` + +##### deep + +Type: `boolean`
+Default: `false` + +Recurse nested objects and objects in arrays. + +##### target + +Type: `object`
+Default: `{}` + +Target object to map properties on to. + + +## Related + +- [filter-obj](https://github.com/sindresorhus/filter-obj) - Filter object keys and values into a new object + + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/ms/index.js b/node_modules/ms/index.js new file mode 100644 index 0000000..6a522b1 --- /dev/null +++ b/node_modules/ms/index.js @@ -0,0 +1,152 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/ms/license.md b/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ms/package.json b/node_modules/ms/package.json new file mode 100644 index 0000000..804da15 --- /dev/null +++ b/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.0.0", + "_id": "ms@2.0.0", + "_inBundle": false, + "_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "_location": "/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.0.0", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.0.0", + "saveSpec": null, + "fetchSpec": "2.0.0" + }, + "_requiredBy": [ + "/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", + "_spec": "ms@2.0.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny milisecond conversion utility", + "devDependencies": { + "eslint": "3.19.0", + "expect.js": "0.3.1", + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.0.0" +} diff --git a/node_modules/ms/readme.md b/node_modules/ms/readme.md new file mode 100644 index 0000000..84a9974 --- /dev/null +++ b/node_modules/ms/readme.md @@ -0,0 +1,51 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +``` + +### Convert from milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +### Time format written-out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. + +## Caught a bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/pino-std-serializers/.editorconfig b/node_modules/pino-std-serializers/.editorconfig new file mode 100644 index 0000000..3fec5c5 --- /dev/null +++ b/node_modules/pino-std-serializers/.editorconfig @@ -0,0 +1,13 @@ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# [*.md] +# trim_trailing_whitespace = false diff --git a/node_modules/pino-std-serializers/.travis.yml b/node_modules/pino-std-serializers/.travis.yml new file mode 100644 index 0000000..27bbac6 --- /dev/null +++ b/node_modules/pino-std-serializers/.travis.yml @@ -0,0 +1,22 @@ +language: node_js + +node_js: + - "12" + - "10" + - "9" + - "8" + - "6" + +# before_install: +# - curl -L https://unpkg.com/@pnpm/self-installer | node +# install: +# - pnpm install + +script: + - npm run lint-ci + - npm run test-ci + +notifications: + email: + on_success: never + on_failure: always diff --git a/node_modules/pino-std-serializers/LICENSE b/node_modules/pino-std-serializers/LICENSE new file mode 100644 index 0000000..69957c5 --- /dev/null +++ b/node_modules/pino-std-serializers/LICENSE @@ -0,0 +1,7 @@ +Copyright Mateo Collina, David Mark Clements, James Sumners + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/pino-std-serializers/Readme.md b/node_modules/pino-std-serializers/Readme.md new file mode 100644 index 0000000..2f6702c --- /dev/null +++ b/node_modules/pino-std-serializers/Readme.md @@ -0,0 +1,107 @@ +# pino-std-serializers  [![Build Status](https://travis-ci.org/pinojs/pino-std-serializers.svg)](https://travis-ci.org/pinojs/pino-std-serializers) + +This module provides a set of standard object serializers for the +[Pino](https://getpino.io) logger. + +## Serializers + +### `exports.err(error)` +Serializes an `Error` like object. Returns an object: + +```js +{ + type: 'string', // The name of the object's constructor. + message: 'string', // The supplied error message. + stack: 'string', // The stack when the error was generated. + raw: Error // Non-enumerable, i.e. will not be in the output, original + // Error object. This is available for subsequent serializers + // to use. +} +``` + +Any other extra properties, e.g. `statusCode`, that have been attached to the +object will also be present on the serialized object. + +### `exports.mapHttpResponse(response)` +Used internally by Pino for general response logging. Returns an object: + +```js +{ + res: {} +} +``` + +Where `res` is the `response` as serialized by the standard response serializer. + +### `exports.mapHttpRequest(request)` +Used internall by Pino for general request logging. Returns an object: + +```js +{ + req: {} +} +``` + +Where `req` is the `request` as serialized by the standard request serializer. + +### `exports.req(request)` +The default `request` serializer. Returns and object: + +```js +{ + id: 'string', // Defaults to `undefined`, unless there is an `id` property + // already attached to the `request` object or to the `request.info` + // object. Attach a synchronous function + // to the `request.id` that returns an identifier to have + // the value filled. + method: 'string', + url: 'string', // the request pathname (as per req.url in core HTTP) + headers: Object, // a reference to the `headers` object from the request + // (as per req.headers in core HTTP) + remoteAddress: 'string', + remotePort: Number, + raw: Object // Non-enumerable, i.e. will not be in the output, original + // request object. This is available for subsequent serializers + // to use. In cases where the `request` input already has + // a `raw` property this will replace the original `request.raw` + // property +} +``` + +### `exports.res(response)` +The default `response` serializer. Returns an object: + +```js +{ + statusCode: Number, + headers: Object, // The headers to be sent in the response. + raw: Object // Non-enumerable, i.e. will not be in the output, original + // response object. This is available for subsequent serializers + // to use. +} +``` + +### `exports.wrapErrorSerializer(customSerializer)` +A utility method for wrapping the default error serializer. This allows +custom serializers to work with the already serialized object. + +The `customSerializer` accepts one parameter — the newly serialized error +object — and returns the new (or updated) error object. + +### `exports.wrapRequestSerializer(customSerializer)` +A utility method for wrapping the default request serializer. This allows +custom serializers to work with the already serialized object. + +The `customSerializer` accepts one parameter — the newly serialized request +object — and returns the new (or updated) request object. + +### `exports.wrapResponseSerializer(customSerializer)` +A utility method for wrapping the default response serializer. This allows +custom serializers to work with the already serialized object. + +The `customSerializer` accepts one parameter — the newly serialized response +object — and returns the new (or updated) response object. + +## License + +MIT License diff --git a/node_modules/pino-std-serializers/index.js b/node_modules/pino-std-serializers/index.js new file mode 100644 index 0000000..f5dfd37 --- /dev/null +++ b/node_modules/pino-std-serializers/index.js @@ -0,0 +1,34 @@ +'use strict' + +var errSerializer = require('./lib/err') +var reqSerializers = require('./lib/req') +var resSerializers = require('./lib/res') + +module.exports = { + err: errSerializer, + mapHttpRequest: reqSerializers.mapHttpRequest, + mapHttpResponse: resSerializers.mapHttpResponse, + req: reqSerializers.reqSerializer, + res: resSerializers.resSerializer, + + wrapErrorSerializer: function wrapErrorSerializer (customSerializer) { + if (customSerializer === errSerializer) return customSerializer + return function wrapErrSerializer (err) { + return customSerializer(errSerializer(err)) + } + }, + + wrapRequestSerializer: function wrapRequestSerializer (customSerializer) { + if (customSerializer === reqSerializers.reqSerializer) return customSerializer + return function wrappedReqSerializer (req) { + return customSerializer(reqSerializers.reqSerializer(req)) + } + }, + + wrapResponseSerializer: function wrapResponseSerializer (customSerializer) { + if (customSerializer === resSerializers.resSerializer) return customSerializer + return function wrappedResSerializer (res) { + return customSerializer(resSerializers.resSerializer(res)) + } + } +} diff --git a/node_modules/pino-std-serializers/lib/err.js b/node_modules/pino-std-serializers/lib/err.js new file mode 100644 index 0000000..8a3091c --- /dev/null +++ b/node_modules/pino-std-serializers/lib/err.js @@ -0,0 +1,64 @@ +'use strict' + +module.exports = errSerializer + +const seen = Symbol('circular-ref-tag') +const rawSymbol = Symbol('pino-raw-err-ref') +const pinoErrProto = Object.create({}, { + type: { + enumerable: true, + writable: true, + value: undefined + }, + message: { + enumerable: true, + writable: true, + value: undefined + }, + stack: { + enumerable: true, + writable: true, + value: undefined + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } + } +}) +Object.defineProperty(pinoErrProto, rawSymbol, { + writable: true, + value: {} +}) + +function errSerializer (err) { + if (!(err instanceof Error)) { + return err + } + + err[seen] = undefined // tag to prevent re-looking at this + const _err = Object.create(pinoErrProto) + _err.type = err.constructor.name + _err.message = err.message + _err.stack = err.stack + for (const key in err) { + if (_err[key] === undefined) { + const val = err[key] + if (val instanceof Error) { + if (!val.hasOwnProperty(seen)) { + _err[key] = errSerializer(val) + } + } else { + _err[key] = val + } + } + } + + delete err[seen] // clean up tag in case err is serialized again later + _err.raw = err + return _err +} diff --git a/node_modules/pino-std-serializers/lib/req.js b/node_modules/pino-std-serializers/lib/req.js new file mode 100644 index 0000000..26ca235 --- /dev/null +++ b/node_modules/pino-std-serializers/lib/req.js @@ -0,0 +1,80 @@ +'use strict' + +module.exports = { + mapHttpRequest, + reqSerializer +} + +var rawSymbol = Symbol('pino-raw-req-ref') +var pinoReqProto = Object.create({}, { + id: { + enumerable: true, + writable: true, + value: '' + }, + method: { + enumerable: true, + writable: true, + value: '' + }, + url: { + enumerable: true, + writable: true, + value: '' + }, + headers: { + enumerable: true, + writable: true, + value: {} + }, + remoteAddress: { + enumerable: true, + writable: true, + value: '' + }, + remotePort: { + enumerable: true, + writable: true, + value: '' + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } + } +}) +Object.defineProperty(pinoReqProto, rawSymbol, { + writable: true, + value: {} +}) + +function reqSerializer (req) { + // req.info is for hapi compat. + var connection = req.info || req.connection + const _req = Object.create(pinoReqProto) + _req.id = (typeof req.id === 'function' ? req.id() : (req.id || (req.info ? req.info.id : undefined))) + _req.method = req.method + // req.originalUrl is for expressjs compat. + if (req.originalUrl) { + _req.url = req.originalUrl + } else { + // req.url.path is for hapi compat. + _req.url = req.url ? (req.url.path || req.url) : undefined + } + _req.headers = req.headers + _req.remoteAddress = connection && connection.remoteAddress + _req.remotePort = connection && connection.remotePort + // req.raw is for hapi compat/equivalence + _req.raw = req.raw || req + return _req +} + +function mapHttpRequest (req) { + return { + req: reqSerializer(req) + } +} diff --git a/node_modules/pino-std-serializers/lib/res.js b/node_modules/pino-std-serializers/lib/res.js new file mode 100644 index 0000000..4bdc52e --- /dev/null +++ b/node_modules/pino-std-serializers/lib/res.js @@ -0,0 +1,47 @@ +'use strict' + +module.exports = { + mapHttpResponse, + resSerializer +} + +var rawSymbol = Symbol('pino-raw-res-ref') +var pinoResProto = Object.create({}, { + statusCode: { + enumerable: true, + writable: true, + value: 0 + }, + headers: { + enumerable: true, + writable: true, + value: '' + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } + } +}) +Object.defineProperty(pinoResProto, rawSymbol, { + writable: true, + value: {} +}) + +function resSerializer (res) { + const _res = Object.create(pinoResProto) + _res.statusCode = res.statusCode + _res.headers = res.getHeaders ? res.getHeaders() : res._headers + _res.raw = res + return _res +} + +function mapHttpResponse (res) { + return { + res: resSerializer(res) + } +} diff --git a/node_modules/pino-std-serializers/package.json b/node_modules/pino-std-serializers/package.json new file mode 100644 index 0000000..d957652 --- /dev/null +++ b/node_modules/pino-std-serializers/package.json @@ -0,0 +1,64 @@ +{ + "_from": "pino-std-serializers@^2.4.2", + "_id": "pino-std-serializers@2.4.2", + "_inBundle": false, + "_integrity": "sha512-WaL504dO8eGs+vrK+j4BuQQq6GLKeCCcHaMB2ItygzVURcL1CycwNEUHTD/lHFHs/NL5qAz2UKrjYWXKSf4aMQ==", + "_location": "/pino-std-serializers", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pino-std-serializers@^2.4.2", + "name": "pino-std-serializers", + "escapedName": "pino-std-serializers", + "rawSpec": "^2.4.2", + "saveSpec": null, + "fetchSpec": "^2.4.2" + }, + "_requiredBy": [ + "/pino" + ], + "_resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-2.4.2.tgz", + "_shasum": "cb5e3e58c358b26f88969d7e619ae54bdfcc1ae1", + "_spec": "pino-std-serializers@^2.4.2", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino", + "author": { + "name": "James Sumners", + "email": "james.sumners@gmail.com" + }, + "bugs": { + "url": "https://github.com/pinojs/pino-std-serializers/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A collection of standard object serializers for Pino", + "devDependencies": { + "pre-commit": "^1.2.2", + "snazzy": "^7.0.0", + "standard": "^11.0.0", + "tap": "^12.0.0" + }, + "homepage": "https://github.com/pinojs/pino-std-serializers#readme", + "keywords": [ + "pino", + "logging" + ], + "license": "MIT", + "main": "index.js", + "name": "pino-std-serializers", + "precommit": [ + "lint", + "test" + ], + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/pinojs/pino-std-serializers.git" + }, + "scripts": { + "lint": "standard | snazzy", + "lint-ci": "standard", + "test": "tap --no-cov 'test/**/*.test.js'", + "test-ci": "tap --cov --coverage-report=text 'test/**/*.test.js'" + }, + "version": "2.4.2" +} diff --git a/node_modules/pino-std-serializers/test/err.test.js b/node_modules/pino-std-serializers/test/err.test.js new file mode 100644 index 0000000..e25193f --- /dev/null +++ b/node_modules/pino-std-serializers/test/err.test.js @@ -0,0 +1,106 @@ +'use strict' + +var test = require('tap').test +const serializer = require('../lib/err') +var wrapErrorSerializer = require('../').wrapErrorSerializer + +test('serializes Error objects', function (t) { + t.plan(3) + var serialized = serializer(Error('foo')) + t.is(serialized.type, 'Error') + t.is(serialized.message, 'foo') + t.match(serialized.stack, /err\.test\.js:/) +}) + +test('serializes Error objects with extra properties', function (t) { + t.plan(5) + var err = Error('foo') + err.statusCode = 500 + var serialized = serializer(err) + t.is(serialized.type, 'Error') + t.is(serialized.message, 'foo') + t.ok(serialized.statusCode) + t.is(serialized.statusCode, 500) + t.match(serialized.stack, /err\.test\.js:/) +}) + +test('serializes nested errors', function (t) { + t.plan(7) + var err = Error('foo') + err.inner = Error('bar') + var serialized = serializer(err) + t.is(serialized.type, 'Error') + t.is(serialized.message, 'foo') + t.match(serialized.stack, /err\.test\.js:/) + t.is(serialized.inner.type, 'Error') + t.is(serialized.inner.message, 'bar') + t.match(serialized.inner.stack, /Error: bar/) + t.match(serialized.inner.stack, /err\.test\.js:/) +}) + +test('prevents infinite recursion', function (t) { + t.plan(4) + var err = Error('foo') + err.inner = err + var serialized = serializer(err) + t.is(serialized.type, 'Error') + t.is(serialized.message, 'foo') + t.match(serialized.stack, /err\.test\.js:/) + t.notOk(serialized.inner) +}) + +test('cleans up infinite recursion tracking', function (t) { + t.plan(8) + var err = Error('foo') + var bar = Error('bar') + err.inner = bar + bar.inner = err + + serializer(err) + var serialized = serializer(err) + + t.is(serialized.type, 'Error') + t.is(serialized.message, 'foo') + t.match(serialized.stack, /err\.test\.js:/) + t.ok(serialized.inner) + t.is(serialized.inner.type, 'Error') + t.is(serialized.inner.message, 'bar') + t.match(serialized.inner.stack, /Error: bar/) + t.notOk(serialized.inner.inner) +}) + +test('err.raw is available', function (t) { + t.plan(1) + const err = Error('foo') + const serialized = serializer(err) + t.equal(serialized.raw, err) +}) + +test('pass through anything that is not an Error', function (t) { + t.plan(3) + + function check (a) { + t.is(serializer(a), a) + } + + check('foo') + check({ hello: 'world' }) + check([1, 2]) +}) + +test('can wrap err serializers', function (t) { + t.plan(5) + var err = Error('foo') + err.foo = 'foo' + var serializer = wrapErrorSerializer(function (err) { + delete err.foo + err.bar = 'bar' + return err + }) + var serialized = serializer(err) + t.is(serialized.type, 'Error') + t.is(serialized.message, 'foo') + t.match(serialized.stack, /err\.test\.js:/) + t.notOk(serialized.foo) + t.is(serialized.bar, 'bar') +}) diff --git a/node_modules/pino-std-serializers/test/req.test.js b/node_modules/pino-std-serializers/test/req.test.js new file mode 100644 index 0000000..63cca26 --- /dev/null +++ b/node_modules/pino-std-serializers/test/req.test.js @@ -0,0 +1,298 @@ +'use strict' + +var http = require('http') +var test = require('tap').test +var serializers = require('../lib/req') +var wrapRequestSerializer = require('../').wrapRequestSerializer + +test('maps request', function (t) { + t.plan(2) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + var serialized = serializers.mapHttpRequest(req) + t.ok(serialized.req) + t.ok(serialized.req.method) + t.end() + res.end() + } +}) + +test('does not return excessively long object', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + var serialized = serializers.reqSerializer(req) + t.is(Object.keys(serialized).length, 6) + res.end() + } +}) + +test('req.raw is available', function (t) { + t.plan(2) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.foo = 'foo' + var serialized = serializers.reqSerializer(req) + t.ok(serialized.raw) + t.is(serialized.raw.foo, 'foo') + res.end() + } +}) + +test('req.raw will be obtained in from input request raw property if input request raw property is truthy', function (t) { + t.plan(2) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.raw = { req: {foo: 'foo'}, res: {} } + var serialized = serializers.reqSerializer(req) + t.ok(serialized.raw) + t.is(serialized.raw.req.foo, 'foo') + res.end() + } +}) + +test('req.id defaults to undefined', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + var serialized = serializers.reqSerializer(req) + t.is(serialized.id, undefined) + res.end() + } +}) + +test('req.id has a non-function value', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + var serialized = serializers.reqSerializer(req) + t.is(typeof serialized.id === 'function', false) + res.end() + } +}) + +test('req.id will be obtained from input request info.id when input request id does not exist', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.info = {id: 'test'} + var serialized = serializers.reqSerializer(req) + t.is(serialized.id, 'test') + res.end() + } +}) + +test('req.id has a non-function value with custom id function', function (t) { + t.plan(2) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.id = function () { return 42 } + var serialized = serializers.reqSerializer(req) + t.is(typeof serialized.id === 'function', false) + t.is(serialized.id, 42) + res.end() + } +}) + +test('req.url will be obtained from input request url.path when input request url is an object', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.url = {path: '/test'} + var serialized = serializers.reqSerializer(req) + t.is(serialized.url, '/test') + res.end() + } +}) + +test('req.url will be obtained from input request originalUrl when available', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.originalUrl = '/test' + var serialized = serializers.reqSerializer(req) + t.is(serialized.url, '/test') + res.end() + } +}) + +test('can wrap request serializers', function (t) { + t.plan(3) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + var serailizer = wrapRequestSerializer(function (req) { + t.ok(req.method) + t.is(req.method, 'GET') + delete req.method + return req + }) + + function handler (req, res) { + var serialized = serailizer(req) + t.notOk(serialized.method) + res.end() + } +}) + +test('req.remoteAddress will be obtained from request connect.remoteAddress as fallback', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.connection = {remoteAddress: 'http://localhost'} + var serialized = serializers.reqSerializer(req) + t.is(serialized.remoteAddress, 'http://localhost') + res.end() + } +}) + +test('req.remoteAddress will be obtained from request info.remoteAddress if available', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.info = {remoteAddress: 'http://localhost'} + var serialized = serializers.reqSerializer(req) + t.is(serialized.remoteAddress, 'http://localhost') + res.end() + } +}) + +test('req.remotePort will be obtained from request connect.remotePort as fallback', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.connection = {remotePort: 3000} + var serialized = serializers.reqSerializer(req) + t.is(serialized.remotePort, 3000) + res.end() + } +}) + +test('req.remotePort will be obtained from request info.remotePort if available', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + req.info = {remotePort: 3000} + var serialized = serializers.reqSerializer(req) + t.is(serialized.remotePort, 3000) + res.end() + } +}) diff --git a/node_modules/pino-std-serializers/test/res.test.js b/node_modules/pino-std-serializers/test/res.test.js new file mode 100644 index 0000000..46d742c --- /dev/null +++ b/node_modules/pino-std-serializers/test/res.test.js @@ -0,0 +1,89 @@ +'use strict' + +var http = require('http') +var test = require('tap').test +var serializers = require('../lib/res') +var wrapResponseSerializer = require('../').wrapResponseSerializer + +test('res.raw is not enumerable', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + var serialized = serializers.resSerializer(res) + t.is(serialized.propertyIsEnumerable('raw'), false) + res.end() + } +}) + +test('res.raw is available', function (t) { + t.plan(2) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + res.statusCode = 200 + var serialized = serializers.resSerializer(res) + t.ok(serialized.raw) + t.is(serialized.raw.statusCode, 200) + res.end() + } +}) + +test('can wrap response serializers', function (t) { + t.plan(3) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + var serializer = wrapResponseSerializer(function (res) { + t.ok(res.statusCode) + t.is(res.statusCode, 200) + delete res.statusCode + return res + }) + + function handler (req, res) { + res.statusCode = 200 + var serialized = serializer(res) + t.notOk(serialized.statusCode) + res.end() + } +}) + +test('res.headers is serialized', function (t) { + t.plan(1) + + var server = http.createServer(handler) + server.unref() + server.listen(0, () => { + http.get(server.address(), () => {}) + }) + + t.tearDown(() => server.close()) + + function handler (req, res) { + res.setHeader('x-custom', 'y') + var serialized = serializers.resSerializer(res) + t.is(serialized.headers['x-custom'], 'y') + res.end() + } +}) diff --git a/node_modules/pino/LICENSE b/node_modules/pino/LICENSE new file mode 100644 index 0000000..5657fb4 --- /dev/null +++ b/node_modules/pino/LICENSE @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) 2016-2019 Matteo Collina, David Mark Clements and the Pino contributors + +Pino contributors listed at https://github.com/pinojs/pino#the-team and in +the README file. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/pino/README.md b/node_modules/pino/README.md new file mode 100644 index 0000000..04a4070 --- /dev/null +++ b/node_modules/pino/README.md @@ -0,0 +1,152 @@ +![banner](pino-banner.png) + +# pino  [![Build Status](https://travis-ci.org/pinojs/pino.svg?branch=master)](https://travis-ci.org/pinojs/pino) [![Coverage Status](https://coveralls.io/repos/github/pinojs/pino/badge.svg?branch=master)](https://coveralls.io/github/pinojs/pino?branch=master) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![TypeScript definitions on DefinitelyTyped](https://definitelytyped.org/badges/standard.svg)](https://definitelytyped.org) + +[Very low overhead](#low-overhead) Node.js logger, inspired by Bunyan. + +## Documentation + +* [Benchmarks ⇗](/docs/benchmarks.md) +* [API ⇗](/docs/api.md) +* [Browser API ⇗](/docs/browser.md) +* [Redaction ⇗](/docs/redaction.md) +* [Child Loggers ⇗](/docs/child-loggers.md) +* [Transports ⇗](/docs/transports.md) +* [Web Frameworks ⇗](/docs/web.md) +* [Pretty Printing ⇗](/docs/pretty.md) +* [Extreme Mode ⇗](/docs/extreme.md) +* [Ecosystem ⇗](/docs/ecosystem.md) +* [Legacy](/docs/legacy.md) +* [Help ⇗](/docs/help.md) + +## Install + +``` +$ npm install pino +``` + +## Usage + +```js +const logger = require('pino')() + +logger.info('hello world') + +const child = logger.child({ a: 'property' }) +child.info('hello child!') +``` + +This produces: + +``` +{"level":30,"time":1531171074631,"msg":"hello world","pid":657,"hostname":"Davids-MBP-3.fritz.box","v":1} +{"level":30,"time":1531171082399,"msg":"hello child!","pid":657,"hostname":"Davids-MBP-3.fritz.box","a":"property","v":1} +``` + +For using Pino with a web framework see: + +* [Pino with Fastify](docs/web.md#fastify) +* [Pino with Express](docs/web.md#express) +* [Pino with Hapi](docs/web.md#hapi) +* [Pino with Restify](docs/web.md#restify) +* [Pino with Koa](docs/web.md#koa) +* [Pino with Node core `http`](docs/web.md#http) +* [Pino with Nest](docs/web.md#nest) + + + +## Essentials + +### Development Formatting + +The [`pino-pretty`](https://github.com/pinojs/pino-pretty) module can be used to +format logs during development: + +![pretty demo](pretty-demo.png) + +### Transports & Log Processing + +Due to Node's single-threaded event-loop, it's highly recommended that sending, +alert triggering, reformatting and all forms of log processing +is conducted in a separate process. In Pino parlance we call all log processors +"transports", and recommend that the transports be run as separate +processes, piping the stdout of the application to the stdin of the transport. + +For more details see our [Transports⇗](docs/transports.md) document. + +### Low overhead + +Using minimum resources for logging is very important. Log messages +tend to get added over time and this can lead to a throttling effect +on applications – such as reduced requests per second. + +In many cases, Pino is over 5x faster than alternatives. + +See the [Benchmarks](docs/benchmarks.md) document for comparisons. + + +## The Team + +### Matteo Collina + + + + + + + +### David Mark Clements + + + + + + + +### James Sumners + + + + + + + +### Thomas Watson Steen + + + + + + + +## Communication + +### Chat on Gitter + + + +### Chat on IRC + +You'll find an active group of Pino users in the #pinojs channel on Freenode, including some of the contributors to this project. + +## Contributing + +Pino is an **OPEN Open Source Project**. This means that: + +> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. + +See the [CONTRIBUTING.md](https://github.com/pinojs/pino/blob/master/CONTRIBUTING.md) file for more details. + + +## Acknowledgements + +This project was kindly sponsored by [nearForm](http://nearform.com). + +Logo and identity designed by Cosmic Fox Design: https://www.behance.net/cosmicfox. + +## License + +Licensed under [MIT](./LICENSE). + +[elasticsearch]: https://www.elastic.co/products/elasticsearch +[kibana]: https://www.elastic.co/products/kibana diff --git a/node_modules/pino/bin.js b/node_modules/pino/bin.js new file mode 100755 index 0000000..939b117 --- /dev/null +++ b/node_modules/pino/bin.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node +console.error( + '`pino` cli has been removed. Use `pino-pretty` cli instead.\n' + + '\nSee: https://github.com/pinojs/pino-pretty' +) +process.exit(1) diff --git a/node_modules/pino/browser.js b/node_modules/pino/browser.js new file mode 100644 index 0000000..da8d9cc --- /dev/null +++ b/node_modules/pino/browser.js @@ -0,0 +1,325 @@ +'use strict' + +var format = require('quick-format-unescaped') + +module.exports = pino + +var _console = pfGlobalThisOrFallback().console || {} +var stdSerializers = { + mapHttpRequest: mock, + mapHttpResponse: mock, + wrapRequestSerializer: passthrough, + wrapResponseSerializer: passthrough, + wrapErrorSerializer: passthrough, + req: mock, + res: mock, + err: asErrValue +} + +function pino (opts) { + opts = opts || {} + opts.browser = opts.browser || {} + + var transmit = opts.browser.transmit + if (transmit && typeof transmit.send !== 'function') { throw Error('pino: transmit option must have a send function') } + + var proto = opts.browser.write || _console + if (opts.browser.write) opts.browser.asObject = true + var serializers = opts.serializers || {} + var serialize = Array.isArray(opts.browser.serialize) + ? opts.browser.serialize.filter(function (k) { + return k !== '!stdSerializers.err' + }) + : opts.browser.serialize === true ? Object.keys(serializers) : false + var stdErrSerialize = opts.browser.serialize + + if ( + Array.isArray(opts.browser.serialize) && + opts.browser.serialize.indexOf('!stdSerializers.err') > -1 + ) stdErrSerialize = false + + var levels = ['error', 'fatal', 'warn', 'info', 'debug', 'trace'] + + if (typeof proto === 'function') { + proto.error = proto.fatal = proto.warn = + proto.info = proto.debug = proto.trace = proto + } + if (opts.enabled === false) opts.level = 'silent' + var level = opts.level || 'info' + var logger = Object.create(proto) + if (!logger.log) logger.log = noop + + Object.defineProperty(logger, 'levelVal', { + get: getLevelVal + }) + Object.defineProperty(logger, 'level', { + get: getLevel, + set: setLevel + }) + + var setOpts = { + transmit: transmit, + serialize: serialize, + asObject: opts.browser.asObject, + levels: levels + } + logger.levels = pino.levels + logger.level = level + + logger.setMaxListeners = logger.getMaxListeners = + logger.emit = logger.addListener = logger.on = + logger.prependListener = logger.once = + logger.prependOnceListener = logger.removeListener = + logger.removeAllListeners = logger.listeners = + logger.listenerCount = logger.eventNames = + logger.write = logger.flush = noop + logger.serializers = serializers + logger._serialize = serialize + logger._stdErrSerialize = stdErrSerialize + logger.child = child + + if (transmit) logger._logEvent = createLogEventShape() + + function getLevelVal () { + return this.level === 'silent' + ? Infinity + : this.levels.values[this.level] + } + + function getLevel () { + return this._level + } + function setLevel (level) { + if (level !== 'silent' && !this.levels.values[level]) { + throw Error('unknown level ' + level) + } + this._level = level + + set(setOpts, logger, 'error', 'log') // <-- must stay first + set(setOpts, logger, 'fatal', 'error') + set(setOpts, logger, 'warn', 'error') + set(setOpts, logger, 'info', 'log') + set(setOpts, logger, 'debug', 'log') + set(setOpts, logger, 'trace', 'log') + } + + function child (bindings) { + if (!bindings) { + throw new Error('missing bindings for child Pino') + } + var bindingsSerializers = bindings.serializers + if (serialize && bindingsSerializers) { + var childSerializers = Object.assign({}, serializers, bindingsSerializers) + var childSerialize = opts.browser.serialize === true + ? Object.keys(childSerializers) + : serialize + delete bindings.serializers + applySerializers([bindings], childSerialize, childSerializers, this._stdErrSerialize) + } + function Child (parent) { + this._childLevel = (parent._childLevel | 0) + 1 + this.error = bind(parent, bindings, 'error') + this.fatal = bind(parent, bindings, 'fatal') + this.warn = bind(parent, bindings, 'warn') + this.info = bind(parent, bindings, 'info') + this.debug = bind(parent, bindings, 'debug') + this.trace = bind(parent, bindings, 'trace') + if (childSerializers) { + this.serializers = childSerializers + this._serialize = childSerialize + } + if (transmit) { + this._logEvent = createLogEventShape( + [].concat(parent._logEvent.bindings, bindings) + ) + } + } + Child.prototype = this + return new Child(this) + } + return logger +} + +pino.LOG_VERSION = 1 + +pino.levels = { + values: { + fatal: 60, + error: 50, + warn: 40, + info: 30, + debug: 20, + trace: 10 + }, + labels: { + 10: 'trace', + 20: 'debug', + 30: 'info', + 40: 'warn', + 50: 'error', + 60: 'fatal' + } +} + +pino.stdSerializers = stdSerializers + +function set (opts, logger, level, fallback) { + var proto = Object.getPrototypeOf(logger) + logger[level] = logger.levelVal > logger.levels.values[level] ? noop + : (proto[level] ? proto[level] : (_console[level] || _console[fallback] || noop)) + + wrap(opts, logger, level) +} + +function wrap (opts, logger, level) { + if (!opts.transmit && logger[level] === noop) return + + logger[level] = (function (write) { + return function LOG () { + var ts = Date.now() + var args = new Array(arguments.length) + var proto = (Object.getPrototypeOf && Object.getPrototypeOf(this) === _console) ? _console : this + for (var i = 0; i < args.length; i++) args[i] = arguments[i] + + if (opts.serialize && !opts.asObject) { + applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize) + } + if (opts.asObject) write.call(proto, asObject(this, level, args, ts)) + else write.apply(proto, args) + + if (opts.transmit) { + var transmitLevel = opts.transmit.level || logger.level + var transmitValue = pino.levels.values[transmitLevel] + var methodValue = pino.levels.values[level] + if (methodValue < transmitValue) return + transmit(this, { + ts: ts, + methodLevel: level, + methodValue: methodValue, + transmitLevel: transmitLevel, + transmitValue: pino.levels.values[opts.transmit.level || logger.level], + send: opts.transmit.send, + val: logger.levelVal + }, args) + } + } + })(logger[level]) +} + +function asObject (logger, level, args, ts) { + if (logger._serialize) applySerializers(args, logger._serialize, logger.serializers, logger._stdErrSerialize) + var argsCloned = args.slice() + var msg = argsCloned[0] + var o = { time: ts, level: pino.levels.values[level] } + var lvl = (logger._childLevel | 0) + 1 + if (lvl < 1) lvl = 1 + // deliberate, catching objects, arrays + if (msg !== null && typeof msg === 'object') { + while (lvl-- && typeof argsCloned[0] === 'object') { + Object.assign(o, argsCloned.shift()) + } + msg = argsCloned.length ? format(argsCloned.shift(), argsCloned) : undefined + } else if (typeof msg === 'string') msg = format(argsCloned.shift(), argsCloned) + if (msg !== undefined) o.msg = msg + return o +} + +function applySerializers (args, serialize, serializers, stdErrSerialize) { + for (var i in args) { + if (stdErrSerialize && args[i] instanceof Error) { + args[i] = pino.stdSerializers.err(args[i]) + } else if (typeof args[i] === 'object' && !Array.isArray(args[i])) { + for (var k in args[i]) { + if (serialize && serialize.indexOf(k) > -1 && k in serializers) { + args[i][k] = serializers[k](args[i][k]) + } + } + } + } +} + +function bind (parent, bindings, level) { + return function () { + var args = new Array(1 + arguments.length) + args[0] = bindings + for (var i = 1; i < args.length; i++) { + args[i] = arguments[i - 1] + } + return parent[level].apply(this, args) + } +} + +function transmit (logger, opts, args) { + var send = opts.send + var ts = opts.ts + var methodLevel = opts.methodLevel + var methodValue = opts.methodValue + var val = opts.val + var bindings = logger._logEvent.bindings + + applySerializers( + args, + logger._serialize || Object.keys(logger.serializers), + logger.serializers, + logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize + ) + logger._logEvent.ts = ts + logger._logEvent.messages = args.filter(function (arg) { + // bindings can only be objects, so reference equality check via indexOf is fine + return bindings.indexOf(arg) === -1 + }) + + logger._logEvent.level.label = methodLevel + logger._logEvent.level.value = methodValue + + send(methodLevel, logger._logEvent, val) + + logger._logEvent = createLogEventShape(bindings) +} + +function createLogEventShape (bindings) { + return { + ts: 0, + messages: [], + bindings: bindings || [], + level: { label: '', value: 0 } + } +} + +function asErrValue (err) { + var obj = { + type: err.constructor.name, + msg: err.message, + stack: err.stack + } + for (var key in err) { + if (obj[key] === undefined) { + obj[key] = err[key] + } + } + return obj +} + +function mock () { return {} } +function passthrough (a) { return a } +function noop () {} + +/* eslint-disable */ +/* istanbul ignore next */ +function pfGlobalThisOrFallback () { + function defd (o) { return typeof o !== 'undefined' && o } + try { + if (typeof globalThis !== 'undefined') return globalThis + Object.defineProperty(Object.prototype, 'globalThis', { + get: function () { + delete Object.prototype.globalThis + return (this.globalThis = this) + }, + configurable: true + }) + return globalThis + } catch (e) { + return defd(self) || defd(window) || defd(this) || {} + } +} +/* eslint-enable */ diff --git a/node_modules/pino/docs/api.md b/node_modules/pino/docs/api.md new file mode 100644 index 0000000..bbd57dd --- /dev/null +++ b/node_modules/pino/docs/api.md @@ -0,0 +1,868 @@ +# API + +* [pino() => logger](#export) + * [options](#options) + * [destination](#destination) + * [destination\[Symbol.for('pino.metadata')\]](#metadata) +* [Logger Instance](#logger) + * [logger.trace()](#trace) + * [logger.debug()](#debug) + * [logger.info()](#info) + * [logger.warn()](#warn) + * [logger.error()](#error) + * [logger.fatal()](#fatal) + * [logger.child()](#child) + * [logger.bindings()](#bindings) + * [logger.flush()](#flush) + * [logger.level](#level) + * [logger.isLevelEnabled()](#islevelenabled) + * [logger.levels](#levels) + * [logger\[Symbol.for('pino.serializers')\]](#serializers) + * [Event: 'level-change'](#level-change) + * [logger.version](#version) + * [logger.LOG_VERSION](#log_version) +* [Statics](#statics) + * [pino.destination()](#pino-destination) + * [pino.extreme()](#pino-extreme) + * [pino.final()](#pino-final) + * [pino.stdSerializers](#pino-stdserializers) + * [pino.stdTimeFunctions](#pino-stdtimefunctions) + * [pino.symbols](#pino-symbols) + * [pino.version](#pino-version) + * [pino.LOG_VERSION](#pino-LOG_VERSION) + + +## `pino([options], [destination]) => logger` + +The exported `pino` function takes two optional arguments, +[`options`](#options) and [`destination`](#destination) and +returns a [logger instance](#logger). + + +### `options` (Object) + +#### `name` (String) + +Default: `undefined` + +The name of the logger. When set adds a `name` field to every JSON line logged. + +#### `level` (String) + +Default: `'info'` + +One of `'fatal'`, `'error'`, `'warn'`, `'info`', `'debug'`, `'trace'` or `'silent'`. + +Additional levels can be added to the instance via the `customLevels` option. + +* See [`customLevels` option](#opt-customlevels) + + +#### `customLevels` (Object) + +Default: `undefined` + +Use this option to define additional logging levels. +The keys of the object correspond the namespace of the log level, +and the values should be the numerical value of the level. + +```js +const logger = pino({ + customLevels: { + foo: 35 + } +}) +logger.foo('hi') +``` + + +#### `useOnlyCustomLevels` (Boolean) + +Default: `false` + +Use this option to only use defined `customLevels` and omit Pino's levels. +Logger's default `level` must be changed to a value in `customLevels` in order to use `useOnlyCustomLevels` +Warning: this option may not be supported by downstream transports. + +```js +const logger = pino({ + customLevels: { + foo: 35 + }, + useOnlyCustomLevels: true, + level: 'foo' +}) +logger.foo('hi') +logger.info('hello') // Will throw an error saying info in not found in logger object +``` + +#### `mixin` (Function): + +Default: `undefined` + +If provided, the `mixin` function is called each time one of the active +logging methods is called. The function must synchronously return an +object. The properties of the returned object will be added to the +logged JSON. + +```js +let n = 0 +const logger = pino({ + mixin () { + return { line: ++n } + } +}) +logger.info('hello') +// {"level":30,"time":1573664685466,"pid":78742,"hostname":"x","line":1,"msg":"hello","v":1} +logger.info('world') +// {"level":30,"time":1573664685469,"pid":78742,"hostname":"x","line":2,"msg":"world","v":1} +``` + +#### `redact` (Array | Object): + +Default: `undefined` + +As an array, the `redact` option specifies paths that should +have their values redacted from any log output. + +Each path must be a string using a syntax which corresponds to JavaScript dot and bracket notation. + +If an object is supplied, three options can be specified: + * `paths` (array): Required. An array of paths. See [redaction - Path Syntax ⇗](/docs/redaction.md#paths) for specifics. + * `censor` (String|Function|Undefined): Optional. When supplied as a String the `censor` option will overwrite keys which are to be redacted. When set to `undefined` the the key will be removed entirely from the object. + The `censor` option may also be a mapping function. The (synchronous) mapping function is called with the unredacted value. The value returned from the mapping function becomes the applied censor value. Default: `'[Redacted]'` + value synchronously. + Default: `'[Redacted]'` + * `remove` (Boolean): Optional. Instead of censoring the value, remove both the key and the value. Default: `false` + +**WARNING**: Never allow user input to define redacted paths. + +* See the [redaction ⇗](/docs/redaction.md) documentation. +* See [fast-redact#caveat ⇗](http://github.com/davidmarkclements/fast-redact#caveat) + + +#### `serializers` (Object) + +Default: `{err: pino.stdSerializers.err}` + +An object containing functions for custom serialization of objects. +These functions should return an JSONifiable object and they +should never throw. When logging an object, each top-level property +matching the exact key of a serializer will be serialized using the defined serializer. + +* See [pino.stdSerializers](#pino-stdserializers) + +##### `serializers[Symbol.for('pino.*')]` (Function) + +Default: `undefined` + +The `serializers` object may contain a key which is the global symbol: `Symbol.for('pino.*')`. +This will act upon the complete log object rather than corresponding to a particular key. + +#### `base` (Object) + +Default: `{pid: process.pid, hostname: os.hostname}` + +Key-value object added as child logger to each log line. + +Set to `null` to avoid adding `pid`, `hostname` and `name` properties to each log. + +#### `enabled` (Boolean) + +Default: `true` + +Set to `false` to disable logging. + +#### `crlf` (Boolean) + +Default: `false` + +Set to `true` to logs newline delimited JSON with `\r\n` instead of `\n`. + + +#### `timestamp` (Boolean | Function) + +Default: `true` + +Enables or disables the inclusion of a timestamp in the +log message. If a function is supplied, it must synchronously return a JSON string +representation of the time, e.g. `,"time":1493426328206` (which is the default). + +If set to `false`, no timestamp will be included in the output. +See [stdTimeFunctions](#pino-stdtimefunctions) for a set of available functions +for passing in as a value for this option. + +**Caution**: attempting to format time in-process will significantly impact logging performance. + + +#### `messageKey` (String) + +Default: `'msg'` + +The string key for the 'message' in the JSON object. + + +#### `nestedKey` (String) + +Default: `null` + +If there's a chance that objects being logged have properties that conflict with those from pino itself (`level`, `timestamp`, `v`, `pid`, etc) +and duplicate keys in your log records are undesirable, pino can be configured with a `nestedKey` option that causes any `object`s that are logged +to be placed under a key whose name is the value of `nestedKey`. + +This way, when searching something like Kibana for values, one can consistently search under the configured `nestedKey` value instead of the root log record keys. + +For example, +```js +const logger = require('pino')({ + nestedKey: 'payload' +}) + +const thing = { level: 'hi', time: 'never', foo: 'bar'} // has pino-conflicting properties! +logger.info(thing) + +// logs the following: +// {"level":30,"time":1578357790020,"pid":91736,"hostname":"x","payload":{"level":"hi","time":"never","foo":"bar"},"v":1} +``` +In this way, logged objects' properties don't conflict with pino's standard logging properties, +and searching for logged objects can start from a consistent path. + + +#### `prettyPrint` (Boolean | Object) + +Default: `false` + +Enables pretty printing log logs. This is intended for non-production +configurations. This may be set to a configuration object as outlined in the +[`pino-pretty` documentation](https://github.com/pinojs/pino-pretty). + +The options object may additionally contain a `prettifier` property to define +which prettifier module to use. When not present, `prettifier` defaults to +`'pino-pretty'`. Regardless of the value, the specified prettifier module +must be installed as a separate dependency: + +```sh +npm install pino-pretty +``` + + +#### `useLevelLabels` (Boolean) + +Default: `false` + +Enables printing of level labels instead of level values in the printed logs. +Warning: this option may not be supported by downstream transports. + + +#### `changeLevelName` (String) - DEPRECATED +Use `levelKey` instead. This will be removed in v7. + + +#### `levelKey` (String) + +Default: `'level'` + +Changes the property `level` to any string value you pass in: +```js +const logger = pino({ + levelKey: 'priority' +}) +logger.info('hello world') +// {"priority":30,"time":1531257112193,"msg":"hello world","pid":55956,"hostname":"x","v":1} +``` + +#### `browser` (Object) + +Browser only, may have `asObject` and `write` keys. This option is separately +documented in the [Browser API ⇗](/docs/browser.md) documentation. + +* See [Browser API ⇗](/docs/browser.md) + + +### `destination` (SonicBoom | WritableStream | String) + +Default: `pino.destination(1)` (STDOUT) + +The `destination` parameter, at a minimum must be an object with a `write` method. +An ordinary Node.js `stream` can be passed as the destination (such as the result +of `fs.createWriteStream`) but for peak log writing performance it is strongly +recommended to use `pino.destination` or `pino.extreme` to create the destination stream. + +```js +// pino.destination(1) by default +const stdoutLogger = require('pino')() + +// destination param may be in first position when no options: +const fileLogger = require('pino')( pino.destination('/log/path')) + +// use the stderr file handle to log to stderr: +const opts = {name: 'my-logger'} +const stderrLogger = require('pino')(opts, pino.destination(2)) + +// automatic wrapping in pino.destination +const fileLogger = require('pino')('/log/path') +``` + +However, there are some special instances where `pino.destination` is not used as the default: + ++ When something, e.g a process manager, has monkey-patched `process.stdout.write`. + +In these cases `process.stdout` is used instead. + +* See [`pino.destination`](#pino-destination) +* See [`pino.extreme`](#pino-extreme) + + +#### `destination[Symbol.for('pino.metadata')]` + +Default: `false` + +Using the global symbol `Symbol.for('pino.metadata')` as a key on the `destination` parameter and +setting the key it to `true`, indicates that the following properties should be +set on the `destination` object after each log line is written: + +* the last logging level as `destination.lastLevel` +* the last logging message as `destination.lastMsg` +* the last logging object as `destination.lastObj` +* the last time as `destination.lastTime`, which will be the partial string returned + by the time function. +* the last logger instance as `destination.lastLogger` (to support child + loggers) + +For a full reference for using `Symbol.for('pino.metadata')`, see the [`pino-multi-stream` ⇗](https://github.com/pinojs/pino-multi-stream) +module. + +The following is a succinct usage example: + +```js +const dest = pino.destination('/dev/null') +dest[Symbol.for('pino.metadata')] = true +const logger = pino(dest) +logger.info({a: 1}, 'hi') +const { lastMsg, lastLevel, lastObj, lastTime} = dest +console.log( + 'Logged message "%s" at level %d with object %o at time %s', + lastMsg, lastLevel, lastObj, lastTime +) // Logged message "hi" at level 30 with object { a: 1 } at time 1531590545089 +``` + +* See [`pino-multi-stream` ⇗](https://github.com/pinojs/pino-multi-stream) + + +## Logger Instance + +The logger instance is the object returned by the main exported +[`pino`](#export) function. + +The primary purpose of the logger instance is to provide logging methods. + +The default logging methods are `trace`, `debug`, `info`, `warn`, `error`, and `fatal`. + +Each logging method has the following signature: +`([mergingObject], [message], [...interpolationValues])`. + +The parameters are explained below using the `logger.info` method but the same applies to all logging methods. + +### Logging Method Parameters + + +#### `mergingObject` (Object) + +An object can optionally be supplied as the first parameter. Each enumerable key and value +of the `mergingObject` is copied in to the JSON log line. + +```js +logger.info({MIX: {IN: true}}) +// {"level":30,"time":1531254555820,"pid":55956,"hostname":"x","MIX":{"IN":true},"v":1} +``` + + +#### `message` (String) + +A `message` string can optionally be supplied as the first parameter, or +as the second parameter after supplying a `mergingObject`. + +By default, the contents of the `message` parameter will be merged into the +JSON log line under the `msg` key: + +```js +logger.info('hello world') +// {"level":30,"time":1531257112193,"msg":"hello world","pid":55956,"hostname":"x","v":1} +``` + +The `message` parameter takes precedence over the `mergedObject`. +That is, if a `mergedObject` contains a `msg` property, and a `message` parameter +is supplied in addition, the `msg` property in the output log will be the value of +the `message` parameter not the value of the `msg` property on the `mergedObject`. + +The `messageKey` option can be used at instantiation time to change the namespace +from `msg` to another string as preferred. + +The `message` string may contain a printf style string with support for +the following placeholders: + +* `%s` – string placeholder +* `%d` – digit placeholder +* `%O`, `%o` and `%j` – object placeholder + +Values supplied as additional arguments to the logger method will +then be interpolated accordingly. + +* See [`messageKey` pino option](#opt-messagekey) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +#### `...interpolationValues` (Any) + +All arguments supplied after `message` are serialized and interpolated according +to any supplied printf-style placeholders (`%s`, `%d`, `%o`|`%O`|`%j`) +or else concatenated together with the `message` string to form the final +output `msg` value for the JSON log line. + +```js +logger.info('hello', 'world') +// {"level":30,"time":1531257618044,"msg":"hello world","pid":55956,"hostname":"x","v":1} +``` + +```js +logger.info('hello', {worldly: 1}) +// {"level":30,"time":1531257797727,"msg":"hello {\"worldly\":1}","pid":55956,"hostname":"x","v":1} +``` + +```js +logger.info('%o hello', {worldly: 1}) +// {"level":30,"time":1531257826880,"msg":"{\"worldly\":1} hello","pid":55956,"hostname":"x","v":1} +``` + +* See [`message` log method parameter](#message) + + +### `logger.trace([mergingObject], [message], [...interpolationValues])` + +Write a `'trace'` level log, if the configured [`level`](#level) allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.debug([mergingObject], [message], [...interpolationValues])` + +Write a `'debug'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.info([mergingObject], [message], [...interpolationValues])` + +Write an `'info'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.warn([mergingObject], [message], [...interpolationValues])` + +Write a `'warn'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.error([mergingObject], [message], [...interpolationValues])` + +Write a `'error'` level log, if the configured `level` allows for it. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + +### `logger.fatal([mergingObject], [message], [...interpolationValues])` + +Write a `'fatal'` level log, if the configured `level` allows for it. + +Since `'fatal'` level messages are intended to be logged just prior to the process exiting the `fatal` +method will always sync flush the destination. +Therefore it's important not to misuse `fatal` since +it will cause performance overhead if used for any +other purpose than writing final log messages before +the process crashes or exits. + +* See [`mergingObject` log method parameter](#mergingobject) +* See [`message` log method parameter](#message) +* See [`...interpolationValues` log method parameter](#interpolationvalues) + + + +### `logger.child(bindings) => logger` + +The `logger.child` method allows for the creation of stateful loggers, +where key-value pairs can be pinned to a logger causing them to be output +on every log line. + +Child loggers use the same output stream as the parent and inherit +the current log level of the parent at the time they are spawned. + +The log level of a child is mutable. It can be set independently +of the parent either by setting the [`level`](#level) accessor after creating +the child logger or using the reserved [`bindings.level`](#bindingslevel-string) key. + +#### `bindings` (Object) + +An object of key-value pairs to include in every log line output +via the returned child logger. + +```js +const child = logger.child({ MIX: {IN: 'always'} }) +child.info('hello') +// {"level":30,"time":1531258616689,"msg":"hello","pid":64849,"hostname":"x","MIX":{"IN":"always"},"v":1} +child.info('child!') +// {"level":30,"time":1531258617401,"msg":"child!","pid":64849,"hostname":"x","MIX":{"IN":"always"},"v":1} +``` + +The `bindings` object may contain any key except for reserved configuration keys `level` and `serializers`. + +##### `bindings.level` (String) + +If a `level` property is present in the `bindings` object passed to `logger.child` +it will override the child logger level. + +```js +const logger = pino() +logger.debug('nope') // will not log, since default level is info +const child = logger.child({foo: 'bar', level: 'debug'}) +child.debug('debug!') // will log as the `level` property set the level to debug +``` + +##### `bindings.serializers` (Object) + +Child loggers inherit the [serializers](#opt-serializers) from the parent logger. + +Setting the `serializers` key of the `bindings` object will override +any configured parent serializers. + +```js +const logger = require('pino')() +logger.info({test: 'will appear'}) +// {"level":30,"time":1531259759482,"pid":67930,"hostname":"x","test":"will appear","v":1} +const child = logger.child({serializers: {test: () => `child-only serializer`}}) +child.info({test: 'will be overwritten'}) +// {"level":30,"time":1531259784008,"pid":67930,"hostname":"x","test":"child-only serializer","v":1} +``` + +* See [`serializers` option](#opt-serializers) +* See [pino.stdSerializers](#pino-stdSerializers) + + +### `logger.bindings()` + +Returns an object containing all the current bindings, cloned from the ones passed in via `logger.child()`. +```js +const child = logger.child({ foo: 'bar' }) +console.log(child.bindings()) +// { foo: 'bar' } +const anotherChild = child.child({ MIX: { IN: 'always' } }) +console.log(anotherChild.bindings()) +// { foo: 'bar', MIX: { IN: 'always' } } +``` + + +### `logger.flush()` + +Flushes the content of the buffer when using a `pino.extreme` destination. + +This is an asynchronous, fire and forget, operation. + +The use case is primarily for Extreme mode logging, which may hold up to +4KiB of logs. The `logger.flush` method can be used to flush the logs +on an long interval, say ten seconds. Such a strategy can provide an +optimium balance between extremely efficient logging at high demand periods +and safer logging at low demand periods. + +* See [`pino.extreme`](#pino-extreme) +* See [`destination` parameter](#destination) +* See [Extreme mode ⇗](/docs/extreme.md) + + +### `logger.level` (String) [Getter/Setter] + +Set this property to the desired logging level. + +The core levels and their values are as follows: + +| | | | | | | | | +|:-----------|-------|-------|------|------|-------|-------|---------:| +| **Level:** | trace | debug | info | warn | error | fatal | silent | +| **Value:** | 10 | 20 | 30 | 40 | 50 | 60 | Infinity | + +The logging level is a *minimum* level based on the associated value of that level. + +For instance if `logger.level` is `info` *(30)* then `info` *(30)*, `warn` *(40)*, `error` *(50)* and `fatal` *(60)* log methods will be enabled but the `trace` *(10)* and `debug` *(20)* methods, being less than 30, will not. + +The `silent` logging level is a specialized level which will disable all logging, +there is no `silent` log method. + + +### `logger.isLevelEnabled(level)` + +A utility method for determining if a given log level will write to the destination. + +#### `level` (String) + +The given level to check against: + +```js +if (logger.isLevelEnabled('debug')) logger.debug('conditional log') +``` + +#### `levelLabel` (String) + +Defines the method name of the new level. + +* See [`logger.level`](#level) + +#### `levelValue` (Number) + +Defines the associated minimum threshold value for the level, and +therefore where it sits in order of priority among other levels. + +* See [`logger.level`](#level) + + +### `logger.levelVal` (Number) + +Supplies the integer value for the current logging level. + +```js +if (logger.levelVal === 30) { + console.log('logger level is `info`') +} +``` + + +### `logger.levels` (Object) + +Levels are mapped to values to determine the minimum threshold that a +logging method should be enabled at (see [`logger.level`](#level)). + +The `logger.levels` property holds the mappings between levels and values, +and vice versa. + +```sh +$ node -p "require('pino')().levels" +``` + +```js +{ labels: + { '10': 'trace', + '20': 'debug', + '30': 'info', + '40': 'warn', + '50': 'error', + '60': 'fatal' }, + values: + { fatal: 60, error: 50, warn: 40, info: 30, debug: 20, trace: 10 } } +``` + +* See [`logger.level`](#level) + + +### logger\[Symbol.for('pino.serializers')\] + +Returns the serializers as applied to the current logger instance. If a child logger did not +register it's own serializer upon instantiation the serializers of the parent will be returned. + + +### Event: 'level-change' + +The logger instance is also an [`EventEmitter ⇗`](https://nodejs.org/dist/latest/docs/api/events.html#events_class_eventemitter) + +A listener function can be attached to a logger via the `level-change` event + +The listener is passed four arguments: + +* `levelLabel` – the new level string, e.g `trace` +* `levelValue` – the new level number, e.g `10` +* `previousLevelLabel` – the prior level string, e.g `info` +* `previousLevelValue` – the prior level numbebr, e.g `30` + +```js +const logger = require('pino')() +logger.on('level-change', (lvl, val, prevLvl, prevVal) => { + console.log('%s (%d) was changed to %s (%d)', lvl, val, prevLvl, prevVal) +}) +logger.level = 'trace' // trigger event +``` + + +### `logger.version` (String) + +Exposes the Pino package version. Also available on the exported `pino` function. + +* See [`pino.version`](#pino-version) + + +### `logger.LOG_VERSION` (Number) + +Holds the current log format version as output in the `v` property of each log record. +Also available on the exported `pino` function. + +* See [`pino.LOG_VERSION`](#pino-LOG_VERSION) + +## Statics + + +### `pino.destination([target]) => SonicBoom` + +Create a Pino Destination instance: a stream-like object with +significantly more throughput (over 30%) than a standard Node.js stream. + +```js +const pino = require('pino') +const logger = pino(pino.destination('./my-file')) +const logger2 = pino(pino.destination()) +``` + +The `pino.destination` method may be passed a file path or a numerical file descriptor. +By default, `pino.destination` will use `process.stdout.fd` (1) as the file descriptor. + +`pino.destination` is implemented on [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom). + +A `pino.destination` instance can also be used to reopen closed files +(for example, for some log rotation scenarios), see [Reopening log files](/docs/help.md#reopening). + +* See [`destination` parameter](#destination) +* See [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) +* See [Reopening log files](/docs/help.md#reopening) + + +### `pino.extreme([target]) => SonicBoom` + +Create an extreme mode destination. This yields an additional 60% performance boost. +There are trade-offs that should be understood before usage. + +```js +const pino = require('pino') +const logger = pino(pino.extreme('./my-file')) +const logger2 = pino(pino.extreme()) +``` + +The `pino.extreme` method may be passed a file path or a numerical file descriptor. +By default, `pino.extreme` will use `process.stdout.fd` (1) as the file descriptor. + +`pino.extreme` is implemented with the [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) +module. + +A `pino.extreme` instance can also be used to reopen closed files +(for example, for some log rotation scenarios), see [Reopening log files](/docs/help.md#reopening). + +On AWS Lambda we recommend to call `extreme.flushSync()` at the end +of each function execution to avoid losing data. + +* See [`destination` parameter](#destination) +* See [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) +* See [Extreme mode ⇗](/docs/extreme.md) +* See [Reopening log files](/docs/help.md#reopening) + + + +### `pino.final(logger, [handler]) => Function | FinalLogger` + +The `pino.final` method can be used to acquire a final logger instance +or create an exit listener function. + +The `finalLogger` is a specialist logger that synchronously flushes +on every write. This is important to guarantee final log writes, +both when using `pino.extreme` target. + +Since final log writes cannot be guaranteed with normal Node.js streams, +if the `destination` parameter of the `logger` supplied to `pino.final` +is a Node.js stream `pino.final` will throw. + +The use of `pino.final` with `pino.destination` is not needed, as +`pino.destination` writes things synchronously. + +#### `pino.final(logger, handler) => Function` + +In this case the `pino.final` method supplies an exit listener function that can be +supplied to process exit events such as `exit`, `uncaughtException`, +`SIGHUP` and so on. + +The exit listener function will call the supplied `handler` function +with an error object (or else `null`), a `finalLogger` instance followed +by any additional arguments the `handler` may be called with. + +```js +process.on('uncaughtException', pino.final(logger, (err, finalLogger) => { + finalLogger.error(err, 'uncaughtException') + process.exit(1) +})) +``` + +#### `pino.final(logger) => FinalLogger` + +In this case the `pino.final` method returns a finalLogger instance. + +```js +var finalLogger = pino.final(logger) +finalLogger.info('exiting...') +``` + +* See [`destination` parameter](#destination) +* See [Exit logging help](/docs/help.md#exit-logging) +* See [Extreme mode ⇗](/docs/extreme.md) +* See [Log loss prevention ⇗](/docs/extreme.md#log-loss-prevention) + + +### `pino.stdSerializers` (Object) + +The `pino.stdSerializers` object provides functions for serializing objects common to many projects. The standard serializers are directly imported from [pino-std-serializers](https://github.com/pinojs/pino-std-serializers). + +* See [pino-std-serializers ⇗](https://github.com/pinojs/pino-std-serializers) + + +### `pino.stdTimeFunctions` (Object) + +The [`timestamp`](#opt-timestamp) option can accept a function which determines the +`timestamp` value in a log line. + +The `pino.stdTimeFunctions` object provides a very small set of common functions for generating the +`timestamp` property. These consist of the following + +* `pino.stdTimeFunctions.epochTime`: Milliseconds since Unix epoch (Default) +* `pino.stdTimeFunctions.unixTime`: Seconds since Unix epoch +* `pino.stdTimeFunctions.nullTime`: Clears timestamp property (Used when `timestamp: false`) +* `pino.stdTimeFunctions.isoTime`: ISO 8601-formatted time in UTC + +* See [`timestamp` option](#opt-timestamp) + + +### `pino.symbols` (Object) + +For integration purposes with ecosystem and third party libraries `pino.symbols` +exposes the symbols used to hold non-public state and methods on the logger instance. + +Access to the symbols allows logger state to be adjusted, and methods to be overridden or +proxied for performant integration where necessary. + +The `pino.symbols` object is intended for library implementers and shouldn't be utilized +for general use. + + +### `pino.version` (String) + +Exposes the Pino package version. Also available on the logger instance. + +* See [`logger.version`](#version) + + +### `pino.LOG_VERSION` (Number) + +Holds the current log format version as output in the `v` property of each log record. Also available on the logger instance. + +* See [`logger.LOG_VERSION`](#log_version) diff --git a/node_modules/pino/docs/benchmarks.md b/node_modules/pino/docs/benchmarks.md new file mode 100644 index 0000000..4f508a4 --- /dev/null +++ b/node_modules/pino/docs/benchmarks.md @@ -0,0 +1,58 @@ +# Benchmarks + +`pino.info('hello world')`: + +``` +BASIC benchmark averages +Bunyan average: 549.042ms +Winston average: 467.873ms +Bole average: 201.529ms +Debug average: 253.724ms +LogLevel average: 282.653ms +Pino average: 188.956ms +PinoExtreme average: 108.809ms +``` + +`pino.info({'hello': 'world'})`: + +``` +OBJECT benchmark averages +BunyanObj average: 564.363ms +WinstonObj average: 464.824ms +BoleObj average: 230.220ms +LogLevelObject average: 474.857ms +PinoObj average: 201.442ms +PinoUnsafeObj average: 202.687ms +PinoExtremeObj average: 108.689ms +PinoUnsafeExtremeObj average: 106.718ms +``` + +`pino.info(aBigDeeplyNestedObject)`: + +``` +DEEPOBJECT benchmark averages +BunyanDeepObj average: 5293.279ms +WinstonDeepObj average: 9020.292ms +BoleDeepObj average: 9169.043ms +LogLevelDeepObj average: 15260.917ms +PinoDeepObj average: 8467.807ms +PinoUnsafeDeepObj average: 6159.227ms +PinoExtremeDeepObj average: 8354.557ms +PinoUnsafeExtremeDeepObj average: 6214.073ms +``` + +`pino.info('hello %s %j %d', 'world', {obj: true}, 4, {another: 'obj'})`: + +``` +BunyanInterpolateExtra average: 778.408ms +WinstonInterpolateExtra average: 627.956ms +BoleInterpolateExtra average: 429.757ms +PinoInterpolateExtra average: 316.043ms +PinoUnsafeInterpolateExtra average: 316.809ms +PinoExtremeInterpolateExtra average: 218.468ms +PinoUnsafeExtremeInterpolateExtra average: 215.040ms +``` + +For a fair comparison, [LogLevel](http://npm.im/loglevel) was extended +to include a timestamp and [bole](http://npm.im/bole) had +`fastTime` mode switched on. diff --git a/node_modules/pino/docs/browser.md b/node_modules/pino/docs/browser.md new file mode 100644 index 0000000..ae357b0 --- /dev/null +++ b/node_modules/pino/docs/browser.md @@ -0,0 +1,199 @@ +# Browser API + +Pino is compatible with [`browserify`](http://npm.im/browserify) for browser side usage: + +This can be useful with isomorphic/universal JavaScript code. + +By default, in the browser, +`pino` uses corresponding [Log4j](https://en.wikipedia.org/wiki/Log4j) `console` methods (`console.error`, `console.warn`, `console.info`, `console.debug`, `console.trace`) and uses `console.error` for any `fatal` level logs. + +## Options + +Pino can be passed a `browser` object in the options object, +which can have the following properties: + +### `asObject` (Boolean) + +```js +const pino = require('pino')({browser: {asObject: true}}) +``` + +The `asObject` option will create a pino-like log object instead of +passing all arguments to a console method, for instance: + +```js +pino.info('hi') // creates and logs {msg: 'hi', level: 30, time: } +``` + +When `write` is set, `asObject` will always be `true`. + +### `write` (Function | Object) + +Instead of passing log messages to `console.log` they can be passed to +a supplied function. + +If `write` is set to a single function, all logging objects are passed +to this function. + +```js +const pino = require('pino')({ + browser: { + write: (o) => { + // do something with o + } + } +}) +``` + +If `write` is an object, it can have methods that correspond to the +levels. When a message is logged at a given level, the corresponding +method is called. If a method isn't present, the logging falls back +to using the `console`. + + +```js +const pino = require('pino')({ + browser: { + write: { + info: function (o) { + //process info log object + }, + error: function (o) { + //process error log object + } + } + } +}) +``` + +### `serialize`: (Boolean | Array) + +The serializers provided to `pino` are ignored by default in the browser, including +the standard serializers provided with Pino. Since the default destination for log +messages is the console, values such as `Error` objects are enhanced for inspection, +which they otherwise wouldn't be if the Error serializer was enabled. + +We can turn all serializers on, + +```js +const pino = require('pino')({ + browser: { + serialize: true + } +}) +``` + +Or we can selectively enable them via an array: + +```js +const pino = require('pino')({ + serializers: { + custom: myCustomSerializer, + another: anotherSerializer + }, + browser: { + serialize: ['custom'] + } +}) +// following will apply myCustomSerializer to the custom property, +// but will not apply anotherSerializer to another key +pino.info({custom: 'a', another: 'b'}) +``` + +When `serialize` is `true` the standard error serializer is also enabled (see https://github.com/pinojs/pino/blob/master/docs/api.md#stdSerializers). +This is a global serializer which will apply to any `Error` objects passed to the logger methods. + +If `serialize` is an array the standard error serializer is also automatically enabled, it can +be explicitly disabled by including a string in the serialize array: `!stdSerializers.err`, like so: + +```js +const pino = require('pino')({ + serializers: { + custom: myCustomSerializer, + another: anotherSerializer + }, + browser: { + serialize: ['!stdSerializers.err', 'custom'] //will not serialize Errors, will serialize `custom` keys + } +}) +``` + +The `serialize` array also applies to any child logger serializers (see https://github.com/pinojs/pino/blob/master/docs/api.md#discussion-2 +for how to set child-bound serializers). + +Unlike server pino the serializers apply to every object passed to the logger method, +if the `asObject` option is `true`, this results in the serializers applying to the +first object (as in server pino). + +For more info on serializers see https://github.com/pinojs/pino/blob/master/docs/api.md#parameters. + +### `transmit` (Object) + +An object with `send` and `level` properties. + +The `transmit.level` property specifies the minimum level (inclusive) of when the `send` function +should be called, if not supplied the `send` function be called based on the main logging `level` +(set via `options.level`, defaulting to `info`). + +The `transmit` object must have a `send` function which will be called after +writing the log message. The `send` function is passed the level of the log +message and a `logEvent` object. + +The `logEvent` object is a data structure representing a log message, it represents +the arguments passed to a logger statement, the level +at which they were logged and the hierarchy of child bindings. + +The `logEvent` format is structured like so: + +```js +{ + ts = Number, + messages = Array, + bindings = Array, + level: { label = String, value = Number} +} +``` + +The `ts` property is a unix epoch timestamp in milliseconds, the time is taken from the moment the +logger method is called. + +The `messages` array is all arguments passed to logger method, (for instance `logger.info('a', 'b', 'c')` +would result in `messages` array `['a', 'b', 'c']`). + +The `bindings` array represents each child logger (if any), and the relevant bindings. +For instance given `logger.child({a: 1}).child({b: 2}).info({c: 3})`, the bindings array +would hold `[{a: 1}, {b: 2}]` and the `messages` array would be `[{c: 3}]`. The `bindings` +are ordered according to their position in the child logger hierarchy, with the lowest index +being the top of the hierarchy. + +By default serializers are not applied to log output in the browser, but they will *always* be +applied to `messages` and `bindings` in the `logEvent` object. This allows us to ensure a consistent +format for all values between server and client. + +The `level` holds the label (for instance `info`), and the corresponding numerical value +(for instance `30`). This could be important in cases where client side level values and +labels differ from server side. + +The point of the `send` function is to remotely record log messages: + +```js +const pino = require('pino')({ + browser: { + transmit: { + level: 'warn', + send: function (level, logEvent) { + if (level === 'warn') { + // maybe send the logEvent to a separate endpoint + // or maybe analyse the messages further before sending + } + // we could also use the `logEvent.level.value` property to determine + // numerical value + if (logEvent.level.value >= 50) { // covers error and fatal + + // send the logEvent somewhere + } + } + } + } +}) +``` diff --git a/node_modules/pino/docs/child-loggers.md b/node_modules/pino/docs/child-loggers.md new file mode 100644 index 0000000..c664c85 --- /dev/null +++ b/node_modules/pino/docs/child-loggers.md @@ -0,0 +1,95 @@ +# Child loggers + +Let's assume we want to have `"module":"foo"` added to every log within a +module `foo.js`. + +To accomplish this, simply use a child logger: + +```js +'use strict' +// imports a pino logger instance of `require('pino')()` +const parentLogger = require('./lib/logger') +const log = parentLogger.child({module: 'foo'}) + +function doSomething () { + log.info('doSomething invoked') +} + +module.exports = { + doSomething +} +``` + +## Cost of child logging + +Child logger creation is fast: + +``` +benchBunyanCreation*10000: 564.514ms +benchBoleCreation*10000: 283.276ms +benchPinoCreation*10000: 258.745ms +benchPinoExtremeCreation*10000: 150.506ms +``` + +Logging through a child logger has little performance penalty: + +``` +benchBunyanChild*10000: 556.275ms +benchBoleChild*10000: 288.124ms +benchPinoChild*10000: 231.695ms +benchPinoExtremeChild*10000: 122.117ms +``` + +Logging via the child logger of a child logger also has negligible overhead: + +``` +benchBunyanChildChild*10000: 559.082ms +benchPinoChildChild*10000: 229.264ms +benchPinoExtremeChildChild*10000: 127.753ms +``` + +## Duplicate keys caveat + +It's possible for naming conflicts to arise between child loggers and +children of child loggers. + +This isn't as bad as it sounds, even if the same keys between +parent and child loggers are used, Pino resolves the conflict in the sanest way. + +For example, consider the following: + +```js +const pino = require('pino') +pino(pino.destination('./my-log')) + .child({a: 'property'}) + .child({a: 'prop'}) + .info('howdy') +``` + +```sh +$ cat my-log +{"pid":95469,"hostname":"MacBook-Pro-3.home","level":30,"msg":"howdy","time":1459534114473,"a":"property","a":"prop","v":1} +``` + +Notice how there's two key's named `a` in the JSON output. The sub-childs properties +appear after the parent child properties. + +At some point the logs will most likely be processed (for instance with a [transport](transports.md)), +and this generally involves parsing. `JSON.parse` will return an object where the conflicting +namespace holds the final value assigned to it: + +```sh +$ cat my-log | node -e "process.stdin.once('data', (line) => console.log(JSON.stringify(JSON.parse(line))))" +{"pid":95469,"hostname":"MacBook-Pro-3.home","level":30,"msg":"howdy","time":"2016-04-01T18:08:34.473Z","a":"prop","v":1} +``` + +Ultimately the conflict is resolved by taking the last value, which aligns with Bunyans child logging +behavior. + +There may be cases where this edge case becomes problematic if a JSON parser with alternative behavior +is used to process the logs. It's recommended to be conscious of namespace conflicts with child loggers, +in light of an expected log processing approach. + +One of Pino's performance tricks is to avoid building objects and stringifying +them, so we're building strings instead. This is why duplicate keys between +parents and children will end up in log output. diff --git a/node_modules/pino/docs/ecosystem.md b/node_modules/pino/docs/ecosystem.md new file mode 100644 index 0000000..29db61a --- /dev/null +++ b/node_modules/pino/docs/ecosystem.md @@ -0,0 +1,72 @@ +# Pino Ecosystem + +This is a list of ecosystem modules that integrate with `pino`. + +Modules listed under [Core](#core) are maintained by the Pino team. Modules +listed under [Community](#community) are maintained by independent community +members. + +Please send a PR to add new modules! + + +## Core + ++ [`express-pino-logger`](https://github.com/pinojs/express-pino-logger): use +Pino to log requests within [express](https://expressjs.com/). ++ [`koa-pino-logger`](https://github.com/pinojs/koa-pino-logger): use Pino to +log requests within [Koa](http://koajs.com/). ++ [`pino-arborsculpture`](https://github.com/pinojs/pino-arborsculpture): change +log levels at runtime. ++ [`pino-caller`](https://github.com/pinojs/pino-caller): add callsite to the log line. ++ [`pino-clf`](https://github.com/pinojs/pino-clf): reformat Pino logs into +Common Log Format. ++ [`pino-debug`](https://github.com/pinojs/pino-debug): use Pino to interpret +[`debug`](https://npm.im/debug) logs. ++ [`pino-elasticsearch`](https://github.com/pinojs/pino-elasticsearch): send +Pino logs to an Elasticsearch instance. ++ [`pino-eventhub`](https://github.com/pinojs/pino-eventhub): send Pino logs +to an [Event Hub](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-what-is-event-hubs). ++ [`pino-filter`](https://github.com/pinojs/pino-filter): filter Pino logs in +the same fashion as the [`debug`](https://npm.im/debug) module. ++ [`pino-gelf`](https://github.com/pinojs/pino-gelf): reformat Pino logs into +GELF format for Graylog. ++ [`pino-hapi`](https://github.com/pinojs/hapi-pino): use Pino as the logger +for [Hapi](https://hapijs.com/). ++ [`pino-http`](https://github.com/pinojs/pino-http): easily use Pino to log +requests with the core `http` module. ++ [`pino-http-print`](https://github.com/pinojs/pino-http-print): reformat Pino +logs into traditional [HTTPD](https://httpd.apache.org/) style request logs. ++ [`pino-multi-stream`](https://github.com/pinojs/pino-multi-stream): send +logs to multiple destination streams (slow!). ++ [`pino-mongodb`](https://github.com/pinojs/pino-mongodb): store Pino logs +in a MongoDB database. ++ [`pino-noir`](https://github.com/pinojs/pino-noir): redact sensitive information +in logs. ++ [`pino-pretty`](https://github.com/pinojs/pino-pretty): basic prettifier to +make log lines human readable. ++ [`pino-socket`](https://github.com/pinojs/pino-socket): send logs to TCP or UDP +destinations. ++ [`pino-std-serializers`](https://github.com/pinojs/pino-std-serializers): the +core object serializers used within Pino. ++ [`pino-syslog`](https://github.com/pinojs/pino-syslog): reformat Pino logs +to standard syslog format. ++ [`pino-tee`](https://github.com/pinojs/pino-tee): pipe Pino logs into files +based upon log levels. ++ [`pino-toke`](https://github.com/pinojs/pino-toke): reformat Pino logs +according to a given format string. ++ [`restify-pino-logger`](https://github.com/pinojs/restify-pino-logger): use +Pino to log requests within [restify](http://restify.com/). ++ [`rill-pino-logger`](https://github.com/pinojs/rill-pino-logger): use Pino as +the logger for the [Rill framework](https://rill.site/). + + +## Community + ++ [`pino-colada`](https://github.com/lrlna/pino-colada): cute ndjson formatter for pino. ++ [`pino-fluentd`](https://github.com/davidedantonio/pino-fluentd): send Pino logs to Elasticsearch, +MongoDB and many [others](https://www.fluentd.org/dataoutputs) via Fluentd. ++ [`pino-pretty-min`](https://github.com/unjello/pino-pretty-min): a minimal +prettifier inspired by the [logrus](https://github.com/sirupsen/logrus) logger. ++ [`pino-rotating-file`](https://github.com/homeaway/pino-rotating-file): a hapi-pino log transport for splitting logs into separate, automatically rotating files. ++ [`cls-proxify`](https://github.com/keenondrums/cls-proxify): integration of pino and [CLS](https://github.com/jeff-lewis/cls-hooked). Useful for creating dynamically configured child loggers (e.g. with added trace ID) for each request. + diff --git a/node_modules/pino/docs/extreme.md b/node_modules/pino/docs/extreme.md new file mode 100644 index 0000000..791be39 --- /dev/null +++ b/node_modules/pino/docs/extreme.md @@ -0,0 +1,95 @@ +# Extreme Mode + +In essence, extreme mode enables even faster performance by Pino. + +In Pino's standard mode of operation log messages are directly written to the +output stream as the messages are generated. Extreme mode works by buffering +log messages and writing them in larger chunks. + +## Caveats + +This has a couple of important caveats: + +* 4KB of spare RAM will be needed for logging +* As opposed to the default mode, there is not a one-to-one relationship between + calls to logging methods (e.g. `logger.info`) and writes to a log file +* There is a possibility of the most recently buffered log messages being lost + (up to 4KB of logs) + * For instance, a power cut will mean up to 4KB of buffered logs will be lost + +So in summary, only use extreme mode when performing an extreme amount of +logging and it is acceptable to potentially lose the most recent logs. + +* Pino will register handlers for the following process events/signals so that + Pino can flush the extreme mode buffer: + + + `beforeExit` + + `exit` + + `uncaughtException` + + `SIGHUP` + + `SIGINT` + + `SIGQUIT` + + `SIGTERM` + + In all of these cases, except `SIGHUP`, the process is in a state that it + *must* terminate. Thus, if an `onTerminated` function isn't registered when + constructing a Pino instance (see [pino#constructor](api.md#constructor)), + then Pino will invoke `process.exit(0)` when no error has occurred, or + `process.exit(1)` otherwise. If an `onTerminated` function is supplied, it + is the responsibility of the `onTerminated` function to manually exit the process. + + In the case of `SIGHUP`, we will look to see if any other handlers are + registered for the event. If not, we will proceed as we do with all other + signals. If there are more handlers registered than just our own, we will + simply flush the extreme mode buffer. + +## Usage + +The `pino.extreme()` method will provide an Extreme Mode destination. + +```js +const pino = require('pino') +const dest = pino.extreme() // logs to stdout with no args +const logger = pino(dest) +``` + + +## Log loss prevention + +The following strategy can be used to minimize log loss: + +```js +const pino = require('pino') +const dest = pino.extreme() // no arguments +const logger = pino(dest) + +// asynchronously flush every 10 seconds to keep the buffer empty +// in periods of low activity +setInterval(function () { + logger.flush() +}, 10000).unref() + +// use pino.final to create a special logger that +// guarantees final tick writes +const handler = pino.final(logger, (err, finalLogger, evt) => { + finalLogger.info(`${evt} caught`) + if (err) finalLogger.error(err, 'error caused exit') + process.exit(err ? 1 : 0) +}) +// catch all the ways node might exit +process.on('beforeExit', () => handler(null, 'beforeExit')) +process.on('exit', () => handler(null, 'exit')) +process.on('uncaughtException', (err) => handler(err, 'uncaughtException')) +process.on('SIGINT', () => handler(null, 'SIGINT')) +process.on('SIGQUIT', () => handler(null, 'SIGQUIT')) +process.on('SIGTERM', () => handler(null, 'SIGTERM')) +``` + +An extreme destination is an instance of +[`SonicBoom`](https://github.com/mcollina/sonic-boom) with `4096` +buffering. + + +* See [`pino.extreme` api](/docs/api.md#pino-extreme) +* See [`pino.final` api](/docs/api.md#pino-final) +* See [`destination` parameter](/docs/api.md#destination) diff --git a/node_modules/pino/docs/help.md b/node_modules/pino/docs/help.md new file mode 100644 index 0000000..db9f1cb --- /dev/null +++ b/node_modules/pino/docs/help.md @@ -0,0 +1,215 @@ +# Help + +* [Exit logging](#exit-logging) +* [Log rotation](#rotate) +* [Reopening log files](#reopening) +* [Saving to multiple files](#multiple) +* [Log filtering](#filter-logs) +* [Transports and systemd](#transport-systemd) +* [Duplicate keys](#dupe-keys) +* [Log levels as labels instead of numbers](#level-string) +* [Pino with `debug`](#debug) +* [Unicode and Windows terminal](#windows) + + +## Exit logging + +When a Node process crashes from uncaught exception, exits due to a signal, +or exits of it's own accord we may want to write some final logs – particularly +in cases of error. + +Writing to a Node.js stream on exit is not necessarily guaranteed, and naively writing +to an Extreme Mode logger on exit will definitely lead to lost logs. + +To write logs in an exit handler, create the handler with [`pino.final`](/docs/api.md#pino-final): + +```js +process.on('uncaughtException', pino.final(logger, (err, finalLogger) => { + finalLogger.error(err, 'uncaughtException') + process.exit(1) +})) + +process.on('unhandledRejection', pino.final(logger, (err, finalLogger) => { + finalLogger.error(err, 'unhandledRejection') + process.exit(1) +})) +``` + +The `finalLogger` is a special logger instance that will synchronously and reliably +flush every log line. This is important in exit handlers, since no more asynchronous +activity may be scheduled. + + +## Log rotation + +Use a separate tool for log rotation: +We recommend [logrotate](https://github.com/logrotate/logrotate). +Consider we output our logs to `/var/log/myapp.log` like so: + +``` +$ node server.js > /var/log/myapp.log +``` + +We would rotate our log files with logrotate, by adding the following to `/etc/logrotate.d/myapp`: + +``` +/var/log/myapp.log { + su root + daily + rotate 7 + delaycompress + compress + notifempty + missingok + copytruncate +} +``` + +The `copytruncate` configuration has a very slight possibility of lost log lines due +to a gap between copying and truncating - the truncate may occur after additional lines +have been written. To perform log rotation without `copytruncate`, see the [Reopening log files](#reopening) +help. + + +## Reopening log files + +In cases where a log rotation tool doesn't offer a copy-truncate capabilities, +or where using them is deemed inappropriate `pino.destination` and `pino.extreme` +destinations are able to reopen file paths after a file has been moved away. + +One way to use this is to set up a `SIGUSR2` or `SIGHUP` signal handler that +reopens the log file destination, making sure to write the process PID out +somewhere so the log rotation tool knows where to send the signal. + +```js +// write the process pid to a well known location for later +const fs = require('fs') +fs.writeFileSync('/var/run/myapp.pid', process.pid) + +const dest = pino.destination('/log/file') // pino.extreme will also work +const logger = require('pino')(dest) +process.on('SIGHUP', () => dest.reopen()) +``` + +The log rotation tool can then be configured to send this signal to the process +after a log rotation event has occurred. + +Given a similar scenario as in the [Log rotation](#rotate) section a basic +`logrotate` config that aligns with this strategy would look similar to the following: + +``` +/var/log/myapp.log { + su root + daily + rotate 7 + delaycompress + compress + notifempty + missingok + postrotate + kill -HUP `cat /var/run/myapp.pid` + endscript +} +``` + + +## Saving to multiple files + +Let's assume we want to store all error messages to a separate log file. + +Install [pino-tee](http://npm.im/pino-tee) with: + +```bash +npm i pino-tee -g +``` + +The following writes the log output of `app.js` to `./all-logs`, while +writing only warnings and errors to `./warn-log: + +```bash +node app.js | pino-tee warn ./warn-logs > ./all-logs +``` + + +## Log Filtering +The Pino philosophy advocates common, pre-existing, system utilities. + +Some recommendations in line with this philosophy are: + +1. Use [`grep`](https://linux.die.net/man/1/grep): + ```sh + $ # View all "INFO" level logs + $ node app.js | grep '"level":30' + ``` +1. Use [`jq`](https://stedolan.github.io/jq/): + ```sh + $ # View all "ERROR" level logs + $ node app.js | jq 'select(.level == 50)' + ``` + + +## Transports and systemd +`systemd` makes it complicated to use pipes in services. One method for overcoming +this challenge is to use a subshell: + +``` +ExecStart=/bin/sh -c '/path/to/node app.js | pino-transport' +``` + + +## How Pino handles duplicate keys + +Duplicate keys are possibly when a child logger logs an object with a key that +collides with a key in the child loggers bindings. + +See the [child logger duplicate keys caveat](/docs/child-loggers.md#duplicate-keys-caveat) +for information on this is handled. + + +## Log levels as labels instead of numbers +Pino log lines are meant to be parseable. Thus, Pino's default mode of operation +is to print the level value instead of the string name. However, while it is +possible to set the `useLevelLabels` option, we recommend using one of these +options instead if you are able: + +1. If the only change desired is the name then a transport can be used. One such +transport is [`pino-text-level-transport`](https://npm.im/pino-text-level-transport). +1. Use a prettifier like [`pino-pretty`](https://npm.im/pino-pretty) to make +the logs human friendly. + + +## Pino with `debug` + +The popular [`debug`](http://npm.im/debug) is used in many modules across the ecosystem. + +The [`pino-debug`](http://github.com/pinojs/pino-debug) module +can capture calls to `debug` loggers and run them +through `pino` instead. This results in a 10x (20x in extreme mode) +performance improvement - even though `pino-debug` is logging additional +data and wrapping it in JSON. + +To quickly enable this install [`pino-debug`](http://github.com/pinojs/pino-debug) +and preload it with the `-r` flag, enabling any `debug` logs with the +`DEBUG` environment variable: + +```sh +$ npm i pino-debug +$ DEBUG=* node -r pino-debug app.js +``` + +[`pino-debug`](http://github.com/pinojs/pino-debug) also offers fine grain control to map specific `debug` +namespaces to `pino` log levels. See [`pino-debug`](http://github.com/pinojs/pino-debug) +for more. + + +## Unicode and Windows terminal + +Pino uses [sonic-boom](https://github.com/mcollina/sonic-boom) to speed +up logging. Internally, it uses [`fs.write`](https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_write_fd_string_position_encoding_callback) to write log lines directly to a file +descriptor. On Windows, unicode output is not handled properly in the +terminal (both `cmd.exe` and powershell), and as such the output could +be visualized incorrectly if the log lines include utf8 characters. It +is possible to configure the terminal to visualize those characters +correctly with the use of [`chcp`](https://ss64.com/nt/chcp.html) by +executing in the terminal `chcp 65001`. This is a known limitation of +Node.js. diff --git a/node_modules/pino/docs/legacy.md b/node_modules/pino/docs/legacy.md new file mode 100644 index 0000000..9471725 --- /dev/null +++ b/node_modules/pino/docs/legacy.md @@ -0,0 +1,167 @@ +# Legacy + +## Legacy Node Support + +### Node v4 + +Node v4 is supported on the [Pino v4](#pino-v4-documentation) line. + +### Node v0.10-v0.12 + +Node v0.10 or Node v0.12 is supported on the [Pino v2](#pino-v2-documentation) line. + +## Documentation + +### Pino v4 Documentation + + + +### Pino v3 Documentation + + + +### Pino v2 Documentation + + + +## Migration + +### Pino v4 to to Pino v5 + +#### Logging Destination + +In Pino v4 the destination could be set by passing a stream as the +second parameter to the exported `pino` function. This is still the +case in v5. However it's strongly recommended to use `pino.destination` +which will write logs ~30% faster. + +##### v4 + +```js +const stdoutLogger = require('pino')() +const stderrLogger = require('pino')(process.stderr) +const fileLogger = require('pino')(fs.createWriteStream('/log/path')) +``` + +##### v5 + +```js +const stdoutLogger = require('pino')() // pino.destination by default +const stderrLogger = require('pino')(pino.destination(2)) +const fileLogger = require('pino')(pino.destination('/log/path')) +``` + +Note: This is not a breaking change, `WritableStream` instances are still +supported, but are slower than `pino.destination` which +uses the high speed [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) library. + +* See [`destination` parameter](/docs/api.md#destination) + +#### Extreme Mode + +The `extreme` setting does not exist as an option in Pino v5, instead use +a `pino.extreme` destination. + +##### v4 + +```js +const stdoutLogger = require('pino')({extreme: true}) +const stderrLogger = require('pino')({extreme: true}, process.stderr) +const fileLogger = require('pino')({extreme: true}, fs.createWriteStream('/log/path')) +``` + +##### v5 + +```js +const stdoutLogger = require('pino')(pino.extreme()) +const stderrLogger = require('pino')(pino.extreme(2)) +const fileLogger = require('pino')(pino.extreme('/log/path')) +``` + +* See [pino.extreme](/docs/api.md#pino-extreme) +* See [Extreme mode ⇗](/docs/extreme.md) + + +#### Pino CLI is now pino-pretty CLI + +The Pino CLI is provided with Pino v4 for basic log prettification. + +From Pino v5 the CLI is installed separately with `pino-pretty`. + +##### v4 +```sh +$ npm install -g pino +$ node app.js | pino +``` + +##### v5 +```sh +$ npm install -g pino-pretty +$ node app.js | pino-pretty +``` + +* See [Pretty Printing documentation](/docs/pretty.md) + +#### Programmatic Pretty Printing + +The [`pino.pretty()`](https://github.com/pinojs/pino/blob/v4.x.x/docs/API.md#prettyoptions) +method has also been removed from Pino v5. + +##### v4 + +```js +var pino = require('pino') +var pretty = pino.pretty() +pretty.pipe(process.stdout) +``` + +##### v5 + +Instead use the `prettyPrint` option (also available in v4): + +```js +const logger = require('pino')({ + prettyPrint: process.env.NODE_ENV !== 'production' +}) +``` + +In v5 the `pretty-print` module must be installed to use the `prettyPrint` option: + +```sh +npm install --save-dev pino-pretty +``` + +* See [prettyPrint option](/docs/api.md#prettyPrint) +* See [Pretty Printing documentation](/docs/pretty.md) + +#### Slowtime + +In Pino v4 a `slowtime` option was supplied, which allowed for full ISO dates +in the timestamps instead of milliseconds since the Epoch. In Pino v5 this +has been completely removed, along with the `pino.stdTimeFunctions.slowTime` +function. In order to achieve the equivalent in v5, a custom +time function should be supplied: + +##### v4 + +```js +const pino = require('pino') +const logger = pino({slowtime: true}) +// following avoids deprecation warning in v4: +const loggerAlt = pino({timestamp: pino.stdTimeFunctions.slowTime}) +``` + +##### v5 + +```js +const logger = require('pino')({ + timestamp: () => ',"time":"' + (new Date()).toISOString() + '"' +}) +``` + +The practice of creating ISO dates in-process for logging purposes is strongly +recommended against. Instead consider post-processing the logs or using a transport +to convert the timestamps. + + +* See [timestamp option](/docs/api.md#timestamp) diff --git a/node_modules/pino/docs/pretty.md b/node_modules/pino/docs/pretty.md new file mode 100644 index 0000000..bd90ebb --- /dev/null +++ b/node_modules/pino/docs/pretty.md @@ -0,0 +1,93 @@ +# Pretty Printing + +By default, Pino log lines are newline delimited JSON (NDJSON). This is perfect +for production usage and long term storage. It's not so great for development +environments. Thus, Pino logs can be prettified by using a Pino prettifier +module like [`pino-pretty`][pp]: + +```sh +$ cat app.log | pino-pretty +``` + +For almost all situations, this is the recommended way to prettify logs. The +programmatic API, described in the next section, is primarily for integration +purposes with other CLI based prettifiers. + +## Prettifier API + +Pino prettifier modules are extra modules that provide a CLI for parsing NDJSON +log lines piped via `stdin` and expose an API which conforms to the Pino +[metadata streams](api.md#metadata) API. + +The API requires modules provide a factory function which returns a prettifier +function. This prettifier function must accept either a string of NDJSON or +a Pino log object. A psuedo-example of such a prettifier is: + +The uninitialized Pino instance is passed as `this` into prettifier factory function, +so it can be accessed via closure by the returned prettifier function. + +```js +module.exports = function myPrettifier (options) { + // `this` is bound to the pino instance + // Deal with whatever options are supplied. + return function prettifier (inputData) { + let logObject + if (typeof inputData === 'string') { + const parsedData = someJsonParser(inputData) + logObject = (isPinoLog(parsedData)) ? parsedData : undefined + } else if (isObject(inputData) && isPinoLog(inputData)) { + logObject = inputData + } + if (!logObject) return inputData + // implement prettification + } + + function isObject (input) { + return Object.prototype.toString.apply(input) === '[object Object]' + } + + function isPinoLog (log) { + return log && (log.hasOwnProperty('v') && log.v === 1) + } +} +``` + +The reference implementation of such a module is the [`pino-pretty`][pp] module. +To learn more about creating a custom prettifier module, refer to the +`pino-pretty` source code. + +Note: if the prettifier returns `undefined`, instead of a formatted line, nothing +will be written to the destination stream. + +### API Example + +> #### NOTE: +> For general usage, it is highly recommended that logs are piped into +> the prettifier instead. Prettified logs are not easily parsed and cannot +> be easily investigated at a later date. + +1. Install a prettifier module as a separate dependency, e.g. `npm install pino-pretty`. +1. Instantiate the logger with pretty printing enabled: + ```js + const pino = require('pino') + const log = pino({ + prettyPrint: { + levelFirst: true + }, + prettifier: require('pino-pretty') + }) + ``` + Note: the default prettifier module is `pino-pretty`, so the preceding + example could be: + ```js + const pino = require('pino') + const log = pino({ + prettyPrint: { + levelFirst: true + } + }) + ``` + See the [`pino-pretty` documentation][pp] for more information on the options + that can be passed via `prettyPrint`. + + [pp]: https://github.com/pinojs/pino-pretty diff --git a/node_modules/pino/docs/redaction.md b/node_modules/pino/docs/redaction.md new file mode 100644 index 0000000..ea87531 --- /dev/null +++ b/node_modules/pino/docs/redaction.md @@ -0,0 +1,133 @@ +# Redaction + +> Redaction is not supported in the browser [#670](https://github.com/pinojs/pino/issues/670) + +To redact sensitive information, supply paths to keys that hold sensitive data +using the `redact` option: + +```js +const logger = require('.')({ + redact: ['key', 'path.to.key', 'stuff.thats[*].secret'] +}) + +logger.info({ + key: 'will be redacted', + path: { + to: {key: 'sensitive', another: 'thing'} + }, + stuff: { + thats: [ + {secret: 'will be redacted', logme: 'will be logged'}, + {secret: 'as will this', logme: 'as will this'} + ] + } +}) +``` + +This will output: + +```JSON +{"level":30,"time":1527777350011,"pid":3186,"hostname":"Davids-MacBook-Pro-3.local","key":"[Redacted]","path":{"to":{"key":"[Redacted]","another":"thing"}},"stuff":{"thats":[{"secret":"[Redacted]","logme":"will be logged"},{"secret":"[Redacted]","logme":"as will this"}]},"v":1} +``` + +The `redact` option can take an array (as shown in the above example) or +an object. This allows control over *how* information is redacted. + +For instance, setting the censor: + +```js +const logger = require('.')({ + redact: { + paths: ['key', 'path.to.key', 'stuff.thats[*].secret'], + censor: '**GDPR COMPLIANT**' + } +}) + +logger.info({ + key: 'will be redacted', + path: { + to: {key: 'sensitive', another: 'thing'} + }, + stuff: { + thats: [ + {secret: 'will be redacted', logme: 'will be logged'}, + {secret: 'as will this', logme: 'as will this'} + ] + } +}) +``` + +This will output: + +```JSON +{"level":30,"time":1527778563934,"pid":3847,"hostname":"Davids-MacBook-Pro-3.local","key":"**GDPR COMPLIANT**","path":{"to":{"key":"**GDPR COMPLIANT**","another":"thing"}},"stuff":{"thats":[{"secret":"**GDPR COMPLIANT**","logme":"will be logged"},{"secret":"**GDPR COMPLIANT**","logme":"as will this"}]},"v":1} +``` + +The `redact.remove` option also allows for the key and value to be removed from output: + +```js +const logger = require('.')({ + redact: { + paths: ['key', 'path.to.key', 'stuff.thats[*].secret'], + remove: true + } +}) + +logger.info({ + key: 'will be redacted', + path: { + to: {key: 'sensitive', another: 'thing'} + }, + stuff: { + thats: [ + {secret: 'will be redacted', logme: 'will be logged'}, + {secret: 'as will this', logme: 'as will this'} + ] + } +}) +``` + +This will output + +```JSON +{"level":30,"time":1527782356751,"pid":5758,"hostname":"Davids-MacBook-Pro-3.local","path":{"to":{"another":"thing"}},"stuff":{"thats":[{"logme":"will be logged"},{"logme":"as will this"}]},"v":1} +``` + +See [pino options in API](/docs/api.md#redact-array-object) for `redact` API details. + + +## Path Syntax + +The syntax for paths supplied to the `redact` option conform to the syntax in path lookups +in standard EcmaScript, with two additions: + +* paths may start with bracket notation +* paths may contain the asterisk `*` to denote a wildcard + +By way of example, the following are all valid paths: + +* `a.b.c` +* `a["b-c"].d` +* `["a-b"].c` +* `a.b.*` +* `a[*].b` + +## Overhead + +Pino's redaction functionality is built on top of [`fast-redact`](http://github.com/davidmarkclements/fast-redact) +which adds about 2% overhead to `JSON.stringify` when using paths without wildcards. + +When used with pino logger with a single redacted path, any overhead is within noise - +a way to deterministically measure it's effect has not been found. This is because its not a bottleneck. + +However, wildcard redaction does carry a non-trivial cost relative to explicitly declaring the keys +(50% in a case where four keys are redacted across two objects). See +the [`fast-redact` benchmarks](https://github.com/davidmarkclements/fast-redact#benchmarks) for details. + +## Safety + +The `redact` option is intended as an initialization time configuration option. +It's extremely important that path strings do not originate from user input. +The `fast-redact` module uses a VM context to syntax check the paths, user input +should never be combined with such an approach. See the [`fast-redact` Caveat](https://github.com/davidmarkclements/fast-redact#caveat) +and the [`fast-redact` Approach](https://github.com/davidmarkclements/fast-redact#approach) for in-depth information. diff --git a/node_modules/pino/docs/transports.md b/node_modules/pino/docs/transports.md new file mode 100644 index 0000000..73cb439 --- /dev/null +++ b/node_modules/pino/docs/transports.md @@ -0,0 +1,387 @@ +# Transports + +A "transport" for Pino is supplementary tool which consumes Pino logs. + +Consider the following example: + +```js +const split = require('split2') +const pump = require('pump') +const through = require('through2') + +const myTransport = through.obj(function (chunk, enc, cb) { + // do the necessary + console.log(chunk) + cb() +}) + +pump(process.stdin, split(JSON.parse), myTransport) +``` + +The above defines our "transport" as the file `my-transport-process.js`. + +Logs can now be consumed using shell piping: + +```sh +node my-app-which-logs-stuff-to-stdout.js | node my-transport-process.js +``` + +Ideally, a transport should consume logs in a separate process to the application, +Using transports in the same process causes unnecessary load and slows down +Node's single threaded event loop. + +## In-process transports + +> **Pino *does not* natively support in-process transports.** + +Pino does not support in-process transports because Node processes are +single threaded processes (ignoring some technical details). Given this +restriction, one of the methods Pino employs to achieve its speed is to +purposefully offload the handling of logs, and their ultimate destination, to +external processes so that the threading capabilities of the OS can be +used (or other CPUs). + +One consequence of this methodology is that "error" logs do not get written to +`stderr`. However, since Pino logs are in a parseable format, it is possible to +use tools like [pino-tee][pino-tee] or [jq][jq] to work with the logs. For +example, to view only logs marked as "error" logs: + +``` +$ node an-app.js | jq 'select(.level == 50)' +``` + +In short, the way Pino generates logs: + +1. Reduces the impact of logging on an application to the absolute minimum. +2. Gives greater flexibility in how logs are processed and stored. + +Given all of the above, Pino recommends out-of-process log processing. + +However, it is possible to wrap Pino and perform processing in-process. +For an example of this, see [pino-multi-stream][pinoms]. + +[pino-tee]: https://npm.im/pino-tee +[jq]: https://stedolan.github.io/jq/ +[pinoms]: https://npm.im/pino-multi-stream + +## Known Transports + +PR's to this document are welcome for any new transports! + ++ [pino-applicationinsights](#pino-applicationinsights) ++ [pino-azuretable](#pino-azuretable) ++ [pino-cloudwatch](#pino-cloudwatch) ++ [pino-couch](#pino-couch) ++ [pino-datadog](#pino-datadog) ++ [pino-elasticsearch](#pino-elasticsearch) ++ [pino-mq](#pino-mq) ++ [pino-mysql](#pino-mysql) ++ [pino-papertrail](#pino-papertrail) ++ [pino-redis](#pino-redis) ++ [pino-sentry](#pino-sentry) ++ [pino-socket](#pino-socket) ++ [pino-stackdriver](#pino-stackdriver) ++ [pino-syslog](#pino-syslog) ++ [pino-websocket](#pino-websocket) ++ [pino-http-send](#pino-http-send) + + +### pino-applicationinsights +The [pino-applicationinsights](https://www.npmjs.com/package/pino-applicationinsights) module is a transport that will forward logs to [Azure Application Insights](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview). + +Given an application `foo` that logs via pino, you would use `pino-applicationinsights` like so: + +``` sh +$ node foo | pino-applicationinsights --key blablabla +``` + +For full documentation of command line switches read [readme](https://github.com/ovhemert/pino-applicationinsights#readme) + + +### pino-azuretable +The [pino-azuretable](https://www.npmjs.com/package/pino-azuretable) module is a transport that will forward logs to the [Azure Table Storage](https://azure.microsoft.com/en-us/services/storage/tables/). + +Given an application `foo` that logs via pino, you would use `pino-azuretable` like so: + +``` sh +$ node foo | pino-azuretable --account storageaccount --key blablabla +``` + +For full documentation of command line switches read [readme](https://github.com/ovhemert/pino-azuretable#readme) + + +### pino-cloudwatch + +[pino-cloudwatch][pino-cloudwatch] is a transport that buffers and forwards logs to [Amazon CloudWatch][]. + +```sh +$ node app.js | pino-cloudwatch --group my-log-group +``` + +[pino-cloudwatch]: https://github.com/dbhowell/pino-cloudwatch +[Amazon CloudWatch]: https://aws.amazon.com/cloudwatch/ + + +### pino-couch + +[pino-couch][pino-couch] uploads each log line as a [CouchDB][CouchDB] document. + +```sh +$ node app.js | pino-couch -U https://couch-server -d mylogs +``` + +[pino-couch]: https://github.com/IBM/pino-couch +[CouchDB]: https://couchdb.apache.org + + +### pino-datadog +The [pino-datadog](https://www.npmjs.com/package/pino-datadog) module is a transport that will forward logs to [DataDog](https://www.datadoghq.com/) through it's API. + +Given an application `foo` that logs via pino, you would use `pino-datadog` like so: + +``` sh +$ node foo | pino-datadog --key blablabla +``` + +For full documentation of command line switches read [readme](https://github.com/ovhemert/pino-datadog#readme) + + +### pino-elasticsearch + +[pino-elasticsearch][pino-elasticsearch] uploads the log lines in bulk +to [Elasticsearch][elasticsearch], to be displayed in [Kibana][kibana]. + +It is extremely simple to use and setup + +```sh +$ node app.js | pino-elasticsearch +``` + +Assuming Elasticsearch is running on localhost. + +To connect to an external elasticsearch instance (recommended for production): + +* Check that `network.host` is defined in the `elasticsearch.yml` configuration file. See [elasticsearch Network Settings documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#common-network-settings) for more details. +* Launch: + +```sh +$ node app.js | pino-elasticsearch --node http://192.168.1.42:9200 +``` + +Assuming Elasticsearch is running on `192.168.1.42`. + +To connect to AWS Elasticsearch: + +```sh +$ node app.js | pino-elasticsearch --node https://es-url.us-east-1.es.amazonaws.com --es-version 6 +``` + +Then [create an index pattern](https://www.elastic.co/guide/en/kibana/current/setup.html) on `'pino'` (the default index key for `pino-elasticsearch`) on the Kibana instance. + +[pino-elasticsearch]: https://github.com/pinojs/pino-elasticsearch +[elasticsearch]: https://www.elastic.co/products/elasticsearch +[kibana]: https://www.elastic.co/products/kibana + + +### pino-mq + +The `pino-mq` transport will take all messages received on `process.stdin` and send them over a message bus using JSON serialization. + +This useful for: + +* moving backpressure from application to broker +* transforming messages pressure to another component + +``` +node app.js | pino-mq -u "amqp://guest:guest@localhost/" -q "pino-logs" +``` + +Alternatively a configuration file can be used: + +``` +node app.js | pino-mq -c pino-mq.json +``` + +A base configuration file can be initialized with: + +``` +pino-mq -g +``` + +For full documentation of command line switches and configuration see [the `pino-mq` readme](https://github.com/itavy/pino-mq#readme) + + +### pino-papertrail +pino-papertrail is a transport that will forward logs to the [papertrail](https://papertrailapp.com) log service through an UDPv4 socket. + +Given an application `foo` that logs via pino, and a papertrail destination that collects logs on port UDP `12345` on address `bar.papertrailapp.com`, you would use `pino-papertrail` +like so: + +``` +node yourapp.js | pino-papertrail --host bar.papertrailapp.com --port 12345 --appname foo +``` + + +for full documentation of command line switches read [readme](https://github.com/ovhemert/pino-papertrail#readme) + + +### pino-mysql + +[pino-mysql][pino-mysql] loads pino logs into [MySQL][MySQL] and [MariaDB][MariaDB]. + +```sh +$ node app.js | pino-mysql -c db-configuration.json +``` + +`pino-mysql` can extract and save log fields into corresponding database field +and/or save the entire log stream as a [JSON Data Type][JSONDT]. + +For full documentation and command line switches read the [readme][pino-mysql]. + +[pino-mysql]: https://www.npmjs.com/package/pino-mysql +[MySQL]: https://www.mysql.com/ +[MariaDB]: https://mariadb.org/ +[JSONDT]: https://dev.mysql.com/doc/refman/8.0/en/json.html + + +### pino-redis + +[pino-redis][pino-redis] loads pino logs into [Redis][Redis]. + +```sh +$ node app.js | pino-redis -U redis://username:password@localhost:6379 +``` + +[pino-redis]: https://github.com/buianhthang/pino-redis +[Redis]: https://redis.io/ + + +### pino-sentry + +[pino-sentry][pino-sentry] loads pino logs into [Sentry][Sentry]. + +```sh +$ node app.js | pino-sentry --dsn=https://******@sentry.io/12345 +``` + +For full documentation of command line switches see the [pino-sentry readme](https://github.com/aandrewww/pino-sentry/blob/master/README.md) + +[pino-sentry]: https://www.npmjs.com/package/pino-sentry +[Sentry]: https://sentry.io/ + + +### pino-socket + +[pino-socket][pino-socket] is a transport that will forward logs to a IPv4 +UDP or TCP socket. + +As an example, use `socat` to fake a listener: + +```sh +$ socat -v udp4-recvfrom:6000,fork exec:'/bin/cat' +``` + +Then run an application that uses `pino` for logging: + +```sh +$ node app.js | pino-socket -p 6000 +``` + +Logs from the application should be observed on both consoles. + +[pino-socket]: https://www.npmjs.com/package/pino-socket + +#### Logstash + +The [pino-socket][pino-socket] module can also be used to upload logs to +[Logstash][logstash] via: + +``` +$ node app.js | pino-socket -a 127.0.0.1 -p 5000 -m tcp +``` + +Assuming logstash is running on the same host and configured as +follows: + +``` +input { + tcp { + port => 5000 + } +} + +filter { + json { + source => "message" + } +} + +output { + elasticsearch { + hosts => "127.0.0.1:9200" + } +} +``` + +See to learn +how to setup [Kibana][kibana]. + +For Docker users, see +https://github.com/deviantony/docker-elk to setup an ELK stack. + + +### pino-stackdriver +The [pino-stackdriver](https://www.npmjs.com/package/pino-stackdriver) module is a transport that will forward logs to the [Google Stackdriver](https://cloud.google.com/logging/) log service through it's API. + +Given an application `foo` that logs via pino, a stackdriver log project `bar` and credentials in the file `/credentials.json`, you would use `pino-stackdriver` +like so: + +``` sh +$ node foo | pino-stackdriver --project bar --credentials /credentials.json +``` + +For full documentation of command line switches read [readme](https://github.com/ovhemert/pino-stackdriver#readme) + + +### pino-syslog + +[pino-syslog][pino-syslog] is a transforming transport that converts +`pino` NDJSON logs to [RFC3164][rfc3164] compatible log messages. The `pino-syslog` module does not +forward the logs anywhere, it merely re-writes the messages to `stdout`. But +when used in combination with `pino-socket` the log messages can be relayed to a syslog server: + +```sh +$ node app.js | pino-syslog | pino-socket -a syslog.example.com +``` + +Example output for the "hello world" log: + +``` +<134>Apr 1 16:44:58 MacBook-Pro-3 none[94473]: {"pid":94473,"hostname":"MacBook-Pro-3","level":30,"msg":"hello world","time":1459529098958,"v":1} +``` + +[pino-syslog]: https://www.npmjs.com/package/pino-syslog +[rfc3164]: https://tools.ietf.org/html/rfc3164 +[logstash]: https://www.elastic.co/products/logstash + + + +### pino-websocket + +[pino-websocket](https://www.npmjs.com/package/@abeai/pino-websocket) is a transport that will forward each log line to a websocket server. + +```sh +$ node app.js | pino-websocket -a my-websocket-server.example.com -p 3004 +``` + +For full documentation of command line switches read [readme](https://github.com/abeai/pino-webscoket#README) + + +### pino-http-send + +[pino-http-send](https://npmjs.com/package/pino-http-send) is a configurable and low overhead +transport that will batch logs and send to a specified URL. + +```console +$ node app.js | pino-http-send -u http://localhost:8080/logs +``` diff --git a/node_modules/pino/docs/web.md b/node_modules/pino/docs/web.md new file mode 100644 index 0000000..b8f9890 --- /dev/null +++ b/node_modules/pino/docs/web.md @@ -0,0 +1,230 @@ +# Web Frameworks + +Since HTTP logging is a primary use case, Pino has first class support for the Node.js +web framework ecosystem. + ++ [Pino with Fastify](#fastify) ++ [Pino with Express](#express) ++ [Pino with Hapi](#hapi) ++ [Pino with Restify](#restify) ++ [Pino with Koa](#koa) ++ [Pino with Node core `http`](#http) ++ [Pino with Nest](#nest) + + +## Pino with Fastify + +The Fastify web framework comes bundled with Pino by default, simply set Fastify's +`logger` option to `true` and use `request.log` or `reply.log` for log messages that correspond +to each individual request: + +```js +const fastify = require('fastify')({ + logger: true +}) +fastify.get('/', async (request, reply) => { + request.log.info('something') + return { hello: 'world' } +}) +``` + +The `logger` option can also be set to an object, which will be passed through directly +as the [`pino` options object](/docs/api.md#options-object). + +See the [fastify documentation](https://www.fastify.io/docs/latest/Logging/) for more information. + + +## Pino with Express + +```sh +npm install express-pino-logger +``` + +```js +const app = require('express')() +const pino = require('express-pino-logger')() + +app.use(pino) + +app.get('/', function (req, res) { + req.log.info('something') + res.send('hello world') +}) + +app.listen(3000) +``` + +See the [express-pino-logger readme](http://npm.im/express-pino-logger) for more info. + + +## Pino with Hapi + +```sh +npm install hapi-pino +``` + +```js +'use strict' + +require('make-promises-safe') + +const Hapi = require('hapi') + +async function start () { + // Create a server with a host and port + const server = Hapi.server({ + host: 'localhost', + port: 3000 + }) + + // Add the route + server.route({ + method: 'GET', + path: '/', + handler: async function (request, h) { + // request.log is HAPI standard way of logging + request.log(['a', 'b'], 'Request into hello world') + + // a pino instance can also be used, which will be faster + request.logger.info('In handler %s', request.path) + + return 'hello world' + } + }) + + await server.register({ + plugin: require('.'), + options: { + prettyPrint: process.env.NODE_ENV !== 'production' + } + }) + + // also as a decorated API + server.logger().info('another way for accessing it') + + // and through Hapi standard logging system + server.log(['subsystem'], 'third way for accessing it') + + await server.start() + + return server +} + +start().catch((err) => { + console.log(err) + process.exit(1) +}) +``` + +See the [hapi-pino readme](http://npm.im/hapi-pino) for more info. + + +## Pino with Restify + +```sh +npm install restify-pino-logger +``` + +```js +const server = require('restify').createServer({name: 'server'}) +const pino = require('restify-pino-logger')() + +server.use(pino) + +server.get('/', function (req, res) { + req.log.info('something') + res.send('hello world') +}) + +server.listen(3000) +``` + +See the [restify-pino-logger readme](http://npm.im/restify-pino-logger) for more info. + + +## Pino with Koa + +### Koa + +```sh +npm install koa-pino-logger +``` + +```js +const Koa = require('koa') +const app = new Koa() +const pino = require('koa-pino-logger')() + +app.use(pino) + +app.use((ctx) => { + ctx.log.info('something else') + ctx.body = 'hello world' +}) + +app.listen(3000) +``` + +See the [koa-pino-logger readme](https://github.com/pinojs/koa-pino-logger) for more info. + + +## Pino with Node core `http` + +```sh +npm install pino-http +``` + +```js +const http = require('http') +const server = http.createServer(handle) +const logger = require('pino-http')() + +function handle (req, res) { + logger(req, res) + req.log.info('something else') + res.end('hello world') +} + +server.listen(3000) +``` + +See the [pino-http readme](http://npm.im/pino-http) for more info. + + + +## Pino with Nest + +```sh +npm install nestjs-pino +``` + +```ts +import { NestFactory } from '@nestjs/core' +import { Controller, Get, Module } from '@nestjs/common' +import { LoggerModule, Logger } from 'nestjs-pino' + +@Controller() +export class AppController { + constructor(private readonly logger: Logger) {} + + @Get() + getHello() { + this.logger.log('something') + return `Hello world` + } +} + +@Module({ + controllers: [AppController], + imports: [LoggerModule.forRoot()] +}) +class MyModule {} + +async function bootstrap() { + const app = await NestFactory.create(MyModule) + await app.listen(3000) +} +bootstrap() +``` + +See the [nestjs-pino readme](http://npm.im/nestjs-pino) for more info. diff --git a/node_modules/pino/example.js b/node_modules/pino/example.js new file mode 100644 index 0000000..5e39692 --- /dev/null +++ b/node_modules/pino/example.js @@ -0,0 +1,35 @@ +'use strict' + +const pino = require('./')() + +pino.info('hello world') +pino.error('this is at error level') +pino.info('the answer is %d', 42) +pino.info({ obj: 42 }, 'hello world') +pino.info({ obj: 42, b: 2 }, 'hello world') +pino.info({ nested: { obj: 42 } }, 'nested') +setImmediate(() => { + pino.info('after setImmediate') +}) +pino.error(new Error('an error')) + +const child = pino.child({ a: 'property' }) +child.info('hello child!') + +const childsChild = child.child({ another: 'property' }) +childsChild.info('hello baby..') + +pino.debug('this should be mute') + +pino.level = 'trace' + +pino.debug('this is a debug statement') + +pino.child({ another: 'property' }).debug('this is a debug statement via child') +pino.trace('this is a trace statement') + +pino.debug('this is a "debug" statement with "') + +pino.info(new Error('kaboom')) + +pino.info(new Error('kaboom'), 'with', 'a', 'message') diff --git a/node_modules/pino/lib/levels.js b/node_modules/pino/lib/levels.js new file mode 100644 index 0000000..0f60f7b --- /dev/null +++ b/node_modules/pino/lib/levels.js @@ -0,0 +1,183 @@ +'use strict' +const flatstr = require('flatstr') +const { + lsCacheSym, + levelValSym, + useLevelLabelsSym, + levelKeySym, + useOnlyCustomLevelsSym, + streamSym +} = require('./symbols') +const { noop, genLog } = require('./tools') + +const levels = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60 +} +const logFatal = genLog(levels.fatal) +const levelMethods = { + fatal (...args) { + const stream = this[streamSym] + logFatal.call(this, ...args) + if (typeof stream.flushSync === 'function') { + try { + stream.flushSync() + } catch (e) { + // https://github.com/pinojs/pino/pull/740#discussion_r346788313 + } + } + }, + error: genLog(levels.error), + warn: genLog(levels.warn), + info: genLog(levels.info), + debug: genLog(levels.debug), + trace: genLog(levels.trace) +} + +const nums = Object.keys(levels).reduce((o, k) => { + o[levels[k]] = k + return o +}, {}) + +const initialLsCache = Object.keys(nums).reduce((o, k) => { + o[k] = flatstr('{"level":' + Number(k)) + return o +}, {}) + +function genLsCache (instance) { + const levelName = instance[levelKeySym] + instance[lsCacheSym] = Object.keys(instance.levels.labels).reduce((o, k) => { + o[k] = instance[useLevelLabelsSym] + ? `{"${levelName}":"${instance.levels.labels[k]}"` + : flatstr(`{"${levelName}":` + Number(k)) + return o + }, Object.assign({}, instance[lsCacheSym])) + return instance +} + +function isStandardLevel (level, useOnlyCustomLevels) { + if (useOnlyCustomLevels) { + return false + } + + switch (level) { + case 'fatal': + case 'error': + case 'warn': + case 'info': + case 'debug': + case 'trace': + return true + default: + return false + } +} + +function setLevel (level) { + const { labels, values } = this.levels + if (typeof level === 'number') { + if (labels[level] === undefined) throw Error('unknown level value' + level) + level = labels[level] + } + if (values[level] === undefined) throw Error('unknown level ' + level) + const preLevelVal = this[levelValSym] + const levelVal = this[levelValSym] = values[level] + const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym] + + for (var key in values) { + if (levelVal > values[key]) { + this[key] = noop + continue + } + this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key] : genLog(values[key]) + } + + this.emit( + 'level-change', + level, + levelVal, + labels[preLevelVal], + preLevelVal + ) +} + +function getLevel (level) { + const { levels, levelVal } = this + return levels.labels[levelVal] +} + +function isLevelEnabled (logLevel) { + const { values } = this.levels + const logLevelVal = values[logLevel] + return logLevelVal !== undefined && (logLevelVal >= this[levelValSym]) +} + +function mappings (customLevels = null, useOnlyCustomLevels = false) { + const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => { + o[customLevels[k]] = k + return o + }, {}) : null + + const labels = Object.assign( + Object.create(Object.prototype, { Infinity: { value: 'silent' } }), + useOnlyCustomLevels ? null : nums, + customNums + ) + const values = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : levels, + customLevels + ) + return { labels, values } +} + +function assertDefaultLevelFound (defaultLevel, customLevels, useOnlyCustomLevels) { + if (typeof defaultLevel === 'number') { + const values = [].concat( + Object.keys(customLevels || {}).map(key => customLevels[key]), + useOnlyCustomLevels ? [] : Object.keys(nums).map(level => +level), + Infinity + ) + if (!values.includes(defaultLevel)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`) + } + return + } + + const labels = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : levels, + customLevels + ) + if (!(defaultLevel in labels)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`) + } +} + +function assertNoLevelCollisions (levels, customLevels) { + const { labels, values } = levels + for (const k in customLevels) { + if (k in values) { + throw Error('levels cannot be overridden') + } + if (customLevels[k] in labels) { + throw Error('pre-existing level values cannot be used for new levels') + } + } +} + +module.exports = { + initialLsCache, + genLsCache, + levelMethods, + getLevel, + setLevel, + isLevelEnabled, + mappings, + assertNoLevelCollisions, + assertDefaultLevelFound +} diff --git a/node_modules/pino/lib/meta.js b/node_modules/pino/lib/meta.js new file mode 100644 index 0000000..21a43e9 --- /dev/null +++ b/node_modules/pino/lib/meta.js @@ -0,0 +1,7 @@ +'use strict' + +const { version } = require('../package.json') + +const LOG_VERSION = 1 + +module.exports = { version, LOG_VERSION } diff --git a/node_modules/pino/lib/proto.js b/node_modules/pino/lib/proto.js new file mode 100644 index 0000000..5099727 --- /dev/null +++ b/node_modules/pino/lib/proto.js @@ -0,0 +1,167 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const { EventEmitter } = require('events') +const SonicBoom = require('sonic-boom') +const flatstr = require('flatstr') +const { + lsCacheSym, + levelValSym, + setLevelSym, + getLevelSym, + chindingsSym, + mixinSym, + asJsonSym, + messageKeySym, + writeSym, + timeSym, + timeSliceIndexSym, + streamSym, + serializersSym, + useOnlyCustomLevelsSym, + needsMetadataGsym +} = require('./symbols') +const { + getLevel, + setLevel, + isLevelEnabled, + mappings, + initialLsCache, + genLsCache, + assertNoLevelCollisions +} = require('./levels') +const { + asChindings, + asJson +} = require('./tools') +const { + version, + LOG_VERSION +} = require('./meta') + +// note: use of class is satirical +// https://github.com/pinojs/pino/pull/433#pullrequestreview-127703127 +const constructor = class Pino {} +const prototype = { + constructor, + child, + bindings, + setBindings, + flush, + isLevelEnabled, + version, + get level () { return this[getLevelSym]() }, + set level (lvl) { return this[setLevelSym](lvl) }, + get levelVal () { return this[levelValSym] }, + set levelVal (n) { throw Error('levelVal is read-only') }, + [lsCacheSym]: initialLsCache, + [writeSym]: write, + [asJsonSym]: asJson, + [getLevelSym]: getLevel, + [setLevelSym]: setLevel, + LOG_VERSION +} + +Object.setPrototypeOf(prototype, EventEmitter.prototype) + +module.exports = prototype + +function child (bindings) { + const { level } = this + const serializers = this[serializersSym] + const chindings = asChindings(this, bindings) + const instance = Object.create(this) + if (bindings.hasOwnProperty('serializers') === true) { + instance[serializersSym] = Object.create(null) + + for (var k in serializers) { + instance[serializersSym][k] = serializers[k] + } + const parentSymbols = Object.getOwnPropertySymbols(serializers) + for (var i = 0; i < parentSymbols.length; i++) { + const ks = parentSymbols[i] + instance[serializersSym][ks] = serializers[ks] + } + + for (var bk in bindings.serializers) { + instance[serializersSym][bk] = bindings.serializers[bk] + } + const bindingsSymbols = Object.getOwnPropertySymbols(bindings.serializers) + for (var bi = 0; bi < bindingsSymbols.length; bi++) { + const bks = bindingsSymbols[bi] + instance[serializersSym][bks] = bindings.serializers[bks] + } + } else instance[serializersSym] = serializers + if (bindings.hasOwnProperty('customLevels') === true) { + assertNoLevelCollisions(this.levels, bindings.customLevels) + instance.levels = mappings(bindings.customLevels, instance[useOnlyCustomLevelsSym]) + genLsCache(instance) + } + instance[chindingsSym] = chindings + const childLevel = bindings.level || level + instance[setLevelSym](childLevel) + + return instance +} + +function bindings () { + const chindings = this[chindingsSym] + var chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" + var bindingsFromJson = JSON.parse(chindingsJson) + delete bindingsFromJson.pid + delete bindingsFromJson.hostname + return bindingsFromJson +} + +function setBindings (newBindings) { + const chindings = asChindings(this, newBindings) + this[chindingsSym] = chindings +} + +function write (_obj, msg, num) { + const t = this[timeSym]() + const messageKey = this[messageKeySym] + const mixin = this[mixinSym] + const objError = _obj instanceof Error + var obj + + if (_obj === undefined || _obj === null) { + obj = mixin ? mixin() : {} + obj[messageKey] = msg + } else { + obj = Object.assign(mixin ? mixin() : {}, _obj) + if (msg) { + obj[messageKey] = msg + } else if (objError) { + obj[messageKey] = _obj.message + } + + if (objError) { + obj.stack = _obj.stack + if (!obj.type) { + obj.type = 'Error' + } + } + } + + const s = this[asJsonSym](obj, num, t) + + const stream = this[streamSym] + if (stream[needsMetadataGsym] === true) { + stream.lastLevel = num + // TODO remove in the next major release, + // it is not needed anymore + stream.lastMsg = msg + stream.lastObj = obj + stream.lastTime = t.slice(this[timeSliceIndexSym]) + stream.lastLogger = this // for child loggers + } + if (stream instanceof SonicBoom) stream.write(s) + else stream.write(flatstr(s)) +} + +function flush () { + const stream = this[streamSym] + if ('flush' in stream) stream.flush() +} diff --git a/node_modules/pino/lib/redaction.js b/node_modules/pino/lib/redaction.js new file mode 100644 index 0000000..c1dd721 --- /dev/null +++ b/node_modules/pino/lib/redaction.js @@ -0,0 +1,104 @@ +'use strict' + +const fastRedact = require('fast-redact') +const { redactFmtSym, wildcardFirstSym } = require('./symbols') +const { rx, validator } = fastRedact + +const validate = validator({ + ERR_PATHS_MUST_BE_STRINGS: () => 'pino – redacted paths must be strings', + ERR_INVALID_PATH: (s) => `pino – redact paths array contains an invalid path (${s})` +}) + +const CENSOR = '[Redacted]' +const strict = false // TODO should this be configurable? + +function redaction (opts, serialize) { + const { paths, censor } = handle(opts) + + const shape = paths.reduce((o, str) => { + rx.lastIndex = 0 + const first = rx.exec(str) + const next = rx.exec(str) + + // ns is the top-level path segment, brackets + quoting removed. + let ns = first[1] !== undefined + ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, '$1') + : first[0] + + if (ns === '*') { + ns = wildcardFirstSym + } + + // top level key: + if (next === null) { + o[ns] = null + return o + } + + // path with at least two segments: + // if ns is already redacted at the top level, ignore lower level redactions + if (o[ns] === null) { + return o + } + + const { index } = next + const nextPath = `${str.substr(index, str.length - 1)}` + + o[ns] = o[ns] || [] + + // shape is a mix of paths beginning with literal values and wildcard + // paths [ "a.b.c", "*.b.z" ] should reduce to a shape of + // { "a": [ "b.c", "b.z" ], *: [ "b.z" ] } + // note: "b.z" is in both "a" and * arrays because "a" matches the wildcard. + // (* entry has wildcardFirstSym as key) + if (ns !== wildcardFirstSym && o[ns].length === 0) { + // first time ns's get all '*' redactions so far + o[ns].push(...(o[wildcardFirstSym] || [])) + } + + if (ns === wildcardFirstSym) { + // new * path gets added to all previously registered literal ns's. + Object.keys(o).forEach(function (k) { + if (o[k]) { + o[k].push(nextPath) + } + }) + } + + o[ns].push(nextPath) + return o + }, {}) + + // the redactor assigned to the format symbol key + // provides top level redaction for instances where + // an object is interpolated into the msg string + const result = { + [redactFmtSym]: fastRedact({ paths, censor, serialize, strict }) + } + + const topCensor = (...args) => + typeof censor === 'function' ? serialize(censor(...args)) : serialize(censor) + + return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => { + // top level key: + if (shape[k] === null) o[k] = topCensor + else o[k] = fastRedact({ paths: shape[k], censor, serialize, strict }) + return o + }, result) +} + +function handle (opts) { + if (Array.isArray(opts)) { + opts = { paths: opts, censor: CENSOR } + validate(opts) + return opts + } + var { paths, censor = CENSOR, remove } = opts + if (Array.isArray(paths) === false) { throw Error('pino – redact must contain an array of strings') } + if (remove === true) censor = undefined + validate({ paths, censor }) + + return { paths, censor } +} + +module.exports = redaction diff --git a/node_modules/pino/lib/symbols.js b/node_modules/pino/lib/symbols.js new file mode 100644 index 0000000..13d3662 --- /dev/null +++ b/node_modules/pino/lib/symbols.js @@ -0,0 +1,64 @@ +'use strict' + +const setLevelSym = Symbol('pino.setLevel') +const getLevelSym = Symbol('pino.getLevel') +const levelValSym = Symbol('pino.levelVal') +const useLevelLabelsSym = Symbol('pino.useLevelLabels') +const levelKeySym = Symbol('pino.levelKey') +const useOnlyCustomLevelsSym = Symbol('pino.useOnlyCustomLevels') +const mixinSym = Symbol('pino.mixin') + +const lsCacheSym = Symbol('pino.lsCache') +const chindingsSym = Symbol('pino.chindings') +const parsedChindingsSym = Symbol('pino.parsedChindings') + +const asJsonSym = Symbol('pino.asJson') +const writeSym = Symbol('pino.write') +const redactFmtSym = Symbol('pino.redactFmt') + +const timeSym = Symbol('pino.time') +const timeSliceIndexSym = Symbol('pino.timeSliceIndex') +const streamSym = Symbol('pino.stream') +const stringifySym = Symbol('pino.stringify') +const stringifiersSym = Symbol('pino.stringifiers') +const endSym = Symbol('pino.end') +const formatOptsSym = Symbol('pino.formatOpts') +const messageKeySym = Symbol('pino.messageKey') +const nestedKeySym = Symbol('pino.nestedKey') + +const wildcardFirstSym = Symbol('pino.wildcardFirst') + +// public symbols, no need to use the same pino +// version for these +const serializersSym = Symbol.for('pino.serializers') +const wildcardGsym = Symbol.for('pino.*') +const needsMetadataGsym = Symbol.for('pino.metadata') + +module.exports = { + setLevelSym, + getLevelSym, + levelValSym, + useLevelLabelsSym, + mixinSym, + lsCacheSym, + chindingsSym, + parsedChindingsSym, + asJsonSym, + writeSym, + serializersSym, + redactFmtSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifiersSym, + endSym, + formatOptsSym, + messageKeySym, + nestedKeySym, + wildcardFirstSym, + levelKeySym, + wildcardGsym, + needsMetadataGsym, + useOnlyCustomLevelsSym +} diff --git a/node_modules/pino/lib/time.js b/node_modules/pino/lib/time.js new file mode 100644 index 0000000..420a028 --- /dev/null +++ b/node_modules/pino/lib/time.js @@ -0,0 +1,11 @@ +'use strict' + +const nullTime = () => '' + +const epochTime = () => `,"time":${Date.now()}` + +const unixTime = () => `,"time":${Math.round(Date.now() / 1000.0)}` + +const isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"` // using Date.now() for testability + +module.exports = { nullTime, epochTime, unixTime, isoTime } diff --git a/node_modules/pino/lib/tools.js b/node_modules/pino/lib/tools.js new file mode 100644 index 0000000..22aa0d3 --- /dev/null +++ b/node_modules/pino/lib/tools.js @@ -0,0 +1,386 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const format = require('quick-format-unescaped') +const { mapHttpRequest, mapHttpResponse } = require('pino-std-serializers') +const SonicBoom = require('sonic-boom') +const stringifySafe = require('fast-safe-stringify') +const { + lsCacheSym, + chindingsSym, + parsedChindingsSym, + writeSym, + serializersSym, + formatOptsSym, + endSym, + stringifiersSym, + stringifySym, + wildcardFirstSym, + needsMetadataGsym, + wildcardGsym, + redactFmtSym, + streamSym, + nestedKeySym +} = require('./symbols') + +function noop () {} + +function genLog (z) { + return function LOG (o, ...n) { + if (typeof o === 'object' && o !== null) { + if (o.method && o.headers && o.socket) { + o = mapHttpRequest(o) + } else if (typeof o.setHeader === 'function') { + o = mapHttpResponse(o) + } + if (this[nestedKeySym]) o = { [this[nestedKeySym]]: o } + this[writeSym](o, format(null, n, this[formatOptsSym]), z) + } else this[writeSym](null, format(o, n, this[formatOptsSym]), z) + } +} + +// magically escape strings for json +// relying on their charCodeAt +// everything below 32 needs JSON.stringify() +// 34 and 92 happens all the time, so we +// have a fast case for them +function asString (str) { + var result = '' + var last = 0 + var found = false + var point = 255 + const l = str.length + if (l > 100) { + return JSON.stringify(str) + } + for (var i = 0; i < l && point >= 32; i++) { + point = str.charCodeAt(i) + if (point === 34 || point === 92) { + result += str.slice(last, i) + '\\' + last = i + found = true + } + } + if (!found) { + result = str + } else { + result += str.slice(last) + } + return point < 32 ? JSON.stringify(str) : '"' + result + '"' +} + +function asJson (obj, num, time) { + const stringify = this[stringifySym] + const stringifiers = this[stringifiersSym] + const end = this[endSym] + const chindings = this[chindingsSym] + const serializers = this[serializersSym] + var data = this[lsCacheSym][num] + time + + // we need the child bindings added to the output first so instance logged + // objects can take precedence when JSON.parse-ing the resulting log line + data = data + chindings + + var value + var notHasOwnProperty = obj.hasOwnProperty === undefined + if (serializers[wildcardGsym]) { + obj = serializers[wildcardGsym](obj) + } + const wildcardStringifier = stringifiers[wildcardFirstSym] + for (var key in obj) { + value = obj[key] + if ((notHasOwnProperty || obj.hasOwnProperty(key)) && value !== undefined) { + value = serializers[key] ? serializers[key](value) : value + + const stringifier = stringifiers[key] || wildcardStringifier + + switch (typeof value) { + case 'undefined': + case 'function': + continue + case 'number': + /* eslint no-fallthrough: "off" */ + if (Number.isFinite(value) === false) { + value = null + } + // this case explicity falls through to the next one + case 'boolean': + if (stringifier) value = stringifier(value) + break + case 'string': + value = (stringifier || asString)(value) + break + default: + value = (stringifier || stringify)(value) + } + if (value === undefined) continue + data += ',"' + key + '":' + value + } + } + + return data + end +} + +function asChindings (instance, bindings) { + if (!bindings) { + throw Error('missing bindings for child Pino') + } + var key + var value + var data = instance[chindingsSym] + const stringify = instance[stringifySym] + const stringifiers = instance[stringifiersSym] + const serializers = instance[serializersSym] + if (serializers[wildcardGsym]) { + bindings = serializers[wildcardGsym](bindings) + } + for (key in bindings) { + value = bindings[key] + const valid = key !== 'level' && + key !== 'serializers' && + key !== 'customLevels' && + bindings.hasOwnProperty(key) && + value !== undefined + if (valid === true) { + value = serializers[key] ? serializers[key](value) : value + value = (stringifiers[key] || stringify)(value) + if (value === undefined) continue + data += ',"' + key + '":' + value + } + } + return data +} + +function getPrettyStream (opts, prettifier, dest, instance) { + if (prettifier && typeof prettifier === 'function') { + prettifier = prettifier.bind(instance) + return prettifierMetaWrapper(prettifier(opts), dest) + } + try { + var prettyFactory = require('pino-pretty') + prettyFactory.asMetaWrapper = prettifierMetaWrapper + return prettifierMetaWrapper(prettyFactory(opts), dest) + } catch (e) { + throw Error('Missing `pino-pretty` module: `pino-pretty` must be installed separately') + } +} + +function prettifierMetaWrapper (pretty, dest) { + var warned = false + return { + [needsMetadataGsym]: true, + lastLevel: 0, + lastMsg: null, + lastObj: null, + lastLogger: null, + flushSync () { + if (warned) { + return + } + warned = true + setMetadataProps(dest, this) + dest.write(pretty(Object.assign({ + level: 40, // warn + msg: 'pino.final with prettyPrint does not support flushing', + time: Date.now() + }, this.chindings()))) + }, + chindings () { + const lastLogger = this.lastLogger + var chindings = null + + // protection against flushSync being called before logging + // anything + if (!lastLogger) { + return null + } + + if (lastLogger.hasOwnProperty(parsedChindingsSym)) { + chindings = lastLogger[parsedChindingsSym] + } else { + chindings = JSON.parse('{"v":1' + lastLogger[chindingsSym] + '}') + lastLogger[parsedChindingsSym] = chindings + } + + return chindings + }, + write (chunk) { + const lastLogger = this.lastLogger + const chindings = this.chindings() + + var time = this.lastTime + + if (time.match(/^\d+/)) { + time = parseInt(time) + } + + var lastObj = this.lastObj + var errorProps = null + + const obj = Object.assign({ + level: this.lastLevel, + time + }, chindings, lastObj, errorProps) + + const serializers = lastLogger[serializersSym] + const keys = Object.keys(serializers) + var key + + for (var i = 0; i < keys.length; i++) { + key = keys[i] + if (obj[key] !== undefined) { + obj[key] = serializers[key](obj[key]) + } + } + + const stringifiers = lastLogger[stringifiersSym] + const redact = stringifiers[redactFmtSym] + + const formatted = pretty(typeof redact === 'function' ? redact(obj) : obj) + if (formatted === undefined) return + + setMetadataProps(dest, this) + dest.write(formatted) + } + } +} + +function hasBeenTampered (stream) { + return stream.write !== stream.constructor.prototype.write +} + +function buildSafeSonicBoom (dest, buffer = 0, sync = true) { + const stream = new SonicBoom(dest, buffer, sync) + stream.on('error', filterBrokenPipe) + return stream + + function filterBrokenPipe (err) { + // TODO verify on Windows + if (err.code === 'EPIPE') { + // If we get EPIPE, we should stop logging here + // however we have no control to the consumer of + // SonicBoom, so we just overwrite the write method + stream.write = noop + stream.end = noop + stream.flushSync = noop + stream.destroy = noop + return + } + stream.removeListener('error', filterBrokenPipe) + stream.emit('error', err) + } +} + +function createArgsNormalizer (defaultOptions) { + return function normalizeArgs (instance, opts = {}, stream) { + // support stream as a string + if (typeof opts === 'string') { + stream = buildSafeSonicBoom(opts) + opts = {} + } else if (typeof stream === 'string') { + stream = buildSafeSonicBoom(stream) + } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { + stream = opts + opts = null + } + opts = Object.assign({}, defaultOptions, opts) + if ('extreme' in opts) { + throw Error('The extreme option has been removed, use pino.extreme instead') + } + if ('onTerminated' in opts) { + throw Error('The onTerminated option has been removed, use pino.final instead') + } + if ('changeLevelName' in opts) { + process.emitWarning( + 'The changeLevelName option is deprecated and will be removed in v7. Use levelKey instead.', + { code: 'changeLevelName_deprecation' } + ) + opts.levelKey = opts.changeLevelName + delete opts.changeLevelName + } + const { enabled, prettyPrint, prettifier, messageKey } = opts + if (enabled === false) opts.level = 'silent' + stream = stream || process.stdout + if (stream === process.stdout && stream.fd >= 0 && !hasBeenTampered(stream)) { + stream = buildSafeSonicBoom(stream.fd) + } + if (prettyPrint) { + const prettyOpts = Object.assign({ messageKey }, prettyPrint) + stream = getPrettyStream(prettyOpts, prettifier, stream, instance) + } + return { opts, stream } + } +} + +function final (logger, handler) { + if (typeof logger === 'undefined' || typeof logger.child !== 'function') { + throw Error('expected a pino logger instance') + } + const hasHandler = (typeof handler !== 'undefined') + if (hasHandler && typeof handler !== 'function') { + throw Error('if supplied, the handler parameter should be a function') + } + const stream = logger[streamSym] + if (typeof stream.flushSync !== 'function') { + throw Error('final requires a stream that has a flushSync method, such as pino.destination and pino.extreme') + } + + const finalLogger = new Proxy(logger, { + get: (logger, key) => { + if (key in logger.levels.values) { + return (...args) => { + logger[key](...args) + stream.flushSync() + } + } + return logger[key] + } + }) + + if (!hasHandler) { + return finalLogger + } + + return (err = null, ...args) => { + try { + stream.flushSync() + } catch (e) { + // it's too late to wait for the stream to be ready + // because this is a final tick scenario. + // in practice there shouldn't be a situation where it isn't + // however, swallow the error just in case (and for easier testing) + } + return handler(err, finalLogger, ...args) + } +} + +function stringify (obj) { + try { + return JSON.stringify(obj) + } catch (_) { + return stringifySafe(obj) + } +} + +function setMetadataProps (dest, that) { + if (dest[needsMetadataGsym] === true) { + dest.lastLevel = that.lastLevel + dest.lastMsg = that.lastMsg + dest.lastObj = that.lastObj + dest.lastTime = that.lastTime + dest.lastLogger = that.lastLogger + } +} + +module.exports = { + noop, + buildSafeSonicBoom, + getPrettyStream, + asChindings, + asJson, + genLog, + createArgsNormalizer, + final, + stringify +} diff --git a/node_modules/pino/package.json b/node_modules/pino/package.json new file mode 100644 index 0000000..4e4db58 --- /dev/null +++ b/node_modules/pino/package.json @@ -0,0 +1,135 @@ +{ + "_from": "pino@5.17.0", + "_id": "pino@5.17.0", + "_inBundle": false, + "_integrity": "sha512-LqrqmRcJz8etUjyV0ddqB6OTUutCgQULPFg2b4dtijRHUsucaAdBgSUW58vY6RFSX+NT8963F+q0tM6lNwGShA==", + "_location": "/pino", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pino@5.17.0", + "name": "pino", + "escapedName": "pino", + "rawSpec": "5.17.0", + "saveSpec": null, + "fetchSpec": "5.17.0" + }, + "_requiredBy": [ + "/docker-hub-utils" + ], + "_resolved": "https://registry.npmjs.org/pino/-/pino-5.17.0.tgz", + "_shasum": "b9def314e82402154f89a25d76a31f20ca84b4c8", + "_spec": "pino@5.17.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils", + "author": { + "name": "Matteo Collina", + "email": "hello@matteocollina.com" + }, + "bin": { + "pino": "bin.js" + }, + "browser": "./browser.js", + "bugs": { + "url": "https://github.com/pinojs/pino/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Mark Clements", + "email": "huperekchuno@googlemail.com" + }, + { + "name": "James Sumners", + "email": "james.sumners@gmail.com" + }, + { + "name": "Thomas Watson Steen", + "email": "w@tson.dk", + "url": "https://twitter.com/wa7son" + } + ], + "dependencies": { + "fast-redact": "^2.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^2.4.2", + "quick-format-unescaped": "^3.0.3", + "sonic-boom": "^0.7.5" + }, + "deprecated": false, + "description": "super fast, all natural json logger", + "devDependencies": { + "airtap": "2.0.2", + "benchmark": "^2.1.4", + "bole": "^3.0.2", + "bunyan": "^1.8.12", + "cross-env": "^5.2.1", + "docsify-cli": "^4.2.1", + "execa": "^1.0.0", + "fastbench": "^1.0.1", + "flush-write-stream": "^2.0.0", + "import-fresh": "^3.0.0", + "log": "^5.0.0", + "loglevel": "^1.6.4", + "pino-pretty": "^2.6.1", + "pre-commit": "^1.2.2", + "proxyquire": "^2.1.3", + "pump": "^3.0.0", + "qodaa": "^1.0.1", + "semver": "^6.3.0", + "snazzy": "^8.0.0", + "split2": "^3.1.1", + "standard": "^14.2.0", + "steed": "^1.1.3", + "tap": "^12.7.0", + "tape": "^4.11.0", + "through2": "^3.0.1", + "winston": "^3.2.1" + }, + "files": [ + "pino.js", + "bin.js", + "browser.js", + "pretty.js", + "usage.txt", + "test", + "docs", + "example.js", + "lib" + ], + "homepage": "http://getpino.io", + "keywords": [ + "fast", + "logger", + "stream", + "json" + ], + "license": "MIT", + "main": "pino.js", + "name": "pino", + "precommit": "test", + "repository": { + "type": "git", + "url": "git+https://github.com/pinojs/pino.git" + }, + "scripts": { + "bench": "node benchmarks/utils/runbench all", + "bench-basic": "node benchmarks/utils/runbench basic", + "bench-child": "node benchmarks/utils/runbench child", + "bench-child-child": "node benchmarks/utils/runbench child-child", + "bench-child-creation": "node benchmarks/utils/runbench child-creation", + "bench-deep-object": "node benchmarks/utils/runbench deep-object", + "bench-longs-tring": "node benchmarks/utils/runbench long-string", + "bench-multi-arg": "node benchmarks/utils/runbench multi-arg", + "bench-object": "node benchmarks/utils/runbench object", + "browser-test": "airtap --local 8080 test/browser*test.js", + "ci": "standard | snazzy && cross-env TAP_TIMEOUT=480000 NODE_OPTIONS=\"--no-warnings -r qodaa\" tap --no-esm -j 4 --100 test/*test.js", + "cov-ci": "cross-env TAP_TIMEOUT=480000 NODE_OPTIONS=\"--no-warnings -r qodaa\" tap --no-esm -j 4 --100 --coverage-report=lcov test/*test.js", + "cov-ui": "cross-env NODE_OPTIONS=\"--no-warnings -r qodaa\" tap --no-esm -j 4 --coverage-report=html test/*test.js", + "docs": "docsify serve", + "test": "standard | snazzy && cross-env NODE_OPTIONS=\"--no-warnings -r qodaa\" tap --no-esm -j 4 --no-cov test/*test.js", + "update-bench-doc": "node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md" + }, + "version": "5.17.0" +} diff --git a/node_modules/pino/pino.js b/node_modules/pino/pino.js new file mode 100644 index 0000000..4138069 --- /dev/null +++ b/node_modules/pino/pino.js @@ -0,0 +1,144 @@ +'use strict' +const os = require('os') +const stdSerializers = require('pino-std-serializers') +const redaction = require('./lib/redaction') +const time = require('./lib/time') +const proto = require('./lib/proto') +const symbols = require('./lib/symbols') +const { assertDefaultLevelFound, mappings, genLsCache } = require('./lib/levels') +const { + createArgsNormalizer, + asChindings, + final, + stringify, + buildSafeSonicBoom +} = require('./lib/tools') +const { version, LOG_VERSION } = require('./lib/meta') +const { + chindingsSym, + redactFmtSym, + serializersSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifiersSym, + setLevelSym, + endSym, + formatOptsSym, + messageKeySym, + nestedKeySym, + useLevelLabelsSym, + levelKeySym, + mixinSym, + useOnlyCustomLevelsSym +} = symbols +const { epochTime, nullTime } = time +const { pid } = process +const hostname = os.hostname() +const defaultErrorSerializer = stdSerializers.err +const defaultOptions = { + level: 'info', + useLevelLabels: false, + messageKey: 'msg', + nestedKey: null, + enabled: true, + prettyPrint: false, + base: { pid, hostname }, + serializers: Object.assign(Object.create(null), { + err: defaultErrorSerializer + }), + timestamp: epochTime, + name: undefined, + redact: null, + customLevels: null, + levelKey: 'level', + useOnlyCustomLevels: false +} + +const normalize = createArgsNormalizer(defaultOptions) + +const serializers = Object.assign(Object.create(null), stdSerializers) + +function pino (...args) { + const instance = {} + const { opts, stream } = normalize(instance, ...args) + const { + redact, + crlf, + serializers, + timestamp, + messageKey, + nestedKey, + base, + name, + level, + customLevels, + useLevelLabels, + levelKey, + mixin, + useOnlyCustomLevels + } = opts + + const stringifiers = redact ? redaction(redact, stringify) : {} + const formatOpts = redact + ? { stringify: stringifiers[redactFmtSym] } + : { stringify } + const end = ',"v":' + LOG_VERSION + '}' + (crlf ? '\r\n' : '\n') + const coreChindings = asChindings.bind(null, { + [chindingsSym]: '', + [serializersSym]: serializers, + [stringifiersSym]: stringifiers, + [stringifySym]: stringify + }) + const chindings = base === null ? '' : (name === undefined) + ? coreChindings(base) : coreChindings(Object.assign({}, base, { name })) + const time = (timestamp instanceof Function) + ? timestamp : (timestamp ? epochTime : nullTime) + const timeSliceIndex = time().indexOf(':') + 1 + + if (useOnlyCustomLevels && !customLevels) throw Error('customLevels is required if useOnlyCustomLevels is set true') + if (mixin && typeof mixin !== 'function') throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`) + + assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels) + const levels = mappings(customLevels, useOnlyCustomLevels) + + Object.assign(instance, { + levels, + [useLevelLabelsSym]: useLevelLabels, + [levelKeySym]: levelKey, + [useOnlyCustomLevelsSym]: useOnlyCustomLevels, + [streamSym]: stream, + [timeSym]: time, + [timeSliceIndexSym]: timeSliceIndex, + [stringifySym]: stringify, + [stringifiersSym]: stringifiers, + [endSym]: end, + [formatOptsSym]: formatOpts, + [messageKeySym]: messageKey, + [nestedKeySym]: nestedKey, + [serializersSym]: serializers, + [mixinSym]: mixin, + [chindingsSym]: chindings + }) + Object.setPrototypeOf(instance, proto) + + if (customLevels || useLevelLabels || levelKey !== defaultOptions.levelKey) genLsCache(instance) + + instance[setLevelSym](level) + + return instance +} + +pino.extreme = (dest = process.stdout.fd) => buildSafeSonicBoom(dest, 4096, false) +pino.destination = (dest = process.stdout.fd) => buildSafeSonicBoom(dest, 0, true) + +pino.final = final +pino.levels = mappings() +pino.stdSerializers = serializers +pino.stdTimeFunctions = Object.assign({}, time) +pino.symbols = symbols +pino.version = version +pino.LOG_VERSION = LOG_VERSION + +module.exports = pino diff --git a/node_modules/pino/test/basic.test.js b/node_modules/pino/test/basic.test.js new file mode 100644 index 0000000..eeb91b6 --- /dev/null +++ b/node_modules/pino/test/basic.test.js @@ -0,0 +1,702 @@ +'use strict' +const os = require('os') +const { join } = require('path') +const { readFileSync, existsSync, statSync } = require('fs') +const { test } = require('tap') +const { sink, check, once } = require('./helper') +const pino = require('../') +const { version } = require('../package.json') +const { pid } = process +const hostname = os.hostname() +const watchFileCreated = (filename) => new Promise((resolve, reject) => { + const TIMEOUT = 800 + const INTERVAL = 100 + const threshold = TIMEOUT / INTERVAL + let counter = 0 + const interval = setInterval(() => { + // On some CI runs file is created but not filled + if (existsSync(filename) && statSync(filename).size !== 0) { + clearInterval(interval) + resolve() + } else if (counter <= threshold) { + counter++ + } else { + clearInterval(interval) + reject(new Error(`${filename} was not created.`)) + } + }, INTERVAL) +}) + +test('pino version is exposed on export', async ({ is }) => { + is(pino.version, version) +}) + +test('pino version is exposed on instance', async ({ is }) => { + const instance = pino() + is(instance.version, version) +}) + +test('child instance exposes pino version', async ({ is }) => { + const child = pino().child({ foo: 'bar' }) + is(child.version, version) +}) + +test('bindings are exposed on every instance', async ({ same }) => { + const instance = pino() + same(instance.bindings(), {}) +}) + +test('bindings contain the name and the child bindings', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }).child({ foo: 'bar' }).child({ a: 2 }) + same(instance.bindings(), { name: 'basicTest', foo: 'bar', a: 2 }) +}) + +test('set bindings on instance', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }) + instance.setBindings({ foo: 'bar' }) + same(instance.bindings(), { name: 'basicTest', foo: 'bar' }) +}) + +test('newly set bindings overwrite old bindings', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info', base: { foo: 'bar' } }) + instance.setBindings({ foo: 'baz' }) + same(instance.bindings(), { name: 'basicTest', foo: 'baz' }) +}) + +test('set bindings on child instance', async ({ same }) => { + const child = pino({ name: 'basicTest', level: 'info' }).child({}) + child.setBindings({ foo: 'bar' }) + same(child.bindings(), { name: 'basicTest', foo: 'bar' }) +}) + +test('child should have bindings set by parent', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }) + instance.setBindings({ foo: 'bar' }) + const child = instance.child({}) + same(child.bindings(), { name: 'basicTest', foo: 'bar' }) +}) + +test('child should not share bindings of parent set after child creation', async ({ same }) => { + const instance = pino({ name: 'basicTest', level: 'info' }) + const child = instance.child({}) + instance.setBindings({ foo: 'bar' }) + same(instance.bindings(), { name: 'basicTest', foo: 'bar' }) + same(child.bindings(), { name: 'basicTest' }) +}) + +function levelTest (name, level) { + test(`${name} logs as ${level}`, async ({ is }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name]('hello world') + check(is, await once(stream, 'data'), level, 'hello world') + }) + + test(`passing objects at level ${name}`, async ({ is, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + const obj = { hello: 'world' } + instance[name](obj) + + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + is(result.pid, pid) + is(result.hostname, hostname) + is(result.level, level) + is(result.hello, 'world') + is(result.v, 1) + same(Object.keys(obj), ['hello']) + }) + + test(`passing an object and a string at level ${name}`, async ({ is, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + const obj = { hello: 'world' } + instance[name](obj, 'a string') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + msg: 'a string', + hello: 'world', + v: 1 + }) + same(Object.keys(obj), ['hello']) + }) + + test(`overriding object key by string at level ${name}`, async ({ is, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name]({ hello: 'world', msg: 'object' }, 'string') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + msg: 'string', + hello: 'world', + v: 1 + }) + }) + + test(`formatting logs as ${name}`, async ({ is }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + instance[name]('hello %d', 42) + const result = await once(stream, 'data') + check(is, result, level, 'hello 42') + }) + + test(`formatting a symbol at level ${name}`, async ({ is }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + + const sym = Symbol('foo') + instance[name]('hello', sym) + + const result = await once(stream, 'data') + + check(is, result, level, 'hello Symbol(foo)') + }) + + test(`passing error with a serializer at level ${name}`, async ({ is, same }) => { + const stream = sink() + const err = new Error('myerror') + const instance = pino({ + serializers: { + err: pino.stdSerializers.err + } + }, stream) + instance.level = name + instance[name]({ err }) + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + err: { + type: 'Error', + message: err.message, + stack: err.stack + }, + v: 1 + }) + }) + + test(`child logger for level ${name}`, async ({ is, same }) => { + const stream = sink() + const instance = pino(stream) + instance.level = name + const child = instance.child({ hello: 'world' }) + child[name]('hello world') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + msg: 'hello world', + hello: 'world', + v: 1 + }) + }) +} + +levelTest('fatal', 60) +levelTest('error', 50) +levelTest('warn', 40) +levelTest('info', 30) +levelTest('debug', 20) +levelTest('trace', 10) + +test('serializers can return undefined to strip field', async ({ is }) => { + const stream = sink() + const instance = pino({ + serializers: { + test () { return undefined } + } + }, stream) + + instance.info({ test: 'sensitive info' }) + const result = await once(stream, 'data') + is('test' in result, false) +}) + +test('does not explode with a circular ref', async ({ doesNotThrow }) => { + const stream = sink() + const instance = pino(stream) + const b = {} + const a = { + hello: b + } + b.a = a // circular ref + doesNotThrow(() => instance.info(a)) +}) + +test('set the name', async ({ is, same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('this is fatal') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + name: 'hello', + msg: 'this is fatal', + v: 1 + }) +}) + +test('set the messageKey', async ({ is, same }) => { + const stream = sink() + const message = 'hello world' + const messageKey = 'fooMessage' + const instance = pino({ + messageKey + }, stream) + instance.info(message) + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + fooMessage: message, + v: 1 + }) +}) + +test('set the nestedKey', async ({ is, same }) => { + const stream = sink() + const object = { hello: 'world' } + const nestedKey = 'stuff' + const instance = pino({ + nestedKey + }, stream) + instance.info(object) + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + stuff: object, + v: 1 + }) +}) + +test('set undefined properties', async ({ is, same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({ hello: 'world', property: undefined }) + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + hello: 'world', + v: 1 + }) +}) + +test('prototype properties are not logged', async ({ is }) => { + const stream = sink() + const instance = pino(stream) + instance.info(Object.create({ hello: 'world' })) + const { hello } = await once(stream, 'data') + is(hello, undefined) +}) + +test('set the base', async ({ is, same }) => { + const stream = sink() + const instance = pino({ + base: { + a: 'b' + } + }, stream) + + instance.fatal('this is fatal') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + a: 'b', + level: 60, + msg: 'this is fatal', + v: 1 + }) +}) + +test('set the base to null', async ({ is, same }) => { + const stream = sink() + const instance = pino({ + base: null + }, stream) + instance.fatal('this is fatal') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + level: 60, + msg: 'this is fatal', + v: 1 + }) +}) + +test('set the base to null and use a serializer', async ({ is, same }) => { + const stream = sink() + const instance = pino({ + base: null, + serializers: { + [Symbol.for('pino.*')]: (input) => { + return Object.assign({}, input, { additionalMessage: 'using pino' }) + } + } + }, stream) + instance.fatal('this is fatal too') + const result = await once(stream, 'data') + is(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()') + delete result.time + same(result, { + level: 60, + msg: 'this is fatal too', + additionalMessage: 'using pino', + v: 1 + }) +}) + +test('throw if creating child without bindings', async ({ throws }) => { + const stream = sink() + const instance = pino(stream) + throws(() => instance.child()) +}) + +test('correctly escapes msg strings with stray double quote at end', async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + + instance.fatal('this contains "') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + name: 'hello', + msg: 'this contains "', + v: 1 + }) +}) + +test('correctly escape msg strings with unclosed double quote', async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('" this contains') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + name: 'hello', + msg: '" this contains', + v: 1 + }) +}) + +// https://github.com/pinojs/pino/issues/139 +test('object and format string', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({}, 'foo %s', 'bar') + + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'foo bar', + v: 1 + }) +}) + +test('object and format string property', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({ answer: 42 }, 'foo %s', 'bar') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'foo bar', + answer: 42, + v: 1 + }) +}) + +test('correctly strip undefined when returned from toJSON', async ({ is }) => { + const stream = sink() + const instance = pino({ + test: 'this' + }, stream) + instance.fatal({ test: { toJSON () { return undefined } } }) + const result = await once(stream, 'data') + is('test' in result, false) +}) + +test('correctly supports stderr', async ({ same }) => { + // stderr inherits from Stream, rather than Writable + const dest = { + writable: true, + write (result) { + result = JSON.parse(result) + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + msg: 'a message', + v: 1 + }) + } + } + const instance = pino(dest) + instance.fatal('a message') +}) + +test('normalize number to string', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info(1) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: '1', + v: 1 + }) +}) + +test('normalize number to string with an object', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + instance.info({ answer: 42 }, 1) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: '1', + answer: 42, + v: 1 + }) +}) + +test('handles objects with null prototype', async ({ same }) => { + const stream = sink() + const instance = pino(stream) + const o = Object.create(null) + o.test = 'test' + instance.info(o) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + test: 'test', + v: 1 + }) +}) + +test('pino.destination', async ({ same }) => { + const tmp = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const instance = pino(pino.destination(tmp)) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'hello', + v: 1 + }) +}) + +test('auto pino.destination with a string', async ({ same }) => { + const tmp = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const instance = pino(tmp) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'hello', + v: 1 + }) +}) + +test('auto pino.destination with a string as second argument', async ({ same }) => { + const tmp = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const instance = pino(null, tmp) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'hello', + v: 1 + }) +}) + +test('does not override opts with a string as second argument', async ({ same }) => { + const tmp = join( + os.tmpdir(), + '_' + Math.random().toString(36).substr(2, 9) + ) + const instance = pino({ + timestamp: () => ',"time":"none"' + }, tmp) + instance.info('hello') + await watchFileCreated(tmp) + const result = JSON.parse(readFileSync(tmp).toString()) + same(result, { + pid: pid, + hostname: hostname, + level: 30, + time: 'none', + msg: 'hello', + v: 1 + }) +}) + +// https://github.com/pinojs/pino/issues/222 +test('children with same names render in correct order', async ({ is }) => { + const stream = sink() + const root = pino(stream) + root.child({ a: 1 }).child({ a: 2 }).info({ a: 3 }) + const { a } = await once(stream, 'data') + is(a, 3, 'last logged object takes precedence') +}) + +// https://github.com/pinojs/pino/pull/251 - use this.stringify +test('use `fast-safe-stringify` to avoid circular dependencies', async ({ deepEqual }) => { + const stream = sink() + const root = pino(stream) + // circular depth + const obj = {} + obj.a = obj + root.info(obj) + const { a } = await once(stream, 'data') + deepEqual(a, { a: '[Circular]' }) +}) + +test('fast-safe-stringify must be used when interpolating', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { a: { b: {} } } + o.a.b.c = o.a.b + instance.info('test', o) + + const { msg } = await once(stream, 'data') + t.is(msg, 'test {"a":{"b":{"c":"[Circular]"}}}') +}) + +test('throws when setting useOnlyCustomLevels without customLevels', async ({ is, throws }) => { + throws(() => { + pino({ + useOnlyCustomLevels: true + }) + }) + try { + pino({ + useOnlyCustomLevels: true + }) + } catch ({ message }) { + is(message, 'customLevels is required if useOnlyCustomLevels is set true') + } +}) + +test('correctly log Infinity', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: Infinity } + instance.info(o) + + const { num } = await once(stream, 'data') + t.is(num, null) +}) + +test('correctly log -Infinity', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: -Infinity } + instance.info(o) + + const { num } = await once(stream, 'data') + t.is(num, null) +}) + +test('correctly log NaN', async (t) => { + const stream = sink() + const instance = pino(stream) + + const o = { num: NaN } + instance.info(o) + + const { num } = await once(stream, 'data') + t.is(num, null) +}) diff --git a/node_modules/pino/test/broken-pipe.test.js b/node_modules/pino/test/broken-pipe.test.js new file mode 100644 index 0000000..0454cee --- /dev/null +++ b/node_modules/pino/test/broken-pipe.test.js @@ -0,0 +1,42 @@ +'use strict' + +const t = require('tap') +const { join } = require('path') +const { fork } = require('child_process') +const { once } = require('./helper') +const pino = require('..') + +function test (file) { + file = join('fixtures', 'broken-pipe', file) + t.test(file, { parallel: true }, async ({ is }) => { + const child = fork(join(__dirname, file), { silent: true }) + child.stdout.destroy() + + child.stderr.pipe(process.stdout) + + const res = await once(child, 'close') + is(res, 0) // process exits successfully + }) +} + +t.jobs = 42 + +test('basic.js') +test('destination.js') +test('extreme.js') + +t.test('let error pass through', ({ is, plan }) => { + plan(3) + const stream = pino.destination() + + // side effect of the pino constructor is that it will set an + // event handler for error + pino(stream) + + process.nextTick(() => stream.emit('error', new Error('kaboom'))) + process.nextTick(() => stream.emit('error', new Error('kaboom'))) + + stream.on('error', (err) => { + is(err.message, 'kaboom') + }) +}) diff --git a/node_modules/pino/test/browser-levels.test.js b/node_modules/pino/test/browser-levels.test.js new file mode 100644 index 0000000..6a2a988 --- /dev/null +++ b/node_modules/pino/test/browser-levels.test.js @@ -0,0 +1,218 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +test('set the level by string', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set the level by string. init with silent', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'silent', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set the level by string. init with silent and transmit', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'silent', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + }, + transmit: { + send () {} + } + }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('set the level via constructor', ({ end, same, is }) => { + const expected = [ + { + level: 50, + msg: 'this is an error' + }, + { + level: 60, + msg: 'this is fatal' + } + ] + const instance = pino({ + level: 'error', + browser: { + write (actual) { + checkLogObjects(is, same, actual, expected.shift()) + } + } + }) + + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + + end() +}) + +test('the wrong level throws', ({ end, throws }) => { + const instance = pino() + throws(() => { + instance.level = 'kaboom' + }) + end() +}) + +test('the wrong level by number throws', ({ end, throws }) => { + const instance = pino() + throws(() => { + instance.levelVal = 55 + }) + end() +}) + +test('exposes level string mappings', ({ end, is }) => { + is(pino.levels.values.error, 50) + end() +}) + +test('exposes level number mappings', ({ end, is }) => { + is(pino.levels.labels[50], 'error') + end() +}) + +test('returns level integer', ({ end, is }) => { + const instance = pino({ level: 'error' }) + is(instance.levelVal, 50) + end() +}) + +test('silent level via constructor', ({ end, fail }) => { + const instance = pino({ + level: 'silent', + browser: { + write () { + fail('no data should be logged') + } + } + }) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) + + end() +}) + +test('silent level by string', ({ end, fail }) => { + const instance = pino({ + browser: { + write () { + fail('no data should be logged') + } + } + }) + + instance.level = 'silent' + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) + + end() +}) + +test('exposed levels', ({ end, same }) => { + same(Object.keys(pino.levels.values), [ + 'fatal', + 'error', + 'warn', + 'info', + 'debug', + 'trace' + ]) + end() +}) + +test('exposed labels', ({ end, same }) => { + same(Object.keys(pino.levels.labels), [ + '10', + '20', + '30', + '40', + '50', + '60' + ]) + end() +}) + +function checkLogObjects (is, same, actual, expected) { + is(actual.time <= Date.now(), true, 'time is greater than Date.now()') + + const actualCopy = Object.assign({}, actual) + const expectedCopy = Object.assign({}, expected) + delete actualCopy.time + delete expectedCopy.time + + same(actualCopy, expectedCopy) +} diff --git a/node_modules/pino/test/browser-serializers.test.js b/node_modules/pino/test/browser-serializers.test.js new file mode 100644 index 0000000..6ed78d5 --- /dev/null +++ b/node_modules/pino/test/browser-serializers.test.js @@ -0,0 +1,327 @@ +'use strict' +// eslint-disable-next-line +if (typeof $1 !== 'undefined') $1 = arguments.callee.caller.arguments[0] + +const test = require('tape') +const fresh = require('import-fresh') +const pino = require('../browser') + +const parentSerializers = { + test: () => 'parent' +} + +const childSerializers = { + test: () => 'child' +} + +test('serializers override values', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write (o) { + is(o.test, 'parent') + end() + } + } + }) + + parent.fatal({ test: 'test' }) +}) + +test('without the serialize option, serializers do not override values', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + write (o) { + is(o.test, 'test') + end() + } + } + }) + + parent.fatal({ test: 'test' }) +}) + +if (process.title !== 'browser') { + test('if serialize option is true, standard error serializer is auto enabled', ({ end, same }) => { + const err = Error('test') + err.code = 'test' + err.type = 'Error' // get that cov + const expect = pino.stdSerializers.err(err) + + const consoleError = console.error + console.error = function (err) { + same(err, expect) + } + + const logger = fresh('../browser')({ + browser: { serialize: true } + }) + + console.error = consoleError + + logger.fatal(err) + end() + }) + + test('if serialize option is array, standard error serializer is auto enabled', ({ end, same }) => { + const err = Error('test') + err.code = 'test' + const expect = pino.stdSerializers.err(err) + + const consoleError = console.error + console.error = function (err) { + same(err, expect) + } + + const logger = fresh('../browser', require)({ + browser: { serialize: [] } + }) + + console.error = consoleError + + logger.fatal(err) + end() + }) + + test('if serialize option is array containing !stdSerializers.err, standard error serializer is disabled', ({ end, is }) => { + const err = Error('test') + err.code = 'test' + const expect = err + + const consoleError = console.error + console.error = function (err) { + is(err, expect) + } + + const logger = fresh('../browser', require)({ + browser: { serialize: ['!stdSerializers.err'] } + }) + + console.error = consoleError + + logger.fatal(err) + end() + }) + + test('in browser, serializers apply to all objects', ({ end, is }) => { + const consoleError = console.error + console.error = function (test, test2, test3, test4, test5) { + is(test.key, 'serialized') + is(test2.key2, 'serialized2') + is(test5.key3, 'serialized3') + } + + const logger = fresh('../browser', require)({ + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + }, + browser: { serialize: true } + }) + + console.error = consoleError + + logger.fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('serialize can be an array of selected serializers', ({ end, is }) => { + const consoleError = console.error + console.error = function (test, test2, test3, test4, test5) { + is(test.key, 'test') + is(test2.key2, 'serialized2') + is(test5.key3, 'test') + } + + const logger = fresh('../browser', require)({ + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + }, + browser: { serialize: ['key2'] } + }) + + console.error = consoleError + + logger.fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('serialize filter applies to child loggers', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding, test, test2, test3, test4, test5) { + is(test.key, 'test') + is(test2.key2, 'serialized2') + is(test5.key3, 'test') + } + + const logger = fresh('../browser', require)({ + browser: { serialize: ['key2'] } + }) + + console.error = consoleError + + logger.child({ + aBinding: 'test', + serializers: { + key: () => 'serialized', + key2: () => 'serialized2', + key3: () => 'serialized3' + } + }).fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' }) + end() + }) + + test('parent serializers apply to child bindings', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding) { + is(binding.key, 'serialized') + } + + const logger = fresh('../browser', require)({ + serializers: { + key: () => 'serialized' + }, + browser: { serialize: true } + }) + + console.error = consoleError + + logger.child({ key: 'test' }).fatal({ test: 'test' }) + end() + }) + + test('child serializers apply to child bindings', ({ end, is }) => { + const consoleError = console.error + console.error = function (binding) { + is(binding.key, 'serialized') + } + + const logger = fresh('../browser', require)({ + browser: { serialize: true } + }) + + console.error = consoleError + + logger.child({ + key: 'test', + serializers: { + key: () => 'serialized' + } + }).fatal({ test: 'test' }) + end() + }) +} + +test('child does not overwrite parent serializers', ({ end, is }) => { + var c = 0 + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write (o) { + c++ + if (c === 1) is(o.test, 'parent') + if (c === 2) { + is(o.test, 'child') + end() + } + } + } + }) + const child = parent.child({ serializers: childSerializers }) + + parent.fatal({ test: 'test' }) + child.fatal({ test: 'test' }) +}) + +test('children inherit parent serializers', ({ end, is }) => { + const parent = pino({ + serializers: parentSerializers, + browser: { + serialize: true, + write (o) { + is(o.test, 'parent') + } + } + }) + + const child = parent.child({ a: 'property' }) + child.fatal({ test: 'test' }) + end() +}) + +test('children serializers get called', ({ end, is }) => { + const parent = pino({ + test: 'this', + browser: { + serialize: true, + write (o) { + is(o.test, 'child') + } + } + }) + + const child = parent.child({ a: 'property', serializers: childSerializers }) + + child.fatal({ test: 'test' }) + end() +}) + +test('children serializers get called when inherited from parent', ({ end, is }) => { + const parent = pino({ + test: 'this', + serializers: parentSerializers, + browser: { + serialize: true, + write: (o) => { + is(o.test, 'pass') + } + } + }) + + const child = parent.child({ serializers: { test: () => 'pass' } }) + + child.fatal({ test: 'fail' }) + end() +}) + +test('non overriden serializers are available in the children', ({ end, is }) => { + const pSerializers = { + onlyParent: () => 'parent', + shared: () => 'parent' + } + + const cSerializers = { + shared: () => 'child', + onlyChild: () => 'child' + } + + var c = 0 + + const parent = pino({ + serializers: pSerializers, + browser: { + serialize: true, + write (o) { + c++ + if (c === 1) is(o.shared, 'child') + if (c === 2) is(o.onlyParent, 'parent') + if (c === 3) is(o.onlyChild, 'child') + if (c === 4) is(o.onlyChild, 'test') + } + } + }) + + const child = parent.child({ serializers: cSerializers }) + + child.fatal({ shared: 'test' }) + child.fatal({ onlyParent: 'test' }) + child.fatal({ onlyChild: 'test' }) + parent.fatal({ onlyChild: 'test' }) + end() +}) diff --git a/node_modules/pino/test/browser-transmit.test.js b/node_modules/pino/test/browser-transmit.test.js new file mode 100644 index 0000000..8490276 --- /dev/null +++ b/node_modules/pino/test/browser-transmit.test.js @@ -0,0 +1,349 @@ +'use strict' +const test = require('tape') +const pino = require('../browser') + +function noop () {} + +test('throws if transmit object does not have send function', ({ end, throws }) => { + throws(() => { + pino({ browser: { transmit: {} } }) + }) + + throws(() => { + pino({ browser: { transmit: { send: 'not a func' } } }) + }) + + end() +}) + +test('calls send function after write', ({ end, is }) => { + var c = 0 + const logger = pino({ + browser: { + write: () => { + c++ + }, + transmit: { + send () { is(c, 1) } + } + } + }) + + logger.fatal({ test: 'test' }) + end() +}) + +test('passes send function the logged level', ({ end, is }) => { + const logger = pino({ + browser: { + write () {}, + transmit: { + send (level) { + is(level, 'fatal') + } + } + } + }) + + logger.fatal({ test: 'test' }) + end() +}) + +test('passes send function message strings in logEvent object when asObject is not set', ({ end, same, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, { messages }) { + is(messages[0], 'test') + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal('test', 'another test') + + end() +}) + +test('passes send function message objects in logEvent object when asObject is not set', ({ end, same, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, { messages }) { + same(messages[0], { test: 'test' }) + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal({ test: 'test' }, 'another test') + + end() +}) + +test('passes send function message strings in logEvent object when asObject is set', ({ end, same, is }) => { + const logger = pino({ + browser: { + asObject: true, + write: noop, + transmit: { + send (level, { messages }) { + is(messages[0], 'test') + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal('test', 'another test') + + end() +}) + +test('passes send function message objects in logEvent object when asObject is set', ({ end, same, is }) => { + const logger = pino({ + browser: { + asObject: true, + write: noop, + transmit: { + send (level, { messages }) { + same(messages[0], { test: 'test' }) + is(messages[1], 'another test') + } + } + } + }) + + logger.fatal({ test: 'test' }, 'another test') + + end() +}) + +test('supplies a timestamp (ts) in logEvent object which is exactly the same as the `time` property in asObject mode', ({ end, is }) => { + var expected + const logger = pino({ + browser: { + asObject: true, // implict because `write`, but just to be explicit + write (o) { + expected = o.time + }, + transmit: { + send (level, logEvent) { + is(logEvent.ts, expected) + } + } + } + }) + + logger.fatal('test') + end() +}) + +test('passes send function child bindings via logEvent object', ({ end, same, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, logEvent) { + const messages = logEvent.messages + const bindings = logEvent.bindings + same(bindings[0], { first: 'binding' }) + same(bindings[1], { second: 'binding2' }) + same(messages[0], { test: 'test' }) + is(messages[1], 'another test') + } + } + } + }) + + logger + .child({ first: 'binding' }) + .child({ second: 'binding2' }) + .fatal({ test: 'test' }, 'another test') + end() +}) + +test('passes send function level:{label, value} via logEvent object', ({ end, is }) => { + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, logEvent) { + const label = logEvent.level.label + const value = logEvent.level.value + + is(label, 'fatal') + is(value, 60) + } + } + } + }) + + logger.fatal({ test: 'test' }, 'another test') + end() +}) + +test('calls send function according to transmit.level', ({ end, is }) => { + var c = 0 + const logger = pino({ + browser: { + write: noop, + transmit: { + level: 'error', + send (level) { + c++ + if (c === 1) is(level, 'error') + if (c === 2) is(level, 'fatal') + } + } + } + }) + logger.warn('ignored') + logger.error('test') + logger.fatal('test') + end() +}) + +test('transmit.level defaults to logger level', ({ end, is }) => { + var c = 0 + const logger = pino({ + level: 'error', + browser: { + write: noop, + transmit: { + send (level) { + c++ + if (c === 1) is(level, 'error') + if (c === 2) is(level, 'fatal') + } + } + } + }) + logger.warn('ignored') + logger.error('test') + logger.fatal('test') + end() +}) + +test('transmit.level is effective even if lower than logger level', ({ end, is }) => { + var c = 0 + const logger = pino({ + level: 'error', + browser: { + write: noop, + transmit: { + level: 'info', + send (level) { + c++ + if (c === 1) is(level, 'warn') + if (c === 2) is(level, 'error') + if (c === 3) is(level, 'fatal') + } + } + } + }) + logger.warn('ignored') + logger.error('test') + logger.fatal('test') + end() +}) + +test('applies all serializers to messages and bindings (serialize:false - default)', ({ end, same, is }) => { + const logger = pino({ + serializers: { + first: () => 'first', + second: () => 'second', + test: () => 'serialize it' + }, + browser: { + write: noop, + transmit: { + send (level, logEvent) { + const messages = logEvent.messages + const bindings = logEvent.bindings + same(bindings[0], { first: 'first' }) + same(bindings[1], { second: 'second' }) + same(messages[0], { test: 'serialize it' }) + is(messages[1].type, 'Error') + } + } + } + }) + + logger + .child({ first: 'binding' }) + .child({ second: 'binding2' }) + .fatal({ test: 'test' }, Error()) + end() +}) + +test('applies all serializers to messages and bindings (serialize:true)', ({ end, same, is }) => { + const logger = pino({ + serializers: { + first: () => 'first', + second: () => 'second', + test: () => 'serialize it' + }, + browser: { + serialize: true, + write: noop, + transmit: { + send (level, logEvent) { + const messages = logEvent.messages + const bindings = logEvent.bindings + same(bindings[0], { first: 'first' }) + same(bindings[1], { second: 'second' }) + same(messages[0], { test: 'serialize it' }) + is(messages[1].type, 'Error') + } + } + } + }) + + logger + .child({ first: 'binding' }) + .child({ second: 'binding2' }) + .fatal({ test: 'test' }, Error()) + end() +}) + +test('extracts correct bindings and raw messages over multiple transmits', ({ end, same, is }) => { + var messages = null + var bindings = null + + const logger = pino({ + browser: { + write: noop, + transmit: { + send (level, logEvent) { + messages = logEvent.messages + bindings = logEvent.bindings + } + } + } + }) + + const child = logger.child({ child: true }) + const grandchild = child.child({ grandchild: true }) + + logger.fatal({ test: 'parent:test1' }) + logger.fatal({ test: 'parent:test2' }) + same([], bindings) + same([{ test: 'parent:test2' }], messages) + + child.fatal({ test: 'child:test1' }) + child.fatal({ test: 'child:test2' }) + same([{ child: true }], bindings) + same([{ test: 'child:test2' }], messages) + + grandchild.fatal({ test: 'grandchild:test1' }) + grandchild.fatal({ test: 'grandchild:test2' }) + same([{ child: true }, { grandchild: true }], bindings) + same([{ test: 'grandchild:test2' }], messages) + + end() +}) diff --git a/node_modules/pino/test/browser.test.js b/node_modules/pino/test/browser.test.js new file mode 100644 index 0000000..76caba3 --- /dev/null +++ b/node_modules/pino/test/browser.test.js @@ -0,0 +1,553 @@ +'use strict' +const test = require('tape') +const fresh = require('import-fresh') +const pinoStdSerializers = require('pino-std-serializers') +const pino = require('../browser') + +levelTest('fatal') +levelTest('error') +levelTest('warn') +levelTest('info') +levelTest('debug') +levelTest('trace') + +test('silent level', ({ end, fail, pass }) => { + const instance = pino({ + level: 'silent', + browser: { write: fail } + }) + instance.info('test') + const child = instance.child({ test: 'test' }) + child.info('msg-test') + // use setTimeout because setImmediate isn't supported in most browsers + setTimeout(() => { + pass() + end() + }, 0) +}) + +test('enabled false', ({ end, fail, pass }) => { + const instance = pino({ + enabled: false, + browser: { write: fail } + }) + instance.info('test') + const child = instance.child({ test: 'test' }) + child.info('msg-test') + // use setTimeout because setImmediate isn't supported in most browsers + setTimeout(() => { + pass() + end() + }, 0) +}) + +test('throw if creating child without bindings', ({ end, throws }) => { + const instance = pino() + throws(() => instance.child()) + end() +}) + +test('stubs write, flush and ee methods on instance', ({ end, ok, is }) => { + const instance = pino() + + ok(isFunc(instance.setMaxListeners)) + ok(isFunc(instance.getMaxListeners)) + ok(isFunc(instance.emit)) + ok(isFunc(instance.addListener)) + ok(isFunc(instance.on)) + ok(isFunc(instance.prependListener)) + ok(isFunc(instance.once)) + ok(isFunc(instance.prependOnceListener)) + ok(isFunc(instance.removeListener)) + ok(isFunc(instance.removeAllListeners)) + ok(isFunc(instance.listeners)) + ok(isFunc(instance.listenerCount)) + ok(isFunc(instance.eventNames)) + ok(isFunc(instance.write)) + ok(isFunc(instance.flush)) + + is(instance.on(), undefined) + + end() +}) + +test('exposes levels object', ({ end, same }) => { + same(pino.levels, { + values: { + fatal: 60, + error: 50, + warn: 40, + info: 30, + debug: 20, + trace: 10 + }, + labels: { + 10: 'trace', + 20: 'debug', + 30: 'info', + 40: 'warn', + 50: 'error', + 60: 'fatal' + } + }) + + end() +}) + +test('exposes LOG_VERSION', ({ end, is }) => { + is(pino.LOG_VERSION, 1) + + end() +}) + +test('exposes faux stdSerializers', ({ end, ok, same }) => { + ok(pino.stdSerializers) + // make sure faux stdSerializers match pino-std-serializers + for (const serializer in pinoStdSerializers) { + ok(pino.stdSerializers[serializer], `pino.stdSerializers.${serializer}`) + } + // confirm faux methods return empty objects + same(pino.stdSerializers.req(), {}) + same(pino.stdSerializers.mapHttpRequest(), {}) + same(pino.stdSerializers.mapHttpResponse(), {}) + same(pino.stdSerializers.res(), {}) + // confirm wrapping function is a passthrough + const noChange = { foo: 'bar', fuz: 42 } + same(pino.stdSerializers.wrapRequestSerializer(noChange), noChange) + same(pino.stdSerializers.wrapResponseSerializer(noChange), noChange) + end() +}) + +test('exposes err stdSerializer', ({ end, ok }) => { + ok(pino.stdSerializers.err) + ok(pino.stdSerializers.err(Error())) + end() +}) + +consoleMethodTest('error') +consoleMethodTest('fatal', 'error') +consoleMethodTest('warn') +consoleMethodTest('info') +consoleMethodTest('debug') +consoleMethodTest('trace') +absentConsoleMethodTest('error', 'log') +absentConsoleMethodTest('warn', 'error') +absentConsoleMethodTest('info', 'log') +absentConsoleMethodTest('debug', 'log') +absentConsoleMethodTest('trace', 'log') + +// do not run this with airtap +if (process.title !== 'browser') { + test('in absence of console, log methods become noops', ({ end, ok }) => { + var console = global.console + delete global.console + const instance = fresh('../browser')() + global.console = console + ok(fnName(instance.log).match(/noop/)) + ok(fnName(instance.fatal).match(/noop/)) + ok(fnName(instance.error).match(/noop/)) + ok(fnName(instance.warn).match(/noop/)) + ok(fnName(instance.info).match(/noop/)) + ok(fnName(instance.debug).match(/noop/)) + ok(fnName(instance.trace).match(/noop/)) + end() + }) +} + +test('opts.browser.asObject logs pino-like object to console', ({ end, ok, is }) => { + var info = console.info + console.info = function (o) { + is(o.level, 30) + is(o.msg, 'test') + ok(o.time) + console.info = info + } + const instance = require('../browser')({ + browser: { + asObject: true + } + }) + + instance.info('test') + end() +}) + +test('opts.browser.write func log single string', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test') + ok(o.time) + } + } + }) + instance.info('test') + + end() +}) + +test('opts.browser.write func string joining', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test test2 test3') + ok(o.time) + } + } + }) + instance.info('test', 'test2', 'test3') + + end() +}) + +test('opts.browser.write func string joining when asObject is true', ({ end, ok, is }) => { + const instance = pino({ + browser: { + asObject: true, + write: function (o) { + is(o.level, 30) + is(o.msg, 'test test2 test3') + ok(o.time) + } + } + }) + instance.info('test', 'test2', 'test3') + + end() +}) + +test('opts.browser.write func string joining when asObject is true', ({ end, ok, is }) => { + const instance = pino({ + browser: { + asObject: true, + write: function (o) { + is(o.level, 30) + is(o.msg, 'test test2 test3') + ok(o.time) + } + } + }) + instance.info('test', 'test2', 'test3') + + end() +}) + +test('opts.browser.write func string object joining', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test {"test":"test2"} {"test":"test3"}') + ok(o.time) + } + } + }) + instance.info('test', { test: 'test2' }, { test: 'test3' }) + + end() +}) + +test('opts.browser.write func string object joining when asObject is true', ({ end, ok, is }) => { + const instance = pino({ + browser: { + asObject: true, + write: function (o) { + is(o.level, 30) + is(o.msg, 'test {"test":"test2"} {"test":"test3"}') + ok(o.time) + } + } + }) + instance.info('test', { test: 'test2' }, { test: 'test3' }) + + end() +}) + +test('opts.browser.write func string interpolation', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 'test2 test ({"test":"test3"})') + ok(o.time) + } + } + }) + instance.info('%s test (%j)', 'test2', { test: 'test3' }) + + end() +}) + +test('opts.browser.write func number', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.msg, 1) + ok(o.time) + } + } + }) + instance.info(1) + + end() +}) + +test('opts.browser.write func log single object', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: function (o) { + is(o.level, 30) + is(o.test, 'test') + ok(o.time) + } + } + }) + instance.info({ test: 'test' }) + + end() +}) + +test('opts.browser.write obj writes to methods corresponding to level', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write: { + error: function (o) { + is(o.level, 50) + is(o.test, 'test') + ok(o.time) + } + } + } + }) + instance.error({ test: 'test' }) + + end() +}) + +test('opts.browser.asObject/write supports child loggers', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write (o) { + is(o.level, 30) + is(o.test, 'test') + is(o.msg, 'msg-test') + ok(o.time) + } + } + }) + const child = instance.child({ test: 'test' }) + child.info('msg-test') + + end() +}) + +test('opts.browser.asObject/write supports child child loggers', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write (o) { + is(o.level, 30) + is(o.test, 'test') + is(o.foo, 'bar') + is(o.msg, 'msg-test') + ok(o.time) + } + } + }) + const child = instance.child({ test: 'test' }).child({ foo: 'bar' }) + child.info('msg-test') + + end() +}) + +test('opts.browser.asObject/write supports child child child loggers', ({ end, ok, is }) => { + const instance = pino({ + browser: { + write (o) { + is(o.level, 30) + is(o.test, 'test') + is(o.foo, 'bar') + is(o.baz, 'bop') + is(o.msg, 'msg-test') + ok(o.time) + } + } + }) + const child = instance.child({ test: 'test' }).child({ foo: 'bar' }).child({ baz: 'bop' }) + child.info('msg-test') + + end() +}) + +test('opts.browser.asObject defensively mitigates naughty numbers', ({ end, pass }) => { + const instance = pino({ + browser: { asObject: true, write: () => {} } + }) + const child = instance.child({ test: 'test' }) + child._childLevel = -10 + child.info('test') + pass() // if we reached here, there was no infinite loop, so, .. pass. + + end() +}) + +test('opts.browser.write obj falls back to console where a method is not supplied', ({ end, ok, is }) => { + var info = console.info + console.info = (o) => { + is(o.level, 30) + is(o.msg, 'test') + ok(o.time) + console.info = info + } + const instance = require('../browser')({ + browser: { + write: { + error (o) { + is(o.level, 50) + is(o.test, 'test') + ok(o.time) + } + } + } + }) + instance.error({ test: 'test' }) + instance.info('test') + + end() +}) + +function levelTest (name) { + test(name + ' logs', ({ end, is }) => { + var msg = 'hello world' + sink(name, (args) => { + is(args[0], msg) + end() + }) + pino({ level: name })[name](msg) + }) + + test('passing objects at level ' + name, ({ end, is }) => { + var msg = { hello: 'world' } + sink(name, (args) => { + is(args[0], msg) + end() + }) + pino({ level: name })[name](msg) + }) + + test('passing an object and a string at level ' + name, ({ end, is }) => { + var a = { hello: 'world' } + var b = 'a string' + sink(name, (args) => { + is(args[0], a) + is(args[1], b) + end() + }) + pino({ level: name })[name](a, b) + }) + + test('formatting logs as ' + name, ({ end, is }) => { + sink(name, (args) => { + is(args[0], 'hello %d') + is(args[1], 42) + end() + }) + pino({ level: name })[name]('hello %d', 42) + }) + + test('passing error at level ' + name, ({ end, is }) => { + var err = new Error('myerror') + sink(name, (args) => { + is(args[0], err) + end() + }) + pino({ level: name })[name](err) + }) + + test('passing error with a serializer at level ' + name, ({ end, is }) => { + // in browser - should have no effect (should not crash) + var err = new Error('myerror') + sink(name, (args) => { + is(args[0].err, err) + end() + }) + const instance = pino({ + level: name, + serializers: { + err: pino.stdSerializers.err + } + }) + instance[name]({ err: err }) + }) + + test('child logger for level ' + name, ({ end, is }) => { + var msg = 'hello world' + var parent = { hello: 'world' } + sink(name, (args) => { + is(args[0], parent) + is(args[1], msg) + end() + }) + const instance = pino({ level: name }) + const child = instance.child(parent) + child[name](msg) + }) + + test('child-child logger for level ' + name, ({ end, is }) => { + var msg = 'hello world' + var grandParent = { hello: 'world' } + var parent = { hello: 'you' } + sink(name, (args) => { + is(args[0], grandParent) + is(args[1], parent) + is(args[2], msg) + end() + }) + const instance = pino({ level: name }) + const child = instance.child(grandParent).child(parent) + child[name](msg) + }) +} + +function consoleMethodTest (level, method) { + if (!method) method = level + test('pino().' + level + ' uses console.' + method, ({ end, is }) => { + sink(method, (args) => { + is(args[0], 'test') + end() + }) + const instance = require('../browser')({ level: level }) + instance[level]('test') + }) +} + +function absentConsoleMethodTest (method, fallback) { + test('in absence of console.' + method + ', console.' + fallback + ' is used', ({ end, is }) => { + var fn = console[method] + console[method] = undefined + sink(fallback, function (args) { + is(args[0], 'test') + end() + console[method] = fn + }) + const instance = require('../browser')({ level: method }) + instance[method]('test') + }) +} + +function isFunc (fn) { return typeof fn === 'function' } +function fnName (fn) { + var rx = /^\s*function\s*([^(]*)/i + var match = rx.exec(fn) + return match && match[1] +} +function sink (method, fn) { + if (method === 'fatal') method = 'error' + var orig = console[method] + console[method] = function () { + console[method] = orig + fn(Array.prototype.slice.call(arguments)) + } +} diff --git a/node_modules/pino/test/crlf.test.js b/node_modules/pino/test/crlf.test.js new file mode 100644 index 0000000..8186fbe --- /dev/null +++ b/node_modules/pino/test/crlf.test.js @@ -0,0 +1,32 @@ +'use strict' + +const { test } = require('tap') +const writer = require('flush-write-stream') +const pino = require('../') + +function capture () { + const ws = writer((chunk, enc, cb) => { + ws.data += chunk.toString() + cb() + }) + ws.data = '' + return ws +} + +test('pino uses LF by default', async ({ ok }) => { + const stream = capture() + const logger = pino(stream) + logger.info('foo') + logger.error('bar') + ok(/foo[^\r\n]+\n[^\r\n]+bar[^\r\n]+\n/.test(stream.data)) +}) + +test('pino can log CRLF', async ({ ok }) => { + const stream = capture() + const logger = pino({ + crlf: true + }, stream) + logger.info('foo') + logger.error('bar') + ok(/foo[^\n]+\r\n[^\n]+bar[^\n]+\r\n/.test(stream.data)) +}) diff --git a/node_modules/pino/test/custom-levels.test.js b/node_modules/pino/test/custom-levels.test.js new file mode 100644 index 0000000..b7d19c3 --- /dev/null +++ b/node_modules/pino/test/custom-levels.test.js @@ -0,0 +1,308 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +test('adds additional levels', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35, + bar: 45 + } + }, stream) + + logger.foo('test') + const { level } = await once(stream, 'data') + is(level, 35) +}) + +test('custom levels does not override default levels', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + } + }, stream) + + logger.info('test') + const { level } = await once(stream, 'data') + is(level, 30) +}) + +test('default levels can be redefined using custom levels', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + info: 35, + debug: 45 + }, + useOnlyCustomLevels: true + }, stream) + + is(logger.hasOwnProperty('info'), true) + + logger.info('test') + const { level } = await once(stream, 'data') + is(level, 35) +}) + +test('custom levels overrides default level label if use useOnlyCustomLevels', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + }, + useOnlyCustomLevels: true, + level: 'foo' + }, stream) + + is(logger.hasOwnProperty('info'), false) +}) + +test('custom levels overrides default level value if use useOnlyCustomLevels', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + }, + useOnlyCustomLevels: true, + level: 35 + }, stream) + + is(logger.hasOwnProperty('info'), false) +}) + +test('custom levels are inherited by children', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35 + } + }, stream) + + logger.child({ childMsg: 'ok' }).foo('test') + const { msg, childMsg, level } = await once(stream, 'data') + is(level, 35) + is(childMsg, 'ok') + is(msg, 'test') +}) + +test('custom levels can be specified on child bindings', async ({ is }) => { + const stream = sink() + const logger = pino(stream).child({ + customLevels: { + foo: 35 + }, + childMsg: 'ok' + }) + + logger.foo('test') + const { msg, childMsg, level } = await once(stream, 'data') + is(level, 35) + is(childMsg, 'ok') + is(msg, 'test') +}) + +test('customLevels property child bindings does not get logged', async ({ is }) => { + const stream = sink() + const logger = pino(stream).child({ + customLevels: { + foo: 35 + }, + childMsg: 'ok' + }) + + logger.foo('test') + const { customLevels } = await once(stream, 'data') + is(customLevels, undefined) +}) + +test('throws when specifying pre-existing parent labels via child bindings', async ({ is, throws }) => { + const stream = sink() + throws(() => pino({ + customLevels: { + foo: 35 + } + }, stream).child({ + customLevels: { + foo: 45 + } + }) + ) + try { + pino({ + customLevels: { + foo: 35 + } + }, stream).child({ + customLevels: { + foo: 45 + } + }) + } catch ({ message }) { + is(message, 'levels cannot be overridden') + } +}) + +test('throws when specifying pre-existing parent values via child bindings', async ({ is, throws }) => { + const stream = sink() + throws(() => pino({ + customLevels: { + foo: 35 + } + }, stream).child({ + customLevels: { + bar: 35 + } + }) + ) + try { + pino({ + customLevels: { + foo: 35 + } + }, stream).child({ + customLevels: { + bar: 35 + } + }) + } catch ({ message }) { + is(message, 'pre-existing level values cannot be used for new levels') + } +}) + +test('throws when specifying core values via child bindings', async ({ is, throws }) => { + const stream = sink() + throws(() => pino(stream).child({ + customLevels: { + foo: 30 + } + }) + ) + try { + pino(stream).child({ + customLevels: { + foo: 30 + } + }) + } catch ({ message }) { + is(message, 'pre-existing level values cannot be used for new levels') + } +}) + +test('throws when useOnlyCustomLevels is set true without customLevels', async ({ is, throws }) => { + const stream = sink() + throws(() => pino({ + useOnlyCustomLevels: true + }, stream) + ) + try { + pino({ + useOnlyCustomLevels: true + }, stream) + } catch ({ message }) { + is(message, 'customLevels is required if useOnlyCustomLevels is set true') + } +}) + +test('custom level on one instance does not affect other instances', async ({ is }) => { + pino({ + customLevels: { + foo: 37 + } + }) + is(typeof pino().foo, 'undefined') +}) + +test('setting level below or at custom level will successfully log', async ({ is }) => { + const stream = sink() + const instance = pino({ customLevels: { foo: 35 } }, stream) + instance.level = 'foo' + instance.info('nope') + instance.foo('bar') + const { msg } = await once(stream, 'data') + is(msg, 'bar') +}) + +test('custom level below level threshold will not log', async ({ is }) => { + const stream = sink() + const instance = pino({ customLevels: { foo: 15 } }, stream) + instance.level = 'info' + instance.info('bar') + instance.foo('nope') + const { msg } = await once(stream, 'data') + is(msg, 'bar') +}) + +test('does not share custom level state across siblings', async ({ doesNotThrow }) => { + const stream = sink() + const logger = pino(stream) + logger.child({ + customLevels: { foo: 35 } + }) + doesNotThrow(() => { + logger.child({ + customLevels: { foo: 35 } + }) + }) +}) + +test('custom level does not affect levelKey', async ({ is }) => { + const stream = sink() + const logger = pino({ + customLevels: { + foo: 35, + bar: 45 + }, + levelKey: 'priority' + }, stream) + + logger.foo('test') + const { priority } = await once(stream, 'data') + is(priority, 35) +}) + +test('custom levels accesible in prettifier function', async ({ plan, same }) => { + plan(1) + const logger = pino({ + prettyPrint: true, + prettifier: function prettifierFactory () { + const instance = this + return function () { + same(instance.levels, { + labels: { + 10: 'trace', + 20: 'debug', + 30: 'info', + 35: 'foo', + 40: 'warn', + 45: 'bar', + 50: 'error', + 60: 'fatal' + }, + values: { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60, + foo: 35, + bar: 45 + } + }) + } + }, + customLevels: { + foo: 35, + bar: 45 + }, + changeLevelName: 'priority' + }) + + logger.foo('test') +}) diff --git a/node_modules/pino/test/error.test.js b/node_modules/pino/test/error.test.js new file mode 100644 index 0000000..ea7c04c --- /dev/null +++ b/node_modules/pino/test/error.test.js @@ -0,0 +1,179 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const os = require('os') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() +const level = 50 +const name = 'error' + +test('err is serialized with additional properties set on the Error object', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('myerror'), { foo: 'bar' }) + const instance = pino(stream) + instance.level = name + instance[name](err) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + type: 'Error', + msg: err.message, + stack: err.stack, + foo: err.foo, + v: 1 + }) +}) + +test('type should be retained, even if type is a property', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('myerror'), { type: 'bar' }) + const instance = pino(stream) + instance.level = name + instance[name](err) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + type: 'bar', + msg: err.message, + stack: err.stack, + v: 1 + }) +}) + +test('type, message and stack should be first level properties', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('foo'), { foo: 'bar' }) + const instance = pino(stream) + instance.level = name + instance[name](err) + + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + type: 'Error', + msg: err.message, + stack: err.stack, + foo: err.foo, + v: 1 + }) +}) + +test('err serializer', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('myerror'), { foo: 'bar' }) + const instance = pino({ + serializers: { + err: pino.stdSerializers.err + } + }, stream) + + instance.level = name + instance[name]({ err }) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + err: { + type: 'Error', + message: err.message, + stack: err.stack, + foo: err.foo + }, + v: 1 + }) +}) + +test('an error with statusCode property is not confused for a http response', async ({ ok, same }) => { + const stream = sink() + const err = Object.assign(new Error('StatusCodeErr'), { statusCode: 500 }) + const instance = pino(stream) + + instance.level = name + instance[name](err) + const result = await once(stream, 'data') + + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: level, + type: 'Error', + msg: err.message, + stack: err.stack, + statusCode: err.statusCode, + v: 1 + }) +}) + +test('stack is omitted if it is not set on err', t => { + t.plan(2) + var err = new Error('myerror') + delete err.stack + var instance = pino(sink(function (chunk, enc, cb) { + t.ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + t.equal(chunk.hasOwnProperty('stack'), false) + cb() + })) + + instance.level = name + instance[name](err) +}) + +test('stack is rendered as any other property if it\'s not a string', t => { + t.plan(3) + var err = new Error('myerror') + err.stack = null + var instance = pino(sink(function (chunk, enc, cb) { + t.ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + t.equal(chunk.hasOwnProperty('stack'), true) + t.equal(chunk.stack, null) + cb() + })) + + instance.level = name + instance[name](err) +}) + +test('correctly ignores toString on errors', async ({ same }) => { + const err = new Error('myerror') + err.toString = () => undefined + const stream = sink() + const instance = pino({ + test: 'this' + }, stream) + instance.fatal(err) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + type: 'Error', + msg: err.message, + stack: err.stack, + v: 1 + }) +}) diff --git a/node_modules/pino/test/escaping.test.js b/node_modules/pino/test/escaping.test.js new file mode 100644 index 0000000..3edf683 --- /dev/null +++ b/node_modules/pino/test/escaping.test.js @@ -0,0 +1,93 @@ +'use strict' + +const os = require('os') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() + +function testEscape (ch, key) { + test('correctly escape ' + ch, async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('this contains ' + key) + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + name: 'hello', + msg: 'this contains ' + key, + v: 1 + }) + }) +} + +testEscape('\\n', '\n') +testEscape('\\/', '/') +testEscape('\\\\', '\\') +testEscape('\\r', '\r') +testEscape('\\t', '\t') +testEscape('\\b', '\b') + +const toEscape = [ + '\u0000', // NUL Null character + '\u0001', // SOH Start of Heading + '\u0002', // STX Start of Text + '\u0003', // ETX End-of-text character + '\u0004', // EOT End-of-transmission character + '\u0005', // ENQ Enquiry character + '\u0006', // ACK Acknowledge character + '\u0007', // BEL Bell character + '\u0008', // BS Backspace + '\u0009', // HT Horizontal tab + '\u000A', // LF Line feed + '\u000B', // VT Vertical tab + '\u000C', // FF Form feed + '\u000D', // CR Carriage return + '\u000E', // SO Shift Out + '\u000F', // SI Shift In + '\u0010', // DLE Data Link Escape + '\u0011', // DC1 Device Control 1 + '\u0012', // DC2 Device Control 2 + '\u0013', // DC3 Device Control 3 + '\u0014', // DC4 Device Control 4 + '\u0015', // NAK Negative-acknowledge character + '\u0016', // SYN Synchronous Idle + '\u0017', // ETB End of Transmission Block + '\u0018', // CAN Cancel character + '\u0019', // EM End of Medium + '\u001A', // SUB Substitute character + '\u001B', // ESC Escape character + '\u001C', // FS File Separator + '\u001D', // GS Group Separator + '\u001E', // RS Record Separator + '\u001F' // US Unit Separator +] + +toEscape.forEach((key) => { + testEscape(JSON.stringify(key), key) +}) + +test('correctly escape `hello \\u001F world \\n \\u0022`', async ({ same }) => { + const stream = sink() + const instance = pino({ + name: 'hello' + }, stream) + instance.fatal('hello \u001F world \n \u0022') + const result = await once(stream, 'data') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 60, + name: 'hello', + msg: 'hello \u001F world \n \u0022', + v: 1 + }) +}) diff --git a/node_modules/pino/test/exit.test.js b/node_modules/pino/test/exit.test.js new file mode 100644 index 0000000..fe7542a --- /dev/null +++ b/node_modules/pino/test/exit.test.js @@ -0,0 +1,53 @@ +'use strict' + +const { test } = require('tap') +const { join } = require('path') +const execa = require('execa') +const writer = require('flush-write-stream') +const { once } = require('./helper') + +// https://github.com/pinojs/pino/issues/542 +test('pino.destination log everything when calling process.exit(0)', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'destination-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + isNot(actual.match(/hello/), null) + isNot(actual.match(/world/), null) +}) + +test('pino.extreme does not log everything when calling process.exit(0)', async ({ is }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'extreme-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + is(actual.match(/hello/), null) + is(actual.match(/world/), null) +}) + +test('pino.extreme logs everything when calling flushSync', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'extreme-flush-exit.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + + isNot(actual.match(/hello/), null) + isNot(actual.match(/world/), null) +}) diff --git a/node_modules/pino/test/extreme.test.js b/node_modules/pino/test/extreme.test.js new file mode 100644 index 0000000..7145d45 --- /dev/null +++ b/node_modules/pino/test/extreme.test.js @@ -0,0 +1,125 @@ +'use strict' + +const os = require('os') +const { createWriteStream } = require('fs') +const { join } = require('path') +const { test } = require('tap') +const { fork } = require('child_process') +const writer = require('flush-write-stream') +const { once, getPathToNull } = require('./helper') + +test('extreme mode', async ({ is, teardown }) => { + const now = Date.now + const hostname = os.hostname + const proc = process + global.process = { + __proto__: process, + pid: 123456 + } + Date.now = () => 1459875739796 + os.hostname = () => 'abcdefghijklmnopqr' + delete require.cache[require.resolve('../')] + const pino = require('../') + var expected = '' + var actual = '' + const normal = pino(writer((s, enc, cb) => { + expected += s + cb() + })) + + const dest = createWriteStream(getPathToNull()) + dest.write = (s) => { + actual += s + } + const extreme = pino(dest) + + var i = 44 + while (i--) { + normal.info('h') + extreme.info('h') + } + + var expected2 = expected.split('\n')[0] + var actual2 = '' + + const child = fork(join(__dirname, '/fixtures/extreme.js'), { silent: true }) + child.stdout.pipe(writer((s, enc, cb) => { + actual2 += s + cb() + })) + await once(child, 'close') + is(actual, expected) + is(actual2.trim(), expected2) + + teardown(() => { + os.hostname = hostname + Date.now = now + global.process = proc + }) +}) + +test('extreme mode with child', async ({ is, teardown }) => { + const now = Date.now + const hostname = os.hostname + const proc = process + global.process = { + __proto__: process, + pid: 123456 + } + Date.now = function () { + return 1459875739796 + } + os.hostname = function () { + return 'abcdefghijklmnopqr' + } + delete require.cache[require.resolve('../')] + const pino = require('../') + var expected = '' + var actual = '' + const normal = pino(writer((s, enc, cb) => { + expected += s + cb() + })).child({ hello: 'world' }) + + const dest = createWriteStream(getPathToNull()) + dest.write = function (s) { actual += s } + const extreme = pino(dest).child({ hello: 'world' }) + + var i = 500 + while (i--) { + normal.info('h') + extreme.info('h') + } + + extreme.flush() + + var expected2 = expected.split('\n')[0] + var actual2 = '' + + const child = fork(join(__dirname, '/fixtures/extreme-child.js'), { silent: true }) + child.stdout.pipe(writer((s, enc, cb) => { + actual2 += s + cb() + })) + await once(child, 'close') + is(actual, expected) + is(actual2.trim(), expected2) + + teardown(() => { + os.hostname = hostname + Date.now = now + global.process = proc + }) +}) + +test('throw an error if extreme is passed', async ({ throws }) => { + const pino = require('..') + throws(() => { + pino({ extreme: true }) + }) +}) + +test('flush does nothing without extreme mode', async () => { + var instance = require('..')() + instance.flush() +}) diff --git a/node_modules/pino/test/final.test.js b/node_modules/pino/test/final.test.js new file mode 100644 index 0000000..b5d6d0d --- /dev/null +++ b/node_modules/pino/test/final.test.js @@ -0,0 +1,182 @@ +'use strict' +const pino = require('..') +const fs = require('fs') +const { test } = require('tap') +const { sleep, getPathToNull } = require('./helper') + +test('replaces onTerminated option', async ({ throws }) => { + throws(() => { + pino({ + onTerminated: () => {} + }) + }, Error('The onTerminated option has been removed, use pino.final instead')) +}) + +test('throws if not supplied a logger instance', async ({ throws }) => { + throws(() => { + pino.final() + }, Error('expected a pino logger instance')) +}) + +test('throws if the supplied handler is not a function', async ({ throws }) => { + throws(() => { + pino.final(pino(), 'dummy') + }, Error('if supplied, the handler parameter should be a function')) +}) + +test('throws if not supplied logger with pino.extreme instance', async ({ throws, doesNotThrow }) => { + throws(() => { + pino.final(pino(fs.createWriteStream(getPathToNull())), () => {}) + }, Error('final requires a stream that has a flushSync method, such as pino.destination and pino.extreme')) + + doesNotThrow(() => { + pino.final(pino(pino.extreme()), () => {}) + }) + + doesNotThrow(() => { + pino.final(pino(pino.extreme()), () => {}) + }) +}) + +test('returns an exit listener function', async ({ is }) => { + is(typeof pino.final(pino(pino.extreme()), () => {}), 'function') +}) + +test('listener function immediately sync flushes when fired', async ({ pass, fail }) => { + const dest = pino.extreme(getPathToNull()) + var passed = false + dest.flushSync = () => { + passed = true + pass('flushSync called') + } + pino.final(pino(dest), () => {})() + await sleep(10) + if (passed === false) fail('flushSync not called') +}) + +test('listener function immediately sync flushes when fired (pino.destination)', async ({ pass, fail }) => { + const dest = pino.destination(getPathToNull()) + var passed = false + dest.flushSync = () => { + passed = true + pass('flushSync called') + } + pino.final(pino(dest), () => {})() + await sleep(10) + if (passed === false) fail('flushSync not called') +}) + +test('swallows the non-ready error', async ({ doesNotThrow }) => { + const dest = pino.extreme(getPathToNull()) + doesNotThrow(() => { + pino.final(pino(dest), () => {})() + }) +}) + +test('listener function triggers handler function parameter', async ({ pass, fail }) => { + const dest = pino.extreme(getPathToNull()) + var passed = false + pino.final(pino(dest), () => { + passed = true + pass('handler function triggered') + })() + await sleep(10) + if (passed === false) fail('handler function not triggered') +}) + +test('passes any error to the handler', async ({ is }) => { + const dest = pino.extreme(getPathToNull()) + pino.final(pino(dest), (err) => { + is(err.message, 'test') + })(Error('test')) +}) + +test('passes a specialized final logger instance', async ({ is, isNot, error }) => { + const dest = pino.extreme(getPathToNull()) + const logger = pino(dest) + pino.final(logger, (err, finalLogger) => { + error(err) + is(typeof finalLogger.trace, 'function') + is(typeof finalLogger.debug, 'function') + is(typeof finalLogger.info, 'function') + is(typeof finalLogger.warn, 'function') + is(typeof finalLogger.error, 'function') + is(typeof finalLogger.fatal, 'function') + + isNot(finalLogger.trace, logger.trace) + isNot(finalLogger.debug, logger.debug) + isNot(finalLogger.info, logger.info) + isNot(finalLogger.warn, logger.warn) + isNot(finalLogger.error, logger.error) + isNot(finalLogger.fatal, logger.fatal) + + is(finalLogger.child, logger.child) + is(finalLogger.levels, logger.levels) + })() +}) + +test('returns a specialized final logger instance if no handler is passed', async ({ is, isNot }) => { + const dest = pino.extreme(getPathToNull()) + const logger = pino(dest) + const finalLogger = pino.final(logger) + is(typeof finalLogger.trace, 'function') + is(typeof finalLogger.debug, 'function') + is(typeof finalLogger.info, 'function') + is(typeof finalLogger.warn, 'function') + is(typeof finalLogger.error, 'function') + is(typeof finalLogger.fatal, 'function') + + isNot(finalLogger.trace, logger.trace) + isNot(finalLogger.debug, logger.debug) + isNot(finalLogger.info, logger.info) + isNot(finalLogger.warn, logger.warn) + isNot(finalLogger.error, logger.error) + isNot(finalLogger.fatal, logger.fatal) + + is(finalLogger.child, logger.child) + is(finalLogger.levels, logger.levels) +}) + +test('final logger instances synchronously flush after a log method call', async ({ pass, fail, error }) => { + const dest = pino.extreme(getPathToNull()) + const logger = pino(dest) + var passed = false + var count = 0 + dest.flushSync = () => { + count++ + if (count === 2) { + passed = true + pass('flushSync called') + } + } + pino.final(logger, (err, finalLogger) => { + error(err) + finalLogger.info('hello') + })() + await sleep(10) + if (passed === false) fail('flushSync not called') +}) + +test('also instruments custom log methods', async ({ pass, fail, error }) => { + const dest = pino.extreme(getPathToNull()) + const logger = pino({ + customLevels: { + foo: 35 + } + }, dest) + var passed = false + var count = 0 + dest.flushSync = () => { + count++ + if (count === 2) { + passed = true + pass('flushSync called') + } + } + pino.final(logger, (err, finalLogger) => { + error(err) + finalLogger.foo('hello') + })() + await sleep(10) + if (passed === false) fail('flushSync not called') +}) diff --git a/node_modules/pino/test/fixtures/broken-pipe/basic.js b/node_modules/pino/test/fixtures/broken-pipe/basic.js new file mode 100644 index 0000000..def7cd0 --- /dev/null +++ b/node_modules/pino/test/fixtures/broken-pipe/basic.js @@ -0,0 +1,9 @@ +'use strict' + +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } + +const pino = require('../../..')() + +pino.info('hello world') diff --git a/node_modules/pino/test/fixtures/broken-pipe/destination.js b/node_modules/pino/test/fixtures/broken-pipe/destination.js new file mode 100644 index 0000000..15a8102 --- /dev/null +++ b/node_modules/pino/test/fixtures/broken-pipe/destination.js @@ -0,0 +1,10 @@ +'use strict' + +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } + +const pino = require('../../..') +const logger = pino(pino.destination()) + +logger.info('hello world') diff --git a/node_modules/pino/test/fixtures/broken-pipe/extreme.js b/node_modules/pino/test/fixtures/broken-pipe/extreme.js new file mode 100644 index 0000000..27a624b --- /dev/null +++ b/node_modules/pino/test/fixtures/broken-pipe/extreme.js @@ -0,0 +1,12 @@ +'use strict' + +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } + +const pino = require('../../..') +const logger = pino(pino.extreme()) + +for (let i = 0; i < 1000; i++) { + logger.info('hello world') +} diff --git a/node_modules/pino/test/fixtures/destination-exit.js b/node_modules/pino/test/fixtures/destination-exit.js new file mode 100644 index 0000000..c14ab07 --- /dev/null +++ b/node_modules/pino/test/fixtures/destination-exit.js @@ -0,0 +1,8 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../')) +var logger = pino({}, pino.destination(1)) +logger.info('hello') +logger.info('world') +process.exit(0) diff --git a/node_modules/pino/test/fixtures/extreme-child.js b/node_modules/pino/test/fixtures/extreme-child.js new file mode 100644 index 0000000..81528ab --- /dev/null +++ b/node_modules/pino/test/fixtures/extreme-child.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../')) +var extreme = pino(pino.extreme()).child({ hello: 'world' }) +pino.final(extreme, (_, logger) => logger.info('h'))() diff --git a/node_modules/pino/test/fixtures/extreme-exit.js b/node_modules/pino/test/fixtures/extreme-exit.js new file mode 100644 index 0000000..a90cc67 --- /dev/null +++ b/node_modules/pino/test/fixtures/extreme-exit.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../')) +var dest = pino.extreme(1) +var logger = pino({}, dest) +logger.info('hello') +logger.info('world') +process.exit(0) diff --git a/node_modules/pino/test/fixtures/extreme-flush-exit.js b/node_modules/pino/test/fixtures/extreme-flush-exit.js new file mode 100644 index 0000000..3abf7e0 --- /dev/null +++ b/node_modules/pino/test/fixtures/extreme-flush-exit.js @@ -0,0 +1,10 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../')) +var dest = pino.extreme(1) +var logger = pino({}, dest) +logger.info('hello') +logger.info('world') +dest.flushSync() +process.exit(0) diff --git a/node_modules/pino/test/fixtures/extreme.js b/node_modules/pino/test/fixtures/extreme.js new file mode 100644 index 0000000..20b2a6c --- /dev/null +++ b/node_modules/pino/test/fixtures/extreme.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../')) +var extreme = pino(pino.extreme()) +pino.final(extreme, (_, logger) => logger.info('h'))() diff --git a/node_modules/pino/test/fixtures/pretty/basic.js b/node_modules/pino/test/fixtures/pretty/basic.js new file mode 100644 index 0000000..5ad1798 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/basic.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/child.js b/node_modules/pino/test/fixtures/pretty/child.js new file mode 100644 index 0000000..ed4d90c --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/child.js @@ -0,0 +1,8 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }).child({ a: 1 }) +log.info('h') +log.child({ b: 2 }).info('h3') +setTimeout(() => log.info('h2'), 200) diff --git a/node_modules/pino/test/fixtures/pretty/custom-time-label.js b/node_modules/pino/test/fixtures/pretty/custom-time-label.js new file mode 100644 index 0000000..4384034 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/custom-time-label.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + timestamp: () => ',"custom-time-label":"test"', + prettyPrint: true +}) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/custom-time.js b/node_modules/pino/test/fixtures/pretty/custom-time.js new file mode 100644 index 0000000..092632b --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/custom-time.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + timestamp: () => ',"time":"test"', + prettyPrint: true +}) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/dateformat.js b/node_modules/pino/test/fixtures/pretty/dateformat.js new file mode 100644 index 0000000..6697fc3 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/dateformat.js @@ -0,0 +1,10 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + prettyPrint: { + translateTime: true + } +}) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/error-props.js b/node_modules/pino/test/fixtures/pretty/error-props.js new file mode 100644 index 0000000..32812cf --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/error-props.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + prettyPrint: { errorProps: 'code,errno' } +}) +var err = Object.assign(new Error('kaboom'), { code: 'ENOENT', errno: 1 }) +log.error(err) diff --git a/node_modules/pino/test/fixtures/pretty/error.js b/node_modules/pino/test/fixtures/pretty/error.js new file mode 100644 index 0000000..309976d --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/error.js @@ -0,0 +1,7 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }) +log.error(new Error('kaboom')) +log.error(new Error('kaboom'), 'with', 'a', 'message') diff --git a/node_modules/pino/test/fixtures/pretty/final-no-log-before.js b/node_modules/pino/test/fixtures/pretty/final-no-log-before.js new file mode 100644 index 0000000..7735042 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/final-no-log-before.js @@ -0,0 +1,8 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }) +process.once('beforeExit', pino.final(log, (_, logger) => { + logger.info('beforeExit') +})) diff --git a/node_modules/pino/test/fixtures/pretty/final-return.js b/node_modules/pino/test/fixtures/pretty/final-return.js new file mode 100644 index 0000000..d2146ea --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/final-return.js @@ -0,0 +1,7 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }) +log.info('h') +pino.final(log).info('after') diff --git a/node_modules/pino/test/fixtures/pretty/final.js b/node_modules/pino/test/fixtures/pretty/final.js new file mode 100644 index 0000000..1bf07c1 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/final.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }) +log.info('h') +process.once('beforeExit', pino.final(log, (_, logger) => { + logger.info('beforeExit') +})) diff --git a/node_modules/pino/test/fixtures/pretty/level-first.js b/node_modules/pino/test/fixtures/pretty/level-first.js new file mode 100644 index 0000000..e1c9e44 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/level-first.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: { levelFirst: true } }) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/no-time.js b/node_modules/pino/test/fixtures/pretty/no-time.js new file mode 100644 index 0000000..7e0bfbe --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/no-time.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + timestamp: false, + prettyPrint: true +}) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/obj-msg-prop.js b/node_modules/pino/test/fixtures/pretty/obj-msg-prop.js new file mode 100644 index 0000000..0869dae --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/obj-msg-prop.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: true }) +log.info({ msg: 'hello' }) diff --git a/node_modules/pino/test/fixtures/pretty/pretty-factory.js b/node_modules/pino/test/fixtures/pretty/pretty-factory.js new file mode 100644 index 0000000..c0428ae --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/pretty-factory.js @@ -0,0 +1,6 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ prettyPrint: { levelFirst: true }, prettifier: require('pino-pretty') }) +log.info('h') diff --git a/node_modules/pino/test/fixtures/pretty/redact.js b/node_modules/pino/test/fixtures/pretty/redact.js new file mode 100644 index 0000000..05c0c8a --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/redact.js @@ -0,0 +1,9 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + prettyPrint: true, + redact: ['foo.an'] +}) +log.info({ foo: { an: 'object' } }, 'h') diff --git a/node_modules/pino/test/fixtures/pretty/serializers.js b/node_modules/pino/test/fixtures/pretty/serializers.js new file mode 100644 index 0000000..fcdb211 --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/serializers.js @@ -0,0 +1,17 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + prettyPrint: true, + serializers: { + foo (obj) { + if (obj.an !== 'object') { + throw new Error('kaboom') + } + + return 'bar' + } + } +}) +log.info({ foo: { an: 'object' } }, 'h') diff --git a/node_modules/pino/test/fixtures/pretty/skipped-output.js b/node_modules/pino/test/fixtures/pretty/skipped-output.js new file mode 100644 index 0000000..048905a --- /dev/null +++ b/node_modules/pino/test/fixtures/pretty/skipped-output.js @@ -0,0 +1,13 @@ +global.process = { __proto__: process, pid: 123456 } +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('./../../../')) +var log = pino({ + prettyPrint: true, + prettifier: function () { + return function () { + return undefined + } + } +}) +log.info('h') diff --git a/node_modules/pino/test/fixtures/stdout-hack-protection.js b/node_modules/pino/test/fixtures/stdout-hack-protection.js new file mode 100644 index 0000000..bd52f8d --- /dev/null +++ b/node_modules/pino/test/fixtures/stdout-hack-protection.js @@ -0,0 +1,11 @@ +global.process = { __proto__: process, pid: 123456 } + +const write = process.stdout.write.bind(process.stdout) +process.stdout.write = function (chunk) { + write('hack ' + chunk) +} + +Date.now = function () { return 1459875739796 } +require('os').hostname = function () { return 'abcdefghijklmnopqr' } +var pino = require(require.resolve('../../'))() +pino.info('me') diff --git a/node_modules/pino/test/helper.js b/node_modules/pino/test/helper.js new file mode 100644 index 0000000..1074099 --- /dev/null +++ b/node_modules/pino/test/helper.js @@ -0,0 +1,55 @@ +'use strict' + +const os = require('os') +const writer = require('flush-write-stream') +const split = require('split2') +const pid = process.pid +const hostname = os.hostname() +const v = 1 + +const isWin = process.platform === 'win32' + +function getPathToNull () { + return isWin ? '\\\\.\\NUL' : '/dev/null' +} + +function once (emitter, name) { + return new Promise((resolve, reject) => { + if (name !== 'error') emitter.once('error', reject) + emitter.once(name, (...args) => { + emitter.removeListener('error', reject) + resolve(...args) + }) + }) +} + +function sink (func) { + const result = split((data) => { + try { + return JSON.parse(data) + } catch (err) { + console.log(err) + console.log(data) + } + }) + if (func) result.pipe(writer.obj(func)) + return result +} + +function check (is, chunk, level, msg) { + is(new Date(chunk.time) <= new Date(), true, 'time is greater than Date.now()') + delete chunk.time + is(chunk.pid, pid) + is(chunk.hostname, hostname) + is(chunk.level, level) + is(chunk.msg, msg) + is(chunk.v, v) +} + +function sleep (ms) { + return new Promise((resolve) => { + setTimeout(resolve, ms) + }) +} + +module.exports = { getPathToNull, sink, check, once, sleep } diff --git a/node_modules/pino/test/http.test.js b/node_modules/pino/test/http.test.js new file mode 100644 index 0000000..1c2023e --- /dev/null +++ b/node_modules/pino/test/http.test.js @@ -0,0 +1,247 @@ +'use strict' + +const http = require('http') +const os = require('os') +const semver = require('semver') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() + +test('http request support', async ({ ok, same, error, teardown }) => { + var originalReq + const instance = pino(sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'my request', + v: 1, + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers, + remoteAddress: originalReq.connection.remoteAddress, + remotePort: originalReq.connection.remotePort + } + }) + })) + + const server = http.createServer((req, res) => { + originalReq = req + instance.info(req, 'my request') + res.end('hello') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http request support via serializer', async ({ ok, same, error, teardown }) => { + var originalReq + const instance = pino({ + serializers: { + req: pino.stdSerializers.req + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'my request', + v: 1, + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers, + remoteAddress: originalReq.connection.remoteAddress, + remotePort: originalReq.connection.remotePort + } + }) + })) + + const server = http.createServer(function (req, res) { + originalReq = req + instance.info({ req: req }, 'my request') + res.end('hello') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http request support via serializer without request connection', async ({ ok, same, error, teardown }) => { + var originalReq + const instance = pino({ + serializers: { + req: pino.stdSerializers.req + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + const expected = { + pid: pid, + hostname: hostname, + level: 30, + msg: 'my request', + v: 1, + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers + } + } + if (semver.gte(process.version, '13.0.0')) { + expected.req.remoteAddress = originalReq.connection.remoteAddress + expected.req.remotePort = originalReq.connection.remotePort + } + same(chunk, expected) + })) + + const server = http.createServer(function (req, res) { + originalReq = req + delete req.connection + instance.info({ req: req }, 'my request') + res.end('hello') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http response support', async ({ ok, same, error, teardown }) => { + var originalRes + const instance = pino(sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'my response', + v: 1, + res: { + statusCode: originalRes.statusCode, + headers: originalRes._headers + } + }) + })) + + const server = http.createServer(function (req, res) { + originalRes = res + res.end('hello') + instance.info(res, 'my response') + }) + server.unref() + server.listen() + const err = await once(server, 'listening') + + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http response support via a serializer', async ({ ok, same, error, teardown }) => { + const instance = pino({ + serializers: { + res: pino.stdSerializers.res + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'my response', + v: 1, + res: { + statusCode: 200, + headers: { + 'x-single': 'y', + 'x-multi': [1, 2] + } + } + }) + })) + + const server = http.createServer(function (req, res) { + res.setHeader('x-single', 'y') + res.setHeader('x-multi', [1, 2]) + res.end('hello') + instance.info({ res: res }, 'my response') + }) + + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) + +test('http request support via serializer in a child', async ({ ok, same, error, teardown }) => { + var originalReq + const instance = pino({ + serializers: { + req: pino.stdSerializers.req + } + }, sink((chunk, enc) => { + ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()') + delete chunk.time + same(chunk, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'my request', + v: 1, + req: { + method: originalReq.method, + url: originalReq.url, + headers: originalReq.headers, + remoteAddress: originalReq.connection.remoteAddress, + remotePort: originalReq.connection.remotePort + } + }) + })) + + const server = http.createServer(function (req, res) { + originalReq = req + const child = instance.child({ req: req }) + child.info('my request') + res.end('hello') + }) + + server.unref() + server.listen() + const err = await once(server, 'listening') + error(err) + + const res = await once(http.get('http://localhost:' + server.address().port), 'response') + res.resume() + server.close() +}) diff --git a/node_modules/pino/test/is-level-enabled.test.js b/node_modules/pino/test/is-level-enabled.test.js new file mode 100644 index 0000000..d8cd2da --- /dev/null +++ b/node_modules/pino/test/is-level-enabled.test.js @@ -0,0 +1,43 @@ +'use strict' + +const { test } = require('tap') +const pino = require('../') + +test('can check if current level enabled', async ({ is }) => { + const log = pino({ level: 'debug' }) + is(true, log.isLevelEnabled('debug')) +}) + +test('can check if level enabled after level set', async ({ is }) => { + const log = pino() + is(false, log.isLevelEnabled('debug')) + log.level = 'debug' + is(true, log.isLevelEnabled('debug')) +}) + +test('can check if higher level enabled', async ({ is }) => { + const log = pino({ level: 'debug' }) + is(true, log.isLevelEnabled('error')) +}) + +test('can check if lower level is disabled', async ({ is }) => { + const log = pino({ level: 'error' }) + is(false, log.isLevelEnabled('trace')) +}) + +test('can check if child has current level enabled', async ({ is }) => { + const log = pino().child({ level: 'debug' }) + is(true, log.isLevelEnabled('debug')) + is(true, log.isLevelEnabled('error')) + is(false, log.isLevelEnabled('trace')) +}) + +test('can check if custom level is enabled', async ({ is }) => { + const log = pino({ + customLevels: { foo: 35 }, + level: 'debug' + }) + is(true, log.isLevelEnabled('foo')) + is(true, log.isLevelEnabled('error')) + is(false, log.isLevelEnabled('trace')) +}) diff --git a/node_modules/pino/test/levels.test.js b/node_modules/pino/test/levels.test.js new file mode 100644 index 0000000..db5f321 --- /dev/null +++ b/node_modules/pino/test/levels.test.js @@ -0,0 +1,441 @@ +'use strict' + +const { test } = require('tap') +const { sink, once, check } = require('./helper') +const pino = require('../') + +test('set the level by string', async ({ is }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const stream = sink() + const instance = pino(stream) + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + const result = await once(stream, 'data') + const current = expected.shift() + check(is, result, current.level, current.msg) +}) + +test('the wrong level throws', async ({ throws }) => { + const instance = pino() + throws(() => { + instance.level = 'kaboom' + }) +}) + +test('set the level by number', async ({ is }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const stream = sink() + const instance = pino(stream) + + instance.level = 50 + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + const result = await once(stream, 'data') + const current = expected.shift() + check(is, result, current.level, current.msg) +}) + +test('exposes level string mappings', async ({ is }) => { + is(pino.levels.values.error, 50) +}) + +test('exposes level number mappings', async ({ is }) => { + is(pino.levels.labels[50], 'error') +}) + +test('returns level integer', async ({ is }) => { + const instance = pino({ level: 'error' }) + is(instance.levelVal, 50) +}) + +test('child returns level integer', async ({ is }) => { + const parent = pino({ level: 'error' }) + const child = parent.child({ foo: 'bar' }) + is(child.levelVal, 50) +}) + +test('set the level via exported pino function', async ({ is }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const stream = sink() + const instance = pino({ level: 'error' }, stream) + + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') + const result = await once(stream, 'data') + const current = expected.shift() + check(is, result, current.level, current.msg) +}) + +test('level-change event', async ({ is }) => { + const instance = pino() + function handle (lvl, val, prevLvl, prevVal) { + is(lvl, 'trace') + is(val, 10) + is(prevLvl, 'info') + is(prevVal, 30) + } + instance.on('level-change', handle) + instance.level = 'trace' + instance.removeListener('level-change', handle) + instance.level = 'info' + + var count = 0 + + const l1 = () => count++ + const l2 = () => count++ + const l3 = () => count++ + instance.on('level-change', l1) + instance.on('level-change', l2) + instance.on('level-change', l3) + + instance.level = 'trace' + instance.removeListener('level-change', l3) + instance.level = 'fatal' + instance.removeListener('level-change', l1) + instance.level = 'debug' + instance.removeListener('level-change', l2) + instance.level = 'info' + + is(count, 6) +}) + +test('enable', async ({ fail }) => { + const instance = pino({ + level: 'trace', + enabled: false + }, sink((result, enc) => { + fail('no data should be logged') + })) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) +}) + +test('silent level', async ({ fail }) => { + const instance = pino({ + level: 'silent' + }, sink((result, enc) => { + fail('no data should be logged') + })) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) +}) + +test('set silent via Infinity', async ({ fail }) => { + const instance = pino({ + level: Infinity + }, sink((result, enc) => { + fail('no data should be logged') + })) + + Object.keys(pino.levels.values).forEach((level) => { + instance[level]('hello world') + }) +}) + +test('exposed levels', async ({ same }) => { + same(Object.keys(pino.levels.values), [ + 'trace', + 'debug', + 'info', + 'warn', + 'error', + 'fatal' + ]) +}) + +test('exposed labels', async ({ same }) => { + same(Object.keys(pino.levels.labels), [ + '10', + '20', + '30', + '40', + '50', + '60' + ]) +}) + +test('setting level in child', async ({ is }) => { + const expected = [{ + level: 50, + msg: 'this is an error' + }, { + level: 60, + msg: 'this is fatal' + }] + const instance = pino(sink((result, enc, cb) => { + const current = expected.shift() + check(is, result, current.level, current.msg) + cb() + })).child({ level: 30 }) + + instance.level = 'error' + instance.info('hello world') + instance.error('this is an error') + instance.fatal('this is fatal') +}) + +test('setting level by assigning a number to level', async ({ is }) => { + const instance = pino() + is(instance.levelVal, 30) + is(instance.level, 'info') + instance.level = 50 + is(instance.levelVal, 50) + is(instance.level, 'error') +}) + +test('setting level by number to unknown value results in a throw', async ({ throws }) => { + const instance = pino() + throws(() => { instance.level = 973 }) +}) + +test('setting level by assigning a known label to level', async ({ is }) => { + const instance = pino() + is(instance.levelVal, 30) + is(instance.level, 'info') + instance.level = 'error' + is(instance.levelVal, 50) + is(instance.level, 'error') +}) + +test('levelVal is read only', async ({ throws }) => { + const instance = pino() + throws(() => { instance.levelVal = 20 }) +}) + +test('produces labels when told to', async ({ is }) => { + const expected = [{ + level: 'info', + msg: 'hello world' + }] + const instance = pino({ useLevelLabels: true }, sink((result, enc, cb) => { + const current = expected.shift() + check(is, result, current.level, current.msg) + cb() + })) + + instance.info('hello world') +}) + +test('resets levels from labels to numbers', async ({ is }) => { + const expected = [{ + level: 30, + msg: 'hello world' + }] + pino({ useLevelLabels: true }) + const instance = pino({ useLevelLabels: false }, sink((result, enc, cb) => { + const current = expected.shift() + check(is, result, current.level, current.msg) + cb() + })) + + instance.info('hello world') +}) + +test('aliases changeLevelName to levelKey', async ({ is }) => { + const instance = pino({ changeLevelName: 'priority' }, sink((result, enc, cb) => { + is(result.priority, 30) + cb() + })) + + instance.info('hello world') +}) + +test('changes label naming when told to', async ({ is }) => { + const expected = [{ + priority: 30, + msg: 'hello world' + }] + const instance = pino({ levelKey: 'priority' }, sink((result, enc, cb) => { + const current = expected.shift() + is(result.priority, current.priority) + is(result.msg, current.msg) + cb() + })) + + instance.info('hello world') +}) + +test('children produce labels when told to', async ({ is }) => { + const expected = [ + { + level: 'info', + msg: 'child 1' + }, + { + level: 'info', + msg: 'child 2' + } + ] + const instance = pino({ useLevelLabels: true }, sink((result, enc, cb) => { + const current = expected.shift() + check(is, result, current.level, current.msg) + cb() + })) + + const child1 = instance.child({ name: 'child1' }) + const child2 = child1.child({ name: 'child2' }) + + child1.info('child 1') + child2.info('child 2') +}) + +test('produces labels for custom levels', async ({ is }) => { + const expected = [ + { + level: 'info', + msg: 'hello world' + }, + { + level: 'foo', + msg: 'foobar' + } + ] + const opts = { + useLevelLabels: true, + customLevels: { + foo: 35 + } + } + const instance = pino(opts, sink((result, enc, cb) => { + const current = expected.shift() + check(is, result, current.level, current.msg) + cb() + })) + + instance.info('hello world') + instance.foo('foobar') +}) + +test('setting levelKey does not affect labels when told to', async ({ is }) => { + const instance = pino( + { + useLevelLabels: true, + levelKey: 'priority' + }, + sink((result, enc, cb) => { + is(result.priority, 'info') + cb() + }) + ) + + instance.info('hello world') +}) + +test('throws when creating a default label that does not exist in logger levels', async ({ is, throws }) => { + const defaultLevel = 'foo' + throws(() => { + pino({ + customLevels: { + bar: 5 + }, + level: defaultLevel + }) + }) + try { + pino({ + level: defaultLevel + }) + } catch ({ message }) { + is(message, `default level:${defaultLevel} must be included in custom levels`) + } +}) + +test('throws when creating a default value that does not exist in logger levels', async ({ is, throws }) => { + const defaultLevel = 15 + throws(() => { + pino({ + customLevels: { + bar: 5 + }, + level: defaultLevel + }) + }) + try { + pino({ + level: defaultLevel + }) + } catch ({ message }) { + is(message, `default level:${defaultLevel} must be included in custom levels`) + } +}) + +test('throws when creating a default value that does not exist in logger levels', async ({ is, throws }) => { + throws(() => { + pino({ + customLevels: { + foo: 5 + }, + useOnlyCustomLevels: true + }) + }) + try { + pino({ + customLevels: { + foo: 5 + }, + useOnlyCustomLevels: true + }) + } catch ({ message }) { + is(message, 'default level:info must be included in custom levels') + } +}) + +test('passes when creating a default value that exists in logger levels', async ({ is, throws }) => { + pino({ + level: 30 + }) +}) + +test('fatal method sync-flushes the destination if sync flushing is available', async ({ pass, doesNotThrow, plan }) => { + plan(2) + const stream = sink() + stream.flushSync = () => { + pass('destination flushed') + } + const instance = pino(stream) + instance.fatal('this is fatal') + await once(stream, 'data') + doesNotThrow(() => { + stream.flushSync = undefined + instance.fatal('this is fatal') + }) +}) + +test('fatal method should call async when sync-flushing fails', ({ equal, fail, doesNotThrow, plan }) => { + plan(2) + const messages = [ + 'this is fatal 1' + ] + const stream = sink((result) => equal(result.msg, messages.shift())) + stream.flushSync = () => { throw new Error('Error') } + stream.flush = () => fail('flush should be called') + + const instance = pino(stream) + doesNotThrow(() => instance.fatal(messages[0])) +}) diff --git a/node_modules/pino/test/metadata.test.js b/node_modules/pino/test/metadata.test.js new file mode 100644 index 0000000..d902d3c --- /dev/null +++ b/node_modules/pino/test/metadata.test.js @@ -0,0 +1,110 @@ +'use strict' + +const os = require('os') +const { test } = require('tap') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() + +test('metadata works', async ({ ok, same, is }) => { + const now = Date.now() + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + is(instance, this.lastLogger) + is(30, this.lastLevel) + is('a msg', this.lastMsg) + ok(Number(this.lastTime) >= now) + same(this.lastObj, { hello: 'world', msg: 'a msg' }) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + hello: 'world', + msg: 'a msg', + v: 1 + }) + } + }) + + instance.info({ hello: 'world' }, 'a msg') +}) + +test('child loggers works', async ({ ok, same, is }) => { + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + is(child, this.lastLogger) + is(30, this.lastLevel) + is('a msg', this.lastMsg) + same(this.lastObj, { from: 'child', msg: 'a msg' }) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + hello: 'world', + from: 'child', + msg: 'a msg', + v: 1 + }) + } + }) + + const child = instance.child({ hello: 'world' }) + child.info({ from: 'child' }, 'a msg') +}) + +test('without object', async ({ ok, same, is }) => { + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + is(instance, this.lastLogger) + is(30, this.lastLevel) + is('a msg', this.lastMsg) + same({ msg: 'a msg' }, this.lastObj) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + msg: 'a msg', + v: 1 + }) + } + }) + + instance.info('a msg') +}) + +test('without msg', async ({ ok, same, is }) => { + const instance = pino({}, { + [Symbol.for('pino.metadata')]: true, + write (chunk) { + is(instance, this.lastLogger) + is(30, this.lastLevel) + is(undefined, this.lastMsg) + same({ hello: 'world' }, this.lastObj) + const result = JSON.parse(chunk) + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid: pid, + hostname: hostname, + level: 30, + hello: 'world', + v: 1 + }) + } + }) + + instance.info({ hello: 'world' }) +}) diff --git a/node_modules/pino/test/mixin.test.js b/node_modules/pino/test/mixin.test.js new file mode 100644 index 0000000..057d766 --- /dev/null +++ b/node_modules/pino/test/mixin.test.js @@ -0,0 +1,106 @@ +'use strict' + +const os = require('os') +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const { pid } = process +const hostname = os.hostname() +const level = 50 +const name = 'error' + +test('mixin object is included', async ({ ok, same }) => { + let n = 0 + const stream = sink() + const instance = pino({ + mixin () { + return { hello: ++n } + } + }, stream) + instance.level = name + instance[name]('test') + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg: 'test', + hello: 1, + v: 1 + }) +}) + +test('mixin object is new every time', async ({ plan, ok, same }) => { + plan(6) + + let n = 0 + const stream = sink() + const instance = pino({ + mixin () { + return { hello: n } + } + }, stream) + instance.level = name + + while (++n < 4) { + const msg = `test #${n}` + stream.pause() + instance[name](msg) + stream.resume() + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + msg, + hello: n, + v: 1 + }) + } +}) + +test('mixin object is not called if below log level', async ({ ok }) => { + const stream = sink() + const instance = pino({ + mixin () { + ok(false, 'should not call mixin function') + } + }, stream) + instance.level = 'error' + instance.info('test') +}) + +test('mixin object + logged object', async ({ ok, same }) => { + const stream = sink() + const instance = pino({ + mixin () { + return { foo: 1, bar: 2 } + } + }, stream) + instance.level = name + instance[name]({ bar: 3, baz: 4 }) + const result = await once(stream, 'data') + ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') + delete result.time + same(result, { + pid, + hostname, + level, + foo: 1, + bar: 3, + baz: 4, + v: 1 + }) +}) + +test('mixin not a function', async ({ throws }) => { + const stream = sink() + throws(function () { + pino({ mixin: 'not a function' }, stream) + }) +}) diff --git a/node_modules/pino/test/pretty.test.js b/node_modules/pino/test/pretty.test.js new file mode 100644 index 0000000..4017d0c --- /dev/null +++ b/node_modules/pino/test/pretty.test.js @@ -0,0 +1,312 @@ +'use strict' + +const { Writable } = require('stream') +const { test } = require('tap') +const { join } = require('path') +const execa = require('execa') +const writer = require('flush-write-stream') +const { once } = require('./helper') +const pino = require('../') +const tap = require('tap') + +const isWin = process.platform === 'win32' +if (isWin) { + tap.comment('Skipping pretty printing tests on Windows as colour codes are different and tests fail') + process.exit(0) +} + +test('can be enabled via exported pino function', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'basic.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): h/), null) +}) + +test('can be enabled via exported pino function with pretty configuration', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'level-first.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/^INFO.*h/), null) +}) + +test('can be enabled via exported pino function with prettifier', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'pretty-factory.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + + await once(child, 'close') + isNot(actual.match(/^INFO.*h/), null) +}) + +test('does not throw error when enabled with stream specified', async ({ doesNotThrow }) => { + doesNotThrow(() => pino({ prettyPrint: true }, process.stdout)) +}) + +test('throws when prettyPrint is true but pino-pretty module is not installed', async ({ throws, is }) => { + // pino pretty *is* installed, and probably also cached, so rather than + // messing with the filesystem the simplest way to generate a not found + // error is to simulate it: + const prettyFactory = require('pino-pretty') + require.cache[require.resolve('pino-pretty')].exports = () => { + throw Error('Cannot find module \'pino-pretty\'') + } + throws(() => pino({ prettyPrint: true })) + try { pino({ prettyPrint: true }) } catch ({ message }) { + is(message, 'Missing `pino-pretty` module: `pino-pretty` must be installed separately') + } + + require.cache[require.resolve('pino-pretty')].exports = prettyFactory +}) + +test('can send pretty print to custom stream', async ({ is }) => { + const dest = new Writable({ + objectMode: true, + write (formatted, enc) { + is(/^INFO.*foo\n$/.test(formatted), true) + } + }) + + const log = pino({ + prettifier: require('pino-pretty'), + prettyPrint: { + levelFirst: true, + colorize: false + } + }, dest) + log.info('foo') +}) + +test('ignores `undefined` from prettifier', async ({ is }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'skipped-output.js')]) + + child.stdout.pipe(writer((s, enc) => { + actual += s + })) + + await once(child, 'close') + is(actual, '') +}) + +test('parses and outputs chindings', async ({ is, isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'child.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): h/), null) + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): h2/), null) + isNot(actual.match(/a: 1/), null) + isNot(actual.match(/b: 2/), null) + is(actual.match(/a: 1/g).length, 3) +}) + +test('applies serializers', async ({ is, isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'serializers.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): h/), null) + isNot(actual.match(/foo: "bar"/), null) +}) + +test('applies redaction rules', async ({ is, isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'redact.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): h/), null) + isNot(actual.match(/\[Redacted\]/), null) + is(actual.match(/object/), null) +}) + +test('dateformat', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'dateformat.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): h/), null) +}) + +test('without timestamp', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'no-time.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.slice(2), '[]') +}) + +test('with custom timestamp', async ({ is }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'custom-time.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + is(actual.slice(0, 8), '["test"]') +}) + +test('with custom timestamp label', async ({ is }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'custom-time-label.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + is(actual.slice(0, 8), '["test"]') +}) + +test('errors', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'error.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): kaboom/), null) + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): with a message/), null) + isNot(actual.match(/.*error\.js.*/), null) +}) + +test('errors with props', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'error-props.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): kaboom/), null) + isNot(actual.match(/code: ENOENT/), null) + isNot(actual.match(/errno: 1/), null) + isNot(actual.match(/.*error-props\.js.*/), null) +}) + +test('final works with pretty', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'final.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/WARN\s+\(123456 on abcdefghijklmnopqr\): pino.final with prettyPrint does not support flushing/), null) + isNot(actual.match(/INFO\s+\(123456 on abcdefghijklmnopqr\): beforeExit/), null) +}) + +test('final works when returning a logger', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'final-return.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/WARN\s+\(123456 on abcdefghijklmnopqr\): pino.final with prettyPrint does not support flushing/), null) + isNot(actual.match(/INFO\s+\(123456 on abcdefghijklmnopqr\): after/), null) +}) + +test('final works without prior logging', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'final-no-log-before.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/WARN\s+: pino.final with prettyPrint does not support flushing/), null) + isNot(actual.match(/INFO\s+\(123456 on abcdefghijklmnopqr\): beforeExit/), null) +}) + +test('works as expected with an object with the msg prop', async ({ isNot }) => { + var actual = '' + const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'obj-msg-prop.js')]) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/\(123456 on abcdefghijklmnopqr\): hello/), null) +}) + +test('should not lose stream metadata for streams with `needsMetadataGsym` flag', async ({ isNot }) => { + const dest = new Writable({ + objectMode: true, + write () { + isNot(typeof this.lastLevel === 'undefined', true) + isNot(typeof this.lastMsg === 'undefined', true) + isNot(typeof this.lastObj === 'undefined', true) + isNot(typeof this.lastTime === 'undefined', true) + isNot(typeof this.lastLogger === 'undefined', true) + } + }) + + dest[pino.symbols.needsMetadataGsym] = true + + const log = pino({ + prettyPrint: true + }, dest) + log.info('foo') +}) + +test('should not add stream metadata for streams without `needsMetadataGsym` flag', async ({ is }) => { + const dest = new Writable({ + objectMode: true, + write () { + is(typeof this.lastLevel === 'undefined', true) + is(typeof this.lastMsg === 'undefined', true) + is(typeof this.lastObj === 'undefined', true) + is(typeof this.lastTime === 'undefined', true) + is(typeof this.lastLogger === 'undefined', true) + } + }) + + const log = pino({ + prettyPrint: true + }, dest) + log.info('foo') +}) diff --git a/node_modules/pino/test/redact.test.js b/node_modules/pino/test/redact.test.js new file mode 100644 index 0000000..be27cc1 --- /dev/null +++ b/node_modules/pino/test/redact.test.js @@ -0,0 +1,713 @@ +'use strict' + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +test('redact option – throws if not array', async ({ throws }) => { + throws(() => { + pino({ redact: 'req.headers.cookie' }) + }) +}) + +test('redact option – throws if array does not only contain strings', async ({ throws }) => { + throws(() => { + pino({ redact: ['req.headers.cookie', {}] }) + }) +}) + +test('redact option – throws if array contains an invalid path', async ({ throws }) => { + throws(() => { + pino({ redact: ['req,headers.cookie'] }) + }) +}) + +test('redact.paths option – throws if not array', async ({ throws }) => { + throws(() => { + pino({ redact: { paths: 'req.headers.cookie' } }) + }) +}) + +test('redact.paths option – throws if array does not only contain strings', async ({ throws }) => { + throws(() => { + pino({ redact: { paths: ['req.headers.cookie', {}] } }) + }) +}) + +test('redact.paths option – throws if array contains an invalid path', async ({ throws }) => { + throws(() => { + pino({ redact: { paths: ['req,headers.cookie'] } }) + }) +}) + +test('redact option – top level key', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['key'] }, stream) + instance.info({ + key: { redact: 'me' } + }) + const { key } = await once(stream, 'data') + is(key, '[Redacted]') +}) + +test('redact option – top level key next level key', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['key', 'key.foo'] }, stream) + instance.info({ + key: { redact: 'me' } + }) + const { key } = await once(stream, 'data') + is(key, '[Redacted]') +}) + +test('redact option – next level key then top level key', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['key.foo', 'key'] }, stream) + instance.info({ + key: { redact: 'me' } + }) + const { key } = await once(stream, 'data') + is(key, '[Redacted]') +}) + +test('redact option – object', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') +}) + +test('redact option – child object', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + instance.child({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }).info('message completed') + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') +}) + +test('redact option – interpolated object', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + + instance.info('test', { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { msg } = await once(stream, 'data') + is(JSON.parse(msg.replace(/test /, '')).req.headers.cookie, '[Redacted]') +}) + +test('redact.paths option – object', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') +}) + +test('redact.paths option – child object', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + instance.child({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }).info('message completed') + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') +}) + +test('redact.paths option – interpolated object', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + + instance.info('test', { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { msg } = await once(stream, 'data') + is(JSON.parse(msg.replace(/test /, '')).req.headers.cookie, '[Redacted]') +}) + +test('redact.censor option – sets the redact value', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], censor: 'test' } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, 'test') +}) + +test('redact.remove option – removes both key and value', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], remove: true } }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is('cookie' in req.headers, false) +}) + +test('redact.remove – top level key - object value', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['key'], remove: true } }, stream) + instance.info({ + key: { redact: 'me' } + }) + const o = await once(stream, 'data') + is('key' in o, false) +}) + +test('redact.remove – top level key - number value', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['key'], remove: true } }, stream) + instance.info({ + key: 1 + }) + const o = await once(stream, 'data') + is('key' in o, false) +}) + +test('redact.remove – top level key - boolean value', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['key'], remove: true } }, stream) + instance.info({ + key: false + }) + const o = await once(stream, 'data') + is('key' in o, false) +}) + +test('redact.remove – top level key in child logger', async ({ is }) => { + const stream = sink() + const opts = { redact: { paths: ['key'], remove: true } } + const instance = pino(opts, stream).child({ key: { redact: 'me' } }) + instance.info('test') + const o = await once(stream, 'data') + is('key' in o, false) +}) + +test('redact.paths preserves original object values after the log write', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.cookie'] }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.req.headers.cookie, '[Redacted]') + is(obj.req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') +}) + +test('redact.paths preserves original object values after the log write', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'] } }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.req.headers.cookie, '[Redacted]') + is(obj.req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') +}) + +test('redact.censor preserves original object values after the log write', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], censor: 'test' } }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.req.headers.cookie, 'test') + is(obj.req.headers.cookie, 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;') +}) + +test('redact.remove preserves original object values after the log write', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: { paths: ['req.headers.cookie'], remove: true } }, stream) + const obj = { + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + } + instance.info(obj) + const o = await once(stream, 'data') + is('cookie' in o.req.headers, false) + is('cookie' in obj.req.headers, true) +}) + +test('redact – supports last position wildcard paths', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.headers.*'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') + is(req.headers.host, '[Redacted]') + is(req.headers.connection, '[Redacted]') +}) + +test('redact – supports first position wildcard paths', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['*.headers'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers, '[Redacted]') +}) + +test('redact – supports first position wildcards before other paths', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['*.headers.cookie', 'req.id'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') + is(req.id, '[Redacted]') +}) + +test('redact – supports first position wildcards after other paths', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.id', '*.headers.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') + is(req.id, '[Redacted]') +}) + +test('redact – supports first position wildcards after top level keys', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['key', '*.headers.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') +}) + +test('redact – supports top level wildcard', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['*'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req, '[Redacted]') +}) + +test('redact – supports top level wildcard with a censor function', async ({ is }) => { + const stream = sink() + const instance = pino({ + redact: { + paths: ['*'], + censor: () => '[Redacted]' + } + }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req, '[Redacted]') +}) + +test('redact – supports top level wildcard and leading wildcard', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['*', '*.req'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req, '[Redacted]') +}) + +test('redact – supports intermediate wildcard paths', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['req.*.cookie'] }, stream) + instance.info({ + req: { + id: 7915, + method: 'GET', + url: '/', + headers: { + host: 'localhost:3000', + connection: 'keep-alive', + cookie: 'SESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;' + }, + remoteAddress: '::ffff:127.0.0.1', + remotePort: 58022 + } + }) + const { req } = await once(stream, 'data') + is(req.headers.cookie, '[Redacted]') +}) + +test('redacts numbers at the top level', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['id'] }, stream) + const obj = { + id: 7915 + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.id, '[Redacted]') +}) + +test('redacts booleans at the top level', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['maybe'] }, stream) + const obj = { + maybe: true + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.maybe, '[Redacted]') +}) + +test('redacts strings at the top level', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['s'] }, stream) + const obj = { + s: 's' + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.s, '[Redacted]') +}) + +test('does not redact primitives if not objects', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['a.b'] }, stream) + const obj = { + a: 42 + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.a, 42) +}) + +test('redacts null at the top level', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['n'] }, stream) + const obj = { + n: null + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.n, '[Redacted]') +}) + +test('supports bracket notation', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['a["b.b"]'] }, stream) + const obj = { + a: { 'b.b': 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.a['b.b'], '[Redacted]') +}) + +test('supports bracket notation with further nesting', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['a["b.b"].c'] }, stream) + const obj = { + a: { 'b.b': { c: 'd' } } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.a['b.b'].c, '[Redacted]') +}) + +test('supports bracket notation with empty string as path segment', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['a[""].c'] }, stream) + const obj = { + a: { '': { c: 'd' } } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o.a[''].c, '[Redacted]') +}) + +test('supports leading bracket notation (single quote)', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['[\'a.a\'].b'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o['a.a'].b, '[Redacted]') +}) + +test('supports leading bracket notation (double quote)', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['["a.a"].b'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o['a.a'].b, '[Redacted]') +}) + +test('supports leading bracket notation (backtick quote)', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['[`a.a`].b'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o['a.a'].b, '[Redacted]') +}) + +test('supports leading bracket notation (single-segment path)', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['[`a.a`]'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o['a.a'], '[Redacted]') +}) + +test('supports leading bracket notation (single-segment path, wilcard)', async ({ is }) => { + const stream = sink() + const instance = pino({ redact: ['[*]'] }, stream) + const obj = { + 'a.a': { b: 'c' } + } + instance.info(obj) + const o = await once(stream, 'data') + is(o['a.a'], '[Redacted]') +}) diff --git a/node_modules/pino/test/serializers.test.js b/node_modules/pino/test/serializers.test.js new file mode 100644 index 0000000..70e8a6a --- /dev/null +++ b/node_modules/pino/test/serializers.test.js @@ -0,0 +1,245 @@ +'use strict' +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +const parentSerializers = { + test: () => 'parent' +} + +const childSerializers = { + test: () => 'child' +} + +test('default err namespace error serializer', async ({ is }) => { + const stream = sink() + const parent = pino(stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + is(typeof o.err, 'object') + is(o.err.type, 'ReferenceError') + is(o.err.message, 'test') + is(typeof o.err.stack, 'string') +}) + +test('custom serializer overrides default err namespace error serializer', async ({ is }) => { + const stream = sink() + const parent = pino({ + serializers: { + err: (e) => ({ + t: e.constructor.name, + m: e.message, + s: e.stack + }) + } + }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + is(typeof o.err, 'object') + is(o.err.t, 'ReferenceError') + is(o.err.m, 'test') + is(typeof o.err.s, 'string') +}) + +test('null overrides default err namespace error serializer', async ({ is }) => { + const stream = sink() + const parent = pino({ serializers: { err: null } }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + is(typeof o.err, 'object') + is(typeof o.err.type, 'undefined') + is(typeof o.err.message, 'undefined') + is(typeof o.err.stack, 'undefined') +}) + +test('undefined overrides default err namespace error serializer', async ({ is }) => { + const stream = sink() + const parent = pino({ serializers: { err: undefined } }, stream) + + parent.info({ err: ReferenceError('test') }) + const o = await once(stream, 'data') + is(typeof o.err, 'object') + is(typeof o.err.type, 'undefined') + is(typeof o.err.message, 'undefined') + is(typeof o.err.stack, 'undefined') +}) + +test('serializers override values', async ({ is }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + parent.child({ serializers: childSerializers }) + + parent.fatal({ test: 'test' }) + const o = await once(stream, 'data') + is(o.test, 'parent') +}) + +test('child does not overwrite parent serializers', async ({ is }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + const child = parent.child({ serializers: childSerializers }) + + parent.fatal({ test: 'test' }) + + const o = once(stream, 'data') + is((await o).test, 'parent') + const o2 = once(stream, 'data') + child.fatal({ test: 'test' }) + is((await o2).test, 'child') +}) + +test('Symbol.for(\'pino.serializers\')', async ({ is, isNot }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + const child = parent.child({ a: 'property' }) + + is(parent[Symbol.for('pino.serializers')], parentSerializers) + is(child[Symbol.for('pino.serializers')], parentSerializers) + + const child2 = parent.child({ + serializers: { + a + } + }) + + function a () { + return 'hello' + } + + isNot(child2[Symbol.for('pino.serializers')], parentSerializers) + is(child2[Symbol.for('pino.serializers')].a, a) + is(child2[Symbol.for('pino.serializers')].test, parentSerializers.test) +}) + +test('children inherit parent serializers', async ({ is }) => { + const stream = sink() + const parent = pino({ serializers: parentSerializers }, stream) + + const child = parent.child({ a: 'property' }) + child.fatal({ test: 'test' }) + const o = await once(stream, 'data') + is(o.test, 'parent') +}) + +test('children inherit parent Symbol serializers', async ({ is, isNot }) => { + const stream = sink() + const symbolSerializers = { + [Symbol.for('pino.*')]: parentSerializers.test + } + const parent = pino({ serializers: symbolSerializers }, stream) + + is(parent[Symbol.for('pino.serializers')], symbolSerializers) + + const child = parent.child({ + serializers: { + [Symbol.for('a')]: a, + a + } + }) + + function a () { + return 'hello' + } + + isNot(child[Symbol.for('pino.serializers')], symbolSerializers) + is(child[Symbol.for('pino.serializers')].a, a) + is(child[Symbol.for('pino.serializers')][Symbol.for('a')], a) + is(child[Symbol.for('pino.serializers')][Symbol.for('pino.*')], parentSerializers.test) +}) + +test('children serializers get called', async ({ is }) => { + const stream = sink() + const parent = pino({ + test: 'this' + }, stream) + + const child = parent.child({ a: 'property', serializers: childSerializers }) + + child.fatal({ test: 'test' }) + const o = await once(stream, 'data') + is(o.test, 'child') +}) + +test('children serializers get called when inherited from parent', async ({ is }) => { + const stream = sink() + const parent = pino({ + test: 'this', + serializers: parentSerializers + }, stream) + + const child = parent.child({ serializers: { test: function () { return 'pass' } } }) + + child.fatal({ test: 'fail' }) + const o = await once(stream, 'data') + is(o.test, 'pass') +}) + +test('non-overridden serializers are available in the children', async ({ is }) => { + const stream = sink() + const pSerializers = { + onlyParent: function () { return 'parent' }, + shared: function () { return 'parent' } + } + + const cSerializers = { + shared: function () { return 'child' }, + onlyChild: function () { return 'child' } + } + + const parent = pino({ serializers: pSerializers }, stream) + + const child = parent.child({ serializers: cSerializers }) + + const o = once(stream, 'data') + child.fatal({ shared: 'test' }) + is((await o).shared, 'child') + const o2 = once(stream, 'data') + child.fatal({ onlyParent: 'test' }) + is((await o2).onlyParent, 'parent') + const o3 = once(stream, 'data') + child.fatal({ onlyChild: 'test' }) + is((await o3).onlyChild, 'child') + const o4 = once(stream, 'data') + parent.fatal({ onlyChild: 'test' }) + is((await o4).onlyChild, 'test') +}) + +test('Symbol.for(\'pino.*\') serializer', async ({ notSame, is, isNot }) => { + const stream = sink() + const globalSerializer = { + [Symbol.for('pino.*')]: function (obj) { + if (obj.lionel === 'richie') { + return { hello: 'is', it: 'me', you: 'are', looking: 'for' } + } + return { lionel: 'richie' } + } + } + + const logger = pino({ serializers: globalSerializer }, stream) + + const o = once(stream, 'data') + logger.info({ hello: 'is', it: 'me', you: 'are', looking: 'for' }) + is((await o).lionel, 'richie') + isNot((await o).hello, 'is') + isNot((await o).it, 'me') + isNot((await o).you, 'are') + isNot((await o).looking, 'for') + + const o2 = once(stream, 'data') + logger.info({ lionel: 'richie' }) + is((await o2).lionel, 'richie') + is((await o2).hello, 'is') + is((await o2).it, 'me') + is((await o2).you, 'are') + is((await o2).looking, 'for') + + const o3 = once(stream, 'data') + logger.info('message') + is((await o3).lionel, 'richie') + is('pid' in (await o3), false) + is('hostname' in (await o3), false) + notSame(await o3, ['pid', 'hostname']) +}) diff --git a/node_modules/pino/test/stdout-protection.test.js b/node_modules/pino/test/stdout-protection.test.js new file mode 100644 index 0000000..1a97785 --- /dev/null +++ b/node_modules/pino/test/stdout-protection.test.js @@ -0,0 +1,19 @@ +'use strict' + +const { test } = require('tap') +const { join } = require('path') +const { fork } = require('child_process') +const { once } = require('./helper') +const writer = require('flush-write-stream') + +test('do not use SonicBoom is someone tampered with process.stdout.write', async ({ isNot }) => { + var actual = '' + const child = fork(join(__dirname, 'fixtures', 'stdout-hack-protection.js'), { silent: true }) + + child.stdout.pipe(writer((s, enc, cb) => { + actual += s + cb() + })) + await once(child, 'close') + isNot(actual.match(/^hack/), null) +}) diff --git a/node_modules/pino/test/timestamp.test.js b/node_modules/pino/test/timestamp.test.js new file mode 100644 index 0000000..87bdc09 --- /dev/null +++ b/node_modules/pino/test/timestamp.test.js @@ -0,0 +1,121 @@ +'use strict' + +/* eslint no-prototype-builtins: 0 */ + +const { test } = require('tap') +const { sink, once } = require('./helper') +const pino = require('../') + +test('pino exposes standard time functions', async ({ ok }) => { + ok(pino.stdTimeFunctions) + ok(pino.stdTimeFunctions.epochTime) + ok(pino.stdTimeFunctions.unixTime) + ok(pino.stdTimeFunctions.nullTime) + ok(pino.stdTimeFunctions.isoTime) +}) + +test('pino accepts external time functions', async ({ is }) => { + const opts = { + timestamp: () => ',"time":"none"' + } + const stream = sink() + const instance = pino(opts, stream) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), true) + is(result.time, 'none') +}) + +test('pino accepts external time functions with custom label', async ({ is }) => { + const opts = { + timestamp: () => ',"custom-time-label":"none"' + } + const stream = sink() + const instance = pino(opts, stream) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('custom-time-label'), true) + is(result['custom-time-label'], 'none') +}) + +test('inserts timestamp by default', async ({ ok, is }) => { + const stream = sink() + const instance = pino(stream) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), true) + ok(new Date(result.time) <= new Date(), 'time is greater than timestamp') + is(result.msg, 'foobar') +}) + +test('omits timestamp when timestamp option is false', async ({ is }) => { + const stream = sink() + const instance = pino({ timestamp: false }, stream) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), false) + is(result.msg, 'foobar') +}) + +test('inserts timestamp when timestamp option is true', async ({ ok, is }) => { + const stream = sink() + const instance = pino({ timestamp: true }, stream) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), true) + ok(new Date(result.time) <= new Date(), 'time is greater than timestamp') + is(result.msg, 'foobar') +}) + +test('child inserts timestamp by default', async ({ ok, is }) => { + const stream = sink() + const logger = pino(stream) + const instance = logger.child({ component: 'child' }) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), true) + ok(new Date(result.time) <= new Date(), 'time is greater than timestamp') + is(result.msg, 'foobar') +}) + +test('child omits timestamp with option', async ({ is }) => { + const stream = sink() + const logger = pino({ timestamp: false }, stream) + const instance = logger.child({ component: 'child' }) + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), false) + is(result.msg, 'foobar') +}) + +test('pino.stdTimeFunctions.unixTime returns seconds based timestamps', async ({ is }) => { + const opts = { + timestamp: pino.stdTimeFunctions.unixTime + } + const stream = sink() + const instance = pino(opts, stream) + const now = Date.now + Date.now = () => 1531069919686 + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), true) + is(result.time, 1531069920) + Date.now = now +}) + +test('pino.stdTimeFunctions.isoTime returns ISO 8601 timestamps', async ({ is }) => { + const opts = { + timestamp: pino.stdTimeFunctions.isoTime + } + const stream = sink() + const instance = pino(opts, stream) + const ms = 1531069919686 + const now = Date.now + Date.now = () => ms + const iso = new Date(ms).toISOString() + instance.info('foobar') + const result = await once(stream, 'data') + is(result.hasOwnProperty('time'), true) + is(result.time, iso) + Date.now = now +}) diff --git a/node_modules/quick-format-unescaped/.travis.yml b/node_modules/quick-format-unescaped/.travis.yml new file mode 100644 index 0000000..bc7efad --- /dev/null +++ b/node_modules/quick-format-unescaped/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +sudo: false +node_js: + - 6 + - 8 + - 10 + - 11 +script: + - npm test diff --git a/node_modules/quick-format-unescaped/LICENSE b/node_modules/quick-format-unescaped/LICENSE new file mode 100644 index 0000000..fc6d313 --- /dev/null +++ b/node_modules/quick-format-unescaped/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2019 David Mark Clements + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/quick-format-unescaped/benchmark.js b/node_modules/quick-format-unescaped/benchmark.js new file mode 100644 index 0000000..73e3b4b --- /dev/null +++ b/node_modules/quick-format-unescaped/benchmark.js @@ -0,0 +1,24 @@ +var bench = require('fastbench') +var utilFormat = require('util').format +var quickFormat = require('./') + +var run = bench([ + function util(cb) { + utilFormat('%s %j %d', 'a', {a: {x: 1}}, 1) + setImmediate(cb) + }, + function quick(cb) { + quickFormat('%s %j %d', 'a', [{a: {x: 1}}, 1], null) + setImmediate(cb) + }, + function utilWithTailObj(cb) { + utilFormat('hello %s %j %d', 'world', {obj: true}, 4, {another: 'obj'}) + setImmediate(cb) + }, + function quickWithTailObj(cb) { + quickFormat('hello %s %j %d', 'world', [{obj: true}, 4, {another: 'obj'}], null) + setImmediate(cb) + } +], 100000) + +run(run) diff --git a/node_modules/quick-format-unescaped/index.js b/node_modules/quick-format-unescaped/index.js new file mode 100644 index 0000000..9c081cc --- /dev/null +++ b/node_modules/quick-format-unescaped/index.js @@ -0,0 +1,105 @@ +'use strict' +function tryStringify (o) { + try { return JSON.stringify(o) } catch(e) { return '"[Circular]"' } +} + +module.exports = format + +function format(f, args, opts) { + var ss = (opts && opts.stringify) || tryStringify + var offset = 1 + if (f === null) { + f = args[0] + offset = 0 + } + if (typeof f === 'object' && f !== null) { + var len = args.length + offset + if (len === 1) return f + var objects = new Array(len) + objects[0] = ss(f) + for (var index = 1; index < len; index++) { + objects[index] = ss(args[index]) + } + return objects.join(' ') + } + var argLen = args.length + if (argLen === 0) return f + var x = '' + var str = '' + var a = 1 - offset + var lastPos = 0 + var flen = (f && f.length) || 0 + for (var i = 0; i < flen;) { + if (f.charCodeAt(i) === 37 && i + 1 < flen) { + switch (f.charCodeAt(i + 1)) { + case 100: // 'd' + if (a >= argLen) + break + if (lastPos < i) + str += f.slice(lastPos, i) + if (args[a] == null) break + str += Number(args[a]) + lastPos = i = i + 2 + break + case 79: // 'O' + case 111: // 'o' + case 106: // 'j' + if (a >= argLen) + break + if (lastPos < i) + str += f.slice(lastPos, i) + if (args[a] === undefined) break + var type = typeof args[a] + if (type === 'string') { + str += '\'' + args[a] + '\'' + lastPos = i + 2 + i++ + break + } + if (type === 'function') { + str += args[a].name || '' + lastPos = i + 2 + i++ + break + } + str += ss(args[a]) + lastPos = i + 2 + i++ + break + case 115: // 's' + if (a >= argLen) + break + if (lastPos < i) + str += f.slice(lastPos, i) + str += String(args[a]) + lastPos = i + 2 + i++ + break + case 37: // '%' + if (lastPos < i) + str += f.slice(lastPos, i) + str += '%' + lastPos = i + 2 + i++ + break + } + ++a + } + ++i + } + if (lastPos === 0) + str = f + else if (lastPos < flen) { + str += f.slice(lastPos) + } + while (a < argLen) { + x = args[a++] + if (x === null || (typeof x !== 'object')) { + str += ' ' + String(x) + } else { + str += ' ' + ss(x) + } + } + + return str +} diff --git a/node_modules/quick-format-unescaped/package.json b/node_modules/quick-format-unescaped/package.json new file mode 100644 index 0000000..e2192f2 --- /dev/null +++ b/node_modules/quick-format-unescaped/package.json @@ -0,0 +1,54 @@ +{ + "_from": "quick-format-unescaped@^3.0.3", + "_id": "quick-format-unescaped@3.0.3", + "_inBundle": false, + "_integrity": "sha512-dy1yjycmn9blucmJLXOfZDx1ikZJUi6E8bBZLnhPG5gBrVhHXx2xVyqqgKBubVNEXmx51dBACMHpoMQK/N/AXQ==", + "_location": "/quick-format-unescaped", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "quick-format-unescaped@^3.0.3", + "name": "quick-format-unescaped", + "escapedName": "quick-format-unescaped", + "rawSpec": "^3.0.3", + "saveSpec": null, + "fetchSpec": "^3.0.3" + }, + "_requiredBy": [ + "/pino" + ], + "_resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-3.0.3.tgz", + "_shasum": "fb3e468ac64c01d22305806c39f121ddac0d1fb9", + "_spec": "quick-format-unescaped@^3.0.3", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino", + "author": { + "name": "David Mark Clements" + }, + "bugs": { + "url": "https://github.com/davidmarkclements/quick-format/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Solves a problem with util.format", + "devDependencies": { + "fastbench": "^1.0.1" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/davidmarkclements/quick-format#readme", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "quick-format-unescaped", + "repository": { + "type": "git", + "url": "git+https://github.com/davidmarkclements/quick-format.git" + }, + "scripts": { + "test": "node test" + }, + "version": "3.0.3" +} diff --git a/node_modules/quick-format-unescaped/readme.md b/node_modules/quick-format-unescaped/readme.md new file mode 100644 index 0000000..653ddd1 --- /dev/null +++ b/node_modules/quick-format-unescaped/readme.md @@ -0,0 +1,66 @@ +# quick-format-unescaped + +## unescaped ? + +Sometimes you want to embed the results of quick-format into another string, +and then escape the whole string. + +## usage + +```js +var format = require('quick-format-unescaped') +format('hello %s %j %d', ['world', [{obj: true}, 4, {another: 'obj'}]]) +``` + +## format(fmt, parameters, [options]) + +### fmt + +A `printf`-like format string. Example: `'hello %s %j %d'` + +### parameters + +Array of values to be inserted into the `format` string. Example: `['world', {obj:true}]` + +### options.stringify + +Passing an options object as the third parameter with a `stringify` will mean +any objects will be passed to the supplied function instead of an the +internal `tryStringify` function. This can be useful when using augmented +capability serializers such as [`fast-safe-stringify`](http://github.com/davidmarkclements/fast-safe-stringify) or [`fast-redact`](http://github.com/davidmarkclements/fast-redact). + +## caveats + +By default `quick-format-unescaped` uses `JSON.stringify` instead of `util.inspect`, this means functions *will not be serialized*. + +## Benchmarks + +### Node 8.11.2 + +``` +util*100000: 350.325ms +quick*100000: 268.141ms +utilWithTailObj*100000: 586.387ms +quickWithTailObj*100000: 280.200ms +util*100000: 325.735ms +quick*100000: 270.251ms +utilWithTailObj*100000: 492.270ms +quickWithTailObj*100000: 261.797ms +``` + +### Node 10.4.0 + +``` +util*100000: 301.035ms +quick*100000: 217.005ms +utilWithTailObj*100000: 404.778ms +quickWithTailObj*100000: 236.176ms +util*100000: 286.349ms +quick*100000: 214.646ms +utilWithTailObj*100000: 388.574ms +quickWithTailObj*100000: 226.036ms +``` + +## Acknowledgements + +Sponsored by [nearForm](http://www.nearform.com) diff --git a/node_modules/quick-format-unescaped/test/index.js b/node_modules/quick-format-unescaped/test/index.js new file mode 100644 index 0000000..76131ac --- /dev/null +++ b/node_modules/quick-format-unescaped/test/index.js @@ -0,0 +1,78 @@ +'use strict'; +const assert = require('assert'); +const format = require('../'); + +// assert.equal(format([]), ''); +// assert.equal(format(['']), ''); +// assert.equal(format([[]]), '[]'); +// assert.equal(format([{}]), '{}'); +// assert.equal(format([null]), 'null'); +// assert.equal(format([true]), 'true'); +// assert.equal(format([false]), 'false'); +// assert.equal(format(['test']), 'test'); + +// // // CHECKME this is for console.log() compatibility - but is it *right*? +// assert.equal(format(['foo', 'bar', 'baz']), 'foo bar baz'); + +// ES6 Symbol handling +const symbol = Symbol('foo') +assert.equal(format(null, [symbol]), symbol); +assert.equal(format('foo', [symbol]), 'foo Symbol(foo)'); +assert.equal(format('%s', [symbol]), 'Symbol(foo)'); +assert.equal(format('%j', [symbol]), 'undefined'); +assert.throws(function() { + format(['%d', symbol]); +}, TypeError); + +assert.equal(format('%d', [42.0]), '42'); +assert.equal(format('%d', [42]), '42'); +assert.equal(format('%s', [42]), '42'); +assert.equal(format('%j', [42]), '42'); + +assert.equal(format('%d', [undefined]), '%d'); +assert.equal(format('%s', [undefined]), 'undefined'); +assert.equal(format('%j', [undefined]), '%j'); + + +assert.equal(format('%d', [null]), '%d'); +assert.equal(format('%s', [null]), 'null'); +assert.equal(format('%j', [null]), 'null'); + + +assert.equal(format('%d', ['42.0']), '42'); +assert.equal(format('%d', ['42']), '42'); +assert.equal(format('%s', ['42']), '42'); +// assert.equal(format('%j', ['42']), '"42"'); + +// assert.equal(format('%%s%s', ['foo']), '%sfoo'); + +assert.equal(format('%s', []), '%s'); +assert.equal(format('%s', [undefined]), 'undefined'); +assert.equal(format('%s', ['foo']), 'foo'); +assert.equal(format('%s', ['\"quoted\"']), '\"quoted\"'); +assert.equal(format('%j', [{ s: '\"quoted\"' }]), '{\"s\":\"\\"quoted\\"\"}'); +assert.equal(format('%s:%s', []), '%s:%s'); +assert.equal(format('%s:%s', [undefined]), 'undefined:%s'); +assert.equal(format('%s:%s', ['foo']), 'foo:%s'); +assert.equal(format('%s:%s', ['foo', 'bar']), 'foo:bar'); +assert.equal(format('%s:%s', ['foo', 'bar', 'baz']), 'foo:bar baz'); +assert.equal(format('%s%s', []), '%s%s'); +assert.equal(format('%s%s', [undefined]), 'undefined%s'); +assert.equal(format('%s%s', ['foo']), 'foo%s'); +assert.equal(format('%s%s', ['foo', 'bar']), 'foobar'); +assert.equal(format('%s%s', ['foo', 'bar', 'baz']), 'foobar baz'); + +assert.equal(format(null, ['foo', null, 'bar']), 'foo null bar'); +assert.equal(format(null, ['foo', undefined, 'bar']), 'foo undefined bar'); + +assert.equal(format(null, [null, 'foo']), 'null foo'); +assert.equal(format(null, [undefined, 'foo']), 'undefined foo'); + +// // assert.equal(format(['%%%s%%', 'hi']), '%hi%'); +// // assert.equal(format(['%%%s%%%%', 'hi']), '%hi%%'); + +// (function() { +// var o = {}; +// o.o = o; +// assert.equal(format(['%j', o]), '[Circular]'); +// })(); diff --git a/node_modules/quick-lru/index.d.ts b/node_modules/quick-lru/index.d.ts new file mode 100644 index 0000000..c382e51 --- /dev/null +++ b/node_modules/quick-lru/index.d.ts @@ -0,0 +1,90 @@ +declare namespace QuickLRU { + interface Options { + /** + The maximum number of items before evicting the least recently used items. + */ + readonly maxSize: number; + } +} + +declare class QuickLRU + implements Iterable<[KeyType, ValueType]> { + /** + The stored item count. + */ + readonly size: number; + + /** + Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29). + + The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop. + + @example + ``` + import QuickLRU = require('quick-lru'); + + const lru = new QuickLRU({maxSize: 1000}); + + lru.set('🦄', '🌈'); + + lru.has('🦄'); + //=> true + + lru.get('🦄'); + //=> '🌈' + ``` + */ + constructor(options: QuickLRU.Options); + + [Symbol.iterator](): IterableIterator<[KeyType, ValueType]>; + + /** + Set an item. + + @returns The list instance. + */ + set(key: KeyType, value: ValueType): this; + + /** + Get an item. + + @returns The stored item or `undefined`. + */ + get(key: KeyType): ValueType | undefined; + + /** + Check if an item exists. + */ + has(key: KeyType): boolean; + + /** + Get an item without marking it as recently used. + + @returns The stored item or `undefined`. + */ + peek(key: KeyType): ValueType | undefined; + + /** + Delete an item. + + @returns `true` if the item is removed or `false` if the item doesn't exist. + */ + delete(key: KeyType): boolean; + + /** + Delete all items. + */ + clear(): void; + + /** + Iterable for all the keys. + */ + keys(): IterableIterator; + + /** + Iterable for all the values. + */ + values(): IterableIterator; +} + +export = QuickLRU; diff --git a/node_modules/quick-lru/index.js b/node_modules/quick-lru/index.js new file mode 100644 index 0000000..b7b1760 --- /dev/null +++ b/node_modules/quick-lru/index.js @@ -0,0 +1,115 @@ +'use strict'; + +class QuickLRU { + constructor(options = {}) { + if (!(options.maxSize && options.maxSize > 0)) { + throw new TypeError('`maxSize` must be a number greater than 0'); + } + + this.maxSize = options.maxSize; + this.cache = new Map(); + this.oldCache = new Map(); + this._size = 0; + } + + _set(key, value) { + this.cache.set(key, value); + this._size++; + + if (this._size >= this.maxSize) { + this._size = 0; + this.oldCache = this.cache; + this.cache = new Map(); + } + } + + get(key) { + if (this.cache.has(key)) { + return this.cache.get(key); + } + + if (this.oldCache.has(key)) { + const value = this.oldCache.get(key); + this.oldCache.delete(key); + this._set(key, value); + return value; + } + } + + set(key, value) { + if (this.cache.has(key)) { + this.cache.set(key, value); + } else { + this._set(key, value); + } + + return this; + } + + has(key) { + return this.cache.has(key) || this.oldCache.has(key); + } + + peek(key) { + if (this.cache.has(key)) { + return this.cache.get(key); + } + + if (this.oldCache.has(key)) { + return this.oldCache.get(key); + } + } + + delete(key) { + const deleted = this.cache.delete(key); + if (deleted) { + this._size--; + } + + return this.oldCache.delete(key) || deleted; + } + + clear() { + this.cache.clear(); + this.oldCache.clear(); + this._size = 0; + } + + * keys() { + for (const [key] of this) { + yield key; + } + } + + * values() { + for (const [, value] of this) { + yield value; + } + } + + * [Symbol.iterator]() { + for (const item of this.cache) { + yield item; + } + + for (const item of this.oldCache) { + const [key] = item; + if (!this.cache.has(key)) { + yield item; + } + } + } + + get size() { + let oldCacheSize = 0; + for (const key of this.oldCache.keys()) { + if (!this.cache.has(key)) { + oldCacheSize++; + } + } + + return this._size + oldCacheSize; + } +} + +module.exports = QuickLRU; diff --git a/node_modules/quick-lru/license b/node_modules/quick-lru/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/quick-lru/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/quick-lru/package.json b/node_modules/quick-lru/package.json new file mode 100644 index 0000000..8c17cae --- /dev/null +++ b/node_modules/quick-lru/package.json @@ -0,0 +1,74 @@ +{ + "_from": "quick-lru@^4.0.1", + "_id": "quick-lru@4.0.1", + "_inBundle": false, + "_integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "_location": "/quick-lru", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "quick-lru@^4.0.1", + "name": "quick-lru", + "escapedName": "quick-lru", + "rawSpec": "^4.0.1", + "saveSpec": null, + "fetchSpec": "^4.0.1" + }, + "_requiredBy": [ + "/camelcase-keys" + ], + "_resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "_shasum": "5b8878f113a58217848c6482026c73e1ba57727f", + "_spec": "quick-lru@^4.0.1", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/camelcase-keys", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/quick-lru/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Simple \"Least Recently Used\" (LRU) cache", + "devDependencies": { + "ava": "^1.4.1", + "coveralls": "^3.0.3", + "nyc": "^14.1.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/quick-lru#readme", + "keywords": [ + "lru", + "quick", + "cache", + "caching", + "least", + "recently", + "used", + "fast", + "map", + "hash", + "buffer" + ], + "license": "MIT", + "name": "quick-lru", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/quick-lru.git" + }, + "scripts": { + "test": "xo && nyc ava && tsd" + }, + "version": "4.0.1" +} diff --git a/node_modules/quick-lru/readme.md b/node_modules/quick-lru/readme.md new file mode 100644 index 0000000..2b87001 --- /dev/null +++ b/node_modules/quick-lru/readme.md @@ -0,0 +1,93 @@ +# quick-lru [![Build Status](https://travis-ci.org/sindresorhus/quick-lru.svg?branch=master)](https://travis-ci.org/sindresorhus/quick-lru) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/quick-lru/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/quick-lru?branch=master) + +> Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29) + +Useful when you need to cache something and limit memory usage. + +Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`. + + +## Install + +``` +$ npm install quick-lru +``` + + +## Usage + +```js +const QuickLRU = require('quick-lru'); + +const lru = new QuickLRU({maxSize: 1000}); + +lru.set('🦄', '🌈'); + +lru.has('🦄'); +//=> true + +lru.get('🦄'); +//=> '🌈' +``` + + +## API + +### new QuickLRU(options?) + +Returns a new instance. + +### options + +Type: `object` + +#### maxSize + +*Required*
+Type: `number` + +The maximum number of items before evicting the least recently used items. + +### Instance + +The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop. + +Both `key` and `value` can be of any type. + +#### .set(key, value) + +Set an item. Returns the instance. + +#### .get(key) + +Get an item. + +#### .has(key) + +Check if an item exists. + +#### .peek(key) + +Get an item without marking it as recently used. + +#### .delete(key) + +Delete an item. + +Returns `true` if the item is removed or `false` if the item doesn't exist. + +#### .clear() + +Delete all items. + +#### .keys() + +Iterable for all the keys. + +#### .values() + +Iterable for all the values. + +#### .size + +The stored item count. diff --git a/node_modules/ramda/CHANGELOG.md b/node_modules/ramda/CHANGELOG.md new file mode 100644 index 0000000..cf75f9a --- /dev/null +++ b/node_modules/ramda/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +See the [upgrade guides][1]. + + +[1]: https://github.com/ramda/ramda/issues?q=label%3A%22upgrade+guide%22 diff --git a/node_modules/ramda/LICENSE.txt b/node_modules/ramda/LICENSE.txt new file mode 100644 index 0000000..7eb3353 --- /dev/null +++ b/node_modules/ramda/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2018 Scott Sauyet and Michael Hurley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/ramda/README.md b/node_modules/ramda/README.md new file mode 100644 index 0000000..c0f1042 --- /dev/null +++ b/node_modules/ramda/README.md @@ -0,0 +1,248 @@ +Ramda +============= + +A practical functional library for JavaScript programmers. + +[![Build Status](https://travis-ci.org/ramda/ramda.svg?branch=master)](https://travis-ci.org/ramda/ramda) +[![npm module](https://badge.fury.io/js/ramda.svg)](https://www.npmjs.org/package/ramda) +[![dependencies](https://david-dm.org/ramda/ramda.svg)](https://david-dm.org/ramda/ramda) +[![Gitter](https://badges.gitter.im/Join_Chat.svg)](https://gitter.im/ramda/ramda?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + + +Why Ramda? +---------- + + + +There are already several excellent libraries with a functional flavor. Typically, they are meant to be general-purpose toolkits, suitable for working in multiple paradigms. Ramda has a more focused goal. We wanted a library designed specifically for a functional programming style, one that makes it easy to create functional pipelines, one that never mutates user data. + + + +What's Different? +----------------- + +The primary distinguishing features of Ramda are: + +* Ramda emphasizes a purer functional style. Immutability and side-effect free functions + are at the heart of its design philosophy. This can help you get the job done with simple, + elegant code. + +* Ramda functions are automatically curried. This allows you to easily build up new functions + from old ones simply by not supplying the final parameters. + +* The parameters to Ramda functions are arranged to make it convenient for currying. The data + to be operated on is generally supplied last. + +The last two points together make it very easy to build functions as sequences of simpler functions, each of which transforms the data and passes it along to the next. Ramda is designed to support this style of coding. + + + +Introductions +------------- + +* [Introducing Ramda](http://buzzdecafe.github.io/code/2014/05/16/introducing-ramda) by Buzz de Cafe +* [Why Ramda?](http://fr.umio.us/why-ramda/) by Scott Sauyet +* [Favoring Curry](http://fr.umio.us/favoring-curry/) by Scott Sauyet +* [Why Curry Helps](https://hughfdjackson.com/javascript/why-curry-helps/) by Hugh Jackson +* [Hey Underscore, You're Doing It Wrong!](https://www.youtube.com/watch?v=m3svKOdZijA&app=desktop) by Brian Lonsdorf +* [Thinking in Ramda](http://randycoulman.com/blog/categories/thinking-in-ramda) by Randy Coulman + + + +Philosophy +---------- +Using Ramda should feel much like just using JavaScript. +It is practical, functional JavaScript. We're not introducing +lambda expressions in strings, we're not borrowing consed +lists, we're not porting over all of the Clojure functions. + +Our basic data structures are plain JavaScript objects, and our +usual collections are JavaScript arrays. We also keep other +native features of JavaScript, such as functions as objects +with properties. + +Functional programming is in good part about immutable objects and +side-effect free functions. While Ramda does not *enforce* this, it +enables such style to be as frictionless as possible. + +We aim for an implementation both clean and elegant, but the API is king. +We sacrifice a great deal of implementation elegance for even a slightly +cleaner API. + +Last but not least, Ramda strives for performance. A reliable and quick +implementation wins over any notions of functional purity. + + + +Installation +------------ + +To use with node: + +```bash +$ npm install ramda +``` + +Then in the console: + +```javascript +const R = require('ramda'); +``` + +To use directly in the browser: + +```html + +``` + +or the minified version: + +```html + +``` + +or from a CDN, either cdnjs: + +```html + +``` + +or one of the below links from [jsDelivr](http://jsdelivr.com): + +```html + + + +``` + +(note that using `latest` is taking a significant risk that ramda API changes could break your code.) + +These script tags add the variable `R` on the browser's global scope. + +Or you can inject ramda into virtually any unsuspecting website using [the bookmarklet](https://github.com/ramda/ramda/blob/master/BOOKMARKLET.md). + +**Note for versions > 0.25** +Ramda versions > 0.25 don't have a default export. +So instead of `import R from 'ramda';`, one has to use `import * as R from 'ramda';` +Or better yet, import only the required functions via `import { functionName } from 'ramda';` + +### Build + +`npm run build` creates `es`, `src` directories and updates both __dist/ramda.js__ and __dist/ramda.min.js__ + +#### Partial Builds + +It is possible to build Ramda with a subset of the functionality to reduce its file size. Ramda's build system supports this with command line flags. For example if you're using `R.compose`, `R.reduce`, and `R.filter` you can create a partial build with: + + npm run --silent partial-build compose reduce filter > dist/ramda.custom.js + +This requires having Node/io.js installed and ramda's dependencies installed (just use `npm install` before running partial build). + + + +Documentation +------------- + +Please review the [API documentation](https://ramdajs.com/docs/). + +Also available is our [Cookbook](https://github.com/ramda/ramda/wiki/Cookbook) of functions built from Ramda that you may find useful. + + +The Name +-------- + +Ok, so we like sheep. That's all. It's a short name, not already +taken. It could as easily have been `eweda`, but then we would be +forced to say _eweda lamb!_, and no one wants that. For non-English +speakers, lambs are baby sheep, ewes are female sheep, and rams are male +sheep. So perhaps ramda is a grown-up lambda... but probably not. + + + + +Running The Test Suite +---------------------- + +**Console:** + +To run the test suite from the console, you need to have `mocha` installed: + + npm install -g mocha + +Then from the root of the project, you can just call + + mocha + +Alternately, if you've installed the dependencies, via: + + npm install + +then you can run the tests (and get detailed output) by running: + + npm test + +**Browser:** + +You can use [testem](https://github.com/airportyh/testem) to +test across different browsers (or even headlessly), with livereloading of +tests. Install testem (`npm install -g testem`) and run `testem`. Open the +link provided in your browser and you will see the results in your terminal. + +If you have _PhantomJS_ installed, you can run `testem -l phantomjs` to run the +tests completely headlessly. + + +Usage +----------------- + +For `v0.25` and up, import the whole library or pick ES modules directly from the library: + +```js +import * as R from 'ramda' + +const {identity} = R +R.map(identity, [1, 2, 3]) +``` + +Destructuring imports from ramda *does not necessarily prevent importing the entire library*. You can manually cherry-pick methods like the following, which would only grab the parts necessary for `identity` to work: + +```js +import identity from 'ramda/src/identity' + +identity() +``` + +Manually cherry picking methods is cumbersome, however. Most bundlers like Webpack and Rollup offer tree-shaking as a way to drop unused Ramda code and reduce bundle size, but their performance varies, discussed [here](https://github.com/scabbiaza/ramda-webpack-tree-shaking-examples). Here is a summary of the optimal setup based on what technology you are using: + +1. Webpack + Babel - use [`babel-plugin-ramda`](https://github.com/megawac/babel-plugin-ramda) to automatically cherry pick methods. Discussion [here](https://www.andrewsouthpaw.com/ramda-webpack-and-tree-shaking/), example [here](https://github.com/AndrewSouthpaw/ramda-webpack-tree-shaking-examples/blob/master/07-webpack-babel-plugin-ramda/package.json) +1. Webpack only - use `UglifyJS` plugin for treeshaking along with the `ModuleConcatenationPlugin`. Discussion [here](https://github.com/ramda/ramda/issues/2355), with an example setup [here](https://github.com/scabbiaza/ramda-webpack-tree-shaking-examples/blob/master/06-webpack-scope-hoisted/webpack.config.js) +1. Rollup - does a fine job properly treeshaking, no special work needed; example [here](https://github.com/scabbiaza/ramda-webpack-tree-shaking-examples/blob/master/07-rollup-ramda-tree-shaking/rollup.config.js) + + +Typings +----------------- + +- [TypeScript](https://github.com/types/npm-ramda/) +- [Flow](https://github.com/flowtype/flow-typed/tree/master/definitions/npm/ramda_v0.x.x) + + + + +Translations +----------------- + +- [Chinese(中文)](http://ramda.cn/) +- [Ukrainian(Українська)](https://github.com/ivanzusko/ramda) +- [Portuguese(BR)](https://github.com/renansj/ramda) +- [Russian(Русский)](https://github.com/Guck111/ramda) + + + +Acknowledgements +----------------- + +Thanks to [J. C. Phillipps](http://www.jcphillipps.com) for the Ramda logo. +Ramda logo artwork © 2014 J. C. Phillipps. Licensed Creative Commons +[CC BY-NC-SA 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/). diff --git a/node_modules/ramda/dist/ramda.js b/node_modules/ramda/dist/ramda.js new file mode 100644 index 0000000..9bed1dd --- /dev/null +++ b/node_modules/ramda/dist/ramda.js @@ -0,0 +1,9716 @@ +// Ramda v0.27.0 +// https://github.com/ramda/ramda +// (c) 2013-2020 Scott Sauyet, Michael Hurley, and David Chambers +// Ramda may be freely distributed under the MIT license. + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.R = {})); +}(this, function (exports) { 'use strict'; + + /** + * A function that always returns `false`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.T + * @example + * + * R.F(); //=> false + */ + var F = function() {return false;}; + + /** + * A function that always returns `true`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.F + * @example + * + * R.T(); //=> true + */ + var T = function() {return true;}; + + /** + * A special placeholder value used to specify "gaps" within curried functions, + * allowing partial application of any combination of arguments, regardless of + * their positions. + * + * If `g` is a curried ternary function and `_` is `R.__`, the following are + * equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2, _)(1, 3)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @name __ + * @constant + * @memberOf R + * @since v0.6.0 + * @category Function + * @example + * + * const greet = R.replace('{name}', R.__, 'Hello, {name}!'); + * greet('Alice'); //=> 'Hello, Alice!' + */ + var __ = {'@@functional/placeholder': true}; + + function _isPlaceholder(a) { + return a != null && + typeof a === 'object' && + a['@@functional/placeholder'] === true; + } + + /** + * Optimized internal one-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + function _curry1(fn) { + return function f1(a) { + if (arguments.length === 0 || _isPlaceholder(a)) { + return f1; + } else { + return fn.apply(this, arguments); + } + }; + } + + /** + * Optimized internal two-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + function _curry2(fn) { + return function f2(a, b) { + switch (arguments.length) { + case 0: + return f2; + case 1: + return _isPlaceholder(a) + ? f2 + : _curry1(function(_b) { return fn(a, _b); }); + default: + return _isPlaceholder(a) && _isPlaceholder(b) + ? f2 + : _isPlaceholder(a) + ? _curry1(function(_a) { return fn(_a, b); }) + : _isPlaceholder(b) + ? _curry1(function(_b) { return fn(a, _b); }) + : fn(a, b); + } + }; + } + + /** + * Adds two values. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a + * @param {Number} b + * @return {Number} + * @see R.subtract + * @example + * + * R.add(2, 3); //=> 5 + * R.add(7)(10); //=> 17 + */ + var add = _curry2(function add(a, b) { + return Number(a) + Number(b); + }); + + /** + * Private `concat` function to merge two array-like objects. + * + * @private + * @param {Array|Arguments} [set1=[]] An array-like object. + * @param {Array|Arguments} [set2=[]] An array-like object. + * @return {Array} A new, merged array. + * @example + * + * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + */ + function _concat(set1, set2) { + set1 = set1 || []; + set2 = set2 || []; + var idx; + var len1 = set1.length; + var len2 = set2.length; + var result = []; + + idx = 0; + while (idx < len1) { + result[result.length] = set1[idx]; + idx += 1; + } + idx = 0; + while (idx < len2) { + result[result.length] = set2[idx]; + idx += 1; + } + return result; + } + + function _arity(n, fn) { + /* eslint-disable no-unused-vars */ + switch (n) { + case 0: return function() { return fn.apply(this, arguments); }; + case 1: return function(a0) { return fn.apply(this, arguments); }; + case 2: return function(a0, a1) { return fn.apply(this, arguments); }; + case 3: return function(a0, a1, a2) { return fn.apply(this, arguments); }; + case 4: return function(a0, a1, a2, a3) { return fn.apply(this, arguments); }; + case 5: return function(a0, a1, a2, a3, a4) { return fn.apply(this, arguments); }; + case 6: return function(a0, a1, a2, a3, a4, a5) { return fn.apply(this, arguments); }; + case 7: return function(a0, a1, a2, a3, a4, a5, a6) { return fn.apply(this, arguments); }; + case 8: return function(a0, a1, a2, a3, a4, a5, a6, a7) { return fn.apply(this, arguments); }; + case 9: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) { return fn.apply(this, arguments); }; + case 10: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { return fn.apply(this, arguments); }; + default: throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); + } + } + + /** + * Internal curryN function. + * + * @private + * @category Function + * @param {Number} length The arity of the curried function. + * @param {Array} received An array of arguments received thus far. + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + function _curryN(length, received, fn) { + return function() { + var combined = []; + var argsIdx = 0; + var left = length; + var combinedIdx = 0; + while (combinedIdx < received.length || argsIdx < arguments.length) { + var result; + if (combinedIdx < received.length && + (!_isPlaceholder(received[combinedIdx]) || + argsIdx >= arguments.length)) { + result = received[combinedIdx]; + } else { + result = arguments[argsIdx]; + argsIdx += 1; + } + combined[combinedIdx] = result; + if (!_isPlaceholder(result)) { + left -= 1; + } + combinedIdx += 1; + } + return left <= 0 + ? fn.apply(this, combined) + : _arity(left, _curryN(length, combined, fn)); + }; + } + + /** + * Returns a curried equivalent of the provided function, with the specified + * arity. The curried function has two unusual capabilities. First, its + * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.5.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curry + * @example + * + * const sumArgs = (...args) => R.sum(args); + * + * const curriedAddFourNumbers = R.curryN(4, sumArgs); + * const f = curriedAddFourNumbers(1, 2); + * const g = f(3); + * g(4); //=> 10 + */ + var curryN = _curry2(function curryN(length, fn) { + if (length === 1) { + return _curry1(fn); + } + return _arity(length, _curryN(length, [], fn)); + }); + + /** + * Creates a new list iteration function from an existing one by adding two new + * parameters to its callback function: the current index, and the entire list. + * + * This would turn, for instance, [`R.map`](#map) function into one that + * more closely resembles `Array.prototype.map`. Note that this will only work + * for functions in which the iteration callback function is the first + * parameter, and where the list is the last parameter. (This latter might be + * unimportant if the list parameter is not used.) + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Function + * @category List + * @sig ((a ... -> b) ... -> [a] -> *) -> ((a ..., Int, [a] -> b) ... -> [a] -> *) + * @param {Function} fn A list iteration function that does not pass index or list to its callback + * @return {Function} An altered list iteration function that passes (item, index, list) to its callback + * @example + * + * const mapIndexed = R.addIndex(R.map); + * mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']); + * //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r'] + */ + var addIndex = _curry1(function addIndex(fn) { + return curryN(fn.length, function() { + var idx = 0; + var origFn = arguments[0]; + var list = arguments[arguments.length - 1]; + var args = Array.prototype.slice.call(arguments, 0); + args[0] = function() { + var result = origFn.apply(this, _concat(arguments, [idx, list])); + idx += 1; + return result; + }; + return fn.apply(this, args); + }); + }); + + /** + * Optimized internal three-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + function _curry3(fn) { + return function f3(a, b, c) { + switch (arguments.length) { + case 0: + return f3; + case 1: + return _isPlaceholder(a) + ? f3 + : _curry2(function(_b, _c) { return fn(a, _b, _c); }); + case 2: + return _isPlaceholder(a) && _isPlaceholder(b) + ? f3 + : _isPlaceholder(a) + ? _curry2(function(_a, _c) { return fn(_a, b, _c); }) + : _isPlaceholder(b) + ? _curry2(function(_b, _c) { return fn(a, _b, _c); }) + : _curry1(function(_c) { return fn(a, b, _c); }); + default: + return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) + ? f3 + : _isPlaceholder(a) && _isPlaceholder(b) + ? _curry2(function(_a, _b) { return fn(_a, _b, c); }) + : _isPlaceholder(a) && _isPlaceholder(c) + ? _curry2(function(_a, _c) { return fn(_a, b, _c); }) + : _isPlaceholder(b) && _isPlaceholder(c) + ? _curry2(function(_b, _c) { return fn(a, _b, _c); }) + : _isPlaceholder(a) + ? _curry1(function(_a) { return fn(_a, b, c); }) + : _isPlaceholder(b) + ? _curry1(function(_b) { return fn(a, _b, c); }) + : _isPlaceholder(c) + ? _curry1(function(_c) { return fn(a, b, _c); }) + : fn(a, b, c); + } + }; + } + + /** + * Applies a function to the value at the given index of an array, returning a + * new copy of the array with the element at the given index replaced with the + * result of the function application. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig Number -> (a -> a) -> [a] -> [a] + * @param {Number} idx The index. + * @param {Function} fn The function to apply. + * @param {Array|Arguments} list An array-like object whose value + * at the supplied index will be replaced. + * @return {Array} A copy of the supplied array-like object with + * the element at index `idx` replaced with the value + * returned by applying `fn` to the existing element. + * @see R.update + * @example + * + * R.adjust(1, R.toUpper, ['a', 'b', 'c', 'd']); //=> ['a', 'B', 'c', 'd'] + * R.adjust(-1, R.toUpper, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c', 'D'] + * @symb R.adjust(-1, f, [a, b]) = [a, f(b)] + * @symb R.adjust(0, f, [a, b]) = [f(a), b] + */ + var adjust = _curry3(function adjust(idx, fn, list) { + if (idx >= list.length || idx < -list.length) { + return list; + } + var start = idx < 0 ? list.length : 0; + var _idx = start + idx; + var _list = _concat(list); + _list[_idx] = fn(list[_idx]); + return _list; + }); + + /** + * Tests whether or not an object is an array. + * + * @private + * @param {*} val The object to test. + * @return {Boolean} `true` if `val` is an array, `false` otherwise. + * @example + * + * _isArray([]); //=> true + * _isArray(null); //=> false + * _isArray({}); //=> false + */ + var _isArray = Array.isArray || function _isArray(val) { + return (val != null && + val.length >= 0 && + Object.prototype.toString.call(val) === '[object Array]'); + }; + + function _isTransformer(obj) { + return obj != null && typeof obj['@@transducer/step'] === 'function'; + } + + /** + * Returns a function that dispatches with different strategies based on the + * object in list position (last argument). If it is an array, executes [fn]. + * Otherwise, if it has a function with one of the given method names, it will + * execute that function (functor case). Otherwise, if it is a transformer, + * uses transducer [xf] to return a new transformer (transducer case). + * Otherwise, it will default to executing [fn]. + * + * @private + * @param {Array} methodNames properties to check for a custom implementation + * @param {Function} xf transducer to initialize if object is transformer + * @param {Function} fn default ramda implementation + * @return {Function} A function that dispatches on object in list position + */ + function _dispatchable(methodNames, xf, fn) { + return function() { + if (arguments.length === 0) { + return fn(); + } + var args = Array.prototype.slice.call(arguments, 0); + var obj = args.pop(); + if (!_isArray(obj)) { + var idx = 0; + while (idx < methodNames.length) { + if (typeof obj[methodNames[idx]] === 'function') { + return obj[methodNames[idx]].apply(obj, args); + } + idx += 1; + } + if (_isTransformer(obj)) { + var transducer = xf.apply(null, args); + return transducer(obj); + } + } + return fn.apply(this, arguments); + }; + } + + function _reduced(x) { + return x && x['@@transducer/reduced'] ? x : + { + '@@transducer/value': x, + '@@transducer/reduced': true + }; + } + + var _xfBase = { + init: function() { + return this.xf['@@transducer/init'](); + }, + result: function(result) { + return this.xf['@@transducer/result'](result); + } + }; + + function XAll(f, xf) { + this.xf = xf; + this.f = f; + this.all = true; + } + XAll.prototype['@@transducer/init'] = _xfBase.init; + XAll.prototype['@@transducer/result'] = function(result) { + if (this.all) { + result = this.xf['@@transducer/step'](result, true); + } + return this.xf['@@transducer/result'](result); + }; + XAll.prototype['@@transducer/step'] = function(result, input) { + if (!this.f(input)) { + this.all = false; + result = _reduced(this.xf['@@transducer/step'](result, false)); + } + return result; + }; + + var _xall = _curry2(function _xall(f, xf) { return new XAll(f, xf); }); + + /** + * Returns `true` if all elements of the list match the predicate, `false` if + * there are any that don't. + * + * Dispatches to the `all` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is satisfied by every element, `false` + * otherwise. + * @see R.any, R.none, R.transduce + * @example + * + * const equals3 = R.equals(3); + * R.all(equals3)([3, 3, 3, 3]); //=> true + * R.all(equals3)([3, 3, 1, 3]); //=> false + */ + var all = _curry2(_dispatchable(['all'], _xall, function all(fn, list) { + var idx = 0; + while (idx < list.length) { + if (!fn(list[idx])) { + return false; + } + idx += 1; + } + return true; + })); + + /** + * Returns the larger of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.maxBy, R.min + * @example + * + * R.max(789, 123); //=> 789 + * R.max('a', 'b'); //=> 'b' + */ + var max = _curry2(function max(a, b) { return b > a ? b : a; }); + + function _map(fn, functor) { + var idx = 0; + var len = functor.length; + var result = Array(len); + while (idx < len) { + result[idx] = fn(functor[idx]); + idx += 1; + } + return result; + } + + function _isString(x) { + return Object.prototype.toString.call(x) === '[object String]'; + } + + /** + * Tests whether or not an object is similar to an array. + * + * @private + * @category Type + * @category List + * @sig * -> Boolean + * @param {*} x The object to test. + * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. + * @example + * + * _isArrayLike([]); //=> true + * _isArrayLike(true); //=> false + * _isArrayLike({}); //=> false + * _isArrayLike({length: 10}); //=> false + * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true + */ + var _isArrayLike = _curry1(function isArrayLike(x) { + if (_isArray(x)) { return true; } + if (!x) { return false; } + if (typeof x !== 'object') { return false; } + if (_isString(x)) { return false; } + if (x.nodeType === 1) { return !!x.length; } + if (x.length === 0) { return true; } + if (x.length > 0) { + return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); + } + return false; + }); + + function XWrap(fn) { + this.f = fn; + } + XWrap.prototype['@@transducer/init'] = function() { + throw new Error('init not implemented on XWrap'); + }; + XWrap.prototype['@@transducer/result'] = function(acc) { return acc; }; + XWrap.prototype['@@transducer/step'] = function(acc, x) { + return this.f(acc, x); + }; + + function _xwrap(fn) { return new XWrap(fn); } + + /** + * Creates a function that is bound to a context. + * Note: `R.bind` does not provide the additional argument-binding capabilities of + * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Function + * @category Object + * @sig (* -> *) -> {*} -> (* -> *) + * @param {Function} fn The function to bind to context + * @param {Object} thisObj The context to bind `fn` to + * @return {Function} A function that will execute in the context of `thisObj`. + * @see R.partial + * @example + * + * const log = R.bind(console.log, console); + * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} + * // logs {a: 2} + * @symb R.bind(f, o)(a, b) = f.call(o, a, b) + */ + var bind = _curry2(function bind(fn, thisObj) { + return _arity(fn.length, function() { + return fn.apply(thisObj, arguments); + }); + }); + + function _arrayReduce(xf, acc, list) { + var idx = 0; + var len = list.length; + while (idx < len) { + acc = xf['@@transducer/step'](acc, list[idx]); + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + idx += 1; + } + return xf['@@transducer/result'](acc); + } + + function _iterableReduce(xf, acc, iter) { + var step = iter.next(); + while (!step.done) { + acc = xf['@@transducer/step'](acc, step.value); + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + step = iter.next(); + } + return xf['@@transducer/result'](acc); + } + + function _methodReduce(xf, acc, obj, methodName) { + return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc)); + } + + var symIterator = (typeof Symbol !== 'undefined') ? Symbol.iterator : '@@iterator'; + + function _reduce(fn, acc, list) { + if (typeof fn === 'function') { + fn = _xwrap(fn); + } + if (_isArrayLike(list)) { + return _arrayReduce(fn, acc, list); + } + if (typeof list['fantasy-land/reduce'] === 'function') { + return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); + } + if (list[symIterator] != null) { + return _iterableReduce(fn, acc, list[symIterator]()); + } + if (typeof list.next === 'function') { + return _iterableReduce(fn, acc, list); + } + if (typeof list.reduce === 'function') { + return _methodReduce(fn, acc, list, 'reduce'); + } + + throw new TypeError('reduce: list must be array or iterable'); + } + + function XMap(f, xf) { + this.xf = xf; + this.f = f; + } + XMap.prototype['@@transducer/init'] = _xfBase.init; + XMap.prototype['@@transducer/result'] = _xfBase.result; + XMap.prototype['@@transducer/step'] = function(result, input) { + return this.xf['@@transducer/step'](result, this.f(input)); + }; + + var _xmap = _curry2(function _xmap(f, xf) { return new XMap(f, xf); }); + + function _has(prop, obj) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + var toString = Object.prototype.toString; + var _isArguments = (function() { + return toString.call(arguments) === '[object Arguments]' ? + function _isArguments(x) { return toString.call(x) === '[object Arguments]'; } : + function _isArguments(x) { return _has('callee', x); }; + }()); + + // cover IE < 9 keys issues + var hasEnumBug = !({toString: null}).propertyIsEnumerable('toString'); + var nonEnumerableProps = [ + 'constructor', 'valueOf', 'isPrototypeOf', 'toString', + 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString' + ]; + // Safari bug + var hasArgsEnumBug = (function() { + return arguments.propertyIsEnumerable('length'); + }()); + + var contains = function contains(list, item) { + var idx = 0; + while (idx < list.length) { + if (list[idx] === item) { + return true; + } + idx += 1; + } + return false; + }; + + /** + * Returns a list containing the names of all the enumerable own properties of + * the supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own properties. + * @see R.keysIn, R.values + * @example + * + * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] + */ + var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? + _curry1(function keys(obj) { + return Object(obj) !== obj ? [] : Object.keys(obj); + }) : + _curry1(function keys(obj) { + if (Object(obj) !== obj) { + return []; + } + var prop, nIdx; + var ks = []; + var checkArgsLength = hasArgsEnumBug && _isArguments(obj); + for (prop in obj) { + if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) { + ks[ks.length] = prop; + } + } + if (hasEnumBug) { + nIdx = nonEnumerableProps.length - 1; + while (nIdx >= 0) { + prop = nonEnumerableProps[nIdx]; + if (_has(prop, obj) && !contains(ks, prop)) { + ks[ks.length] = prop; + } + nIdx -= 1; + } + } + return ks; + }); + + /** + * Takes a function and + * a [functor](https://github.com/fantasyland/fantasy-land#functor), + * applies the function to each of the functor's values, and returns + * a functor of the same shape. + * + * Ramda provides suitable `map` implementations for `Array` and `Object`, + * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. + * + * Dispatches to the `map` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * Also treats functions as functors and will compose them together. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => (a -> b) -> f a -> f b + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {Array} list The list to be iterated over. + * @return {Array} The new list. + * @see R.transduce, R.addIndex + * @example + * + * const double = x => x * 2; + * + * R.map(double, [1, 2, 3]); //=> [2, 4, 6] + * + * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} + * @symb R.map(f, [a, b]) = [f(a), f(b)] + * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } + * @symb R.map(f, functor_o) = functor_o.map(f) + */ + var map = _curry2(_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { + switch (Object.prototype.toString.call(functor)) { + case '[object Function]': + return curryN(functor.length, function() { + return fn.call(this, functor.apply(this, arguments)); + }); + case '[object Object]': + return _reduce(function(acc, key) { + acc[key] = fn(functor[key]); + return acc; + }, {}, keys(functor)); + default: + return _map(fn, functor); + } + })); + + /** + * Determine if the passed argument is an integer. + * + * @private + * @param {*} n + * @category Type + * @return {Boolean} + */ + var _isInteger = Number.isInteger || function _isInteger(n) { + return (n << 0) === n; + }; + + /** + * Returns the nth element of the given list or string. If n is negative the + * element at index length + n is returned. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> a | Undefined + * @sig Number -> String -> String + * @param {Number} offset + * @param {*} list + * @return {*} + * @example + * + * const list = ['foo', 'bar', 'baz', 'quux']; + * R.nth(1, list); //=> 'bar' + * R.nth(-1, list); //=> 'quux' + * R.nth(-99, list); //=> undefined + * + * R.nth(2, 'abc'); //=> 'c' + * R.nth(3, 'abc'); //=> '' + * @symb R.nth(-1, [a, b, c]) = c + * @symb R.nth(0, [a, b, c]) = a + * @symb R.nth(1, [a, b, c]) = b + */ + var nth = _curry2(function nth(offset, list) { + var idx = offset < 0 ? list.length + offset : offset; + return _isString(list) ? list.charAt(idx) : list[idx]; + }); + + /** + * Retrieves the values at given paths of an object. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Object + * @typedefn Idx = [String | Int] + * @sig [Idx] -> {a} -> [a | Undefined] + * @param {Array} pathsArray The array of paths to be fetched. + * @param {Object} obj The object to retrieve the nested properties from. + * @return {Array} A list consisting of values at paths specified by "pathsArray". + * @see R.path + * @example + * + * R.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, 3] + * R.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, undefined] + */ + var paths = _curry2(function paths(pathsArray, obj) { + return pathsArray.map(function(paths) { + var val = obj; + var idx = 0; + var p; + while (idx < paths.length) { + if (val == null) { + return; + } + p = paths[idx]; + val = _isInteger(p) ? nth(p, val) : val[p]; + idx += 1; + } + return val; + }); + }); + + /** + * Retrieve the value at a given path. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> a | Undefined + * @param {Array} path The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path`. + * @see R.prop, R.nth + * @example + * + * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 + * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined + * R.path(['a', 'b', 0], {a: {b: [1, 2, 3]}}); //=> 1 + * R.path(['a', 'b', -2], {a: {b: [1, 2, 3]}}); //=> 2 + */ + + var path = _curry2(function path(pathAr, obj) { + return paths([pathAr], obj)[0]; + }); + + /** + * Returns a function that when supplied an object returns the indicated + * property of that object, if it exists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @typedefn Idx = String | Int + * @sig Idx -> {s: a} -> a | Undefined + * @param {String|Number} p The property name or array index + * @param {Object} obj The object to query + * @return {*} The value at `obj.p`. + * @see R.path, R.nth + * @example + * + * R.prop('x', {x: 100}); //=> 100 + * R.prop('x', {}); //=> undefined + * R.prop(0, [100]); //=> 100 + * R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4 + */ + + var prop = _curry2(function prop(p, obj) { return path([p], obj); }); + + /** + * Returns a new list by plucking the same named property off all objects in + * the list supplied. + * + * `pluck` will work on + * any [functor](https://github.com/fantasyland/fantasy-land#functor) in + * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => k -> f {k: v} -> f v + * @param {Number|String} key The key name to pluck off of each object. + * @param {Array} f The array or functor to consider. + * @return {Array} The list of values for the given key. + * @see R.props + * @example + * + * var getAges = R.pluck('age'); + * getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27] + * + * R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3] + * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5} + * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] + * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] + */ + var pluck = _curry2(function pluck(p, list) { + return map(prop(p), list); + }); + + /** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It may use + * [`R.reduced`](#reduced) to shortcut the iteration. + * + * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function + * is *(value, acc)*. + * + * Note: `R.reduce` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduce` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description + * + * Dispatches to the `reduce` method of the third argument, if present. When + * doing so, it is up to the user to handle the [`R.reduced`](#reduced) + * shortcuting, as this is not implemented by `reduce`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> a + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduced, R.addIndex, R.reduceRight + * @example + * + * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 + * // - -10 + * // / \ / \ + * // - 4 -6 4 + * // / \ / \ + * // - 3 ==> -3 3 + * // / \ / \ + * // - 2 -1 2 + * // / \ / \ + * // 0 1 0 1 + * + * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) + */ + var reduce = _curry3(_reduce); + + /** + * Takes a list of predicates and returns a predicate that returns true for a + * given list of arguments if every one of the provided predicates is satisfied + * by those arguments. + * + * The function returned is a curried function whose arity matches that of the + * highest-arity predicate. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Logic + * @sig [(*... -> Boolean)] -> (*... -> Boolean) + * @param {Array} predicates An array of predicates to check + * @return {Function} The combined predicate + * @see R.anyPass + * @example + * + * const isQueen = R.propEq('rank', 'Q'); + * const isSpade = R.propEq('suit', '♠︎'); + * const isQueenOfSpades = R.allPass([isQueen, isSpade]); + * + * isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false + * isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true + */ + var allPass = _curry1(function allPass(preds) { + return curryN(reduce(max, 0, pluck('length', preds)), function() { + var idx = 0; + var len = preds.length; + while (idx < len) { + if (!preds[idx].apply(this, arguments)) { + return false; + } + idx += 1; + } + return true; + }); + }); + + /** + * Returns a function that always returns the given value. Note that for + * non-primitives the value returned is a reference to the original value. + * + * This function is known as `const`, `constant`, or `K` (for K combinator) in + * other languages and libraries. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> (* -> a) + * @param {*} val The value to wrap in a function + * @return {Function} A Function :: * -> val. + * @example + * + * const t = R.always('Tee'); + * t(); //=> 'Tee' + */ + var always = _curry1(function always(val) { + return function() { + return val; + }; + }); + + /** + * Returns `true` if both arguments are `true`; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> b -> a | b + * @param {Any} a + * @param {Any} b + * @return {Any} the first argument if it is falsy, otherwise the second argument. + * @see R.both, R.xor + * @example + * + * R.and(true, true); //=> true + * R.and(true, false); //=> false + * R.and(false, true); //=> false + * R.and(false, false); //=> false + */ + var and = _curry2(function and(a, b) { + return a && b; + }); + + function XAny(f, xf) { + this.xf = xf; + this.f = f; + this.any = false; + } + XAny.prototype['@@transducer/init'] = _xfBase.init; + XAny.prototype['@@transducer/result'] = function(result) { + if (!this.any) { + result = this.xf['@@transducer/step'](result, false); + } + return this.xf['@@transducer/result'](result); + }; + XAny.prototype['@@transducer/step'] = function(result, input) { + if (this.f(input)) { + this.any = true; + result = _reduced(this.xf['@@transducer/step'](result, true)); + } + return result; + }; + + var _xany = _curry2(function _xany(f, xf) { return new XAny(f, xf); }); + + /** + * Returns `true` if at least one of the elements of the list match the predicate, + * `false` otherwise. + * + * Dispatches to the `any` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false` + * otherwise. + * @see R.all, R.none, R.transduce + * @example + * + * const lessThan0 = R.flip(R.lt)(0); + * const lessThan2 = R.flip(R.lt)(2); + * R.any(lessThan0)([1, 2]); //=> false + * R.any(lessThan2)([1, 2]); //=> true + */ + var any = _curry2(_dispatchable(['any'], _xany, function any(fn, list) { + var idx = 0; + while (idx < list.length) { + if (fn(list[idx])) { + return true; + } + idx += 1; + } + return false; + })); + + /** + * Takes a list of predicates and returns a predicate that returns true for a + * given list of arguments if at least one of the provided predicates is + * satisfied by those arguments. + * + * The function returned is a curried function whose arity matches that of the + * highest-arity predicate. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Logic + * @sig [(*... -> Boolean)] -> (*... -> Boolean) + * @param {Array} predicates An array of predicates to check + * @return {Function} The combined predicate + * @see R.allPass + * @example + * + * const isClub = R.propEq('suit', '♣'); + * const isSpade = R.propEq('suit', '♠'); + * const isBlackCard = R.anyPass([isClub, isSpade]); + * + * isBlackCard({rank: '10', suit: '♣'}); //=> true + * isBlackCard({rank: 'Q', suit: '♠'}); //=> true + * isBlackCard({rank: 'Q', suit: '♦'}); //=> false + */ + var anyPass = _curry1(function anyPass(preds) { + return curryN(reduce(max, 0, pluck('length', preds)), function() { + var idx = 0; + var len = preds.length; + while (idx < len) { + if (preds[idx].apply(this, arguments)) { + return true; + } + idx += 1; + } + return false; + }); + }); + + /** + * ap applies a list of functions to a list of values. + * + * Dispatches to the `ap` method of the second argument, if present. Also + * treats curried functions as applicatives. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig [a -> b] -> [a] -> [b] + * @sig Apply f => f (a -> b) -> f a -> f b + * @sig (r -> a -> b) -> (r -> a) -> (r -> b) + * @param {*} applyF + * @param {*} applyX + * @return {*} + * @example + * + * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6] + * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"] + * + * // R.ap can also be used as S combinator + * // when only two functions are passed + * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA' + * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] + */ + var ap = _curry2(function ap(applyF, applyX) { + return ( + typeof applyX['fantasy-land/ap'] === 'function' + ? applyX['fantasy-land/ap'](applyF) + : typeof applyF.ap === 'function' + ? applyF.ap(applyX) + : typeof applyF === 'function' + ? function(x) { return applyF(x)(applyX(x)); } + : _reduce(function(acc, f) { return _concat(acc, map(f, applyX)); }, [], applyF) + ); + }); + + function _aperture(n, list) { + var idx = 0; + var limit = list.length - (n - 1); + var acc = new Array(limit >= 0 ? limit : 0); + while (idx < limit) { + acc[idx] = Array.prototype.slice.call(list, idx, idx + n); + idx += 1; + } + return acc; + } + + function XAperture(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + XAperture.prototype['@@transducer/init'] = _xfBase.init; + XAperture.prototype['@@transducer/result'] = function(result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + XAperture.prototype['@@transducer/step'] = function(result, input) { + this.store(input); + return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result; + }; + XAperture.prototype.store = function(input) { + this.acc[this.pos] = input; + this.pos += 1; + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + XAperture.prototype.getCopy = function() { + return _concat(Array.prototype.slice.call(this.acc, this.pos), + Array.prototype.slice.call(this.acc, 0, this.pos) + ); + }; + + var _xaperture = _curry2(function _xaperture(n, xf) { return new XAperture(n, xf); }); + + /** + * Returns a new list, composed of n-tuples of consecutive elements. If `n` is + * greater than the length of the list, an empty list is returned. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig Number -> [a] -> [[a]] + * @param {Number} n The size of the tuples to create + * @param {Array} list The list to split into `n`-length tuples + * @return {Array} The resulting list of `n`-length tuples + * @see R.transduce + * @example + * + * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] + * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] + * R.aperture(7, [1, 2, 3, 4, 5]); //=> [] + */ + var aperture = _curry2(_dispatchable([], _xaperture, _aperture)); + + /** + * Returns a new list containing the contents of the given list, followed by + * the given element. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} el The element to add to the end of the new list. + * @param {Array} list The list of elements to add a new item to. + * list. + * @return {Array} A new list containing the elements of the old list followed by `el`. + * @see R.prepend + * @example + * + * R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] + * R.append('tests', []); //=> ['tests'] + * R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] + */ + var append = _curry2(function append(el, list) { + return _concat(list, [el]); + }); + + /** + * Applies function `fn` to the argument list `args`. This is useful for + * creating a fixed-arity function from a variadic function. `fn` should be a + * bound function if context is significant. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> a) -> [*] -> a + * @param {Function} fn The function which will be called with `args` + * @param {Array} args The arguments to call `fn` with + * @return {*} result The result, equivalent to `fn(...args)` + * @see R.call, R.unapply + * @example + * + * const nums = [1, 2, 3, -99, 42, 6, 7]; + * R.apply(Math.max, nums); //=> 42 + * @symb R.apply(f, [a, b, c]) = f(a, b, c) + */ + var apply = _curry2(function apply(fn, args) { + return fn.apply(this, args); + }); + + /** + * Returns a list of all the enumerable own properties of the supplied object. + * Note that the order of the output array is not guaranteed across different + * JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [v] + * @param {Object} obj The object to extract values from + * @return {Array} An array of the values of the object's own properties. + * @see R.valuesIn, R.keys + * @example + * + * R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3] + */ + var values = _curry1(function values(obj) { + var props = keys(obj); + var len = props.length; + var vals = []; + var idx = 0; + while (idx < len) { + vals[idx] = obj[props[idx]]; + idx += 1; + } + return vals; + }); + + // Use custom mapValues function to avoid issues with specs that include a "map" key and R.map + // delegating calls to .map + function mapValues(fn, obj) { + return keys(obj).reduce(function(acc, key) { + acc[key] = fn(obj[key]); + return acc; + }, {}); + } + + /** + * Given a spec object recursively mapping properties to functions, creates a + * function producing an object of the same structure, by mapping each property + * to the result of calling its associated function with the supplied arguments. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Function + * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v}) + * @param {Object} spec an object recursively mapping properties to functions for + * producing the values for these properties. + * @return {Function} A function that returns an object of the same structure + * as `spec', with each property set to the value returned by calling its + * associated function with the supplied arguments. + * @see R.converge, R.juxt + * @example + * + * const getMetrics = R.applySpec({ + * sum: R.add, + * nested: { mul: R.multiply } + * }); + * getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } } + * @symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } } + */ + var applySpec = _curry1(function applySpec(spec) { + spec = mapValues( + function(v) { return typeof v == 'function' ? v : applySpec(v); }, + spec + ); + + return curryN( + reduce(max, 0, pluck('length', values(spec))), + function() { + var args = arguments; + return mapValues(function(f) { return apply(f, args); }, spec); + }); + }); + + /** + * Takes a value and applies a function to it. + * + * This function is also known as the `thrush` combinator. + * + * @func + * @memberOf R + * @since v0.25.0 + * @category Function + * @sig a -> (a -> b) -> b + * @param {*} x The value + * @param {Function} f The function to apply + * @return {*} The result of applying `f` to `x` + * @example + * + * const t42 = R.applyTo(42); + * t42(R.identity); //=> 42 + * t42(R.add(1)); //=> 43 + */ + var applyTo = _curry2(function applyTo(x, f) { return f(x); }); + + /** + * Makes an ascending comparator function out of a function that returns a value + * that can be compared with `<` and `>`. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Function + * @sig Ord b => (a -> b) -> a -> a -> Number + * @param {Function} fn A function of arity one that returns a value that can be compared + * @param {*} a The first item to be compared. + * @param {*} b The second item to be compared. + * @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0` + * @see R.descend + * @example + * + * const byAge = R.ascend(R.prop('age')); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByYoungestFirst = R.sort(byAge, people); + * //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }] + */ + var ascend = _curry3(function ascend(fn, a, b) { + var aa = fn(a); + var bb = fn(b); + return aa < bb ? -1 : aa > bb ? 1 : 0; + }); + + /** + * Makes a shallow clone of an object, setting or overriding the specified + * property with the given value. Note that this copies and flattens prototype + * properties onto the new object as well. All non-primitive properties are + * copied by reference. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @sig String -> a -> {k: v} -> {k: v} + * @param {String} prop The property name to set + * @param {*} val The new value + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original except for the changed property. + * @see R.dissoc, R.pick + * @example + * + * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} + */ + var assoc = _curry3(function assoc(prop, val, obj) { + var result = {}; + for (var p in obj) { + result[p] = obj[p]; + } + result[prop] = val; + return result; + }); + + /** + * Checks if the input value is `null` or `undefined`. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Type + * @sig * -> Boolean + * @param {*} x The value to test. + * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`. + * @example + * + * R.isNil(null); //=> true + * R.isNil(undefined); //=> true + * R.isNil(0); //=> false + * R.isNil([]); //=> false + */ + var isNil = _curry1(function isNil(x) { return x == null; }); + + /** + * Makes a shallow clone of an object, setting or overriding the nodes required + * to create the given path, and placing the specific value at the tail end of + * that path. Note that this copies and flattens prototype properties onto the + * new object as well. All non-primitive properties are copied by reference. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> a -> {a} -> {a} + * @param {Array} path the path to set + * @param {*} val The new value + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original except along the specified path. + * @see R.dissocPath + * @example + * + * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} + * + * // Any missing or non-object keys in path will be overridden + * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}} + */ + var assocPath = _curry3(function assocPath(path, val, obj) { + if (path.length === 0) { + return val; + } + var idx = path[0]; + if (path.length > 1) { + var nextObj = (!isNil(obj) && _has(idx, obj)) ? obj[idx] : _isInteger(path[1]) ? [] : {}; + val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj); + } + if (_isInteger(idx) && _isArray(obj)) { + var arr = [].concat(obj); + arr[idx] = val; + return arr; + } else { + return assoc(idx, val, obj); + } + }); + + /** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly `n` parameters. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} n The desired arity of the new function. + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity `n`. + * @see R.binary, R.unary + * @example + * + * const takesTwoArgs = (a, b) => [a, b]; + * + * takesTwoArgs.length; //=> 2 + * takesTwoArgs(1, 2); //=> [1, 2] + * + * const takesOneArg = R.nAry(1, takesTwoArgs); + * takesOneArg.length; //=> 1 + * // Only `n` arguments are passed to the wrapped function + * takesOneArg(1, 2); //=> [1, undefined] + * @symb R.nAry(0, f)(a, b) = f() + * @symb R.nAry(1, f)(a, b) = f(a) + * @symb R.nAry(2, f)(a, b) = f(a, b) + */ + var nAry = _curry2(function nAry(n, fn) { + switch (n) { + case 0: return function() {return fn.call(this);}; + case 1: return function(a0) {return fn.call(this, a0);}; + case 2: return function(a0, a1) {return fn.call(this, a0, a1);}; + case 3: return function(a0, a1, a2) {return fn.call(this, a0, a1, a2);}; + case 4: return function(a0, a1, a2, a3) {return fn.call(this, a0, a1, a2, a3);}; + case 5: return function(a0, a1, a2, a3, a4) {return fn.call(this, a0, a1, a2, a3, a4);}; + case 6: return function(a0, a1, a2, a3, a4, a5) {return fn.call(this, a0, a1, a2, a3, a4, a5);}; + case 7: return function(a0, a1, a2, a3, a4, a5, a6) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6);}; + case 8: return function(a0, a1, a2, a3, a4, a5, a6, a7) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7);}; + case 9: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8);}; + case 10: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);}; + default: throw new Error('First argument to nAry must be a non-negative integer no greater than ten'); + } + }); + + /** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly 2 parameters. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Function + * @sig (* -> c) -> (a, b -> c) + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity 2. + * @see R.nAry, R.unary + * @example + * + * const takesThreeArgs = function(a, b, c) { + * return [a, b, c]; + * }; + * takesThreeArgs.length; //=> 3 + * takesThreeArgs(1, 2, 3); //=> [1, 2, 3] + * + * const takesTwoArgs = R.binary(takesThreeArgs); + * takesTwoArgs.length; //=> 2 + * // Only 2 arguments are passed to the wrapped function + * takesTwoArgs(1, 2, 3); //=> [1, 2, undefined] + * @symb R.binary(f)(a, b, c) = f(a, b) + */ + var binary = _curry1(function binary(fn) { + return nAry(2, fn); + }); + + function _isFunction(x) { + var type = Object.prototype.toString.call(x); + return type === '[object Function]' || + type === '[object AsyncFunction]' || + type === '[object GeneratorFunction]' || + type === '[object AsyncGeneratorFunction]'; + } + + /** + * "lifts" a function to be the specified arity, so that it may "map over" that + * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig Number -> (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.lift, R.ap + * @example + * + * const madd3 = R.liftN(3, (...args) => R.sum(args)); + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + */ + var liftN = _curry2(function liftN(arity, fn) { + var lifted = curryN(arity, fn); + return curryN(arity, function() { + return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); + }); + }); + + /** + * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other + * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.liftN + * @example + * + * const madd3 = R.lift((a, b, c) => a + b + c); + * + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + * + * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e); + * + * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] + */ + var lift = _curry1(function lift(fn) { + return liftN(fn.length, fn); + }); + + /** + * A function which calls the two provided functions and returns the `&&` + * of the results. + * It returns the result of the first function if it is false-y and the result + * of the second function otherwise. Note that this is short-circuited, + * meaning that the second function will not be invoked if the first returns a + * false-y value. + * + * In addition to functions, `R.both` also accepts any fantasy-land compatible + * applicative functor. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) + * @param {Function} f A predicate + * @param {Function} g Another predicate + * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together. + * @see R.and + * @example + * + * const gt10 = R.gt(R.__, 10) + * const lt20 = R.lt(R.__, 20) + * const f = R.both(gt10, lt20); + * f(15); //=> true + * f(30); //=> false + * + * R.both(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(false) + * R.both([false, false, 'a'], [11]); //=> [false, false, 11] + */ + var both = _curry2(function both(f, g) { + return _isFunction(f) ? + function _both() { + return f.apply(this, arguments) && g.apply(this, arguments); + } : + lift(and)(f, g); + }); + + /** + * Returns a curried equivalent of the provided function. The curried function + * has two unusual capabilities. First, its arguments needn't be provided one + * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> a) -> (* -> a) + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curryN, R.partial + * @example + * + * const addFourNumbers = (a, b, c, d) => a + b + c + d; + * + * const curriedAddFourNumbers = R.curry(addFourNumbers); + * const f = curriedAddFourNumbers(1, 2); + * const g = f(3); + * g(4); //=> 10 + */ + var curry = _curry1(function curry(fn) { + return curryN(fn.length, fn); + }); + + /** + * Returns the result of calling its first argument with the remaining + * arguments. This is occasionally useful as a converging function for + * [`R.converge`](#converge): the first branch can produce a function while the + * remaining branches produce values to be passed to that function as its + * arguments. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig (*... -> a),*... -> a + * @param {Function} fn The function to apply to the remaining arguments. + * @param {...*} args Any number of positional arguments. + * @return {*} + * @see R.apply + * @example + * + * R.call(R.add, 1, 2); //=> 3 + * + * const indentN = R.pipe(R.repeat(' '), + * R.join(''), + * R.replace(/^(?!$)/gm)); + * + * const format = R.converge(R.call, [ + * R.pipe(R.prop('indent'), indentN), + * R.prop('value') + * ]); + * + * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' + * @symb R.call(f, a, b) = f(a, b) + */ + var call = curry(function call(fn) { + return fn.apply(this, Array.prototype.slice.call(arguments, 1)); + }); + + /** + * `_makeFlat` is a helper function that returns a one-level or fully recursive + * function based on the flag passed in. + * + * @private + */ + function _makeFlat(recursive) { + return function flatt(list) { + var value, jlen, j; + var result = []; + var idx = 0; + var ilen = list.length; + + while (idx < ilen) { + if (_isArrayLike(list[idx])) { + value = recursive ? flatt(list[idx]) : list[idx]; + j = 0; + jlen = value.length; + while (j < jlen) { + result[result.length] = value[j]; + j += 1; + } + } else { + result[result.length] = list[idx]; + } + idx += 1; + } + return result; + }; + } + + function _forceReduced(x) { + return { + '@@transducer/value': x, + '@@transducer/reduced': true + }; + } + + var preservingReduced = function(xf) { + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function(result) { + return xf['@@transducer/result'](result); + }, + '@@transducer/step': function(result, input) { + var ret = xf['@@transducer/step'](result, input); + return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret; + } + }; + }; + + var _flatCat = function _xcat(xf) { + var rxf = preservingReduced(xf); + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function(result) { + return rxf['@@transducer/result'](result); + }, + '@@transducer/step': function(result, input) { + return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input); + } + }; + }; + + var _xchain = _curry2(function _xchain(f, xf) { + return map(f, _flatCat(xf)); + }); + + /** + * `chain` maps a function over a list and concatenates the results. `chain` + * is also known as `flatMap` in some libraries. + * + * Dispatches to the `chain` method of the second argument, if present, + * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). + * + * If second argument is a function, `chain(f, g)(x)` is equivalent to `f(g(x), x)`. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain m => (a -> m b) -> m a -> m b + * @param {Function} fn The function to map with + * @param {Array} list The list to map over + * @return {Array} The result of flat-mapping `list` with `fn` + * @example + * + * const duplicate = n => [n, n]; + * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + * + * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] + */ + var chain = _curry2(_dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { + if (typeof monad === 'function') { + return function(x) { return fn(monad(x))(x); }; + } + return _makeFlat(false)(map(fn, monad)); + })); + + /** + * Restricts a number to be within a range. + * + * Also works for other ordered types such as Strings and Dates. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Relation + * @sig Ord a => a -> a -> a -> a + * @param {Number} minimum The lower limit of the clamp (inclusive) + * @param {Number} maximum The upper limit of the clamp (inclusive) + * @param {Number} value Value to be clamped + * @return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise + * @example + * + * R.clamp(1, 10, -5) // => 1 + * R.clamp(1, 10, 15) // => 10 + * R.clamp(1, 10, 4) // => 4 + */ + var clamp = _curry3(function clamp(min, max, value) { + if (min > max) { + throw new Error('min must not be greater than max in clamp(min, max, value)'); + } + return value < min + ? min + : value > max + ? max + : value; + }); + + function _cloneRegExp(pattern) { + return new RegExp(pattern.source, (pattern.global ? 'g' : '') + + (pattern.ignoreCase ? 'i' : '') + + (pattern.multiline ? 'm' : '') + + (pattern.sticky ? 'y' : '') + + (pattern.unicode ? 'u' : '')); + } + + /** + * Gives a single-word string description of the (native) type of a value, + * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not + * attempt to distinguish user Object types any further, reporting them all as + * 'Object'. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Type + * @sig (* -> {*}) -> String + * @param {*} val The value to test + * @return {String} + * @example + * + * R.type({}); //=> "Object" + * R.type(1); //=> "Number" + * R.type(false); //=> "Boolean" + * R.type('s'); //=> "String" + * R.type(null); //=> "Null" + * R.type([]); //=> "Array" + * R.type(/[A-z]/); //=> "RegExp" + * R.type(() => {}); //=> "Function" + * R.type(undefined); //=> "Undefined" + */ + var type = _curry1(function type(val) { + return val === null + ? 'Null' + : val === undefined + ? 'Undefined' + : Object.prototype.toString.call(val).slice(8, -1); + }); + + /** + * Copies an object. + * + * @private + * @param {*} value The value to be copied + * @param {Array} refFrom Array containing the source references + * @param {Array} refTo Array containing the copied source references + * @param {Boolean} deep Whether or not to perform deep cloning. + * @return {*} The copied value. + */ + function _clone(value, refFrom, refTo, deep) { + var copy = function copy(copiedValue) { + var len = refFrom.length; + var idx = 0; + while (idx < len) { + if (value === refFrom[idx]) { + return refTo[idx]; + } + idx += 1; + } + refFrom[idx + 1] = value; + refTo[idx + 1] = copiedValue; + for (var key in value) { + copiedValue[key] = deep ? + _clone(value[key], refFrom, refTo, true) : value[key]; + } + return copiedValue; + }; + switch (type(value)) { + case 'Object': return copy({}); + case 'Array': return copy([]); + case 'Date': return new Date(value.valueOf()); + case 'RegExp': return _cloneRegExp(value); + default: return value; + } + } + + /** + * Creates a deep copy of the value which may contain (nested) `Array`s and + * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are + * assigned by reference rather than copied + * + * Dispatches to a `clone` method if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {*} -> {*} + * @param {*} value The object or array to clone + * @return {*} A deeply cloned copy of `val` + * @example + * + * const objects = [{}, {}, {}]; + * const objectsClone = R.clone(objects); + * objects === objectsClone; //=> false + * objects[0] === objectsClone[0]; //=> false + */ + var clone = _curry1(function clone(value) { + return value != null && typeof value.clone === 'function' ? + value.clone() : + _clone(value, [], [], true); + }); + + /** + * Makes a comparator function out of a function that reports whether the first + * element is less than the second. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b) -> Boolean) -> ((a, b) -> Number) + * @param {Function} pred A predicate function of arity two which will return `true` if the first argument + * is less than the second, `false` otherwise + * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0` + * @example + * + * const byAge = R.comparator((a, b) => a.age < b.age); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByIncreasingAge = R.sort(byAge, people); + * //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }] + */ + var comparator = _curry1(function comparator(pred) { + return function(a, b) { + return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; + }; + }); + + /** + * A function that returns the `!` of its argument. It will return `true` when + * passed false-y value, and `false` when passed a truth-y one. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig * -> Boolean + * @param {*} a any value + * @return {Boolean} the logical inverse of passed argument. + * @see R.complement + * @example + * + * R.not(true); //=> false + * R.not(false); //=> true + * R.not(0); //=> true + * R.not(1); //=> false + */ + var not = _curry1(function not(a) { + return !a; + }); + + /** + * Takes a function `f` and returns a function `g` such that if called with the same arguments + * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. + * + * `R.complement` may be applied to any functor + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> *) -> (*... -> Boolean) + * @param {Function} f + * @return {Function} + * @see R.not + * @example + * + * const isNotNil = R.complement(R.isNil); + * isNil(null); //=> true + * isNotNil(null); //=> false + * isNil(7); //=> false + * isNotNil(7); //=> true + */ + var complement = lift(not); + + function _pipe(f, g) { + return function() { + return g.call(this, f.apply(this, arguments)); + }; + } + + /** + * This checks whether a function has a [methodname] function. If it isn't an + * array it will execute that function otherwise it will default to the ramda + * implementation. + * + * @private + * @param {Function} fn ramda implemtation + * @param {String} methodname property to check for a custom implementation + * @return {Object} Whatever the return value of the method is. + */ + function _checkForMethod(methodname, fn) { + return function() { + var length = arguments.length; + if (length === 0) { + return fn(); + } + var obj = arguments[length - 1]; + return (_isArray(obj) || typeof obj[methodname] !== 'function') ? + fn.apply(this, arguments) : + obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1)); + }; + } + + /** + * Returns the elements of the given list or string (or object with a `slice` + * method) from `fromIndex` (inclusive) to `toIndex` (exclusive). + * + * Dispatches to the `slice` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @sig Number -> Number -> String -> String + * @param {Number} fromIndex The start index (inclusive). + * @param {Number} toIndex The end index (exclusive). + * @param {*} list + * @return {*} + * @example + * + * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd'] + * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c'] + * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(0, 3, 'ramda'); //=> 'ram' + */ + var slice = _curry3(_checkForMethod('slice', function slice(fromIndex, toIndex, list) { + return Array.prototype.slice.call(list, fromIndex, toIndex); + })); + + /** + * Returns all but the first element of the given list or string (or object + * with a `tail` method). + * + * Dispatches to the `slice` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.head, R.init, R.last + * @example + * + * R.tail([1, 2, 3]); //=> [2, 3] + * R.tail([1, 2]); //=> [2] + * R.tail([1]); //=> [] + * R.tail([]); //=> [] + * + * R.tail('abc'); //=> 'bc' + * R.tail('ab'); //=> 'b' + * R.tail('a'); //=> '' + * R.tail(''); //=> '' + */ + var tail = _curry1(_checkForMethod('tail', slice(1, Infinity))); + + /** + * Performs left-to-right function composition. The first argument may have + * any arity; the remaining arguments must be unary. + * + * In some libraries this function is named `sequence`. + * + * **Note:** The result of pipe is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.compose + * @example + * + * const f = R.pipe(Math.pow, R.negate, R.inc); + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) + */ + function pipe() { + if (arguments.length === 0) { + throw new Error('pipe requires at least one argument'); + } + return _arity( + arguments[0].length, + reduce(_pipe, arguments[0], tail(arguments)) + ); + } + + /** + * Returns a new list or string with the elements or characters in reverse + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {Array|String} list + * @return {Array|String} + * @example + * + * R.reverse([1, 2, 3]); //=> [3, 2, 1] + * R.reverse([1, 2]); //=> [2, 1] + * R.reverse([1]); //=> [1] + * R.reverse([]); //=> [] + * + * R.reverse('abc'); //=> 'cba' + * R.reverse('ab'); //=> 'ba' + * R.reverse('a'); //=> 'a' + * R.reverse(''); //=> '' + */ + var reverse = _curry1(function reverse(list) { + return _isString(list) + ? list.split('').reverse().join('') + : Array.prototype.slice.call(list, 0).reverse(); + }); + + /** + * Performs right-to-left function composition. The last argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of compose is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipe + * @example + * + * const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName + * const yellGreeting = R.compose(R.toUpper, classyGreeting); + * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 + * + * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) + */ + function compose() { + if (arguments.length === 0) { + throw new Error('compose requires at least one argument'); + } + return pipe.apply(this, reverse(arguments)); + } + + /** + * Returns the right-to-left Kleisli composition of the provided functions, + * each of which must return a value of a type supported by [`chain`](#chain). + * + * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), f)`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Function + * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipeK + * @deprecated since v0.26.0 + * @example + * + * // get :: String -> Object -> Maybe * + * const get = R.curry((propName, obj) => Maybe(obj[propName])) + * + * // getStateCode :: Maybe String -> Maybe String + * const getStateCode = R.composeK( + * R.compose(Maybe.of, R.toUpper), + * get('state'), + * get('address'), + * get('user'), + * ); + * getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY") + * getStateCode({}); //=> Maybe.Nothing() + * @symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a))) + */ + function composeK() { + if (arguments.length === 0) { + throw new Error('composeK requires at least one argument'); + } + var init = Array.prototype.slice.call(arguments); + var last = init.pop(); + return compose(compose.apply(this, map(chain, init)), last); + } + + function _pipeP(f, g) { + return function() { + var ctx = this; + return f.apply(ctx, arguments).then(function(x) { + return g.call(ctx, x); + }); + }; + } + + /** + * Performs left-to-right composition of one or more Promise-returning + * functions. The first argument may have any arity; the remaining arguments + * must be unary. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z) + * @param {...Function} functions + * @return {Function} + * @see R.composeP + * @deprecated since v0.26.0 + * @example + * + * // followersForUser :: String -> Promise [User] + * const followersForUser = R.pipeP(db.getUserById, db.getFollowers); + */ + function pipeP() { + if (arguments.length === 0) { + throw new Error('pipeP requires at least one argument'); + } + return _arity( + arguments[0].length, + reduce(_pipeP, arguments[0], tail(arguments)) + ); + } + + /** + * Performs right-to-left composition of one or more Promise-returning + * functions. The last arguments may have any arity; the remaining + * arguments must be unary. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z) + * @param {...Function} functions The functions to compose + * @return {Function} + * @see R.pipeP + * @deprecated since v0.26.0 + * @example + * + * const db = { + * users: { + * JOE: { + * name: 'Joe', + * followers: ['STEVE', 'SUZY'] + * } + * } + * } + * + * // We'll pretend to do a db lookup which returns a promise + * const lookupUser = (userId) => Promise.resolve(db.users[userId]) + * const lookupFollowers = (user) => Promise.resolve(user.followers) + * lookupUser('JOE').then(lookupFollowers) + * + * // followersForUser :: String -> Promise [UserId] + * const followersForUser = R.composeP(lookupFollowers, lookupUser); + * followersForUser('JOE').then(followers => console.log('Followers:', followers)) + * // Followers: ["STEVE","SUZY"] + */ + function composeP() { + if (arguments.length === 0) { + throw new Error('composeP requires at least one argument'); + } + return pipeP.apply(this, reverse(arguments)); + } + + /** + * Returns the first element of the given list or string. In some libraries + * this function is named `first`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {Array|String} list + * @return {*} + * @see R.tail, R.init, R.last + * @example + * + * R.head(['fi', 'fo', 'fum']); //=> 'fi' + * R.head([]); //=> undefined + * + * R.head('abc'); //=> 'a' + * R.head(''); //=> '' + */ + var head = nth(0); + + function _identity(x) { return x; } + + /** + * A function that does nothing but return the parameter supplied to it. Good + * as a default or placeholder function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> a + * @param {*} x The value to return. + * @return {*} The input value, `x`. + * @example + * + * R.identity(1); //=> 1 + * + * const obj = {}; + * R.identity(obj) === obj; //=> true + * @symb R.identity(a) = a + */ + var identity = _curry1(_identity); + + /** + * Performs left-to-right function composition using transforming function. The first argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of pipeWith is not automatically curried. Transforming function is not used on the + * first argument. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((* -> *), [((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)]) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.composeWith, R.pipe + * @example + * + * const pipeWhileNotNil = R.pipeWith((f, res) => R.isNil(res) ? res : f(res)); + * const f = pipeWhileNotNil([Math.pow, R.negate, R.inc]) + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipeWith(f)([g, h, i])(...args) = f(i, f(h, g(...args))) + */ + var pipeWith = _curry2(function pipeWith(xf, list) { + if (list.length <= 0) { + return identity; + } + + var headList = head(list); + var tailList = tail(list); + + return _arity(headList.length, function() { + return _reduce( + function(result, f) { + return xf.call(this, f, result); + }, + headList.apply(this, arguments), + tailList + ); + }); + }); + + /** + * Performs right-to-left function composition using transforming function. The last argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of compose is not automatically curried. Transforming function is not used on the + * last argument. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((* -> *), [(y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)]) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.compose, R.pipeWith + * @example + * + * const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res)); + * + * composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2 + * composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined + * + * @symb R.composeWith(f)([g, h, i])(...args) = f(g, f(h, i(...args))) + */ + var composeWith = _curry2(function composeWith(xf, list) { + return pipeWith.apply(this, [xf, reverse(list)]); + }); + + function _arrayFromIterator(iter) { + var list = []; + var next; + while (!(next = iter.next()).done) { + list.push(next.value); + } + return list; + } + + function _includesWith(pred, x, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (pred(x, list[idx])) { + return true; + } + idx += 1; + } + return false; + } + + function _functionName(f) { + // String(x => x) evaluates to "x => x", so the pattern may not match. + var match = String(f).match(/^function (\w*)/); + return match == null ? '' : match[1]; + } + + // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + function _objectIs(a, b) { + // SameValue algorithm + if (a === b) { // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return a !== 0 || 1 / a === 1 / b; + } else { + // Step 6.a: NaN == NaN + return a !== a && b !== b; + } + } + + var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs; + + /** + * private _uniqContentEquals function. + * That function is checking equality of 2 iterator contents with 2 assumptions + * - iterators lengths are the same + * - iterators values are unique + * + * false-positive result will be returned for comparision of, e.g. + * - [1,2,3] and [1,2,3,4] + * - [1,1,1] and [1,2,3] + * */ + + function _uniqContentEquals(aIterator, bIterator, stackA, stackB) { + var a = _arrayFromIterator(aIterator); + var b = _arrayFromIterator(bIterator); + + function eq(_a, _b) { + return _equals(_a, _b, stackA.slice(), stackB.slice()); + } + + // if *a* array contains any element that is not included in *b* + return !_includesWith(function(b, aItem) { + return !_includesWith(eq, aItem, b); + }, b, a); + } + + function _equals(a, b, stackA, stackB) { + if (_objectIs$1(a, b)) { + return true; + } + + var typeA = type(a); + + if (typeA !== type(b)) { + return false; + } + + if (a == null || b == null) { + return false; + } + + if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') { + return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && + typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a); + } + + if (typeof a.equals === 'function' || typeof b.equals === 'function') { + return typeof a.equals === 'function' && a.equals(b) && + typeof b.equals === 'function' && b.equals(a); + } + + switch (typeA) { + case 'Arguments': + case 'Array': + case 'Object': + if (typeof a.constructor === 'function' && + _functionName(a.constructor) === 'Promise') { + return a === b; + } + break; + case 'Boolean': + case 'Number': + case 'String': + if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) { + return false; + } + break; + case 'Date': + if (!_objectIs$1(a.valueOf(), b.valueOf())) { + return false; + } + break; + case 'Error': + return a.name === b.name && a.message === b.message; + case 'RegExp': + if (!(a.source === b.source && + a.global === b.global && + a.ignoreCase === b.ignoreCase && + a.multiline === b.multiline && + a.sticky === b.sticky && + a.unicode === b.unicode)) { + return false; + } + break; + } + + var idx = stackA.length - 1; + while (idx >= 0) { + if (stackA[idx] === a) { + return stackB[idx] === b; + } + idx -= 1; + } + + switch (typeA) { + case 'Map': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b])); + case 'Set': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b])); + case 'Arguments': + case 'Array': + case 'Object': + case 'Boolean': + case 'Number': + case 'String': + case 'Date': + case 'Error': + case 'RegExp': + case 'Int8Array': + case 'Uint8Array': + case 'Uint8ClampedArray': + case 'Int16Array': + case 'Uint16Array': + case 'Int32Array': + case 'Uint32Array': + case 'Float32Array': + case 'Float64Array': + case 'ArrayBuffer': + break; + default: + // Values of other types are only equal if identical. + return false; + } + + var keysA = keys(a); + if (keysA.length !== keys(b).length) { + return false; + } + + var extendedStackA = stackA.concat([a]); + var extendedStackB = stackB.concat([b]); + + idx = keysA.length - 1; + while (idx >= 0) { + var key = keysA[idx]; + if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { + return false; + } + idx -= 1; + } + return true; + } + + /** + * Returns `true` if its arguments are equivalent, `false` otherwise. Handles + * cyclical data structures. + * + * Dispatches symmetrically to the `equals` methods of both arguments, if + * present. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> b -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * R.equals(1, 1); //=> true + * R.equals(1, '1'); //=> false + * R.equals([1, 2, 3], [1, 2, 3]); //=> true + * + * const a = {}; a.v = a; + * const b = {}; b.v = b; + * R.equals(a, b); //=> true + */ + var equals = _curry2(function equals(a, b) { + return _equals(a, b, [], []); + }); + + function _indexOf(list, a, idx) { + var inf, item; + // Array.prototype.indexOf doesn't exist below IE9 + if (typeof list.indexOf === 'function') { + switch (typeof a) { + case 'number': + if (a === 0) { + // manually crawl the list to distinguish between +0 and -0 + inf = 1 / a; + while (idx < list.length) { + item = list[idx]; + if (item === 0 && 1 / item === inf) { + return idx; + } + idx += 1; + } + return -1; + } else if (a !== a) { + // NaN + while (idx < list.length) { + item = list[idx]; + if (typeof item === 'number' && item !== item) { + return idx; + } + idx += 1; + } + return -1; + } + // non-zero numbers can utilise Set + return list.indexOf(a, idx); + + // all these types can utilise Set + case 'string': + case 'boolean': + case 'function': + case 'undefined': + return list.indexOf(a, idx); + + case 'object': + if (a === null) { + // null can utilise Set + return list.indexOf(a, idx); + } + } + } + // anything else not covered above, defer to R.equals + while (idx < list.length) { + if (equals(list[idx], a)) { + return idx; + } + idx += 1; + } + return -1; + } + + function _includes(a, list) { + return _indexOf(list, a, 0) >= 0; + } + + function _quote(s) { + var escaped = s + .replace(/\\/g, '\\\\') + .replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace + .replace(/\f/g, '\\f') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\t/g, '\\t') + .replace(/\v/g, '\\v') + .replace(/\0/g, '\\0'); + + return '"' + escaped.replace(/"/g, '\\"') + '"'; + } + + /** + * Polyfill from . + */ + var pad = function pad(n) { return (n < 10 ? '0' : '') + n; }; + + var _toISOString = typeof Date.prototype.toISOString === 'function' ? + function _toISOString(d) { + return d.toISOString(); + } : + function _toISOString(d) { + return ( + d.getUTCFullYear() + '-' + + pad(d.getUTCMonth() + 1) + '-' + + pad(d.getUTCDate()) + 'T' + + pad(d.getUTCHours()) + ':' + + pad(d.getUTCMinutes()) + ':' + + pad(d.getUTCSeconds()) + '.' + + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z' + ); + }; + + function _complement(f) { + return function() { + return !f.apply(this, arguments); + }; + } + + function _filter(fn, list) { + var idx = 0; + var len = list.length; + var result = []; + + while (idx < len) { + if (fn(list[idx])) { + result[result.length] = list[idx]; + } + idx += 1; + } + return result; + } + + function _isObject(x) { + return Object.prototype.toString.call(x) === '[object Object]'; + } + + function XFilter(f, xf) { + this.xf = xf; + this.f = f; + } + XFilter.prototype['@@transducer/init'] = _xfBase.init; + XFilter.prototype['@@transducer/result'] = _xfBase.result; + XFilter.prototype['@@transducer/step'] = function(result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; + }; + + var _xfilter = _curry2(function _xfilter(f, xf) { return new XFilter(f, xf); }); + + /** + * Takes a predicate and a `Filterable`, and returns a new filterable of the + * same type containing the members of the given filterable which satisfy the + * given predicate. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * Dispatches to the `filter` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} Filterable + * @see R.reject, R.transduce, R.addIndex + * @example + * + * const isEven = n => n % 2 === 0; + * + * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + * + * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + var filter = _curry2(_dispatchable(['filter'], _xfilter, function(pred, filterable) { + return ( + _isObject(filterable) ? + _reduce(function(acc, key) { + if (pred(filterable[key])) { + acc[key] = filterable[key]; + } + return acc; + }, {}, keys(filterable)) : + // else + _filter(pred, filterable) + ); + })); + + /** + * The complement of [`filter`](#filter). + * + * Acts as a transducer if a transformer is given in list position. Filterable + * objects include plain objects or any object that has a filter method such + * as `Array`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} + * @see R.filter, R.transduce, R.addIndex + * @example + * + * const isOdd = (n) => n % 2 === 1; + * + * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + * + * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + var reject = _curry2(function reject(pred, filterable) { + return filter(_complement(pred), filterable); + }); + + function _toString(x, seen) { + var recur = function recur(y) { + var xs = seen.concat([x]); + return _includes(y, xs) ? '' : _toString(y, xs); + }; + + // mapPairs :: (Object, [String]) -> [String] + var mapPairs = function(obj, keys$$1) { + return _map(function(k) { return _quote(k) + ': ' + recur(obj[k]); }, keys$$1.slice().sort()); + }; + + switch (Object.prototype.toString.call(x)) { + case '[object Arguments]': + return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))'; + case '[object Array]': + return '[' + _map(recur, x).concat(mapPairs(x, reject(function(k) { return /^\d+$/.test(k); }, keys(x)))).join(', ') + ']'; + case '[object Boolean]': + return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); + case '[object Date]': + return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')'; + case '[object Null]': + return 'null'; + case '[object Number]': + return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); + case '[object String]': + return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); + case '[object Undefined]': + return 'undefined'; + default: + if (typeof x.toString === 'function') { + var repr = x.toString(); + if (repr !== '[object Object]') { + return repr; + } + } + return '{' + mapPairs(x, keys(x)).join(', ') + '}'; + } + } + + /** + * Returns the string representation of the given value. `eval`'ing the output + * should result in a value equivalent to the input value. Many of the built-in + * `toString` methods do not satisfy this requirement. + * + * If the given value is an `[object Object]` with a `toString` method other + * than `Object.prototype.toString`, this method is invoked with no arguments + * to produce the return value. This means user-defined constructor functions + * can provide a suitable `toString` method. For example: + * + * function Point(x, y) { + * this.x = x; + * this.y = y; + * } + * + * Point.prototype.toString = function() { + * return 'new Point(' + this.x + ', ' + this.y + ')'; + * }; + * + * R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + * + * @func + * @memberOf R + * @since v0.14.0 + * @category String + * @sig * -> String + * @param {*} val + * @return {String} + * @example + * + * R.toString(42); //=> '42' + * R.toString('abc'); //=> '"abc"' + * R.toString([1, 2, 3]); //=> '[1, 2, 3]' + * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' + * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' + */ + var toString$1 = _curry1(function toString(val) { return _toString(val, []); }); + + /** + * Returns the result of concatenating the given lists or strings. + * + * Note: `R.concat` expects both arguments to be of the same type, + * unlike the native `Array.prototype.concat` method. It will throw + * an error if you `concat` an Array with a non-Array value. + * + * Dispatches to the `concat` method of the first argument, if present. + * Can also concatenate two members of a [fantasy-land + * compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] -> [a] + * @sig String -> String -> String + * @param {Array|String} firstList The first list + * @param {Array|String} secondList The second list + * @return {Array|String} A list consisting of the elements of `firstList` followed by the elements of + * `secondList`. + * + * @example + * + * R.concat('ABC', 'DEF'); // 'ABCDEF' + * R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + * R.concat([], []); //=> [] + */ + var concat = _curry2(function concat(a, b) { + if (_isArray(a)) { + if (_isArray(b)) { + return a.concat(b); + } + throw new TypeError(toString$1(b) + ' is not an array'); + } + if (_isString(a)) { + if (_isString(b)) { + return a + b; + } + throw new TypeError(toString$1(b) + ' is not a string'); + } + if (a != null && _isFunction(a['fantasy-land/concat'])) { + return a['fantasy-land/concat'](b); + } + if (a != null && _isFunction(a.concat)) { + return a.concat(b); + } + throw new TypeError(toString$1(a) + ' does not have a method named "concat" or "fantasy-land/concat"'); + }); + + /** + * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic. + * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments + * to `fn` are applied to each of the predicates in turn until one returns a + * "truthy" value, at which point `fn` returns the result of applying its + * arguments to the corresponding transformer. If none of the predicates + * matches, `fn` returns undefined. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Logic + * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *) + * @param {Array} pairs A list of [predicate, transformer] + * @return {Function} + * @see R.ifElse, R.unless, R.when + * @example + * + * const fn = R.cond([ + * [R.equals(0), R.always('water freezes at 0°C')], + * [R.equals(100), R.always('water boils at 100°C')], + * [R.T, temp => 'nothing special happens at ' + temp + '°C'] + * ]); + * fn(0); //=> 'water freezes at 0°C' + * fn(50); //=> 'nothing special happens at 50°C' + * fn(100); //=> 'water boils at 100°C' + */ + var cond = _curry1(function cond(pairs) { + var arity = reduce( + max, + 0, + map(function(pair) { return pair[0].length; }, pairs) + ); + return _arity(arity, function() { + var idx = 0; + while (idx < pairs.length) { + if (pairs[idx][0].apply(this, arguments)) { + return pairs[idx][1].apply(this, arguments); + } + idx += 1; + } + }); + }); + + /** + * Wraps a constructor function inside a curried function that can be called + * with the same arguments and returns the same type. The arity of the function + * returned is specified to allow using variadic constructor functions. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Function + * @sig Number -> (* -> {*}) -> (* -> {*}) + * @param {Number} n The arity of the constructor function. + * @param {Function} Fn The constructor function to wrap. + * @return {Function} A wrapped, curried constructor function. + * @example + * + * // Variadic Constructor function + * function Salad() { + * this.ingredients = arguments; + * } + * + * Salad.prototype.recipe = function() { + * const instructions = R.map(ingredient => 'Add a dollop of ' + ingredient, this.ingredients); + * return R.join('\n', instructions); + * }; + * + * const ThreeLayerSalad = R.constructN(3, Salad); + * + * // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments. + * const salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup'); + * + * console.log(salad.recipe()); + * // Add a dollop of Mayonnaise + * // Add a dollop of Potato Chips + * // Add a dollop of Ketchup + */ + var constructN = _curry2(function constructN(n, Fn) { + if (n > 10) { + throw new Error('Constructor with greater than ten arguments'); + } + if (n === 0) { + return function() { return new Fn(); }; + } + return curry(nAry(n, function($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) { + switch (arguments.length) { + case 1: return new Fn($0); + case 2: return new Fn($0, $1); + case 3: return new Fn($0, $1, $2); + case 4: return new Fn($0, $1, $2, $3); + case 5: return new Fn($0, $1, $2, $3, $4); + case 6: return new Fn($0, $1, $2, $3, $4, $5); + case 7: return new Fn($0, $1, $2, $3, $4, $5, $6); + case 8: return new Fn($0, $1, $2, $3, $4, $5, $6, $7); + case 9: return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8); + case 10: return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9); + } + })); + }); + + /** + * Wraps a constructor function inside a curried function that can be called + * with the same arguments and returns the same type. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> {*}) -> (* -> {*}) + * @param {Function} fn The constructor function to wrap. + * @return {Function} A wrapped, curried constructor function. + * @see R.invoker + * @example + * + * // Constructor function + * function Animal(kind) { + * this.kind = kind; + * }; + * Animal.prototype.sighting = function() { + * return "It's a " + this.kind + "!"; + * } + * + * const AnimalConstructor = R.construct(Animal) + * + * // Notice we no longer need the 'new' keyword: + * AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}}; + * + * const animalTypes = ["Lion", "Tiger", "Bear"]; + * const animalSighting = R.invoker(0, 'sighting'); + * const sightNewAnimal = R.compose(animalSighting, AnimalConstructor); + * R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"] + */ + var construct = _curry1(function construct(Fn) { + return constructN(Fn.length, Fn); + }); + + /** + * Returns `true` if the specified value is equal, in [`R.equals`](#equals) + * terms, to at least one element of the given list; `false` otherwise. + * Works also with strings. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Boolean + * @param {Object} a The item to compare against. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. + * @see R.includes + * @deprecated since v0.26.0 + * @example + * + * R.contains(3, [1, 2, 3]); //=> true + * R.contains(4, [1, 2, 3]); //=> false + * R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + * R.contains([42], [[42]]); //=> true + * R.contains('ba', 'banana'); //=>true + */ + var contains$1 = _curry2(_includes); + + /** + * Accepts a converging function and a list of branching functions and returns + * a new function. The arity of the new function is the same as the arity of + * the longest branching function. When invoked, this new function is applied + * to some arguments, and each branching function is applied to those same + * arguments. The results of each branching function are passed as arguments + * to the converging function to produce the return value. + * + * @func + * @memberOf R + * @since v0.4.2 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} after A function. `after` will be invoked with the return values of + * `fn1` and `fn2` as its arguments. + * @param {Array} functions A list of functions. + * @return {Function} A new function. + * @see R.useWith + * @example + * + * const average = R.converge(R.divide, [R.sum, R.length]) + * average([1, 2, 3, 4, 5, 6, 7]) //=> 4 + * + * const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]) + * strangeConcat("Yodel") //=> "YODELyodel" + * + * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) + */ + var converge = _curry2(function converge(after, fns) { + return curryN(reduce(max, 0, pluck('length', fns)), function() { + var args = arguments; + var context = this; + return after.apply(context, _map(function(fn) { + return fn.apply(context, args); + }, fns)); + }); + }); + + function XReduceBy(valueFn, valueAcc, keyFn, xf) { + this.valueFn = valueFn; + this.valueAcc = valueAcc; + this.keyFn = keyFn; + this.xf = xf; + this.inputs = {}; + } + XReduceBy.prototype['@@transducer/init'] = _xfBase.init; + XReduceBy.prototype['@@transducer/result'] = function(result) { + var key; + for (key in this.inputs) { + if (_has(key, this.inputs)) { + result = this.xf['@@transducer/step'](result, this.inputs[key]); + if (result['@@transducer/reduced']) { + result = result['@@transducer/value']; + break; + } + } + } + this.inputs = null; + return this.xf['@@transducer/result'](result); + }; + XReduceBy.prototype['@@transducer/step'] = function(result, input) { + var key = this.keyFn(input); + this.inputs[key] = this.inputs[key] || [key, this.valueAcc]; + this.inputs[key][1] = this.valueFn(this.inputs[key][1], input); + return result; + }; + + var _xreduceBy = _curryN(4, [], + function _xreduceBy(valueFn, valueAcc, keyFn, xf) { + return new XReduceBy(valueFn, valueAcc, keyFn, xf); + } + ); + + /** + * Groups the elements of the list according to the result of calling + * the String-returning function `keyFn` on each element and reduces the elements + * of each group to a single value via the reducer function `valueFn`. + * + * This function is basically a more general [`groupBy`](#groupBy) function. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category List + * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} + * @param {Function} valueFn The function that reduces the elements of each group to a single + * value. Receives two values, accumulator for a particular group and the current element. + * @param {*} acc The (initial) accumulator value for each group. + * @param {Function} keyFn The function that maps the list's element into a key. + * @param {Array} list The array to group. + * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of + * `valueFn` for elements which produced that key when passed to `keyFn`. + * @see R.groupBy, R.reduce + * @example + * + * const groupNames = (acc, {name}) => acc.concat(name) + * const toGrade = ({score}) => + * score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A' + * + * var students = [ + * {name: 'Abby', score: 83}, + * {name: 'Bart', score: 62}, + * {name: 'Curt', score: 88}, + * {name: 'Dora', score: 92}, + * ] + * + * reduceBy(groupNames, [], toGrade, students) + * //=> {"A": ["Dora"], "B": ["Abby", "Curt"], "F": ["Bart"]} + */ + var reduceBy = _curryN(4, [], _dispatchable([], _xreduceBy, + function reduceBy(valueFn, valueAcc, keyFn, list) { + return _reduce(function(acc, elt) { + var key = keyFn(elt); + acc[key] = valueFn(_has(key, acc) ? acc[key] : _clone(valueAcc, [], [], false), elt); + return acc; + }, {}, list); + })); + + /** + * Counts the elements of a list according to how many match each value of a + * key generated by the supplied function. Returns an object mapping the keys + * produced by `fn` to the number of occurrences in the list. Note that all + * keys are coerced to strings because of how JavaScript objects work. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig (a -> String) -> [a] -> {*} + * @param {Function} fn The function used to map values to keys. + * @param {Array} list The list to count elements from. + * @return {Object} An object mapping keys to number of occurrences in the list. + * @example + * + * const numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; + * R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + * + * const letters = ['a', 'b', 'A', 'a', 'B', 'c']; + * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} + */ + var countBy = reduceBy(function(acc, elem) { return acc + 1; }, 0); + + /** + * Decrements its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n - 1 + * @see R.inc + * @example + * + * R.dec(42); //=> 41 + */ + var dec = add(-1); + + /** + * Returns the second argument if it is not `null`, `undefined` or `NaN`; + * otherwise the first argument is returned. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Logic + * @sig a -> b -> a | b + * @param {a} default The default value. + * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`. + * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value + * @example + * + * const defaultTo42 = R.defaultTo(42); + * + * defaultTo42(null); //=> 42 + * defaultTo42(undefined); //=> 42 + * defaultTo42(false); //=> false + * defaultTo42('Ramda'); //=> 'Ramda' + * // parseInt('string') results in NaN + * defaultTo42(parseInt('string')); //=> 42 + */ + var defaultTo = _curry2(function defaultTo(d, v) { + return v == null || v !== v ? d : v; + }); + + /** + * Makes a descending comparator function out of a function that returns a value + * that can be compared with `<` and `>`. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Function + * @sig Ord b => (a -> b) -> a -> a -> Number + * @param {Function} fn A function of arity one that returns a value that can be compared + * @param {*} a The first item to be compared. + * @param {*} b The second item to be compared. + * @return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0` + * @see R.ascend + * @example + * + * const byAge = R.descend(R.prop('age')); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByOldestFirst = R.sort(byAge, people); + * //=> [{ name: 'Peter', age: 78 }, { name: 'Emma', age: 70 }, { name: 'Mikhail', age: 62 }] + */ + var descend = _curry3(function descend(fn, a, b) { + var aa = fn(a); + var bb = fn(b); + return aa > bb ? -1 : aa < bb ? 1 : 0; + }); + + function _Set() { + /* globals Set */ + this._nativeSet = typeof Set === 'function' ? new Set() : null; + this._items = {}; + } + + // until we figure out why jsdoc chokes on this + // @param item The item to add to the Set + // @returns {boolean} true if the item did not exist prior, otherwise false + // + _Set.prototype.add = function(item) { + return !hasOrAdd(item, true, this); + }; + + // + // @param item The item to check for existence in the Set + // @returns {boolean} true if the item exists in the Set, otherwise false + // + _Set.prototype.has = function(item) { + return hasOrAdd(item, false, this); + }; + + // + // Combines the logic for checking whether an item is a member of the set and + // for adding a new item to the set. + // + // @param item The item to check or add to the Set instance. + // @param shouldAdd If true, the item will be added to the set if it doesn't + // already exist. + // @param set The set instance to check or add to. + // @return {boolean} true if the item already existed, otherwise false. + // + function hasOrAdd(item, shouldAdd, set) { + var type = typeof item; + var prevSize, newSize; + switch (type) { + case 'string': + case 'number': + // distinguish between +0 and -0 + if (item === 0 && 1 / item === -Infinity) { + if (set._items['-0']) { + return true; + } else { + if (shouldAdd) { + set._items['-0'] = true; + } + return false; + } + } + // these types can all utilise the native Set + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + set._nativeSet.add(item); + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = {}; + set._items[type][item] = true; + } + return false; + } else if (item in set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type][item] = true; + } + return false; + } + } + + case 'boolean': + // set._items['boolean'] holds a two element array + // representing [ falseExists, trueExists ] + if (type in set._items) { + var bIdx = item ? 1 : 0; + if (set._items[type][bIdx]) { + return true; + } else { + if (shouldAdd) { + set._items[type][bIdx] = true; + } + return false; + } + } else { + if (shouldAdd) { + set._items[type] = item ? [false, true] : [true, false]; + } + return false; + } + + case 'function': + // compare functions for reference equality + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + set._nativeSet.add(item); + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + return false; + } + if (!_includes(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + return false; + } + return true; + } + + case 'undefined': + if (set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type] = true; + } + return false; + } + + case 'object': + if (item === null) { + if (!set._items['null']) { + if (shouldAdd) { + set._items['null'] = true; + } + return false; + } + return true; + } + /* falls through */ + default: + // reduce the search size of heterogeneous sets by creating buckets + // for each type. + type = Object.prototype.toString.call(item); + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + return false; + } + // scan through all previously applied items + if (!_includes(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + return false; + } + return true; + } + } + + /** + * Finds the set (i.e. no duplicates) of all elements in the first list not + * contained in the second list. Objects and Arrays are compared in terms of + * value equality, not reference equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` that are not in `list2`. + * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without + * @example + * + * R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2] + * R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5] + * R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}] + */ + var difference = _curry2(function difference(first, second) { + var out = []; + var idx = 0; + var firstLen = first.length; + var secondLen = second.length; + var toFilterOut = new _Set(); + + for (var i = 0; i < secondLen; i += 1) { + toFilterOut.add(second[i]); + } + + while (idx < firstLen) { + if (toFilterOut.add(first[idx])) { + out[out.length] = first[idx]; + } + idx += 1; + } + return out; + }); + + /** + * Finds the set (i.e. no duplicates) of all elements in the first list not + * contained in the second list. Duplication is determined according to the + * value returned by applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` that are not in `list2`. + * @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith + * @example + * + * const cmp = (x, y) => x.a === y.a; + * const l1 = [{a: 1}, {a: 2}, {a: 3}]; + * const l2 = [{a: 3}, {a: 4}]; + * R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] + */ + var differenceWith = _curry3(function differenceWith(pred, first, second) { + var out = []; + var idx = 0; + var firstLen = first.length; + while (idx < firstLen) { + if (!_includesWith(pred, first[idx], second) && + !_includesWith(pred, first[idx], out)) { + out.push(first[idx]); + } + idx += 1; + } + return out; + }); + + /** + * Returns a new object that does not contain a `prop` property. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Object + * @sig String -> {k: v} -> {k: v} + * @param {String} prop The name of the property to dissociate + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original but without the specified property + * @see R.assoc, R.omit + * @example + * + * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3} + */ + var dissoc = _curry2(function dissoc(prop, obj) { + var result = {}; + for (var p in obj) { + result[p] = obj[p]; + } + delete result[prop]; + return result; + }); + + /** + * Removes the sub-list of `list` starting at index `start` and containing + * `count` elements. _Note that this is not destructive_: it returns a copy of + * the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.2.2 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @param {Number} start The position to start removing elements + * @param {Number} count The number of elements to remove + * @param {Array} list The list to remove from + * @return {Array} A new Array with `count` elements from `start` removed. + * @see R.without + * @example + * + * R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8] + */ + var remove = _curry3(function remove(start, count, list) { + var result = Array.prototype.slice.call(list, 0); + result.splice(start, count); + return result; + }); + + /** + * Returns a new copy of the array with the element at the provided index + * replaced with the given value. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig Number -> a -> [a] -> [a] + * @param {Number} idx The index to update. + * @param {*} x The value to exist at the given index of the returned array. + * @param {Array|Arguments} list The source array-like object to be updated. + * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`. + * @see R.adjust + * @example + * + * R.update(1, '_', ['a', 'b', 'c']); //=> ['a', '_', 'c'] + * R.update(-1, '_', ['a', 'b', 'c']); //=> ['a', 'b', '_'] + * @symb R.update(-1, a, [b, c]) = [b, a] + * @symb R.update(0, a, [b, c]) = [a, c] + * @symb R.update(1, a, [b, c]) = [b, a] + */ + var update = _curry3(function update(idx, x, list) { + return adjust(idx, always(x), list); + }); + + /** + * Makes a shallow clone of an object, omitting the property at the given path. + * Note that this copies and flattens prototype properties onto the new object + * as well. All non-primitive properties are copied by reference. + * + * @func + * @memberOf R + * @since v0.11.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {k: v} -> {k: v} + * @param {Array} path The path to the value to omit + * @param {Object} obj The object to clone + * @return {Object} A new object without the property at path + * @see R.assocPath + * @example + * + * R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} + */ + var dissocPath = _curry2(function dissocPath(path, obj) { + switch (path.length) { + case 0: + return obj; + case 1: + return _isInteger(path[0]) && _isArray(obj) ? remove(path[0], 1, obj) : dissoc(path[0], obj); + default: + var head = path[0]; + var tail = Array.prototype.slice.call(path, 1); + if (obj[head] == null) { + return obj; + } else if (_isInteger(head) && _isArray(obj)) { + return update(head, dissocPath(tail, obj[head]), obj); + } else { + return assoc(head, dissocPath(tail, obj[head]), obj); + } + } + }); + + /** + * Divides two numbers. Equivalent to `a / b`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a / b`. + * @see R.multiply + * @example + * + * R.divide(71, 100); //=> 0.71 + * + * const half = R.divide(R.__, 2); + * half(42); //=> 21 + * + * const reciprocal = R.divide(1); + * reciprocal(4); //=> 0.25 + */ + var divide = _curry2(function divide(a, b) { return a / b; }); + + function XDrop(n, xf) { + this.xf = xf; + this.n = n; + } + XDrop.prototype['@@transducer/init'] = _xfBase.init; + XDrop.prototype['@@transducer/result'] = _xfBase.result; + XDrop.prototype['@@transducer/step'] = function(result, input) { + if (this.n > 0) { + this.n -= 1; + return result; + } + return this.xf['@@transducer/step'](result, input); + }; + + var _xdrop = _curry2(function _xdrop(n, xf) { return new XDrop(n, xf); }); + + /** + * Returns all but the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `drop` method). + * + * Dispatches to the `drop` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} A copy of list without the first `n` elements + * @see R.take, R.transduce, R.dropLast, R.dropWhile + * @example + * + * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz'] + * R.drop(3, ['foo', 'bar', 'baz']); //=> [] + * R.drop(4, ['foo', 'bar', 'baz']); //=> [] + * R.drop(3, 'ramda'); //=> 'da' + */ + var drop = _curry2(_dispatchable(['drop'], _xdrop, function drop(n, xs) { + return slice(Math.max(0, n), Infinity, xs); + })); + + function XTake(n, xf) { + this.xf = xf; + this.n = n; + this.i = 0; + } + XTake.prototype['@@transducer/init'] = _xfBase.init; + XTake.prototype['@@transducer/result'] = _xfBase.result; + XTake.prototype['@@transducer/step'] = function(result, input) { + this.i += 1; + var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input); + return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret; + }; + + var _xtake = _curry2(function _xtake(n, xf) { return new XTake(n, xf); }); + + /** + * Returns the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `take` method). + * + * Dispatches to the `take` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} + * @see R.drop + * @example + * + * R.take(1, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(3, 'ramda'); //=> 'ram' + * + * const personnel = [ + * 'Dave Brubeck', + * 'Paul Desmond', + * 'Eugene Wright', + * 'Joe Morello', + * 'Gerry Mulligan', + * 'Bob Bates', + * 'Joe Dodge', + * 'Ron Crotty' + * ]; + * + * const takeFive = R.take(5); + * takeFive(personnel); + * //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan'] + * @symb R.take(-1, [a, b]) = [a, b] + * @symb R.take(0, [a, b]) = [] + * @symb R.take(1, [a, b]) = [a] + * @symb R.take(2, [a, b]) = [a, b] + */ + var take = _curry2(_dispatchable(['take'], _xtake, function take(n, xs) { + return slice(0, n < 0 ? Infinity : n, xs); + })); + + function dropLast(n, xs) { + return take(n < xs.length ? xs.length - n : 0, xs); + } + + function XDropLast(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + XDropLast.prototype['@@transducer/init'] = _xfBase.init; + XDropLast.prototype['@@transducer/result'] = function(result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + XDropLast.prototype['@@transducer/step'] = function(result, input) { + if (this.full) { + result = this.xf['@@transducer/step'](result, this.acc[this.pos]); + } + this.store(input); + return result; + }; + XDropLast.prototype.store = function(input) { + this.acc[this.pos] = input; + this.pos += 1; + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + + var _xdropLast = _curry2(function _xdropLast(n, xf) { return new XDropLast(n, xf); }); + + /** + * Returns a list containing all but the last `n` elements of the given `list`. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements of `list` to skip. + * @param {Array} list The list of elements to consider. + * @return {Array} A copy of the list with only the first `list.length - n` elements + * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile + * @example + * + * R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.dropLast(3, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(4, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(3, 'ramda'); //=> 'ra' + */ + var dropLast$1 = _curry2(_dispatchable([], _xdropLast, dropLast)); + + function dropLastWhile(pred, xs) { + var idx = xs.length - 1; + while (idx >= 0 && pred(xs[idx])) { + idx -= 1; + } + return slice(0, idx + 1, xs); + } + + function XDropLastWhile(fn, xf) { + this.f = fn; + this.retained = []; + this.xf = xf; + } + XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init; + XDropLastWhile.prototype['@@transducer/result'] = function(result) { + this.retained = null; + return this.xf['@@transducer/result'](result); + }; + XDropLastWhile.prototype['@@transducer/step'] = function(result, input) { + return this.f(input) + ? this.retain(result, input) + : this.flush(result, input); + }; + XDropLastWhile.prototype.flush = function(result, input) { + result = _reduce( + this.xf['@@transducer/step'], + result, + this.retained + ); + this.retained = []; + return this.xf['@@transducer/step'](result, input); + }; + XDropLastWhile.prototype.retain = function(result, input) { + this.retained.push(input); + return result; + }; + + var _xdropLastWhile = _curry2(function _xdropLastWhile(fn, xf) { return new XDropLastWhile(fn, xf); }); + + /** + * Returns a new list excluding all the tailing elements of a given list which + * satisfy the supplied predicate function. It passes each value from the right + * to the supplied predicate function, skipping elements until the predicate + * function returns a `falsy` value. The predicate function is applied to one argument: + * *(value)*. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} predicate The function to be called on each element + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`. + * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile + * @example + * + * const lteThree = x => x <= 3; + * + * R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4] + * + * R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd' + */ + var dropLastWhile$1 = _curry2(_dispatchable([], _xdropLastWhile, dropLastWhile)); + + function XDropRepeatsWith(pred, xf) { + this.xf = xf; + this.pred = pred; + this.lastValue = undefined; + this.seenFirstValue = false; + } + + XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; + XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; + XDropRepeatsWith.prototype['@@transducer/step'] = function(result, input) { + var sameAsLast = false; + if (!this.seenFirstValue) { + this.seenFirstValue = true; + } else if (this.pred(this.lastValue, input)) { + sameAsLast = true; + } + this.lastValue = input; + return sameAsLast ? result : this.xf['@@transducer/step'](result, input); + }; + + var _xdropRepeatsWith = _curry2(function _xdropRepeatsWith(pred, xf) { return new XDropRepeatsWith(pred, xf); }); + + /** + * Returns the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.init, R.head, R.tail + * @example + * + * R.last(['fi', 'fo', 'fum']); //=> 'fum' + * R.last([]); //=> undefined + * + * R.last('abc'); //=> 'c' + * R.last(''); //=> '' + */ + var last = nth(-1); + + /** + * Returns a new list without any consecutively repeating elements. Equality is + * determined by applying the supplied predicate to each pair of consecutive elements. The + * first element in a series of equal elements will be preserved. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] + */ + var dropRepeatsWith = _curry2(_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { + var result = []; + var idx = 1; + var len = list.length; + if (len !== 0) { + result[0] = list[0]; + while (idx < len) { + if (!pred(last(result), list[idx])) { + result[result.length] = list[idx]; + } + idx += 1; + } + } + return result; + })); + + /** + * Returns a new list without any consecutively repeating elements. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] + */ + var dropRepeats = _curry1( + _dispatchable([], _xdropRepeatsWith(equals), dropRepeatsWith(equals)) + ); + + function XDropWhile(f, xf) { + this.xf = xf; + this.f = f; + } + XDropWhile.prototype['@@transducer/init'] = _xfBase.init; + XDropWhile.prototype['@@transducer/result'] = _xfBase.result; + XDropWhile.prototype['@@transducer/step'] = function(result, input) { + if (this.f) { + if (this.f(input)) { + return result; + } + this.f = null; + } + return this.xf['@@transducer/step'](result, input); + }; + + var _xdropWhile = _curry2(function _xdropWhile(f, xf) { return new XDropWhile(f, xf); }); + + /** + * Returns a new list excluding the leading elements of a given list which + * satisfy the supplied predicate function. It passes each value to the supplied + * predicate function, skipping elements while the predicate function returns + * `true`. The predicate function is applied to one argument: *(value)*. + * + * Dispatches to the `dropWhile` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.takeWhile, R.transduce, R.addIndex + * @example + * + * const lteTwo = x => x <= 2; + * + * R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1] + * + * R.dropWhile(x => x !== 'd' , 'Ramda'); //=> 'da' + */ + var dropWhile = _curry2(_dispatchable(['dropWhile'], _xdropWhile, function dropWhile(pred, xs) { + var idx = 0; + var len = xs.length; + while (idx < len && pred(xs[idx])) { + idx += 1; + } + return slice(idx, Infinity, xs); + })); + + /** + * Returns `true` if one or both of its arguments are `true`. Returns `false` + * if both arguments are `false`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> b -> a | b + * @param {Any} a + * @param {Any} b + * @return {Any} the first argument if truthy, otherwise the second argument. + * @see R.either, R.xor + * @example + * + * R.or(true, true); //=> true + * R.or(true, false); //=> true + * R.or(false, true); //=> true + * R.or(false, false); //=> false + */ + var or = _curry2(function or(a, b) { + return a || b; + }); + + /** + * A function wrapping calls to the two functions in an `||` operation, + * returning the result of the first function if it is truth-y and the result + * of the second function otherwise. Note that this is short-circuited, + * meaning that the second function will not be invoked if the first returns a + * truth-y value. + * + * In addition to functions, `R.either` also accepts any fantasy-land compatible + * applicative functor. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) + * @param {Function} f a predicate + * @param {Function} g another predicate + * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together. + * @see R.or + * @example + * + * const gt10 = x => x > 10; + * const even = x => x % 2 === 0; + * const f = R.either(gt10, even); + * f(101); //=> true + * f(8); //=> true + * + * R.either(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(55) + * R.either([false, false, 'a'], [11]) // => [11, 11, "a"] + */ + var either = _curry2(function either(f, g) { + return _isFunction(f) ? + function _either() { + return f.apply(this, arguments) || g.apply(this, arguments); + } : + lift(or)(f, g); + }); + + /** + * Returns the empty value of its argument's type. Ramda defines the empty + * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other + * types are supported if they define `.empty`, + * `.prototype.empty` or implement the + * [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid). + * + * Dispatches to the `empty` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig a -> a + * @param {*} x + * @return {*} + * @example + * + * R.empty(Just(42)); //=> Nothing() + * R.empty([1, 2, 3]); //=> [] + * R.empty('unicorns'); //=> '' + * R.empty({x: 1, y: 2}); //=> {} + */ + var empty = _curry1(function empty(x) { + return ( + (x != null && typeof x['fantasy-land/empty'] === 'function') + ? x['fantasy-land/empty']() + : (x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function') + ? x.constructor['fantasy-land/empty']() + : (x != null && typeof x.empty === 'function') + ? x.empty() + : (x != null && x.constructor != null && typeof x.constructor.empty === 'function') + ? x.constructor.empty() + : _isArray(x) + ? [] + : _isString(x) + ? '' + : _isObject(x) + ? {} + : _isArguments(x) + ? (function() { return arguments; }()) + : void 0 // else + ); + }); + + /** + * Returns a new list containing the last `n` elements of the given list. + * If `n > list.length`, returns a list of `list.length` elements. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements to return. + * @param {Array} xs The collection to consider. + * @return {Array} + * @see R.dropLast + * @example + * + * R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] + * R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + * R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.takeLast(3, 'ramda'); //=> 'mda' + */ + var takeLast = _curry2(function takeLast(n, xs) { + return drop(n >= 0 ? xs.length - n : 0, xs); + }); + + /** + * Checks if a list ends with the provided sublist. + * + * Similarly, checks if a string ends with the provided substring. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category List + * @sig [a] -> [a] -> Boolean + * @sig String -> String -> Boolean + * @param {*} suffix + * @param {*} list + * @return {Boolean} + * @see R.startsWith + * @example + * + * R.endsWith('c', 'abc') //=> true + * R.endsWith('b', 'abc') //=> false + * R.endsWith(['c'], ['a', 'b', 'c']) //=> true + * R.endsWith(['b'], ['a', 'b', 'c']) //=> false + */ + var endsWith = _curry2(function(suffix, list) { + return equals(takeLast(suffix.length, list), suffix); + }); + + /** + * Takes a function and two values in its domain and returns `true` if the + * values map to the same value in the codomain; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Relation + * @sig (a -> b) -> a -> a -> Boolean + * @param {Function} f + * @param {*} x + * @param {*} y + * @return {Boolean} + * @example + * + * R.eqBy(Math.abs, 5, -5); //=> true + */ + var eqBy = _curry3(function eqBy(f, x, y) { + return equals(f(x), f(y)); + }); + + /** + * Reports whether two objects have the same value, in [`R.equals`](#equals) + * terms, for the specified property. Useful as a curried predicate. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig k -> {k: v} -> {k: v} -> Boolean + * @param {String} prop The name of the property to compare + * @param {Object} obj1 + * @param {Object} obj2 + * @return {Boolean} + * + * @example + * + * const o1 = { a: 1, b: 2, c: 3, d: 4 }; + * const o2 = { a: 10, b: 20, c: 3, d: 40 }; + * R.eqProps('a', o1, o2); //=> false + * R.eqProps('c', o1, o2); //=> true + */ + var eqProps = _curry3(function eqProps(prop, obj1, obj2) { + return equals(obj1[prop], obj2[prop]); + }); + + /** + * Creates a new object by recursively evolving a shallow copy of `object`, + * according to the `transformation` functions. All non-primitive properties + * are copied by reference. + * + * A `transformation` function will not be invoked if its corresponding key + * does not exist in the evolved object. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {k: (v -> v)} -> {k: v} -> {k: v} + * @param {Object} transformations The object specifying transformation functions to apply + * to the object. + * @param {Object} object The object to be transformed. + * @return {Object} The transformed object. + * @example + * + * const tomato = {firstName: ' Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; + * const transformations = { + * firstName: R.trim, + * lastName: R.trim, // Will not get invoked. + * data: {elapsed: R.add(1), remaining: R.add(-1)} + * }; + * R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} + */ + var evolve = _curry2(function evolve(transformations, object) { + var result = object instanceof Array ? [] : {}; + var transformation, key, type; + for (key in object) { + transformation = transformations[key]; + type = typeof transformation; + result[key] = type === 'function' + ? transformation(object[key]) + : transformation && type === 'object' + ? evolve(transformation, object[key]) + : object[key]; + } + return result; + }); + + function XFind(f, xf) { + this.xf = xf; + this.f = f; + this.found = false; + } + XFind.prototype['@@transducer/init'] = _xfBase.init; + XFind.prototype['@@transducer/result'] = function(result) { + if (!this.found) { + result = this.xf['@@transducer/step'](result, void 0); + } + return this.xf['@@transducer/result'](result); + }; + XFind.prototype['@@transducer/step'] = function(result, input) { + if (this.f(input)) { + this.found = true; + result = _reduced(this.xf['@@transducer/step'](result, input)); + } + return result; + }; + + var _xfind = _curry2(function _xfind(f, xf) { return new XFind(f, xf); }); + + /** + * Returns the first element of the list which matches the predicate, or + * `undefined` if no element matches. + * + * Dispatches to the `find` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> a | undefined + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Object} The element found, or `undefined`. + * @see R.transduce + * @example + * + * const xs = [{a: 1}, {a: 2}, {a: 3}]; + * R.find(R.propEq('a', 2))(xs); //=> {a: 2} + * R.find(R.propEq('a', 4))(xs); //=> undefined + */ + var find = _curry2(_dispatchable(['find'], _xfind, function find(fn, list) { + var idx = 0; + var len = list.length; + while (idx < len) { + if (fn(list[idx])) { + return list[idx]; + } + idx += 1; + } + })); + + function XFindIndex(f, xf) { + this.xf = xf; + this.f = f; + this.idx = -1; + this.found = false; + } + XFindIndex.prototype['@@transducer/init'] = _xfBase.init; + XFindIndex.prototype['@@transducer/result'] = function(result) { + if (!this.found) { + result = this.xf['@@transducer/step'](result, -1); + } + return this.xf['@@transducer/result'](result); + }; + XFindIndex.prototype['@@transducer/step'] = function(result, input) { + this.idx += 1; + if (this.f(input)) { + this.found = true; + result = _reduced(this.xf['@@transducer/step'](result, this.idx)); + } + return result; + }; + + var _xfindIndex = _curry2(function _xfindIndex(f, xf) { return new XFindIndex(f, xf); }); + + /** + * Returns the index of the first element of the list which matches the + * predicate, or `-1` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> Number + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Number} The index of the element found, or `-1`. + * @see R.transduce + * @example + * + * const xs = [{a: 1}, {a: 2}, {a: 3}]; + * R.findIndex(R.propEq('a', 2))(xs); //=> 1 + * R.findIndex(R.propEq('a', 4))(xs); //=> -1 + */ + var findIndex = _curry2(_dispatchable([], _xfindIndex, function findIndex(fn, list) { + var idx = 0; + var len = list.length; + while (idx < len) { + if (fn(list[idx])) { + return idx; + } + idx += 1; + } + return -1; + })); + + function XFindLast(f, xf) { + this.xf = xf; + this.f = f; + } + XFindLast.prototype['@@transducer/init'] = _xfBase.init; + XFindLast.prototype['@@transducer/result'] = function(result) { + return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last)); + }; + XFindLast.prototype['@@transducer/step'] = function(result, input) { + if (this.f(input)) { + this.last = input; + } + return result; + }; + + var _xfindLast = _curry2(function _xfindLast(f, xf) { return new XFindLast(f, xf); }); + + /** + * Returns the last element of the list which matches the predicate, or + * `undefined` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> a | undefined + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Object} The element found, or `undefined`. + * @see R.transduce + * @example + * + * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; + * R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} + * R.findLast(R.propEq('a', 4))(xs); //=> undefined + */ + var findLast = _curry2(_dispatchable([], _xfindLast, function findLast(fn, list) { + var idx = list.length - 1; + while (idx >= 0) { + if (fn(list[idx])) { + return list[idx]; + } + idx -= 1; + } + })); + + function XFindLastIndex(f, xf) { + this.xf = xf; + this.f = f; + this.idx = -1; + this.lastIdx = -1; + } + XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init; + XFindLastIndex.prototype['@@transducer/result'] = function(result) { + return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx)); + }; + XFindLastIndex.prototype['@@transducer/step'] = function(result, input) { + this.idx += 1; + if (this.f(input)) { + this.lastIdx = this.idx; + } + return result; + }; + + var _xfindLastIndex = _curry2(function _xfindLastIndex(f, xf) { return new XFindLastIndex(f, xf); }); + + /** + * Returns the index of the last element of the list which matches the + * predicate, or `-1` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> Number + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Number} The index of the element found, or `-1`. + * @see R.transduce + * @example + * + * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; + * R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 + * R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 + */ + var findLastIndex = _curry2(_dispatchable([], _xfindLastIndex, function findLastIndex(fn, list) { + var idx = list.length - 1; + while (idx >= 0) { + if (fn(list[idx])) { + return idx; + } + idx -= 1; + } + return -1; + })); + + /** + * Returns a new list by pulling every item out of it (and all its sub-arrays) + * and putting them in a new array, depth-first. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] + * @param {Array} list The array to consider. + * @return {Array} The flattened list. + * @see R.unnest + * @example + * + * R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]); + * //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + */ + var flatten = _curry1(_makeFlat(true)); + + /** + * Returns a new function much like the supplied one, except that the first two + * arguments' order is reversed. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b, c, ...) -> z) -> (b -> a -> c -> ... -> z) + * @param {Function} fn The function to invoke with its first two parameters reversed. + * @return {*} The result of invoking `fn` with its first two parameters' order reversed. + * @example + * + * const mergeThree = (a, b, c) => [].concat(a, b, c); + * + * mergeThree(1, 2, 3); //=> [1, 2, 3] + * + * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] + * @symb R.flip(f)(a, b, c) = f(b, a, c) + */ + var flip = _curry1(function flip(fn) { + return curryN(fn.length, function(a, b) { + var args = Array.prototype.slice.call(arguments, 0); + args[0] = b; + args[1] = a; + return fn.apply(this, args); + }); + }); + + /** + * Iterate over an input `list`, calling a provided function `fn` for each + * element in the list. + * + * `fn` receives one argument: *(value)*. + * + * Note: `R.forEach` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.forEach` method. For more + * details on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description + * + * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns + * the original array. In some libraries this function is named `each`. + * + * Dispatches to the `forEach` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> *) -> [a] -> [a] + * @param {Function} fn The function to invoke. Receives one argument, `value`. + * @param {Array} list The list to iterate over. + * @return {Array} The original list. + * @see R.addIndex + * @example + * + * const printXPlusFive = x => console.log(x + 5); + * R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3] + * // logs 6 + * // logs 7 + * // logs 8 + * @symb R.forEach(f, [a, b, c]) = [a, b, c] + */ + var forEach = _curry2(_checkForMethod('forEach', function forEach(fn, list) { + var len = list.length; + var idx = 0; + while (idx < len) { + fn(list[idx]); + idx += 1; + } + return list; + })); + + /** + * Iterate over an input `object`, calling a provided function `fn` for each + * key and value in the object. + * + * `fn` receives three argument: *(value, key, obj)*. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Object + * @sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a + * @param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`. + * @param {Object} obj The object to iterate over. + * @return {Object} The original object. + * @example + * + * const printKeyConcatValue = (value, key) => console.log(key + ':' + value); + * R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2} + * // logs x:1 + * // logs y:2 + * @symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b} + */ + var forEachObjIndexed = _curry2(function forEachObjIndexed(fn, obj) { + var keyList = keys(obj); + var idx = 0; + while (idx < keyList.length) { + var key = keyList[idx]; + fn(obj[key], key, obj); + idx += 1; + } + return obj; + }); + + /** + * Creates a new object from a list key-value pairs. If a key appears in + * multiple pairs, the rightmost pair is included in the object. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [[k,v]] -> {k: v} + * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object. + * @return {Object} The object made by pairing up `keys` and `values`. + * @see R.toPairs, R.pair + * @example + * + * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} + */ + var fromPairs = _curry1(function fromPairs(pairs) { + var result = {}; + var idx = 0; + while (idx < pairs.length) { + result[pairs[idx][0]] = pairs[idx][1]; + idx += 1; + } + return result; + }); + + /** + * Splits a list into sub-lists stored in an object, based on the result of + * calling a String-returning function on each element, and grouping the + * results according to values returned. + * + * Dispatches to the `groupBy` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> String) -> [a] -> {String: [a]} + * @param {Function} fn Function :: a -> String + * @param {Array} list The array to group + * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements + * that produced that key when passed to `fn`. + * @see R.reduceBy, R.transduce + * @example + * + * const byGrade = R.groupBy(function(student) { + * const score = student.score; + * return score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A'; + * }); + * const students = [{name: 'Abby', score: 84}, + * {name: 'Eddy', score: 58}, + * // ... + * {name: 'Jack', score: 69}]; + * byGrade(students); + * // { + * // 'A': [{name: 'Dianne', score: 99}], + * // 'B': [{name: 'Abby', score: 84}] + * // // ..., + * // 'F': [{name: 'Eddy', score: 58}] + * // } + */ + var groupBy = _curry2(_checkForMethod('groupBy', reduceBy(function(acc, item) { + if (acc == null) { + acc = []; + } + acc.push(item); + return acc; + }, null))); + + /** + * Takes a list and returns a list of lists where each sublist's elements are + * all satisfied pairwise comparison according to the provided function. + * Only adjacent elements are passed to the comparison function. + * + * @func + * @memberOf R + * @since v0.21.0 + * @category List + * @sig ((a, a) → Boolean) → [a] → [[a]] + * @param {Function} fn Function for determining whether two given (adjacent) + * elements should be in the same group + * @param {Array} list The array to group. Also accepts a string, which will be + * treated as a list of characters. + * @return {List} A list that contains sublists of elements, + * whose concatenations are equal to the original list. + * @example + * + * R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]] + * + * R.groupWith((a, b) => a + 1 === b, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0, 1], [1, 2, 3], [5], [8], [13], [21]] + * + * R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]] + * + * R.groupWith(R.eqBy(isVowel), 'aestiou') + * //=> ['ae', 'st', 'iou'] + */ + var groupWith = _curry2(function(fn, list) { + var res = []; + var idx = 0; + var len = list.length; + while (idx < len) { + var nextidx = idx + 1; + while (nextidx < len && fn(list[nextidx - 1], list[nextidx])) { + nextidx += 1; + } + res.push(list.slice(idx, nextidx)); + idx = nextidx; + } + return res; + }); + + /** + * Returns `true` if the first argument is greater than the second; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @see R.lt + * @example + * + * R.gt(2, 1); //=> true + * R.gt(2, 2); //=> false + * R.gt(2, 3); //=> false + * R.gt('a', 'z'); //=> false + * R.gt('z', 'a'); //=> true + */ + var gt = _curry2(function gt(a, b) { return a > b; }); + + /** + * Returns `true` if the first argument is greater than or equal to the second; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {Number} a + * @param {Number} b + * @return {Boolean} + * @see R.lte + * @example + * + * R.gte(2, 1); //=> true + * R.gte(2, 2); //=> true + * R.gte(2, 3); //=> false + * R.gte('a', 'z'); //=> false + * R.gte('z', 'a'); //=> true + */ + var gte = _curry2(function gte(a, b) { return a >= b; }); + + /** + * Returns whether or not a path exists in an object. Only the object's + * own properties are checked. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> Boolean + * @param {Array} path The path to use. + * @param {Object} obj The object to check the path in. + * @return {Boolean} Whether the path exists. + * @see R.has + * @example + * + * R.hasPath(['a', 'b'], {a: {b: 2}}); // => true + * R.hasPath(['a', 'b'], {a: {b: undefined}}); // => true + * R.hasPath(['a', 'b'], {a: {c: 2}}); // => false + * R.hasPath(['a', 'b'], {}); // => false + */ + var hasPath = _curry2(function hasPath(_path, obj) { + if (_path.length === 0 || isNil(obj)) { + return false; + } + var val = obj; + var idx = 0; + while (idx < _path.length) { + if (!isNil(val) && _has(_path[idx], val)) { + val = val[_path[idx]]; + idx += 1; + } else { + return false; + } + } + return true; + }); + + /** + * Returns whether or not an object has an own property with the specified name + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Object + * @sig s -> {s: x} -> Boolean + * @param {String} prop The name of the property to check for. + * @param {Object} obj The object to query. + * @return {Boolean} Whether the property exists. + * @example + * + * const hasName = R.has('name'); + * hasName({name: 'alice'}); //=> true + * hasName({name: 'bob'}); //=> true + * hasName({}); //=> false + * + * const point = {x: 0, y: 0}; + * const pointHas = R.has(R.__, point); + * pointHas('x'); //=> true + * pointHas('y'); //=> true + * pointHas('z'); //=> false + */ + var has = _curry2(function has(prop, obj) { + return hasPath([prop], obj); + }); + + /** + * Returns whether or not an object or its prototype chain has a property with + * the specified name + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Object + * @sig s -> {s: x} -> Boolean + * @param {String} prop The name of the property to check for. + * @param {Object} obj The object to query. + * @return {Boolean} Whether the property exists. + * @example + * + * function Rectangle(width, height) { + * this.width = width; + * this.height = height; + * } + * Rectangle.prototype.area = function() { + * return this.width * this.height; + * }; + * + * const square = new Rectangle(2, 2); + * R.hasIn('width', square); //=> true + * R.hasIn('area', square); //=> true + */ + var hasIn = _curry2(function hasIn(prop, obj) { + return prop in obj; + }); + + /** + * Returns true if its arguments are identical, false otherwise. Values are + * identical if they reference the same memory. `NaN` is identical to `NaN`; + * `0` and `-0` are not identical. + * + * Note this is merely a curried version of ES6 `Object.is`. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * const o = {}; + * R.identical(o, o); //=> true + * R.identical(1, 1); //=> true + * R.identical(1, '1'); //=> false + * R.identical([], []); //=> false + * R.identical(0, -0); //=> false + * R.identical(NaN, NaN); //=> true + */ + var identical = _curry2(_objectIs$1); + + /** + * Creates a function that will process either the `onTrue` or the `onFalse` + * function depending upon the result of the `condition` predicate. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *) + * @param {Function} condition A predicate function + * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value. + * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value. + * @return {Function} A new function that will process either the `onTrue` or the `onFalse` + * function depending upon the result of the `condition` predicate. + * @see R.unless, R.when, R.cond + * @example + * + * const incCount = R.ifElse( + * R.has('count'), + * R.over(R.lensProp('count'), R.inc), + * R.assoc('count', 1) + * ); + * incCount({}); //=> { count: 1 } + * incCount({ count: 1 }); //=> { count: 2 } + */ + var ifElse = _curry3(function ifElse(condition, onTrue, onFalse) { + return curryN(Math.max(condition.length, onTrue.length, onFalse.length), + function _ifElse() { + return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments); + } + ); + }); + + /** + * Increments its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n + 1 + * @see R.dec + * @example + * + * R.inc(42); //=> 43 + */ + var inc = add(1); + + /** + * Returns `true` if the specified value is equal, in [`R.equals`](#equals) + * terms, to at least one element of the given list; `false` otherwise. + * Works also with strings. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category List + * @sig a -> [a] -> Boolean + * @param {Object} a The item to compare against. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. + * @see R.any + * @example + * + * R.includes(3, [1, 2, 3]); //=> true + * R.includes(4, [1, 2, 3]); //=> false + * R.includes({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + * R.includes([42], [[42]]); //=> true + * R.includes('ba', 'banana'); //=>true + */ + var includes = _curry2(_includes); + + /** + * Given a function that generates a key, turns a list of objects into an + * object indexing the objects by the given key. Note that if multiple + * objects generate the same value for the indexing key only the last value + * will be included in the generated object. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> String) -> [{k: v}] -> {k: {k: v}} + * @param {Function} fn Function :: a -> String + * @param {Array} array The array of objects to index + * @return {Object} An object indexing each array element by the given property. + * @example + * + * const list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; + * R.indexBy(R.prop('id'), list); + * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} + */ + var indexBy = reduceBy(function(acc, elem) { return elem; }, null); + + /** + * Returns the position of the first occurrence of an item in an array, or -1 + * if the item is not included in the array. [`R.equals`](#equals) is used to + * determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Number + * @param {*} target The item to find. + * @param {Array} xs The array to search in. + * @return {Number} the index of the target, or -1 if the target is not found. + * @see R.lastIndexOf + * @example + * + * R.indexOf(3, [1,2,3,4]); //=> 2 + * R.indexOf(10, [1,2,3,4]); //=> -1 + */ + var indexOf = _curry2(function indexOf(target, xs) { + return typeof xs.indexOf === 'function' && !_isArray(xs) ? + xs.indexOf(target) : + _indexOf(xs, target, 0); + }); + + /** + * Returns all but the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.last, R.head, R.tail + * @example + * + * R.init([1, 2, 3]); //=> [1, 2] + * R.init([1, 2]); //=> [1] + * R.init([1]); //=> [] + * R.init([]); //=> [] + * + * R.init('abc'); //=> 'ab' + * R.init('ab'); //=> 'a' + * R.init('a'); //=> '' + * R.init(''); //=> '' + */ + var init = slice(0, -1); + + /** + * Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list + * `xs'` comprising each of the elements of `xs` which is equal to one or more + * elements of `ys` according to `pred`. + * + * `pred` must be a binary function expecting an element from each list. + * + * `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should + * not be significant, but since `xs'` is ordered the implementation guarantees + * that its values are in the same order as they appear in `xs`. Duplicates are + * not removed, so `xs'` may contain duplicates if `xs` contains duplicates. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Relation + * @sig ((a, b) -> Boolean) -> [a] -> [b] -> [a] + * @param {Function} pred + * @param {Array} xs + * @param {Array} ys + * @return {Array} + * @see R.intersection + * @example + * + * R.innerJoin( + * (record, id) => record.id === id, + * [{id: 824, name: 'Richie Furay'}, + * {id: 956, name: 'Dewey Martin'}, + * {id: 313, name: 'Bruce Palmer'}, + * {id: 456, name: 'Stephen Stills'}, + * {id: 177, name: 'Neil Young'}], + * [177, 456, 999] + * ); + * //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] + */ + var innerJoin = _curry3(function innerJoin(pred, xs, ys) { + return _filter(function(x) { return _includesWith(pred, x, ys); }, xs); + }); + + /** + * Inserts the supplied element into the list, at the specified `index`. _Note that + + * this is not destructive_: it returns a copy of the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.2.2 + * @category List + * @sig Number -> a -> [a] -> [a] + * @param {Number} index The position to insert the element + * @param {*} elt The element to insert into the Array + * @param {Array} list The list to insert into + * @return {Array} A new Array with `elt` inserted at `index`. + * @example + * + * R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4] + */ + var insert = _curry3(function insert(idx, elt, list) { + idx = idx < list.length && idx >= 0 ? idx : list.length; + var result = Array.prototype.slice.call(list, 0); + result.splice(idx, 0, elt); + return result; + }); + + /** + * Inserts the sub-list into the list, at the specified `index`. _Note that this is not + * destructive_: it returns a copy of the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig Number -> [a] -> [a] -> [a] + * @param {Number} index The position to insert the sub-list + * @param {Array} elts The sub-list to insert into the Array + * @param {Array} list The list to insert the sub-list into + * @return {Array} A new Array with `elts` inserted starting at `index`. + * @example + * + * R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4] + */ + var insertAll = _curry3(function insertAll(idx, elts, list) { + idx = idx < list.length && idx >= 0 ? idx : list.length; + return [].concat( + Array.prototype.slice.call(list, 0, idx), + elts, + Array.prototype.slice.call(list, idx) + ); + }); + + /** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied function to + * each list element. Prefers the first item if the supplied function produces + * the same value on two items. [`R.equals`](#equals) is used for comparison. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> b) -> [a] -> [a] + * @param {Function} fn A function used to produce a value to use during comparisons. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] + */ + var uniqBy = _curry2(function uniqBy(fn, list) { + var set = new _Set(); + var result = []; + var idx = 0; + var appliedItem, item; + + while (idx < list.length) { + item = list[idx]; + appliedItem = fn(item); + if (set.add(appliedItem)) { + result.push(item); + } + idx += 1; + } + return result; + }); + + /** + * Returns a new list containing only one copy of each element in the original + * list. [`R.equals`](#equals) is used to determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniq([1, 1, 2, 1]); //=> [1, 2] + * R.uniq([1, '1']); //=> [1, '1'] + * R.uniq([[42], [42]]); //=> [[42]] + */ + var uniq = uniqBy(identity); + + /** + * Combines two lists into a set (i.e. no duplicates) composed of those + * elements common to both lists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The list of elements found in both `list1` and `list2`. + * @see R.innerJoin + * @example + * + * R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3] + */ + var intersection = _curry2(function intersection(list1, list2) { + var lookupList, filteredList; + if (list1.length > list2.length) { + lookupList = list1; + filteredList = list2; + } else { + lookupList = list2; + filteredList = list1; + } + return uniq(_filter(flip(_includes)(lookupList), filteredList)); + }); + + /** + * Creates a new list with the separator interposed between elements. + * + * Dispatches to the `intersperse` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} separator The element to add to the list. + * @param {Array} list The list to be interposed. + * @return {Array} The new list. + * @example + * + * R.intersperse('a', ['b', 'n', 'n', 's']); //=> ['b', 'a', 'n', 'a', 'n', 'a', 's'] + */ + var intersperse = _curry2(_checkForMethod('intersperse', function intersperse(separator, list) { + var out = []; + var idx = 0; + var length = list.length; + while (idx < length) { + if (idx === length - 1) { + out.push(list[idx]); + } else { + out.push(list[idx], separator); + } + idx += 1; + } + return out; + })); + + // Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + function _objectAssign(target) { + if (target == null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + var idx = 1; + var length = arguments.length; + while (idx < length) { + var source = arguments[idx]; + if (source != null) { + for (var nextKey in source) { + if (_has(nextKey, source)) { + output[nextKey] = source[nextKey]; + } + } + } + idx += 1; + } + return output; + } + + var _objectAssign$1 = typeof Object.assign === 'function' ? Object.assign : _objectAssign; + + /** + * Creates an object containing a single key:value pair. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Object + * @sig String -> a -> {String:a} + * @param {String} key + * @param {*} val + * @return {Object} + * @see R.pair + * @example + * + * const matchPhrases = R.compose( + * R.objOf('must'), + * R.map(R.objOf('match_phrase')) + * ); + * matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]} + */ + var objOf = _curry2(function objOf(key, val) { + var obj = {}; + obj[key] = val; + return obj; + }); + + var _stepCatArray = { + '@@transducer/init': Array, + '@@transducer/step': function(xs, x) { + xs.push(x); + return xs; + }, + '@@transducer/result': _identity + }; + var _stepCatString = { + '@@transducer/init': String, + '@@transducer/step': function(a, b) { return a + b; }, + '@@transducer/result': _identity + }; + var _stepCatObject = { + '@@transducer/init': Object, + '@@transducer/step': function(result, input) { + return _objectAssign$1( + result, + _isArrayLike(input) ? objOf(input[0], input[1]) : input + ); + }, + '@@transducer/result': _identity + }; + + function _stepCat(obj) { + if (_isTransformer(obj)) { + return obj; + } + if (_isArrayLike(obj)) { + return _stepCatArray; + } + if (typeof obj === 'string') { + return _stepCatString; + } + if (typeof obj === 'object') { + return _stepCatObject; + } + throw new Error('Cannot create transformer for ' + obj); + } + + /** + * Transforms the items of the list with the transducer and appends the + * transformed items to the accumulator using an appropriate iterator function + * based on the accumulator type. + * + * The accumulator can be an array, string, object or a transformer. Iterated + * items will be appended to arrays and concatenated to strings. Objects will + * be merged directly or 2-item arrays will be merged as key, value pairs. + * + * The accumulator can also be a transformer object that provides a 2-arity + * reducing iterator function, step, 0-arity initial value function, init, and + * 1-arity result extraction function result. The step function is used as the + * iterator function in reduce. The result function is used to convert the + * final accumulator into the return type and in most cases is R.identity. The + * init function is used to provide the initial accumulator. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the + * transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig a -> (b -> b) -> [c] -> a + * @param {*} acc The initial accumulator value. + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.transduce + * @example + * + * const numbers = [1, 2, 3, 4]; + * const transducer = R.compose(R.map(R.add(1)), R.take(2)); + * + * R.into([], transducer, numbers); //=> [2, 3] + * + * const intoArray = R.into([]); + * intoArray(transducer, numbers); //=> [2, 3] + */ + var into = _curry3(function into(acc, xf, list) { + return _isTransformer(acc) ? + _reduce(xf(acc), acc['@@transducer/init'](), list) : + _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list); + }); + + /** + * Same as [`R.invertObj`](#invertObj), however this accounts for objects with + * duplicate values by putting the values into an array. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {s: x} -> {x: [ s, ... ]} + * @param {Object} obj The object or array to invert + * @return {Object} out A new object with keys in an array. + * @see R.invertObj + * @example + * + * const raceResultsByFirstName = { + * first: 'alice', + * second: 'jake', + * third: 'alice', + * }; + * R.invert(raceResultsByFirstName); + * //=> { 'alice': ['first', 'third'], 'jake':['second'] } + */ + var invert = _curry1(function invert(obj) { + var props = keys(obj); + var len = props.length; + var idx = 0; + var out = {}; + + while (idx < len) { + var key = props[idx]; + var val = obj[key]; + var list = _has(val, out) ? out[val] : (out[val] = []); + list[list.length] = key; + idx += 1; + } + return out; + }); + + /** + * Returns a new object with the keys of the given object as values, and the + * values of the given object, which are coerced to strings, as keys. Note + * that the last key found is preferred when handling the same value. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {s: x} -> {x: s} + * @param {Object} obj The object or array to invert + * @return {Object} out A new object + * @see R.invert + * @example + * + * const raceResults = { + * first: 'alice', + * second: 'jake' + * }; + * R.invertObj(raceResults); + * //=> { 'alice': 'first', 'jake':'second' } + * + * // Alternatively: + * const raceResults = ['alice', 'jake']; + * R.invertObj(raceResults); + * //=> { 'alice': '0', 'jake':'1' } + */ + var invertObj = _curry1(function invertObj(obj) { + var props = keys(obj); + var len = props.length; + var idx = 0; + var out = {}; + + while (idx < len) { + var key = props[idx]; + out[obj[key]] = key; + idx += 1; + } + return out; + }); + + /** + * Turns a named method with a specified arity into a function that can be + * called directly supplied with arguments and a target object. + * + * The returned function is curried and accepts `arity + 1` parameters where + * the final parameter is the target object. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *) + * @param {Number} arity Number of arguments the returned function should take + * before the target object. + * @param {String} method Name of any of the target object's methods to call. + * @return {Function} A new curried function. + * @see R.construct + * @example + * + * const sliceFrom = R.invoker(1, 'slice'); + * sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm' + * const sliceFrom6 = R.invoker(2, 'slice')(6); + * sliceFrom6(8, 'abcdefghijklm'); //=> 'gh' + * + * const dog = { + * speak: async () => 'Woof!' + * }; + * const speak = R.invoker(0, 'speak'); + * speak(dog).then(console.log) //~> 'Woof!' + * + * @symb R.invoker(0, 'method')(o) = o['method']() + * @symb R.invoker(1, 'method')(a, o) = o['method'](a) + * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) + */ + var invoker = _curry2(function invoker(arity, method) { + return curryN(arity + 1, function() { + var target = arguments[arity]; + if (target != null && _isFunction(target[method])) { + return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity)); + } + throw new TypeError(toString$1(target) + ' does not have a method named "' + method + '"'); + }); + }); + + /** + * See if an object (`val`) is an instance of the supplied constructor. This + * function will check up the inheritance chain, if any. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Type + * @sig (* -> {*}) -> a -> Boolean + * @param {Object} ctor A constructor + * @param {*} val The value to test + * @return {Boolean} + * @example + * + * R.is(Object, {}); //=> true + * R.is(Number, 1); //=> true + * R.is(Object, 1); //=> false + * R.is(String, 's'); //=> true + * R.is(String, new String('')); //=> true + * R.is(Object, new String('')); //=> true + * R.is(Object, 's'); //=> false + * R.is(Number, {}); //=> false + */ + var is = _curry2(function is(Ctor, val) { + return val != null && val.constructor === Ctor || val instanceof Ctor; + }); + + /** + * Returns `true` if the given value is its type's empty value; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> Boolean + * @param {*} x + * @return {Boolean} + * @see R.empty + * @example + * + * R.isEmpty([1, 2, 3]); //=> false + * R.isEmpty([]); //=> true + * R.isEmpty(''); //=> true + * R.isEmpty(null); //=> false + * R.isEmpty({}); //=> true + * R.isEmpty({length: 0}); //=> false + */ + var isEmpty = _curry1(function isEmpty(x) { + return x != null && equals(x, empty(x)); + }); + + /** + * Returns a string made by inserting the `separator` between each element and + * concatenating all the elements into a single string. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig String -> [a] -> String + * @param {Number|String} separator The string used to separate the elements. + * @param {Array} xs The elements to join into a string. + * @return {String} str The string made by concatenating `xs` with `separator`. + * @see R.split + * @example + * + * const spacer = R.join(' '); + * spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + * R.join('|', [1, 2, 3]); //=> '1|2|3' + */ + var join = invoker(1, 'join'); + + /** + * juxt applies a list of functions to a list of values. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Function + * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n]) + * @param {Array} fns An array of functions + * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters. + * @see R.applySpec + * @example + * + * const getRange = R.juxt([Math.min, Math.max]); + * getRange(3, 4, 9, -3); //=> [-3, 9] + * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] + */ + var juxt = _curry1(function juxt(fns) { + return converge(function() { return Array.prototype.slice.call(arguments, 0); }, fns); + }); + + /** + * Returns a list containing the names of all the properties of the supplied + * object, including prototype properties. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own and prototype properties. + * @see R.keys, R.valuesIn + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.keysIn(f); //=> ['x', 'y'] + */ + var keysIn = _curry1(function keysIn(obj) { + var prop; + var ks = []; + for (prop in obj) { + ks[ks.length] = prop; + } + return ks; + }); + + /** + * Returns the position of the last occurrence of an item in an array, or -1 if + * the item is not included in the array. [`R.equals`](#equals) is used to + * determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Number + * @param {*} target The item to find. + * @param {Array} xs The array to search in. + * @return {Number} the index of the target, or -1 if the target is not found. + * @see R.indexOf + * @example + * + * R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6 + * R.lastIndexOf(10, [1,2,3,4]); //=> -1 + */ + var lastIndexOf = _curry2(function lastIndexOf(target, xs) { + if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) { + return xs.lastIndexOf(target); + } else { + var idx = xs.length - 1; + while (idx >= 0) { + if (equals(xs[idx], target)) { + return idx; + } + idx -= 1; + } + return -1; + } + }); + + function _isNumber(x) { + return Object.prototype.toString.call(x) === '[object Number]'; + } + + /** + * Returns the number of elements in the array by returning `list.length`. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [a] -> Number + * @param {Array} list The array to inspect. + * @return {Number} The length of the array. + * @example + * + * R.length([]); //=> 0 + * R.length([1, 2, 3]); //=> 3 + */ + var length = _curry1(function length(list) { + return list != null && _isNumber(list.length) ? list.length : NaN; + }); + + /** + * Returns a lens for the given getter and setter functions. The getter "gets" + * the value of the focus; the setter "sets" the value of the focus. The setter + * should not mutate the data structure. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig (s -> a) -> ((a, s) -> s) -> Lens s a + * @param {Function} getter + * @param {Function} setter + * @return {Lens} + * @see R.view, R.set, R.over, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lens(R.prop('x'), R.assoc('x')); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} + */ + var lens = _curry2(function lens(getter, setter) { + return function(toFunctorFn) { + return function(target) { + return map( + function(focus) { + return setter(focus, target); + }, + toFunctorFn(getter(target)) + ); + }; + }; + }); + + /** + * Returns a lens whose focus is the specified index. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Number -> Lens s a + * @param {Number} n + * @return {Lens} + * @see R.view, R.set, R.over, R.nth + * @example + * + * const headLens = R.lensIndex(0); + * + * R.view(headLens, ['a', 'b', 'c']); //=> 'a' + * R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] + * R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] + */ + var lensIndex = _curry1(function lensIndex(n) { + return lens(nth(n), update(n)); + }); + + /** + * Returns a lens whose focus is the specified path. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @typedefn Idx = String | Int + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig [Idx] -> Lens s a + * @param {Array} path The path to use. + * @return {Lens} + * @see R.view, R.set, R.over + * @example + * + * const xHeadYLens = R.lensPath(['x', 0, 'y']); + * + * R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> 2 + * R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]} + * R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]} + */ + var lensPath = _curry1(function lensPath(p) { + return lens(path(p), assocPath(p)); + }); + + /** + * Returns a lens whose focus is the specified property. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig String -> Lens s a + * @param {String} k + * @return {Lens} + * @see R.view, R.set, R.over + * @example + * + * const xLens = R.lensProp('x'); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} + */ + var lensProp = _curry1(function lensProp(k) { + return lens(prop(k), assoc(k)); + }); + + /** + * Returns `true` if the first argument is less than the second; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @see R.gt + * @example + * + * R.lt(2, 1); //=> false + * R.lt(2, 2); //=> false + * R.lt(2, 3); //=> true + * R.lt('a', 'z'); //=> true + * R.lt('z', 'a'); //=> false + */ + var lt = _curry2(function lt(a, b) { return a < b; }); + + /** + * Returns `true` if the first argument is less than or equal to the second; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {Number} a + * @param {Number} b + * @return {Boolean} + * @see R.gte + * @example + * + * R.lte(2, 1); //=> false + * R.lte(2, 2); //=> true + * R.lte(2, 3); //=> true + * R.lte('a', 'z'); //=> true + * R.lte('z', 'a'); //=> false + */ + var lte = _curry2(function lte(a, b) { return a <= b; }); + + /** + * The `mapAccum` function behaves like a combination of map and reduce; it + * applies a function to each element of a list, passing an accumulating + * parameter from left to right, and returning a final value of this + * accumulator together with the new list. + * + * The iterator function receives two arguments, *acc* and *value*, and should + * return a tuple *[acc, value]*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y]) + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.scan, R.addIndex, R.mapAccumRight + * @example + * + * const digits = ['1', '2', '3', '4']; + * const appender = (a, b) => [a + b, a + b]; + * + * R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']] + * @symb R.mapAccum(f, a, [b, c, d]) = [ + * f(f(f(a, b)[0], c)[0], d)[0], + * [ + * f(a, b)[1], + * f(f(a, b)[0], c)[1], + * f(f(f(a, b)[0], c)[0], d)[1] + * ] + * ] + */ + var mapAccum = _curry3(function mapAccum(fn, acc, list) { + var idx = 0; + var len = list.length; + var result = []; + var tuple = [acc]; + while (idx < len) { + tuple = fn(tuple[0], list[idx]); + result[idx] = tuple[1]; + idx += 1; + } + return [tuple[0], result]; + }); + + /** + * The `mapAccumRight` function behaves like a combination of map and reduce; it + * applies a function to each element of a list, passing an accumulating + * parameter from right to left, and returning a final value of this + * accumulator together with the new list. + * + * Similar to [`mapAccum`](#mapAccum), except moves through the input list from + * the right to the left. + * + * The iterator function receives two arguments, *acc* and *value*, and should + * return a tuple *[acc, value]*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y]) + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.addIndex, R.mapAccum + * @example + * + * const digits = ['1', '2', '3', '4']; + * const appender = (a, b) => [b + a, b + a]; + * + * R.mapAccumRight(appender, 5, digits); //=> ['12345', ['12345', '2345', '345', '45']] + * @symb R.mapAccumRight(f, a, [b, c, d]) = [ + * f(f(f(a, d)[0], c)[0], b)[0], + * [ + * f(a, d)[1], + * f(f(a, d)[0], c)[1], + * f(f(f(a, d)[0], c)[0], b)[1] + * ] + * ] + */ + var mapAccumRight = _curry3(function mapAccumRight(fn, acc, list) { + var idx = list.length - 1; + var result = []; + var tuple = [acc]; + while (idx >= 0) { + tuple = fn(tuple[0], list[idx]); + result[idx] = tuple[1]; + idx -= 1; + } + return [tuple[0], result]; + }); + + /** + * An Object-specific version of [`map`](#map). The function is applied to three + * arguments: *(value, key, obj)*. If only the value is significant, use + * [`map`](#map) instead. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig ((*, String, Object) -> *) -> Object -> Object + * @param {Function} fn + * @param {Object} obj + * @return {Object} + * @see R.map + * @example + * + * const xyz = { x: 1, y: 2, z: 3 }; + * const prependKeyAndDouble = (num, key, obj) => key + (num * 2); + * + * R.mapObjIndexed(prependKeyAndDouble, xyz); //=> { x: 'x2', y: 'y4', z: 'z6' } + */ + var mapObjIndexed = _curry2(function mapObjIndexed(fn, obj) { + return _reduce(function(acc, key) { + acc[key] = fn(obj[key], key, obj); + return acc; + }, {}, keys(obj)); + }); + + /** + * Tests a regular expression against a String. Note that this function will + * return an empty array when there are no matches. This differs from + * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) + * which returns `null` when there are no matches. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig RegExp -> String -> [String | Undefined] + * @param {RegExp} rx A regular expression. + * @param {String} str The string to match against + * @return {Array} The list of matches or empty array. + * @see R.test + * @example + * + * R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] + * R.match(/a/, 'b'); //=> [] + * R.match(/a/, null); //=> TypeError: null does not have a method named "match" + */ + var match = _curry2(function match(rx, str) { + return str.match(rx) || []; + }); + + /** + * `mathMod` behaves like the modulo operator should mathematically, unlike the + * `%` operator (and by extension, [`R.modulo`](#modulo)). So while + * `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. `mathMod` requires Integer + * arguments, and returns NaN when the modulus is zero or negative. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} m The dividend. + * @param {Number} p the modulus. + * @return {Number} The result of `b mod a`. + * @see R.modulo + * @example + * + * R.mathMod(-17, 5); //=> 3 + * R.mathMod(17, 5); //=> 2 + * R.mathMod(17, -5); //=> NaN + * R.mathMod(17, 0); //=> NaN + * R.mathMod(17.2, 5); //=> NaN + * R.mathMod(17, 5.3); //=> NaN + * + * const clock = R.mathMod(R.__, 12); + * clock(15); //=> 3 + * clock(24); //=> 0 + * + * const seventeenMod = R.mathMod(17); + * seventeenMod(3); //=> 2 + * seventeenMod(4); //=> 1 + * seventeenMod(10); //=> 7 + */ + var mathMod = _curry2(function mathMod(m, p) { + if (!_isInteger(m)) { return NaN; } + if (!_isInteger(p) || p < 1) { return NaN; } + return ((m % p) + p) % p; + }); + + /** + * Takes a function and two values, and returns whichever value produces the + * larger result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.max, R.minBy + * @example + * + * // square :: Number -> Number + * const square = n => n * n; + * + * R.maxBy(square, -3, 2); //=> -3 + * + * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5 + * R.reduce(R.maxBy(square), 0, []); //=> 0 + */ + var maxBy = _curry3(function maxBy(f, a, b) { + return f(b) > f(a) ? b : a; + }); + + /** + * Adds together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The sum of all the numbers in the list. + * @see R.reduce + * @example + * + * R.sum([2,4,6,8,100,1]); //=> 121 + */ + var sum = reduce(add, 0); + + /** + * Returns the mean of the given list of numbers. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list + * @return {Number} + * @see R.median + * @example + * + * R.mean([2, 7, 9]); //=> 6 + * R.mean([]); //=> NaN + */ + var mean = _curry1(function mean(list) { + return sum(list) / list.length; + }); + + /** + * Returns the median of the given list of numbers. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list + * @return {Number} + * @see R.mean + * @example + * + * R.median([2, 9, 7]); //=> 7 + * R.median([7, 2, 10, 9]); //=> 8 + * R.median([]); //=> NaN + */ + var median = _curry1(function median(list) { + var len = list.length; + if (len === 0) { + return NaN; + } + var width = 2 - len % 2; + var idx = (len - width) / 2; + return mean(Array.prototype.slice.call(list, 0).sort(function(a, b) { + return a < b ? -1 : a > b ? 1 : 0; + }).slice(idx, idx + width)); + }); + + /** + * Creates a new function that, when invoked, caches the result of calling `fn` + * for a given argument set and returns the result. Subsequent calls to the + * memoized `fn` with the same argument set will not result in an additional + * call to `fn`; instead, the cached result for that set of arguments will be + * returned. + * + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (*... -> String) -> (*... -> a) -> (*... -> a) + * @param {Function} fn The function to generate the cache key. + * @param {Function} fn The function to memoize. + * @return {Function} Memoized version of `fn`. + * @example + * + * let count = 0; + * const factorial = R.memoizeWith(R.identity, n => { + * count += 1; + * return R.product(R.range(1, n + 1)); + * }); + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * count; //=> 1 + */ + var memoizeWith = _curry2(function memoizeWith(mFn, fn) { + var cache = {}; + return _arity(fn.length, function() { + var key = mFn.apply(this, arguments); + if (!_has(key, cache)) { + cache[key] = fn.apply(this, arguments); + } + return cache[key]; + }); + }); + + /** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeRight, R.mergeDeepRight, R.mergeWith, R.mergeWithKey + * @deprecated since v0.26.0 + * @example + * + * R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const withDefaults = R.merge({x: 0, y: 0}); + * withDefaults({y: 2}); //=> {x: 0, y: 2} + * @symb R.merge(a, b) = {...a, ...b} + */ + var merge = _curry2(function merge(l, r) { + return _objectAssign$1({}, l, r); + }); + + /** + * Merges a list of objects together into one object. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig [{k: v}] -> {k: v} + * @param {Array} list An array of objects + * @return {Object} A merged object. + * @see R.reduce + * @example + * + * R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3} + * R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2} + * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 } + */ + var mergeAll = _curry1(function mergeAll(list) { + return _objectAssign$1.apply(null, [{}].concat(list)); + }); + + /** + * Creates a new object with the own properties of the two provided objects. If + * a key exists in both objects, the provided function is applied to the key + * and the values associated with the key in each object, with the result being + * used as the value associated with the key in the returned object. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeDeepWithKey, R.merge, R.mergeWith + * @example + * + * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + * R.mergeWithKey(concatValues, + * { a: true, thing: 'foo', values: [10, 20] }, + * { b: true, thing: 'bar', values: [15, 35] }); + * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] } + * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 } + */ + var mergeWithKey = _curry3(function mergeWithKey(fn, l, r) { + var result = {}; + var k; + + for (k in l) { + if (_has(k, l)) { + result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k]; + } + } + + for (k in r) { + if (_has(k, r) && !(_has(k, result))) { + result[k] = r[k]; + } + } + + return result; + }); + + /** + * Creates a new object with the own properties of the two provided objects. + * If a key exists in both objects: + * - and both associated values are also objects then the values will be + * recursively merged. + * - otherwise the provided function is applied to the key and associated values + * using the resulting value as the new value associated with the key. + * If a key only exists in one object, the value will be associated with the key + * of the resulting object. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.mergeWithKey, R.mergeDeepWith + * @example + * + * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + * R.mergeDeepWithKey(concatValues, + * { a: true, c: { thing: 'foo', values: [10, 20] }}, + * { b: true, c: { thing: 'bar', values: [15, 35] }}); + * //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }} + */ + var mergeDeepWithKey = _curry3(function mergeDeepWithKey(fn, lObj, rObj) { + return mergeWithKey(function(k, lVal, rVal) { + if (_isObject(lVal) && _isObject(rVal)) { + return mergeDeepWithKey(fn, lVal, rVal); + } else { + return fn(k, lVal, rVal); + } + }, lObj, rObj); + }); + + /** + * Creates a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects: + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the first object will be used. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig {a} -> {a} -> {a} + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.merge, R.mergeDeepRight, R.mergeDeepWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepLeft({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + * { age: 40, contact: { email: 'baa@example.com' }}); + * //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }} + */ + var mergeDeepLeft = _curry2(function mergeDeepLeft(lObj, rObj) { + return mergeDeepWithKey(function(k, lVal, rVal) { + return lVal; + }, lObj, rObj); + }); + + /** + * Creates a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects: + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig {a} -> {a} -> {a} + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + * { age: 40, contact: { email: 'baa@example.com' }}); + * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }} + */ + var mergeDeepRight = _curry2(function mergeDeepRight(lObj, rObj) { + return mergeDeepWithKey(function(k, lVal, rVal) { + return rVal; + }, lObj, rObj); + }); + + /** + * Creates a new object with the own properties of the two provided objects. + * If a key exists in both objects: + * - and both associated values are also objects then the values will be + * recursively merged. + * - otherwise the provided function is applied to associated values using the + * resulting value as the new value associated with the key. + * If a key only exists in one object, the value will be associated with the key + * of the resulting object. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig ((a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.mergeWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepWith(R.concat, + * { a: true, c: { values: [10, 20] }}, + * { b: true, c: { values: [15, 35] }}); + * //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }} + */ + var mergeDeepWith = _curry3(function mergeDeepWith(fn, lObj, rObj) { + return mergeDeepWithKey(function(k, lVal, rVal) { + return fn(lVal, rVal); + }, lObj, rObj); + }); + + /** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the first object will be used. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeRight, R.mergeDeepLeft, R.mergeWith, R.mergeWithKey + * @example + * + * R.mergeLeft({ 'age': 40 }, { 'name': 'fred', 'age': 10 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const resetToDefault = R.mergeLeft({x: 0}); + * resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2} + * @symb R.mergeLeft(a, b) = {...b, ...a} + */ + var mergeLeft = _curry2(function mergeLeft(l, r) { + return _objectAssign$1({}, r, l); + }); + + /** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeLeft, R.mergeDeepRight, R.mergeWith, R.mergeWithKey + * @example + * + * R.mergeRight({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const withDefaults = R.mergeRight({x: 0, y: 0}); + * withDefaults({y: 2}); //=> {x: 0, y: 2} + * @symb R.mergeRight(a, b) = {...a, ...b} + */ + var mergeRight = _curry2(function mergeRight(l, r) { + return _objectAssign$1({}, l, r); + }); + + /** + * Creates a new object with the own properties of the two provided objects. If + * a key exists in both objects, the provided function is applied to the values + * associated with the key in each object, with the result being used as the + * value associated with the key in the returned object. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @sig ((a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeDeepWith, R.merge, R.mergeWithKey + * @example + * + * R.mergeWith(R.concat, + * { a: true, values: [10, 20] }, + * { b: true, values: [15, 35] }); + * //=> { a: true, b: true, values: [10, 20, 15, 35] } + */ + var mergeWith = _curry3(function mergeWith(fn, l, r) { + return mergeWithKey(function(_, _l, _r) { + return fn(_l, _r); + }, l, r); + }); + + /** + * Returns the smaller of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.minBy, R.max + * @example + * + * R.min(789, 123); //=> 123 + * R.min('a', 'b'); //=> 'a' + */ + var min = _curry2(function min(a, b) { return b < a ? b : a; }); + + /** + * Takes a function and two values, and returns whichever value produces the + * smaller result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.min, R.maxBy + * @example + * + * // square :: Number -> Number + * const square = n => n * n; + * + * R.minBy(square, -3, 2); //=> 2 + * + * R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1 + * R.reduce(R.minBy(square), Infinity, []); //=> Infinity + */ + var minBy = _curry3(function minBy(f, a, b) { + return f(b) < f(a) ? b : a; + }); + + /** + * Divides the first parameter by the second and returns the remainder. Note + * that this function preserves the JavaScript-style behavior for modulo. For + * mathematical modulo see [`mathMod`](#mathMod). + * + * @func + * @memberOf R + * @since v0.1.1 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The value to the divide. + * @param {Number} b The pseudo-modulus + * @return {Number} The result of `b % a`. + * @see R.mathMod + * @example + * + * R.modulo(17, 3); //=> 2 + * // JS behavior: + * R.modulo(-17, 3); //=> -2 + * R.modulo(17, -3); //=> 2 + * + * const isOdd = R.modulo(R.__, 2); + * isOdd(42); //=> 0 + * isOdd(21); //=> 1 + */ + var modulo = _curry2(function modulo(a, b) { return a % b; }); + + /** + * Move an item, at index `from`, to index `to`, in a list of elements. + * A new list will be created containing the new elements order. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @param {Number} from The source index + * @param {Number} to The destination index + * @param {Array} list The list which will serve to realise the move + * @return {Array} The new list reordered + * @example + * + * R.move(0, 2, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['b', 'c', 'a', 'd', 'e', 'f'] + * R.move(-1, 0, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['f', 'a', 'b', 'c', 'd', 'e'] list rotation + */ + var move = _curry3(function(from, to, list) { + var length = list.length; + var result = list.slice(); + var positiveFrom = from < 0 ? length + from : from; + var positiveTo = to < 0 ? length + to : to; + var item = result.splice(positiveFrom, 1); + + return positiveFrom < 0 || positiveFrom >= list.length + || positiveTo < 0 || positiveTo >= list.length + ? list + : [] + .concat(result.slice(0, positiveTo)) + .concat(item) + .concat(result.slice(positiveTo, list.length)); + }); + + /** + * Multiplies two numbers. Equivalent to `a * b` but curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a * b`. + * @see R.divide + * @example + * + * const double = R.multiply(2); + * const triple = R.multiply(3); + * double(3); //=> 6 + * triple(4); //=> 12 + * R.multiply(2, 5); //=> 10 + */ + var multiply = _curry2(function multiply(a, b) { return a * b; }); + + /** + * Negates its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} + * @example + * + * R.negate(42); //=> -42 + */ + var negate = _curry1(function negate(n) { return -n; }); + + /** + * Returns `true` if no elements of the list match the predicate, `false` + * otherwise. + * + * Dispatches to the `all` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise. + * @see R.all, R.any + * @example + * + * const isEven = n => n % 2 === 0; + * const isOdd = n => n % 2 === 1; + * + * R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true + * R.none(isOdd, [1, 3, 5, 7, 8, 11]); //=> false + */ + var none = _curry2(function none(fn, input) { + return all(_complement(fn), input); + }); + + /** + * Returns a function which returns its nth argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig Number -> *... -> * + * @param {Number} n + * @return {Function} + * @example + * + * R.nthArg(1)('a', 'b', 'c'); //=> 'b' + * R.nthArg(-1)('a', 'b', 'c'); //=> 'c' + * @symb R.nthArg(-1)(a, b, c) = c + * @symb R.nthArg(0)(a, b, c) = a + * @symb R.nthArg(1)(a, b, c) = b + */ + var nthArg = _curry1(function nthArg(n) { + var arity = n < 0 ? 1 : n + 1; + return curryN(arity, function() { + return nth(n, arguments); + }); + }); + + /** + * `o` is a curried composition function that returns a unary function. + * Like [`compose`](#compose), `o` performs right-to-left function composition. + * Unlike [`compose`](#compose), the rightmost function passed to `o` will be + * invoked with only one argument. Also, unlike [`compose`](#compose), `o` is + * limited to accepting only 2 unary functions. The name o was chosen because + * of its similarity to the mathematical composition operator ∘. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (b -> c) -> (a -> b) -> a -> c + * @param {Function} f + * @param {Function} g + * @return {Function} + * @see R.compose, R.pipe + * @example + * + * const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last + * const yellGreeting = R.o(R.toUpper, classyGreeting); + * yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.o(R.multiply(10), R.add(10))(-4) //=> 60 + * + * @symb R.o(f, g, x) = f(g(x)) + */ + var o = _curry3(function o(f, g, x) { + return f(g(x)); + }); + + function _of(x) { return [x]; } + + /** + * Returns a singleton array containing the value provided. + * + * Note this `of` is different from the ES6 `of`; See + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig a -> [a] + * @param {*} x any value + * @return {Array} An array wrapping `x`. + * @example + * + * R.of(null); //=> [null] + * R.of([42]); //=> [[42]] + */ + var of = _curry1(_of); + + /** + * Returns a partial copy of an object omitting the keys specified. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [String] -> {String: *} -> {String: *} + * @param {Array} names an array of String property names to omit from the new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with properties from `names` not on it. + * @see R.pick + * @example + * + * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3} + */ + var omit = _curry2(function omit(names, obj) { + var result = {}; + var index = {}; + var idx = 0; + var len = names.length; + + while (idx < len) { + index[names[idx]] = 1; + idx += 1; + } + + for (var prop in obj) { + if (!index.hasOwnProperty(prop)) { + result[prop] = obj[prop]; + } + } + return result; + }); + + /** + * Accepts a function `fn` and returns a function that guards invocation of + * `fn` such that `fn` can only ever be called once, no matter how many times + * the returned function is invoked. The first value calculated is returned in + * subsequent invocations. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (a... -> b) -> (a... -> b) + * @param {Function} fn The function to wrap in a call-only-once wrapper. + * @return {Function} The wrapped function. + * @example + * + * const addOneOnce = R.once(x => x + 1); + * addOneOnce(10); //=> 11 + * addOneOnce(addOneOnce(50)); //=> 11 + */ + var once = _curry1(function once(fn) { + var called = false; + var result; + return _arity(fn.length, function() { + if (called) { + return result; + } + called = true; + result = fn.apply(this, arguments); + return result; + }); + }); + + function _assertPromise(name, p) { + if (p == null || !_isFunction(p.then)) { + throw new TypeError('`' + name + '` expected a Promise, received ' + _toString(p, [])); + } + } + + /** + * Returns the result of applying the onFailure function to the value inside + * a failed promise. This is useful for handling rejected promises + * inside function compositions. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig (e -> b) -> (Promise e a) -> (Promise e b) + * @sig (e -> (Promise f b)) -> (Promise e a) -> (Promise f b) + * @param {Function} onFailure The function to apply. Can return a value or a promise of a value. + * @param {Promise} p + * @return {Promise} The result of calling `p.then(null, onFailure)` + * @see R.then + * @example + * + * var failedFetch = (id) => Promise.reject('bad ID'); + * var useDefault = () => ({ firstName: 'Bob', lastName: 'Loblaw' }) + * + * //recoverFromFailure :: String -> Promise ({firstName, lastName}) + * var recoverFromFailure = R.pipe( + * failedFetch, + * R.otherwise(useDefault), + * R.then(R.pick(['firstName', 'lastName'])), + * ); + * recoverFromFailure(12345).then(console.log) + */ + var otherwise = _curry2(function otherwise(f, p) { + _assertPromise('otherwise', p); + + return p.then(null, f); + }); + + // `Identity` is a functor that holds a single value, where `map` simply + // transforms the held value with the provided function. + var Identity = function(x) { + return {value: x, map: function(f) { return Identity(f(x)); }}; + }; + + + /** + * Returns the result of "setting" the portion of the given data structure + * focused by the given lens to the result of applying the given function to + * the focused value. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> (a -> a) -> s -> s + * @param {Lens} lens + * @param {*} v + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const headLens = R.lensIndex(0); + * + * R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz'] + */ + var over = _curry3(function over(lens, f, x) { + // The value returned by the getter function is first transformed with `f`, + // then set as the value of an `Identity`. This is then mapped over with the + // setter function of the lens. + return lens(function(y) { return Identity(f(y)); })(x).value; + }); + + /** + * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category List + * @sig a -> b -> (a,b) + * @param {*} fst + * @param {*} snd + * @return {Array} + * @see R.objOf, R.of + * @example + * + * R.pair('foo', 'bar'); //=> ['foo', 'bar'] + */ + var pair = _curry2(function pair(fst, snd) { return [fst, snd]; }); + + function _createPartialApplicator(concat) { + return _curry2(function(fn, args) { + return _arity(Math.max(0, fn.length - args.length), function() { + return fn.apply(this, concat(args, arguments)); + }); + }); + } + + /** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided initially followed by the arguments provided to `g`. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partialRight, R.curry + * @example + * + * const multiply2 = (a, b) => a * b; + * const double = R.partial(multiply2, [2]); + * double(2); //=> 4 + * + * const greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * const sayHello = R.partial(greet, ['Hello']); + * const sayHelloToMs = R.partial(sayHello, ['Ms.']); + * sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d) + */ + var partial = _createPartialApplicator(_concat); + + /** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided to `g` followed by the arguments provided initially. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partial + * @example + * + * const greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + * + * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) + */ + var partialRight = _createPartialApplicator(flip(_concat)); + + /** + * Takes a predicate and a list or other `Filterable` object and returns the + * pair of filterable objects of the same type of elements which do and do not + * satisfy, the predicate, respectively. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a] + * @param {Function} pred A predicate to determine which side the element belongs to. + * @param {Array} filterable the list (or other filterable) to partition. + * @return {Array} An array, containing first the subset of elements that satisfy the + * predicate, and second the subset of elements that do not satisfy. + * @see R.filter, R.reject + * @example + * + * R.partition(R.includes('s'), ['sss', 'ttt', 'foo', 'bars']); + * // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ] + * + * R.partition(R.includes('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); + * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] + */ + var partition = juxt([filter, reject]); + + /** + * Determines whether a nested path on an object has a specific value, in + * [`R.equals`](#equals) terms. Most likely used to filter a list. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Relation + * @typedefn Idx = String | Int + * @sig [Idx] -> a -> {a} -> Boolean + * @param {Array} path The path of the nested property to use + * @param {*} val The value to compare the nested property with + * @param {Object} obj The object to check the nested property in + * @return {Boolean} `true` if the value equals the nested object property, + * `false` otherwise. + * @example + * + * const user1 = { address: { zipCode: 90210 } }; + * const user2 = { address: { zipCode: 55555 } }; + * const user3 = { name: 'Bob' }; + * const users = [ user1, user2, user3 ]; + * const isFamous = R.pathEq(['address', 'zipCode'], 90210); + * R.filter(isFamous, users); //=> [ user1 ] + */ + var pathEq = _curry3(function pathEq(_path, val, obj) { + return equals(path(_path, obj), val); + }); + + /** + * If the given, non-null object has a value at the given path, returns the + * value at that path. Otherwise returns the provided default value. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Object + * @typedefn Idx = String | Int + * @sig a -> [Idx] -> {a} -> a + * @param {*} d The default value. + * @param {Array} p The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path` of the supplied object or the default value. + * @example + * + * R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2 + * R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A" + */ + var pathOr = _curry3(function pathOr(d, p, obj) { + return defaultTo(d, path(p, obj)); + }); + + /** + * Returns `true` if the specified object property at given path satisfies the + * given predicate; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Logic + * @typedefn Idx = String | Int + * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean + * @param {Function} pred + * @param {Array} propPath + * @param {*} obj + * @return {Boolean} + * @see R.propSatisfies, R.path + * @example + * + * R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true + * R.pathSatisfies(R.is(Object), [], {x: {y: 2}}); //=> true + */ + var pathSatisfies = _curry3(function pathSatisfies(pred, propPath, obj) { + return pred(path(propPath, obj)); + }); + + /** + * Returns a partial copy of an object containing only the keys specified. If + * the key does not exist, the property is ignored. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.omit, R.props + * @example + * + * R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1} + */ + var pick = _curry2(function pick(names, obj) { + var result = {}; + var idx = 0; + while (idx < names.length) { + if (names[idx] in obj) { + result[names[idx]] = obj[names[idx]]; + } + idx += 1; + } + return result; + }); + + /** + * Similar to `pick` except that this one includes a `key: undefined` pair for + * properties that don't exist. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.pick + * @example + * + * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} + */ + var pickAll = _curry2(function pickAll(names, obj) { + var result = {}; + var idx = 0; + var len = names.length; + while (idx < len) { + var name = names[idx]; + result[name] = obj[name]; + idx += 1; + } + return result; + }); + + /** + * Returns a partial copy of an object containing only the keys that satisfy + * the supplied predicate. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @sig ((v, k) -> Boolean) -> {k: v} -> {k: v} + * @param {Function} pred A predicate to determine whether or not a key + * should be included on the output object. + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties that satisfy `pred` + * on it. + * @see R.pick, R.filter + * @example + * + * const isUpperCase = (val, key) => key.toUpperCase() === key; + * R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4} + */ + var pickBy = _curry2(function pickBy(test, obj) { + var result = {}; + for (var prop in obj) { + if (test(obj[prop], prop, obj)) { + result[prop] = obj[prop]; + } + } + return result; + }); + + /** + * Returns the left-to-right Kleisli composition of the provided functions, + * each of which must return a value of a type supported by [`chain`](#chain). + * + * `R.pipeK(f, g, h)` is equivalent to `R.pipe(f, R.chain(g), R.chain(h))`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Function + * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z) + * @param {...Function} + * @return {Function} + * @see R.composeK + * @deprecated since v0.26.0 + * @example + * + * // parseJson :: String -> Maybe * + * // get :: String -> Object -> Maybe * + * + * // getStateCode :: Maybe String -> Maybe String + * const getStateCode = R.pipeK( + * parseJson, + * get('user'), + * get('address'), + * get('state'), + * R.compose(Maybe.of, R.toUpper) + * ); + * + * getStateCode('{"user":{"address":{"state":"ny"}}}'); + * //=> Just('NY') + * getStateCode('[Invalid JSON]'); + * //=> Nothing() + * @symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a))) + */ + function pipeK() { + if (arguments.length === 0) { + throw new Error('pipeK requires at least one argument'); + } + return composeK.apply(this, reverse(arguments)); + } + + /** + * Returns a new list with the given element at the front, followed by the + * contents of the list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} el The item to add to the head of the output list. + * @param {Array} list The array to add to the tail of the output list. + * @return {Array} A new array. + * @see R.append + * @example + * + * R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] + */ + var prepend = _curry2(function prepend(el, list) { + return _concat([el], list); + }); + + /** + * Multiplies together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The product of all the numbers in the list. + * @see R.reduce + * @example + * + * R.product([2,4,6,8,100,1]); //=> 38400 + */ + var product = reduce(multiply, 1); + + /** + * Accepts a function `fn` and a list of transformer functions and returns a + * new curried function. When the new function is invoked, it calls the + * function `fn` with parameters consisting of the result of calling each + * supplied handler on successive arguments to the new function. + * + * If more arguments are passed to the returned function than transformer + * functions, those arguments are passed directly to `fn` as additional + * parameters. If you expect additional arguments that don't need to be + * transformed, although you can ignore them, it's best to pass an identity + * function so that the new function reports the correct arity. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} fn The function to wrap. + * @param {Array} transformers A list of transformer functions + * @return {Function} The wrapped function. + * @see R.converge + * @example + * + * R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + * R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + * R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 + * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) + */ + var useWith = _curry2(function useWith(fn, transformers) { + return curryN(transformers.length, function() { + var args = []; + var idx = 0; + while (idx < transformers.length) { + args.push(transformers[idx].call(this, arguments[idx])); + idx += 1; + } + return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length))); + }); + }); + + /** + * Reasonable analog to SQL `select` statement. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @category Relation + * @sig [k] -> [{k: v}] -> [{k: v}] + * @param {Array} props The property names to project + * @param {Array} objs The objects to query + * @return {Array} An array of objects with just the `props` properties. + * @example + * + * const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; + * const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; + * const kids = [abby, fred]; + * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] + */ + var project = useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity + + /** + * Returns `true` if the specified object property is equal, in + * [`R.equals`](#equals) terms, to the given value; `false` otherwise. + * You can test multiple properties with [`R.whereEq`](#whereEq). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig String -> a -> Object -> Boolean + * @param {String} name + * @param {*} val + * @param {*} obj + * @return {Boolean} + * @see R.whereEq, R.propSatisfies, R.equals + * @example + * + * const abby = {name: 'Abby', age: 7, hair: 'blond'}; + * const fred = {name: 'Fred', age: 12, hair: 'brown'}; + * const rusty = {name: 'Rusty', age: 10, hair: 'brown'}; + * const alois = {name: 'Alois', age: 15, disposition: 'surly'}; + * const kids = [abby, fred, rusty, alois]; + * const hasBrownHair = R.propEq('hair', 'brown'); + * R.filter(hasBrownHair, kids); //=> [fred, rusty] + */ + var propEq = _curry3(function propEq(name, val, obj) { + return equals(val, obj[name]); + }); + + /** + * Returns `true` if the specified object property is of the given type; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Type + * @sig Type -> String -> Object -> Boolean + * @param {Function} type + * @param {String} name + * @param {*} obj + * @return {Boolean} + * @see R.is, R.propSatisfies + * @example + * + * R.propIs(Number, 'x', {x: 1, y: 2}); //=> true + * R.propIs(Number, 'x', {x: 'foo'}); //=> false + * R.propIs(Number, 'x', {}); //=> false + */ + var propIs = _curry3(function propIs(type, name, obj) { + return is(type, obj[name]); + }); + + /** + * If the given, non-null object has an own property with the specified name, + * returns the value of that property. Otherwise returns the provided default + * value. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Object + * @sig a -> String -> Object -> a + * @param {*} val The default value. + * @param {String} p The name of the property to return. + * @param {Object} obj The object to query. + * @return {*} The value of given property of the supplied object or the default value. + * @example + * + * const alice = { + * name: 'ALICE', + * age: 101 + * }; + * const favorite = R.prop('favoriteLibrary'); + * const favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary'); + * + * favorite(alice); //=> undefined + * favoriteWithDefault(alice); //=> 'Ramda' + */ + var propOr = _curry3(function propOr(val, p, obj) { + return pathOr(val, [p], obj); + }); + + /** + * Returns `true` if the specified object property satisfies the given + * predicate; `false` otherwise. You can test multiple properties with + * [`R.where`](#where). + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Logic + * @sig (a -> Boolean) -> String -> {String: a} -> Boolean + * @param {Function} pred + * @param {String} name + * @param {*} obj + * @return {Boolean} + * @see R.where, R.propEq, R.propIs + * @example + * + * R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true + */ + var propSatisfies = _curry3(function propSatisfies(pred, name, obj) { + return pred(obj[name]); + }); + + /** + * Acts as multiple `prop`: array of keys in, array of values out. Preserves + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> [v] + * @param {Array} ps The property names to fetch + * @param {Object} obj The object to query + * @return {Array} The corresponding values or partially applied function. + * @example + * + * R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2] + * R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2] + * + * const fullName = R.compose(R.join(' '), R.props(['first', 'last'])); + * fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth' + */ + var props = _curry2(function props(ps, obj) { + return ps.map(function(p) { + return path([p], obj); + }); + }); + + /** + * Returns a list of numbers from `from` (inclusive) to `to` (exclusive). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> Number -> [Number] + * @param {Number} from The first number in the list. + * @param {Number} to One more than the last number in the list. + * @return {Array} The list of numbers in the set `[a, b)`. + * @example + * + * R.range(1, 5); //=> [1, 2, 3, 4] + * R.range(50, 53); //=> [50, 51, 52] + */ + var range = _curry2(function range(from, to) { + if (!(_isNumber(from) && _isNumber(to))) { + throw new TypeError('Both arguments to range must be numbers'); + } + var result = []; + var n = from; + while (n < to) { + result.push(n); + n += 1; + } + return result; + }); + + /** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * Similar to [`reduce`](#reduce), except moves through the input list from the + * right to the left. + * + * The iterator function receives two values: *(value, acc)*, while the arguments' + * order of `reduce`'s iterator function is *(acc, value)*. + * + * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduceRight` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> b) -> b -> [a] -> b + * @param {Function} fn The iterator function. Receives two values, the current element from the array + * and the accumulator. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.addIndex + * @example + * + * R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2 + * // - -2 + * // / \ / \ + * // 1 - 1 3 + * // / \ / \ + * // 2 - ==> 2 -1 + * // / \ / \ + * // 3 - 3 4 + * // / \ / \ + * // 4 0 4 0 + * + * @symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a))) + */ + var reduceRight = _curry3(function reduceRight(fn, acc, list) { + var idx = list.length - 1; + while (idx >= 0) { + acc = fn(list[idx], acc); + idx -= 1; + } + return acc; + }); + + /** + * Like [`reduce`](#reduce), `reduceWhile` returns a single item by iterating + * through the list, successively calling the iterator function. `reduceWhile` + * also takes a predicate that is evaluated before each step. If the predicate + * returns `false`, it "short-circuits" the iteration and returns the current + * value of the accumulator. + * + * @func + * @memberOf R + * @since v0.22.0 + * @category List + * @sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} pred The predicate. It is passed the accumulator and the + * current element. + * @param {Function} fn The iterator function. Receives two values, the + * accumulator and the current element. + * @param {*} a The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced + * @example + * + * const isOdd = (acc, x) => x % 2 === 1; + * const xs = [1, 3, 5, 60, 777, 800]; + * R.reduceWhile(isOdd, R.add, 0, xs); //=> 9 + * + * const ys = [2, 4, 6] + * R.reduceWhile(isOdd, R.add, 111, ys); //=> 111 + */ + var reduceWhile = _curryN(4, [], function _reduceWhile(pred, fn, a, list) { + return _reduce(function(acc, x) { + return pred(acc, x) ? fn(acc, x) : _reduced(acc); + }, a, list); + }); + + /** + * Returns a value wrapped to indicate that it is the final value of the reduce + * and transduce functions. The returned value should be considered a black + * box: the internal structure is not guaranteed to be stable. + * + * Note: this optimization is only available to the below functions: + * - [`reduce`](#reduce) + * - [`reduceWhile`](#reduceWhile) + * - [`transduce`](#transduce) + * + * @func + * @memberOf R + * @since v0.15.0 + * @category List + * @sig a -> * + * @param {*} x The final value of the reduce. + * @return {*} The wrapped value. + * @see R.reduce, R.reduceWhile, R.transduce + * @example + * + * R.reduce( + * (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item), + * [], + * [1, 2, 3, 4, 5]) // [1, 2, 3] + */ + var reduced = _curry1(_reduced); + + /** + * Calls an input function `n` times, returning an array containing the results + * of those function calls. + * + * `fn` is passed one argument: The current value of `n`, which begins at `0` + * and is gradually incremented to `n - 1`. + * + * @func + * @memberOf R + * @since v0.2.3 + * @category List + * @sig (Number -> a) -> Number -> [a] + * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`. + * @param {Number} n A value between `0` and `n - 1`. Increments after each function call. + * @return {Array} An array containing the return values of all calls to `fn`. + * @see R.repeat + * @example + * + * R.times(R.identity, 5); //=> [0, 1, 2, 3, 4] + * @symb R.times(f, 0) = [] + * @symb R.times(f, 1) = [f(0)] + * @symb R.times(f, 2) = [f(0), f(1)] + */ + var times = _curry2(function times(fn, n) { + var len = Number(n); + var idx = 0; + var list; + + if (len < 0 || isNaN(len)) { + throw new RangeError('n must be a non-negative number'); + } + list = new Array(len); + while (idx < len) { + list[idx] = fn(idx); + idx += 1; + } + return list; + }); + + /** + * Returns a fixed list of size `n` containing a specified identical value. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig a -> n -> [a] + * @param {*} value The value to repeat. + * @param {Number} n The desired size of the output list. + * @return {Array} A new array containing `n` `value`s. + * @see R.times + * @example + * + * R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi'] + * + * const obj = {}; + * const repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}] + * repeatedObjs[0] === repeatedObjs[1]; //=> true + * @symb R.repeat(a, 0) = [] + * @symb R.repeat(a, 1) = [a] + * @symb R.repeat(a, 2) = [a, a] + */ + var repeat = _curry2(function repeat(value, n) { + return times(always(value), n); + }); + + /** + * Replace a substring or regex match in a string with a replacement. + * + * The first two parameters correspond to the parameters of the + * `String.prototype.replace()` function, so the second parameter can also be a + * function. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category String + * @sig RegExp|String -> String -> String -> String + * @param {RegExp|String} pattern A regular expression or a substring to match. + * @param {String} replacement The string to replace the matches with. + * @param {String} str The String to do the search and replacement in. + * @return {String} The result. + * @example + * + * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo' + * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo' + * + * // Use the "g" (global) flag to replace all occurrences: + * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar' + */ + var replace = _curry3(function replace(regex, replacement, str) { + return str.replace(regex, replacement); + }); + + /** + * Scan is similar to [`reduce`](#reduce), but returns a list of successively + * reduced values from the left + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> [a] + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {Array} A list of all intermediately reduced values. + * @see R.reduce, R.mapAccum + * @example + * + * const numbers = [1, 2, 3, 4]; + * const factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24] + * @symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)] + */ + var scan = _curry3(function scan(fn, acc, list) { + var idx = 0; + var len = list.length; + var result = [acc]; + while (idx < len) { + acc = fn(acc, list[idx]); + result[idx + 1] = acc; + idx += 1; + } + return result; + }); + + /** + * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) + * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an + * Applicative of Traversable. + * + * Dispatches to the `sequence` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a) + * @param {Function} of + * @param {*} traversable + * @return {*} + * @see R.traverse + * @example + * + * R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]); //=> Just([1, 2, 3]) + * R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing() + * + * R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)] + * R.sequence(R.of, Nothing()); //=> [Nothing()] + */ + var sequence = _curry2(function sequence(of, traversable) { + return typeof traversable.sequence === 'function' ? + traversable.sequence(of) : + reduceRight( + function(x, acc) { return ap(map(prepend, x), acc); }, + of([]), + traversable + ); + }); + + /** + * Returns the result of "setting" the portion of the given data structure + * focused by the given lens to the given value. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> a -> s -> s + * @param {Lens} lens + * @param {*} v + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lensProp('x'); + * + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2} + */ + var set = _curry3(function set(lens, v, x) { + return over(lens, always(v), x); + }); + + /** + * Returns a copy of the list, sorted according to the comparator function, + * which should accept two values at a time and return a negative number if the + * first value is smaller, a positive number if it's larger, and zero if they + * are equal. Please note that this is a **copy** of the list. It does not + * modify the original. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, a) -> Number) -> [a] -> [a] + * @param {Function} comparator A sorting function :: a -> b -> Int + * @param {Array} list The list to sort + * @return {Array} a new array with its elements sorted by the comparator function. + * @example + * + * const diff = function(a, b) { return a - b; }; + * R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7] + */ + var sort = _curry2(function sort(comparator, list) { + return Array.prototype.slice.call(list, 0).sort(comparator); + }); + + /** + * Sorts the list according to the supplied function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord b => (a -> b) -> [a] -> [a] + * @param {Function} fn + * @param {Array} list The list to sort. + * @return {Array} A new list sorted by the keys generated by `fn`. + * @example + * + * const sortByFirstItem = R.sortBy(R.prop(0)); + * const pairs = [[-1, 1], [-2, 2], [-3, 3]]; + * sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]] + * + * const sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name'))); + * const alice = { + * name: 'ALICE', + * age: 101 + * }; + * const bob = { + * name: 'Bob', + * age: -10 + * }; + * const clara = { + * name: 'clara', + * age: 314.159 + * }; + * const people = [clara, bob, alice]; + * sortByNameCaseInsensitive(people); //=> [alice, bob, clara] + */ + var sortBy = _curry2(function sortBy(fn, list) { + return Array.prototype.slice.call(list, 0).sort(function(a, b) { + var aa = fn(a); + var bb = fn(b); + return aa < bb ? -1 : aa > bb ? 1 : 0; + }); + }); + + /** + * Sorts a list according to a list of comparators. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Relation + * @sig [(a, a) -> Number] -> [a] -> [a] + * @param {Array} functions A list of comparator functions. + * @param {Array} list The list to sort. + * @return {Array} A new list sorted according to the comarator functions. + * @example + * + * const alice = { + * name: 'alice', + * age: 40 + * }; + * const bob = { + * name: 'bob', + * age: 30 + * }; + * const clara = { + * name: 'clara', + * age: 40 + * }; + * const people = [clara, bob, alice]; + * const ageNameSort = R.sortWith([ + * R.descend(R.prop('age')), + * R.ascend(R.prop('name')) + * ]); + * ageNameSort(people); //=> [alice, clara, bob] + */ + var sortWith = _curry2(function sortWith(fns, list) { + return Array.prototype.slice.call(list, 0).sort(function(a, b) { + var result = 0; + var i = 0; + while (result === 0 && i < fns.length) { + result = fns[i](a, b); + i += 1; + } + return result; + }); + }); + + /** + * Splits a string into an array of strings based on the given + * separator. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig (String | RegExp) -> String -> [String] + * @param {String|RegExp} sep The pattern. + * @param {String} str The string to separate into an array. + * @return {Array} The array of strings from `str` separated by `sep`. + * @see R.join + * @example + * + * const pathComponents = R.split('/'); + * R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + * + * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] + */ + var split = invoker(1, 'split'); + + /** + * Splits a given list or string at a given index. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig Number -> [a] -> [[a], [a]] + * @sig Number -> String -> [String, String] + * @param {Number} index The index where the array/string is split. + * @param {Array|String} array The array/string to be split. + * @return {Array} + * @example + * + * R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] + * R.splitAt(5, 'hello world'); //=> ['hello', ' world'] + * R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] + */ + var splitAt = _curry2(function splitAt(index, array) { + return [slice(0, index, array), slice(index, length(array), array)]; + }); + + /** + * Splits a collection into slices of the specified length. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [[a]] + * @sig Number -> String -> [String] + * @param {Number} n + * @param {Array} list + * @return {Array} + * @example + * + * R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]] + * R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz'] + */ + var splitEvery = _curry2(function splitEvery(n, list) { + if (n <= 0) { + throw new Error('First argument to splitEvery must be a positive integer'); + } + var result = []; + var idx = 0; + while (idx < list.length) { + result.push(slice(idx, idx += n, list)); + } + return result; + }); + + /** + * Takes a list and a predicate and returns a pair of lists with the following properties: + * + * - the result of concatenating the two output lists is equivalent to the input list; + * - none of the elements of the first output list satisfies the predicate; and + * - if the second output list is non-empty, its first element satisfies the predicate. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [[a], [a]] + * @param {Function} pred The predicate that determines where the array is split. + * @param {Array} list The array to be split. + * @return {Array} + * @example + * + * R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] + */ + var splitWhen = _curry2(function splitWhen(pred, list) { + var idx = 0; + var len = list.length; + var prefix = []; + + while (idx < len && !pred(list[idx])) { + prefix.push(list[idx]); + idx += 1; + } + + return [prefix, Array.prototype.slice.call(list, idx)]; + }); + + /** + * Checks if a list starts with the provided sublist. + * + * Similarly, checks if a string starts with the provided substring. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category List + * @sig [a] -> [a] -> Boolean + * @sig String -> String -> Boolean + * @param {*} prefix + * @param {*} list + * @return {Boolean} + * @see R.endsWith + * @example + * + * R.startsWith('a', 'abc') //=> true + * R.startsWith('b', 'abc') //=> false + * R.startsWith(['a'], ['a', 'b', 'c']) //=> true + * R.startsWith(['b'], ['a', 'b', 'c']) //=> false + */ + var startsWith = _curry2(function(prefix, list) { + return equals(take(prefix.length, list), prefix); + }); + + /** + * Subtracts its second argument from its first argument. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a - b`. + * @see R.add + * @example + * + * R.subtract(10, 8); //=> 2 + * + * const minus5 = R.subtract(R.__, 5); + * minus5(17); //=> 12 + * + * const complementaryAngle = R.subtract(90); + * complementaryAngle(30); //=> 60 + * complementaryAngle(72); //=> 18 + */ + var subtract = _curry2(function subtract(a, b) { + return Number(a) - Number(b); + }); + + /** + * Finds the set (i.e. no duplicates) of all elements contained in the first or + * second list, but not both. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` or `list2`, but not both. + * @see R.symmetricDifferenceWith, R.difference, R.differenceWith + * @example + * + * R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5] + * R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2] + */ + var symmetricDifference = _curry2(function symmetricDifference(list1, list2) { + return concat(difference(list1, list2), difference(list2, list1)); + }); + + /** + * Finds the set (i.e. no duplicates) of all elements contained in the first or + * second list, but not both. Duplication is determined according to the value + * returned by applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` or `list2`, but not both. + * @see R.symmetricDifference, R.difference, R.differenceWith + * @example + * + * const eqA = R.eqBy(R.prop('a')); + * const l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}]; + * const l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}]; + * R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + */ + var symmetricDifferenceWith = _curry3(function symmetricDifferenceWith(pred, list1, list2) { + return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1)); + }); + + /** + * Returns a new list containing the last `n` elements of a given list, passing + * each value to the supplied predicate function, and terminating when the + * predicate function returns `false`. Excludes the element that caused the + * predicate function to fail. The predicate function is passed one argument: + * *(value)*. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.dropLastWhile, R.addIndex + * @example + * + * const isNotOne = x => x !== 1; + * + * R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4] + * + * R.takeLastWhile(x => x !== 'R' , 'Ramda'); //=> 'amda' + */ + var takeLastWhile = _curry2(function takeLastWhile(fn, xs) { + var idx = xs.length - 1; + while (idx >= 0 && fn(xs[idx])) { + idx -= 1; + } + return slice(idx + 1, Infinity, xs); + }); + + function XTakeWhile(f, xf) { + this.xf = xf; + this.f = f; + } + XTakeWhile.prototype['@@transducer/init'] = _xfBase.init; + XTakeWhile.prototype['@@transducer/result'] = _xfBase.result; + XTakeWhile.prototype['@@transducer/step'] = function(result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result); + }; + + var _xtakeWhile = _curry2(function _xtakeWhile(f, xf) { return new XTakeWhile(f, xf); }); + + /** + * Returns a new list containing the first `n` elements of a given list, + * passing each value to the supplied predicate function, and terminating when + * the predicate function returns `false`. Excludes the element that caused the + * predicate function to fail. The predicate function is passed one argument: + * *(value)*. + * + * Dispatches to the `takeWhile` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.dropWhile, R.transduce, R.addIndex + * @example + * + * const isNotFour = x => x !== 4; + * + * R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3] + * + * R.takeWhile(x => x !== 'd' , 'Ramda'); //=> 'Ram' + */ + var takeWhile = _curry2(_dispatchable(['takeWhile'], _xtakeWhile, function takeWhile(fn, xs) { + var idx = 0; + var len = xs.length; + while (idx < len && fn(xs[idx])) { + idx += 1; + } + return slice(0, idx, xs); + })); + + function XTap(f, xf) { + this.xf = xf; + this.f = f; + } + XTap.prototype['@@transducer/init'] = _xfBase.init; + XTap.prototype['@@transducer/result'] = _xfBase.result; + XTap.prototype['@@transducer/step'] = function(result, input) { + this.f(input); + return this.xf['@@transducer/step'](result, input); + }; + + var _xtap = _curry2(function _xtap(f, xf) { return new XTap(f, xf); }); + + /** + * Runs the given function with the supplied object, then returns the object. + * + * Acts as a transducer if a transformer is given as second parameter. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (a -> *) -> a -> a + * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away. + * @param {*} x + * @return {*} `x`. + * @example + * + * const sayX = x => console.log('x is ' + x); + * R.tap(sayX, 100); //=> 100 + * // logs 'x is 100' + * @symb R.tap(f, a) = a + */ + var tap = _curry2(_dispatchable([], _xtap, function tap(fn, x) { + fn(x); + return x; + })); + + function _isRegExp(x) { + return Object.prototype.toString.call(x) === '[object RegExp]'; + } + + /** + * Determines whether a given string matches a given regular expression. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category String + * @sig RegExp -> String -> Boolean + * @param {RegExp} pattern + * @param {String} str + * @return {Boolean} + * @see R.match + * @example + * + * R.test(/^x/, 'xyz'); //=> true + * R.test(/^y/, 'xyz'); //=> false + */ + var test = _curry2(function test(pattern, str) { + if (!_isRegExp(pattern)) { + throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received ' + toString$1(pattern)); + } + return _cloneRegExp(pattern).test(str); + }); + + /** + * Returns the result of applying the onSuccess function to the value inside + * a successfully resolved promise. This is useful for working with promises + * inside function compositions. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Function + * @sig (a -> b) -> (Promise e a) -> (Promise e b) + * @sig (a -> (Promise e b)) -> (Promise e a) -> (Promise e b) + * @param {Function} onSuccess The function to apply. Can return a value or a promise of a value. + * @param {Promise} p + * @return {Promise} The result of calling `p.then(onSuccess)` + * @see R.otherwise + * @example + * + * var makeQuery = (email) => ({ query: { email }}); + * + * //getMemberName :: String -> Promise ({firstName, lastName}) + * var getMemberName = R.pipe( + * makeQuery, + * fetchMember, + * R.andThen(R.pick(['firstName', 'lastName'])) + * ); + */ + var andThen = _curry2(function andThen(f, p) { + _assertPromise('andThen', p); + + return p.then(f); + }); + + /** + * The lower case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to lower case. + * @return {String} The lower case version of `str`. + * @see R.toUpper + * @example + * + * R.toLower('XYZ'); //=> 'xyz' + */ + var toLower = invoker(0, 'toLowerCase'); + + /** + * Converts an object into an array of key, value arrays. Only the object's + * own properties are used. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own properties. + * @see R.fromPairs + * @example + * + * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] + */ + var toPairs = _curry1(function toPairs(obj) { + var pairs = []; + for (var prop in obj) { + if (_has(prop, obj)) { + pairs[pairs.length] = [prop, obj[prop]]; + } + } + return pairs; + }); + + /** + * Converts an object into an array of key, value arrays. The object's own + * properties and prototype properties are used. Note that the order of the + * output array is not guaranteed to be consistent across different JS + * platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own + * and prototype properties. + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.toPairsIn(f); //=> [['x','X'], ['y','Y']] + */ + var toPairsIn = _curry1(function toPairsIn(obj) { + var pairs = []; + for (var prop in obj) { + pairs[pairs.length] = [prop, obj[prop]]; + } + return pairs; + }); + + /** + * The upper case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to upper case. + * @return {String} The upper case version of `str`. + * @see R.toLower + * @example + * + * R.toUpper('abc'); //=> 'ABC' + */ + var toUpper = invoker(0, 'toUpperCase'); + + /** + * Initializes a transducer using supplied iterator function. Returns a single + * item by iterating through the list, successively calling the transformed + * iterator function and passing it an accumulator value and the current value + * from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It will be + * wrapped as a transformer to initialize the transducer. A transformer can be + * passed directly in place of an iterator function. In both cases, iteration + * may be stopped early with the [`R.reduced`](#reduced) function. + * + * A transducer is a function that accepts a transformer and returns a + * transformer and can be composed directly. + * + * A transformer is an an object that provides a 2-arity reducing iterator + * function, step, 0-arity initial value function, init, and 1-arity result + * extraction function, result. The step function is used as the iterator + * function in reduce. The result function is used to convert the final + * accumulator into the return type and in most cases is + * [`R.identity`](#identity). The init function can be used to provide an + * initial accumulator, but is ignored by transduce. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. Wrapped as transformer, if necessary, and used to + * initialize the transducer + * @param {*} acc The initial accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced, R.into + * @example + * + * const numbers = [1, 2, 3, 4]; + * const transducer = R.compose(R.map(R.add(1)), R.take(2)); + * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] + * + * const isOdd = (x) => x % 2 === 1; + * const firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); + * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] + */ + var transduce = curryN(4, function transduce(xf, fn, acc, list) { + return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); + }); + + /** + * Transposes the rows and columns of a 2D list. + * When passed a list of `n` lists of length `x`, + * returns a list of `x` lists of length `n`. + * + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig [[a]] -> [[a]] + * @param {Array} list A 2D list + * @return {Array} A 2D list + * @example + * + * R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']] + * R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']] + * + * // If some of the rows are shorter than the following rows, their elements are skipped: + * R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]] + * @symb R.transpose([[a], [b], [c]]) = [a, b, c] + * @symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]] + * @symb R.transpose([[a, b], [c]]) = [[a, c], [b]] + */ + var transpose = _curry1(function transpose(outerlist) { + var i = 0; + var result = []; + while (i < outerlist.length) { + var innerlist = outerlist[i]; + var j = 0; + while (j < innerlist.length) { + if (typeof result[j] === 'undefined') { + result[j] = []; + } + result[j].push(innerlist[j]); + j += 1; + } + i += 1; + } + return result; + }); + + /** + * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning + * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable), + * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative + * into an Applicative of Traversable. + * + * Dispatches to the `traverse` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b) + * @param {Function} of + * @param {Function} f + * @param {*} traversable + * @return {*} + * @see R.sequence + * @example + * + * // Returns `Maybe.Nothing` if the given divisor is `0` + * const safeDiv = n => d => d === 0 ? Maybe.Nothing() : Maybe.Just(n / d) + * + * R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Maybe.Just([5, 2.5, 2]) + * R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Maybe.Nothing + */ + var traverse = _curry3(function traverse(of, f, traversable) { + return typeof traversable['fantasy-land/traverse'] === 'function' ? + traversable['fantasy-land/traverse'](f, of) : + sequence(of, map(f, traversable)); + }); + + var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + + '\u2029\uFEFF'; + var zeroWidth = '\u200b'; + var hasProtoTrim = (typeof String.prototype.trim === 'function'); + /** + * Removes (strips) whitespace from both ends of the string. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category String + * @sig String -> String + * @param {String} str The string to trim. + * @return {String} Trimmed version of `str`. + * @example + * + * R.trim(' xyz '); //=> 'xyz' + * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] + */ + var trim = !hasProtoTrim || (ws.trim() || !zeroWidth.trim()) ? + _curry1(function trim(str) { + var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); + var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); + return str.replace(beginRx, '').replace(endRx, ''); + }) : + _curry1(function trim(str) { + return str.trim(); + }); + + /** + * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned + * function evaluates the `tryer`; if it does not throw, it simply returns the + * result. If the `tryer` *does* throw, the returned function evaluates the + * `catcher` function and returns its result. Note that for effective + * composition with this function, both the `tryer` and `catcher` functions + * must return the same type of results. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Function + * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a) + * @param {Function} tryer The function that may throw. + * @param {Function} catcher The function that will be evaluated if `tryer` throws. + * @return {Function} A new function that will catch exceptions and send then to the catcher. + * @example + * + * R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true + * R.tryCatch(() => { throw 'foo'}, R.always('catched'))('bar') // => 'catched' + * R.tryCatch(R.times(R.identity), R.always([]))('s') // => [] + * R.tryCatch(() => { throw 'this is not a valid value'}, (err, value)=>({error : err, value }))('bar') // => {'error': 'this is not a valid value', 'value': 'bar'} + */ + var tryCatch = _curry2(function _tryCatch(tryer, catcher) { + return _arity(tryer.length, function() { + try { + return tryer.apply(this, arguments); + } catch (e) { + return catcher.apply(this, _concat([e], arguments)); + } + }); + }); + + /** + * Takes a function `fn`, which takes a single array argument, and returns a + * function which: + * + * - takes any number of positional arguments; + * - passes these arguments to `fn` as an array; and + * - returns the result. + * + * In other words, `R.unapply` derives a variadic function from a function which + * takes an array. `R.unapply` is the inverse of [`R.apply`](#apply). + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Function + * @sig ([*...] -> a) -> (*... -> a) + * @param {Function} fn + * @return {Function} + * @see R.apply + * @example + * + * R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]' + * @symb R.unapply(f)(a, b) = f([a, b]) + */ + var unapply = _curry1(function unapply(fn) { + return function() { + return fn(Array.prototype.slice.call(arguments, 0)); + }; + }); + + /** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly 1 parameter. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Function + * @sig (* -> b) -> (a -> b) + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity 1. + * @see R.binary, R.nAry + * @example + * + * const takesTwoArgs = function(a, b) { + * return [a, b]; + * }; + * takesTwoArgs.length; //=> 2 + * takesTwoArgs(1, 2); //=> [1, 2] + * + * const takesOneArg = R.unary(takesTwoArgs); + * takesOneArg.length; //=> 1 + * // Only 1 argument is passed to the wrapped function + * takesOneArg(1, 2); //=> [1, undefined] + * @symb R.unary(f)(a, b, c) = f(a) + */ + var unary = _curry1(function unary(fn) { + return nAry(1, fn); + }); + + /** + * Returns a function of arity `n` from a (manually) curried function. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Function + * @sig Number -> (a -> b) -> (a -> c) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to uncurry. + * @return {Function} A new function. + * @see R.curry + * @example + * + * const addFour = a => b => c => d => a + b + c + d; + * + * const uncurriedAddFour = R.uncurryN(4, addFour); + * uncurriedAddFour(1, 2, 3, 4); //=> 10 + */ + var uncurryN = _curry2(function uncurryN(depth, fn) { + return curryN(depth, function() { + var currentDepth = 1; + var value = fn; + var idx = 0; + var endIdx; + while (currentDepth <= depth && typeof value === 'function') { + endIdx = currentDepth === depth ? arguments.length : idx + value.length; + value = value.apply(this, Array.prototype.slice.call(arguments, idx, endIdx)); + currentDepth += 1; + idx = endIdx; + } + return value; + }); + }); + + /** + * Builds a list from a seed value. Accepts an iterator function, which returns + * either false to stop iteration or an array of length 2 containing the value + * to add to the resulting list and the seed to be used in the next call to the + * iterator function. + * + * The iterator function receives one argument: *(seed)*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig (a -> [b]) -> * -> [b] + * @param {Function} fn The iterator function. receives one argument, `seed`, and returns + * either false to quit iteration or an array of length two to proceed. The element + * at index 0 of this array will be added to the resulting array, and the element + * at index 1 will be passed to the next call to `fn`. + * @param {*} seed The seed value. + * @return {Array} The final list. + * @example + * + * const f = n => n > 50 ? false : [-n, n + 10]; + * R.unfold(f, 10); //=> [-10, -20, -30, -40, -50] + * @symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...] + */ + var unfold = _curry2(function unfold(fn, seed) { + var pair = fn(seed); + var result = []; + while (pair && pair.length) { + result[result.length] = pair[0]; + pair = fn(pair[1]); + } + return result; + }); + + /** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @example + * + * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] + */ + var union = _curry2(compose(uniq, _concat)); + + /** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied predicate to + * two list elements. Prefers the first item if two items compare equal based + * on the predicate. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * const strEq = R.eqBy(String); + * R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2] + * R.uniqWith(strEq)([{}, {}]); //=> [{}] + * R.uniqWith(strEq)([1, '1', 1]); //=> [1] + * R.uniqWith(strEq)(['1', 1, 1]); //=> ['1'] + */ + var uniqWith = _curry2(function uniqWith(pred, list) { + var idx = 0; + var len = list.length; + var result = []; + var item; + while (idx < len) { + item = list[idx]; + if (!_includesWith(pred, item, result)) { + result[result.length] = item; + } + idx += 1; + } + return result; + }); + + /** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. Duplication is determined according to the value returned by + * applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [*] -> [*] -> [*] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @see R.union + * @example + * + * const l1 = [{a: 1}, {a: 2}]; + * const l2 = [{a: 1}, {a: 4}]; + * R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}] + */ + var unionWith = _curry3(function unionWith(pred, list1, list2) { + return uniqWith(pred, _concat(list1, list2)); + }); + + /** + * Tests the final argument by passing it to the given predicate function. If + * the predicate is not satisfied, the function will return the result of + * calling the `whenFalseFn` function with the same argument. If the predicate + * is satisfied, the argument is returned as is. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates + * to a falsy value. + * @param {*} x An object to test with the `pred` function and + * pass to `whenFalseFn` if necessary. + * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`. + * @see R.ifElse, R.when, R.cond + * @example + * + * let safeInc = R.unless(R.isNil, R.inc); + * safeInc(null); //=> null + * safeInc(1); //=> 2 + */ + var unless = _curry3(function unless(pred, whenFalseFn, x) { + return pred(x) ? x : whenFalseFn(x); + }); + + /** + * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from + * any [Chain](https://github.com/fantasyland/fantasy-land#chain). + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain c => c (c a) -> c a + * @param {*} list + * @return {*} + * @see R.flatten, R.chain + * @example + * + * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] + * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] + */ + var unnest = chain(_identity); + + /** + * Takes a predicate, a transformation function, and an initial value, + * and returns a value of the same type as the initial value. + * It does so by applying the transformation until the predicate is satisfied, + * at which point it returns the satisfactory value. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} fn The iterator function + * @param {*} init Initial value + * @return {*} Final value that satisfies predicate + * @example + * + * R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128 + */ + var until = _curry3(function until(pred, fn, init) { + var val = init; + while (!pred(val)) { + val = fn(val); + } + return val; + }); + + /** + * Returns a list of all the properties, including prototype properties, of the + * supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @sig {k: v} -> [v] + * @param {Object} obj The object to extract values from + * @return {Array} An array of the values of the object's own and prototype properties. + * @see R.values, R.keysIn + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.valuesIn(f); //=> ['X', 'Y'] + */ + var valuesIn = _curry1(function valuesIn(obj) { + var prop; + var vs = []; + for (prop in obj) { + vs[vs.length] = obj[prop]; + } + return vs; + }); + + // `Const` is a functor that effectively ignores the function given to `map`. + var Const = function(x) { + return {value: x, 'fantasy-land/map': function() { return this; }}; + }; + + /** + * Returns a "view" of the given data structure, determined by the given lens. + * The lens's focus determines which portion of the data structure is visible. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> s -> a + * @param {Lens} lens + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lensProp('x'); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.view(xLens, {x: 4, y: 2}); //=> 4 + */ + var view = _curry2(function view(lens, x) { + // Using `Const` effectively ignores the setter function of the `lens`, + // leaving the value returned by the getter function unmodified. + return lens(Const)(x).value; + }); + + /** + * Tests the final argument by passing it to the given predicate function. If + * the predicate is satisfied, the function will return the result of calling + * the `whenTrueFn` function with the same argument. If the predicate is not + * satisfied, the argument is returned as is. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} whenTrueFn A function to invoke when the `condition` + * evaluates to a truthy value. + * @param {*} x An object to test with the `pred` function and + * pass to `whenTrueFn` if necessary. + * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`. + * @see R.ifElse, R.unless, R.cond + * @example + * + * // truncate :: String -> String + * const truncate = R.when( + * R.propSatisfies(R.gt(R.__, 10), 'length'), + * R.pipe(R.take(10), R.append('…'), R.join('')) + * ); + * truncate('12345'); //=> '12345' + * truncate('0123456789ABC'); //=> '0123456789…' + */ + var when = _curry3(function when(pred, whenTrueFn, x) { + return pred(x) ? whenTrueFn(x) : x; + }); + + /** + * Takes a spec object and a test object; returns true if the test satisfies + * the spec. Each of the spec's own properties must be a predicate function. + * Each predicate is applied to the value of the corresponding property of the + * test object. `where` returns true if all the predicates return true, false + * otherwise. + * + * `where` is well suited to declaratively expressing constraints for other + * functions such as [`filter`](#filter) and [`find`](#find). + * + * @func + * @memberOf R + * @since v0.1.1 + * @category Object + * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean + * @param {Object} spec + * @param {Object} testObj + * @return {Boolean} + * @see R.propSatisfies, R.whereEq + * @example + * + * // pred :: Object -> Boolean + * const pred = R.where({ + * a: R.equals('foo'), + * b: R.complement(R.equals('bar')), + * x: R.gt(R.__, 10), + * y: R.lt(R.__, 20) + * }); + * + * pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true + * pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false + * pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false + * pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false + * pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false + */ + var where = _curry2(function where(spec, testObj) { + for (var prop in spec) { + if (_has(prop, spec) && !spec[prop](testObj[prop])) { + return false; + } + } + return true; + }); + + /** + * Takes a spec object and a test object; returns true if the test satisfies + * the spec, false otherwise. An object satisfies the spec if, for each of the + * spec's own properties, accessing that property of the object gives the same + * value (in [`R.equals`](#equals) terms) as accessing that property of the + * spec. + * + * `whereEq` is a specialization of [`where`](#where). + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @sig {String: *} -> {String: *} -> Boolean + * @param {Object} spec + * @param {Object} testObj + * @return {Boolean} + * @see R.propEq, R.where + * @example + * + * // pred :: Object -> Boolean + * const pred = R.whereEq({a: 1, b: 2}); + * + * pred({a: 1}); //=> false + * pred({a: 1, b: 2}); //=> true + * pred({a: 1, b: 2, c: 3}); //=> true + * pred({a: 1, b: 1}); //=> false + */ + var whereEq = _curry2(function whereEq(spec, testObj) { + return where(map(equals, spec), testObj); + }); + + /** + * Returns a new list without values in the first argument. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig [a] -> [a] -> [a] + * @param {Array} list1 The values to be removed from `list2`. + * @param {Array} list2 The array to remove values from. + * @return {Array} The new array without values in `list1`. + * @see R.transduce, R.difference, R.remove + * @example + * + * R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4] + */ + var without = _curry2(function(xs, list) { + return reject(flip(_includes)(xs), list); + }); + + /** + * Exclusive disjunction logical operation. + * Returns `true` if one of the arguments is truthy and the other is falsy. + * Otherwise, it returns `false`. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Logic + * @sig a -> b -> Boolean + * @param {Any} a + * @param {Any} b + * @return {Boolean} true if one of the arguments is truthy and the other is falsy + * @see R.or, R.and + * @example + * + * R.xor(true, true); //=> false + * R.xor(true, false); //=> true + * R.xor(false, true); //=> true + * R.xor(false, false); //=> false + */ + var xor = _curry2(function xor(a, b) { + return Boolean(!a ^ !b); + }); + + /** + * Creates a new list out of the two supplied by creating each possible pair + * from the lists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] -> [[a,b]] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The list made by combining each possible pair from + * `as` and `bs` into pairs (`[a, b]`). + * @example + * + * R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]] + */ + var xprod = _curry2(function xprod(a, b) { // = xprodWith(prepend); (takes about 3 times as long...) + var idx = 0; + var ilen = a.length; + var j; + var jlen = b.length; + var result = []; + while (idx < ilen) { + j = 0; + while (j < jlen) { + result[result.length] = [a[idx], b[j]]; + j += 1; + } + idx += 1; + } + return result; + }); + + /** + * Creates a new list out of the two supplied by pairing up equally-positioned + * items from both lists. The returned list is truncated to the length of the + * shorter of the two input lists. + * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] -> [[a,b]] + * @param {Array} list1 The first array to consider. + * @param {Array} list2 The second array to consider. + * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`. + * @example + * + * R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + * @symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]] + */ + var zip = _curry2(function zip(a, b) { + var rv = []; + var idx = 0; + var len = Math.min(a.length, b.length); + while (idx < len) { + rv[idx] = [a[idx], b[idx]]; + idx += 1; + } + return rv; + }); + + /** + * Creates a new object out of a list of keys and a list of values. + * Key/value pairing is truncated to the length of the shorter of the two lists. + * Note: `zipObj` is equivalent to `pipe(zip, fromPairs)`. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [String] -> [*] -> {String: *} + * @param {Array} keys The array that will be properties on the output object. + * @param {Array} values The list of values on the output object. + * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`. + * @example + * + * R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} + */ + var zipObj = _curry2(function zipObj(keys, values) { + var idx = 0; + var len = Math.min(keys.length, values.length); + var out = {}; + while (idx < len) { + out[keys[idx]] = values[idx]; + idx += 1; + } + return out; + }); + + /** + * Creates a new list out of the two supplied by applying the function to each + * equally-positioned pair in the lists. The returned list is truncated to the + * length of the shorter of the two input lists. + * + * @function + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> c) -> [a] -> [b] -> [c] + * @param {Function} fn The function used to combine the two elements into one value. + * @param {Array} list1 The first array to consider. + * @param {Array} list2 The second array to consider. + * @return {Array} The list made by combining same-indexed elements of `list1` and `list2` + * using `fn`. + * @example + * + * const f = (x, y) => { + * // ... + * }; + * R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); + * //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + * @symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)] + */ + var zipWith = _curry3(function zipWith(fn, a, b) { + var rv = []; + var idx = 0; + var len = Math.min(a.length, b.length); + while (idx < len) { + rv[idx] = fn(a[idx], b[idx]); + idx += 1; + } + return rv; + }); + + /** + * Creates a thunk out of a function. A thunk delays a calculation until + * its result is needed, providing lazy evaluation of arguments. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((a, b, ..., j) -> k) -> (a, b, ..., j) -> (() -> k) + * @param {Function} fn A function to wrap in a thunk + * @return {Function} Expects arguments for `fn` and returns a new function + * that, when called, applies those arguments to `fn`. + * @see R.partial, R.partialRight + * @example + * + * R.thunkify(R.identity)(42)(); //=> 42 + * R.thunkify((a, b) => a + b)(25, 17)(); //=> 42 + */ + var thunkify = _curry1(function thunkify(fn) { + return curryN(fn.length, function createThunk() { + var fnArgs = arguments; + return function invokeThunk() { + return fn.apply(this, fnArgs); + }; + }); + }); + + exports.F = F; + exports.T = T; + exports.__ = __; + exports.add = add; + exports.addIndex = addIndex; + exports.adjust = adjust; + exports.all = all; + exports.allPass = allPass; + exports.always = always; + exports.and = and; + exports.any = any; + exports.anyPass = anyPass; + exports.ap = ap; + exports.aperture = aperture; + exports.append = append; + exports.apply = apply; + exports.applySpec = applySpec; + exports.applyTo = applyTo; + exports.ascend = ascend; + exports.assoc = assoc; + exports.assocPath = assocPath; + exports.binary = binary; + exports.bind = bind; + exports.both = both; + exports.call = call; + exports.chain = chain; + exports.clamp = clamp; + exports.clone = clone; + exports.comparator = comparator; + exports.complement = complement; + exports.compose = compose; + exports.composeK = composeK; + exports.composeP = composeP; + exports.composeWith = composeWith; + exports.concat = concat; + exports.cond = cond; + exports.construct = construct; + exports.constructN = constructN; + exports.contains = contains$1; + exports.converge = converge; + exports.countBy = countBy; + exports.curry = curry; + exports.curryN = curryN; + exports.dec = dec; + exports.defaultTo = defaultTo; + exports.descend = descend; + exports.difference = difference; + exports.differenceWith = differenceWith; + exports.dissoc = dissoc; + exports.dissocPath = dissocPath; + exports.divide = divide; + exports.drop = drop; + exports.dropLast = dropLast$1; + exports.dropLastWhile = dropLastWhile$1; + exports.dropRepeats = dropRepeats; + exports.dropRepeatsWith = dropRepeatsWith; + exports.dropWhile = dropWhile; + exports.either = either; + exports.empty = empty; + exports.endsWith = endsWith; + exports.eqBy = eqBy; + exports.eqProps = eqProps; + exports.equals = equals; + exports.evolve = evolve; + exports.filter = filter; + exports.find = find; + exports.findIndex = findIndex; + exports.findLast = findLast; + exports.findLastIndex = findLastIndex; + exports.flatten = flatten; + exports.flip = flip; + exports.forEach = forEach; + exports.forEachObjIndexed = forEachObjIndexed; + exports.fromPairs = fromPairs; + exports.groupBy = groupBy; + exports.groupWith = groupWith; + exports.gt = gt; + exports.gte = gte; + exports.has = has; + exports.hasIn = hasIn; + exports.hasPath = hasPath; + exports.head = head; + exports.identical = identical; + exports.identity = identity; + exports.ifElse = ifElse; + exports.inc = inc; + exports.includes = includes; + exports.indexBy = indexBy; + exports.indexOf = indexOf; + exports.init = init; + exports.innerJoin = innerJoin; + exports.insert = insert; + exports.insertAll = insertAll; + exports.intersection = intersection; + exports.intersperse = intersperse; + exports.into = into; + exports.invert = invert; + exports.invertObj = invertObj; + exports.invoker = invoker; + exports.is = is; + exports.isEmpty = isEmpty; + exports.isNil = isNil; + exports.join = join; + exports.juxt = juxt; + exports.keys = keys; + exports.keysIn = keysIn; + exports.last = last; + exports.lastIndexOf = lastIndexOf; + exports.length = length; + exports.lens = lens; + exports.lensIndex = lensIndex; + exports.lensPath = lensPath; + exports.lensProp = lensProp; + exports.lift = lift; + exports.liftN = liftN; + exports.lt = lt; + exports.lte = lte; + exports.map = map; + exports.mapAccum = mapAccum; + exports.mapAccumRight = mapAccumRight; + exports.mapObjIndexed = mapObjIndexed; + exports.match = match; + exports.mathMod = mathMod; + exports.max = max; + exports.maxBy = maxBy; + exports.mean = mean; + exports.median = median; + exports.memoizeWith = memoizeWith; + exports.merge = merge; + exports.mergeAll = mergeAll; + exports.mergeDeepLeft = mergeDeepLeft; + exports.mergeDeepRight = mergeDeepRight; + exports.mergeDeepWith = mergeDeepWith; + exports.mergeDeepWithKey = mergeDeepWithKey; + exports.mergeLeft = mergeLeft; + exports.mergeRight = mergeRight; + exports.mergeWith = mergeWith; + exports.mergeWithKey = mergeWithKey; + exports.min = min; + exports.minBy = minBy; + exports.modulo = modulo; + exports.move = move; + exports.multiply = multiply; + exports.nAry = nAry; + exports.negate = negate; + exports.none = none; + exports.not = not; + exports.nth = nth; + exports.nthArg = nthArg; + exports.o = o; + exports.objOf = objOf; + exports.of = of; + exports.omit = omit; + exports.once = once; + exports.or = or; + exports.otherwise = otherwise; + exports.over = over; + exports.pair = pair; + exports.partial = partial; + exports.partialRight = partialRight; + exports.partition = partition; + exports.path = path; + exports.paths = paths; + exports.pathEq = pathEq; + exports.pathOr = pathOr; + exports.pathSatisfies = pathSatisfies; + exports.pick = pick; + exports.pickAll = pickAll; + exports.pickBy = pickBy; + exports.pipe = pipe; + exports.pipeK = pipeK; + exports.pipeP = pipeP; + exports.pipeWith = pipeWith; + exports.pluck = pluck; + exports.prepend = prepend; + exports.product = product; + exports.project = project; + exports.prop = prop; + exports.propEq = propEq; + exports.propIs = propIs; + exports.propOr = propOr; + exports.propSatisfies = propSatisfies; + exports.props = props; + exports.range = range; + exports.reduce = reduce; + exports.reduceBy = reduceBy; + exports.reduceRight = reduceRight; + exports.reduceWhile = reduceWhile; + exports.reduced = reduced; + exports.reject = reject; + exports.remove = remove; + exports.repeat = repeat; + exports.replace = replace; + exports.reverse = reverse; + exports.scan = scan; + exports.sequence = sequence; + exports.set = set; + exports.slice = slice; + exports.sort = sort; + exports.sortBy = sortBy; + exports.sortWith = sortWith; + exports.split = split; + exports.splitAt = splitAt; + exports.splitEvery = splitEvery; + exports.splitWhen = splitWhen; + exports.startsWith = startsWith; + exports.subtract = subtract; + exports.sum = sum; + exports.symmetricDifference = symmetricDifference; + exports.symmetricDifferenceWith = symmetricDifferenceWith; + exports.tail = tail; + exports.take = take; + exports.takeLast = takeLast; + exports.takeLastWhile = takeLastWhile; + exports.takeWhile = takeWhile; + exports.tap = tap; + exports.test = test; + exports.andThen = andThen; + exports.times = times; + exports.toLower = toLower; + exports.toPairs = toPairs; + exports.toPairsIn = toPairsIn; + exports.toString = toString$1; + exports.toUpper = toUpper; + exports.transduce = transduce; + exports.transpose = transpose; + exports.traverse = traverse; + exports.trim = trim; + exports.tryCatch = tryCatch; + exports.type = type; + exports.unapply = unapply; + exports.unary = unary; + exports.uncurryN = uncurryN; + exports.unfold = unfold; + exports.union = union; + exports.unionWith = unionWith; + exports.uniq = uniq; + exports.uniqBy = uniqBy; + exports.uniqWith = uniqWith; + exports.unless = unless; + exports.unnest = unnest; + exports.until = until; + exports.update = update; + exports.useWith = useWith; + exports.values = values; + exports.valuesIn = valuesIn; + exports.view = view; + exports.when = when; + exports.where = where; + exports.whereEq = whereEq; + exports.without = without; + exports.xor = xor; + exports.xprod = xprod; + exports.zip = zip; + exports.zipObj = zipObj; + exports.zipWith = zipWith; + exports.thunkify = thunkify; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/node_modules/ramda/dist/ramda.min.js b/node_modules/ramda/dist/ramda.min.js new file mode 100644 index 0000000..ee0823c --- /dev/null +++ b/node_modules/ramda/dist/ramda.min.js @@ -0,0 +1 @@ +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).R={})}(this,function(t){"use strict";function a(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function o(r){return function t(n){return 0===arguments.length||a(n)?t:r.apply(this,arguments)}}function n(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return a(n)?t:o(function(t){return e(n,t)});default:return a(n)&&a(r)?t:a(n)?o(function(t){return e(t,r)}):a(r)?o(function(t){return e(n,t)}):e(n,r)}}}var r=n(function(t,n){return+t+ +n});function i(t,n){var r,e=(t=t||[]).length,u=(n=n||[]).length,i=[];for(r=0;r":ln(t,n)}function t(n,t){return x(function(t){return nn(t)+": "+u(n[t])},t.slice().sort())}switch(Object.prototype.toString.call(r)){case"[object Arguments]":return"(function() { return arguments; }("+x(u,r).join(", ")+"))";case"[object Array]":return"["+x(u,r).concat(t(r,sn(function(t){return/^\d+$/.test(t)},U(r)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof r?"new Boolean("+u(r.valueOf())+")":""+r;case"[object Date]":return"new Date("+(isNaN(r.valueOf())?u(NaN):nn(en(r)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof r?"new Number("+u(r.valueOf())+")":1/r==-1/0?"-0":r.toString(10);case"[object String]":return"object"==typeof r?"new String("+u(r.valueOf())+")":nn(r);case"[object Undefined]":return"undefined";default:if("function"==typeof r.toString){var n=""+r;if("[object Object]"!=n)return n}return"{"+t(r,U(r)).join(", ")+"}"}}var pn=o(function(t){return ln(t,[])}),hn=n(function(t,n){if(p(t)){if(p(n))return t.concat(n);throw new TypeError(pn(n)+" is not an array")}if(w(t)){if(w(n))return t+n;throw new TypeError(pn(n)+" is not a string")}if(null!=t&&dt(t["fantasy-land/concat"]))return t["fantasy-land/concat"](n);if(null!=t&&dt(t.concat))return t.concat(n);throw new TypeError(pn(t)+' does not have a method named "concat" or "fantasy-land/concat"')}),yn=o(function(n){return f($(b,0,D(function(t){return t[0].length},n)),function(){for(var t=0;tt(n)?r:n}),pe=$(r,0),he=o(function(t){return pe(t)/t.length}),ye=o(function(t){var n=t.length;if(0===n)return NaN;var r=2-n%2,e=(n-r)/2;return he(Array.prototype.slice.call(t,0).sort(function(t,n){return t Boolean + * @param {*} + * @return {Boolean} + * @see R.T + * @example + * + * R.F(); //=> false + */ +var F = function () { + return false; +}; + +export default F; \ No newline at end of file diff --git a/node_modules/ramda/es/T.js b/node_modules/ramda/es/T.js new file mode 100644 index 0000000..b4c455a --- /dev/null +++ b/node_modules/ramda/es/T.js @@ -0,0 +1,20 @@ +/** + * A function that always returns `true`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.F + * @example + * + * R.T(); //=> true + */ +var T = function () { + return true; +}; + +export default T; \ No newline at end of file diff --git a/node_modules/ramda/es/__.js b/node_modules/ramda/es/__.js new file mode 100644 index 0000000..c515902 --- /dev/null +++ b/node_modules/ramda/es/__.js @@ -0,0 +1,30 @@ +/** + * A special placeholder value used to specify "gaps" within curried functions, + * allowing partial application of any combination of arguments, regardless of + * their positions. + * + * If `g` is a curried ternary function and `_` is `R.__`, the following are + * equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2, _)(1, 3)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @name __ + * @constant + * @memberOf R + * @since v0.6.0 + * @category Function + * @example + * + * const greet = R.replace('{name}', R.__, 'Hello, {name}!'); + * greet('Alice'); //=> 'Hello, Alice!' + */ +export default { + '@@functional/placeholder': true +}; \ No newline at end of file diff --git a/node_modules/ramda/es/add.js b/node_modules/ramda/es/add.js new file mode 100644 index 0000000..4cb92d3 --- /dev/null +++ b/node_modules/ramda/es/add.js @@ -0,0 +1,26 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Adds two values. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a + * @param {Number} b + * @return {Number} + * @see R.subtract + * @example + * + * R.add(2, 3); //=> 5 + * R.add(7)(10); //=> 17 + */ + +var add = +/*#__PURE__*/ +_curry2(function add(a, b) { + return Number(a) + Number(b); +}); + +export default add; \ No newline at end of file diff --git a/node_modules/ramda/es/addIndex.js b/node_modules/ramda/es/addIndex.js new file mode 100644 index 0000000..0a2d292 --- /dev/null +++ b/node_modules/ramda/es/addIndex.js @@ -0,0 +1,48 @@ +import _concat from "./internal/_concat.js"; +import _curry1 from "./internal/_curry1.js"; +import curryN from "./curryN.js"; +/** + * Creates a new list iteration function from an existing one by adding two new + * parameters to its callback function: the current index, and the entire list. + * + * This would turn, for instance, [`R.map`](#map) function into one that + * more closely resembles `Array.prototype.map`. Note that this will only work + * for functions in which the iteration callback function is the first + * parameter, and where the list is the last parameter. (This latter might be + * unimportant if the list parameter is not used.) + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Function + * @category List + * @sig ((a ... -> b) ... -> [a] -> *) -> ((a ..., Int, [a] -> b) ... -> [a] -> *) + * @param {Function} fn A list iteration function that does not pass index or list to its callback + * @return {Function} An altered list iteration function that passes (item, index, list) to its callback + * @example + * + * const mapIndexed = R.addIndex(R.map); + * mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']); + * //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r'] + */ + +var addIndex = +/*#__PURE__*/ +_curry1(function addIndex(fn) { + return curryN(fn.length, function () { + var idx = 0; + var origFn = arguments[0]; + var list = arguments[arguments.length - 1]; + var args = Array.prototype.slice.call(arguments, 0); + + args[0] = function () { + var result = origFn.apply(this, _concat(arguments, [idx, list])); + idx += 1; + return result; + }; + + return fn.apply(this, args); + }); +}); + +export default addIndex; \ No newline at end of file diff --git a/node_modules/ramda/es/adjust.js b/node_modules/ramda/es/adjust.js new file mode 100644 index 0000000..a28d25a --- /dev/null +++ b/node_modules/ramda/es/adjust.js @@ -0,0 +1,46 @@ +import _concat from "./internal/_concat.js"; +import _curry3 from "./internal/_curry3.js"; +/** + * Applies a function to the value at the given index of an array, returning a + * new copy of the array with the element at the given index replaced with the + * result of the function application. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig Number -> (a -> a) -> [a] -> [a] + * @param {Number} idx The index. + * @param {Function} fn The function to apply. + * @param {Array|Arguments} list An array-like object whose value + * at the supplied index will be replaced. + * @return {Array} A copy of the supplied array-like object with + * the element at index `idx` replaced with the value + * returned by applying `fn` to the existing element. + * @see R.update + * @example + * + * R.adjust(1, R.toUpper, ['a', 'b', 'c', 'd']); //=> ['a', 'B', 'c', 'd'] + * R.adjust(-1, R.toUpper, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c', 'D'] + * @symb R.adjust(-1, f, [a, b]) = [a, f(b)] + * @symb R.adjust(0, f, [a, b]) = [f(a), b] + */ + +var adjust = +/*#__PURE__*/ +_curry3(function adjust(idx, fn, list) { + if (idx >= list.length || idx < -list.length) { + return list; + } + + var start = idx < 0 ? list.length : 0; + + var _idx = start + idx; + + var _list = _concat(list); + + _list[_idx] = fn(list[_idx]); + return _list; +}); + +export default adjust; \ No newline at end of file diff --git a/node_modules/ramda/es/all.js b/node_modules/ramda/es/all.js new file mode 100644 index 0000000..2a6af4c --- /dev/null +++ b/node_modules/ramda/es/all.js @@ -0,0 +1,47 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xall from "./internal/_xall.js"; +/** + * Returns `true` if all elements of the list match the predicate, `false` if + * there are any that don't. + * + * Dispatches to the `all` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is satisfied by every element, `false` + * otherwise. + * @see R.any, R.none, R.transduce + * @example + * + * const equals3 = R.equals(3); + * R.all(equals3)([3, 3, 3, 3]); //=> true + * R.all(equals3)([3, 3, 1, 3]); //=> false + */ + +var all = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['all'], _xall, function all(fn, list) { + var idx = 0; + + while (idx < list.length) { + if (!fn(list[idx])) { + return false; + } + + idx += 1; + } + + return true; +})); + +export default all; \ No newline at end of file diff --git a/node_modules/ramda/es/allPass.js b/node_modules/ramda/es/allPass.js new file mode 100644 index 0000000..c0c75ef --- /dev/null +++ b/node_modules/ramda/es/allPass.js @@ -0,0 +1,51 @@ +import _curry1 from "./internal/_curry1.js"; +import curryN from "./curryN.js"; +import max from "./max.js"; +import pluck from "./pluck.js"; +import reduce from "./reduce.js"; +/** + * Takes a list of predicates and returns a predicate that returns true for a + * given list of arguments if every one of the provided predicates is satisfied + * by those arguments. + * + * The function returned is a curried function whose arity matches that of the + * highest-arity predicate. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Logic + * @sig [(*... -> Boolean)] -> (*... -> Boolean) + * @param {Array} predicates An array of predicates to check + * @return {Function} The combined predicate + * @see R.anyPass + * @example + * + * const isQueen = R.propEq('rank', 'Q'); + * const isSpade = R.propEq('suit', '♠︎'); + * const isQueenOfSpades = R.allPass([isQueen, isSpade]); + * + * isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false + * isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true + */ + +var allPass = +/*#__PURE__*/ +_curry1(function allPass(preds) { + return curryN(reduce(max, 0, pluck('length', preds)), function () { + var idx = 0; + var len = preds.length; + + while (idx < len) { + if (!preds[idx].apply(this, arguments)) { + return false; + } + + idx += 1; + } + + return true; + }); +}); + +export default allPass; \ No newline at end of file diff --git a/node_modules/ramda/es/always.js b/node_modules/ramda/es/always.js new file mode 100644 index 0000000..15bd140 --- /dev/null +++ b/node_modules/ramda/es/always.js @@ -0,0 +1,30 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Returns a function that always returns the given value. Note that for + * non-primitives the value returned is a reference to the original value. + * + * This function is known as `const`, `constant`, or `K` (for K combinator) in + * other languages and libraries. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> (* -> a) + * @param {*} val The value to wrap in a function + * @return {Function} A Function :: * -> val. + * @example + * + * const t = R.always('Tee'); + * t(); //=> 'Tee' + */ + +var always = +/*#__PURE__*/ +_curry1(function always(val) { + return function () { + return val; + }; +}); + +export default always; \ No newline at end of file diff --git a/node_modules/ramda/es/and.js b/node_modules/ramda/es/and.js new file mode 100644 index 0000000..0bf9d37 --- /dev/null +++ b/node_modules/ramda/es/and.js @@ -0,0 +1,28 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if both arguments are `true`; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> b -> a | b + * @param {Any} a + * @param {Any} b + * @return {Any} the first argument if it is falsy, otherwise the second argument. + * @see R.both, R.xor + * @example + * + * R.and(true, true); //=> true + * R.and(true, false); //=> false + * R.and(false, true); //=> false + * R.and(false, false); //=> false + */ + +var and = +/*#__PURE__*/ +_curry2(function and(a, b) { + return a && b; +}); + +export default and; \ No newline at end of file diff --git a/node_modules/ramda/es/andThen.js b/node_modules/ramda/es/andThen.js new file mode 100644 index 0000000..fef8bbc --- /dev/null +++ b/node_modules/ramda/es/andThen.js @@ -0,0 +1,38 @@ +import _curry2 from "./internal/_curry2.js"; +import _assertPromise from "./internal/_assertPromise.js"; +/** + * Returns the result of applying the onSuccess function to the value inside + * a successfully resolved promise. This is useful for working with promises + * inside function compositions. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Function + * @sig (a -> b) -> (Promise e a) -> (Promise e b) + * @sig (a -> (Promise e b)) -> (Promise e a) -> (Promise e b) + * @param {Function} onSuccess The function to apply. Can return a value or a promise of a value. + * @param {Promise} p + * @return {Promise} The result of calling `p.then(onSuccess)` + * @see R.otherwise + * @example + * + * var makeQuery = (email) => ({ query: { email }}); + * + * //getMemberName :: String -> Promise ({firstName, lastName}) + * var getMemberName = R.pipe( + * makeQuery, + * fetchMember, + * R.andThen(R.pick(['firstName', 'lastName'])) + * ); + */ + +var andThen = +/*#__PURE__*/ +_curry2(function andThen(f, p) { + _assertPromise('andThen', p); + + return p.then(f); +}); + +export default andThen; \ No newline at end of file diff --git a/node_modules/ramda/es/any.js b/node_modules/ramda/es/any.js new file mode 100644 index 0000000..4362265 --- /dev/null +++ b/node_modules/ramda/es/any.js @@ -0,0 +1,48 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xany from "./internal/_xany.js"; +/** + * Returns `true` if at least one of the elements of the list match the predicate, + * `false` otherwise. + * + * Dispatches to the `any` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false` + * otherwise. + * @see R.all, R.none, R.transduce + * @example + * + * const lessThan0 = R.flip(R.lt)(0); + * const lessThan2 = R.flip(R.lt)(2); + * R.any(lessThan0)([1, 2]); //=> false + * R.any(lessThan2)([1, 2]); //=> true + */ + +var any = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['any'], _xany, function any(fn, list) { + var idx = 0; + + while (idx < list.length) { + if (fn(list[idx])) { + return true; + } + + idx += 1; + } + + return false; +})); + +export default any; \ No newline at end of file diff --git a/node_modules/ramda/es/anyPass.js b/node_modules/ramda/es/anyPass.js new file mode 100644 index 0000000..e98a7d1 --- /dev/null +++ b/node_modules/ramda/es/anyPass.js @@ -0,0 +1,52 @@ +import _curry1 from "./internal/_curry1.js"; +import curryN from "./curryN.js"; +import max from "./max.js"; +import pluck from "./pluck.js"; +import reduce from "./reduce.js"; +/** + * Takes a list of predicates and returns a predicate that returns true for a + * given list of arguments if at least one of the provided predicates is + * satisfied by those arguments. + * + * The function returned is a curried function whose arity matches that of the + * highest-arity predicate. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Logic + * @sig [(*... -> Boolean)] -> (*... -> Boolean) + * @param {Array} predicates An array of predicates to check + * @return {Function} The combined predicate + * @see R.allPass + * @example + * + * const isClub = R.propEq('suit', '♣'); + * const isSpade = R.propEq('suit', '♠'); + * const isBlackCard = R.anyPass([isClub, isSpade]); + * + * isBlackCard({rank: '10', suit: '♣'}); //=> true + * isBlackCard({rank: 'Q', suit: '♠'}); //=> true + * isBlackCard({rank: 'Q', suit: '♦'}); //=> false + */ + +var anyPass = +/*#__PURE__*/ +_curry1(function anyPass(preds) { + return curryN(reduce(max, 0, pluck('length', preds)), function () { + var idx = 0; + var len = preds.length; + + while (idx < len) { + if (preds[idx].apply(this, arguments)) { + return true; + } + + idx += 1; + } + + return false; + }); +}); + +export default anyPass; \ No newline at end of file diff --git a/node_modules/ramda/es/ap.js b/node_modules/ramda/es/ap.js new file mode 100644 index 0000000..3de065f --- /dev/null +++ b/node_modules/ramda/es/ap.js @@ -0,0 +1,42 @@ +import _concat from "./internal/_concat.js"; +import _curry2 from "./internal/_curry2.js"; +import _reduce from "./internal/_reduce.js"; +import map from "./map.js"; +/** + * ap applies a list of functions to a list of values. + * + * Dispatches to the `ap` method of the second argument, if present. Also + * treats curried functions as applicatives. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig [a -> b] -> [a] -> [b] + * @sig Apply f => f (a -> b) -> f a -> f b + * @sig (r -> a -> b) -> (r -> a) -> (r -> b) + * @param {*} applyF + * @param {*} applyX + * @return {*} + * @example + * + * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6] + * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"] + * + * // R.ap can also be used as S combinator + * // when only two functions are passed + * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA' + * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] + */ + +var ap = +/*#__PURE__*/ +_curry2(function ap(applyF, applyX) { + return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) { + return applyF(x)(applyX(x)); + } : _reduce(function (acc, f) { + return _concat(acc, map(f, applyX)); + }, [], applyF); +}); + +export default ap; \ No newline at end of file diff --git a/node_modules/ramda/es/aperture.js b/node_modules/ramda/es/aperture.js new file mode 100644 index 0000000..db78388 --- /dev/null +++ b/node_modules/ramda/es/aperture.js @@ -0,0 +1,33 @@ +import _aperture from "./internal/_aperture.js"; +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xaperture from "./internal/_xaperture.js"; +/** + * Returns a new list, composed of n-tuples of consecutive elements. If `n` is + * greater than the length of the list, an empty list is returned. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig Number -> [a] -> [[a]] + * @param {Number} n The size of the tuples to create + * @param {Array} list The list to split into `n`-length tuples + * @return {Array} The resulting list of `n`-length tuples + * @see R.transduce + * @example + * + * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] + * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] + * R.aperture(7, [1, 2, 3, 4, 5]); //=> [] + */ + +var aperture = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xaperture, _aperture)); + +export default aperture; \ No newline at end of file diff --git a/node_modules/ramda/es/append.js b/node_modules/ramda/es/append.js new file mode 100644 index 0000000..ceb15b6 --- /dev/null +++ b/node_modules/ramda/es/append.js @@ -0,0 +1,30 @@ +import _concat from "./internal/_concat.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a new list containing the contents of the given list, followed by + * the given element. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} el The element to add to the end of the new list. + * @param {Array} list The list of elements to add a new item to. + * list. + * @return {Array} A new list containing the elements of the old list followed by `el`. + * @see R.prepend + * @example + * + * R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] + * R.append('tests', []); //=> ['tests'] + * R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] + */ + +var append = +/*#__PURE__*/ +_curry2(function append(el, list) { + return _concat(list, [el]); +}); + +export default append; \ No newline at end of file diff --git a/node_modules/ramda/es/apply.js b/node_modules/ramda/es/apply.js new file mode 100644 index 0000000..66248ac --- /dev/null +++ b/node_modules/ramda/es/apply.js @@ -0,0 +1,29 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Applies function `fn` to the argument list `args`. This is useful for + * creating a fixed-arity function from a variadic function. `fn` should be a + * bound function if context is significant. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> a) -> [*] -> a + * @param {Function} fn The function which will be called with `args` + * @param {Array} args The arguments to call `fn` with + * @return {*} result The result, equivalent to `fn(...args)` + * @see R.call, R.unapply + * @example + * + * const nums = [1, 2, 3, -99, 42, 6, 7]; + * R.apply(Math.max, nums); //=> 42 + * @symb R.apply(f, [a, b, c]) = f(a, b, c) + */ + +var apply = +/*#__PURE__*/ +_curry2(function apply(fn, args) { + return fn.apply(this, args); +}); + +export default apply; \ No newline at end of file diff --git a/node_modules/ramda/es/applySpec.js b/node_modules/ramda/es/applySpec.js new file mode 100644 index 0000000..e1967cb --- /dev/null +++ b/node_modules/ramda/es/applySpec.js @@ -0,0 +1,58 @@ +import _curry1 from "./internal/_curry1.js"; +import apply from "./apply.js"; +import curryN from "./curryN.js"; +import max from "./max.js"; +import pluck from "./pluck.js"; +import reduce from "./reduce.js"; +import keys from "./keys.js"; +import values from "./values.js"; // Use custom mapValues function to avoid issues with specs that include a "map" key and R.map +// delegating calls to .map + +function mapValues(fn, obj) { + return keys(obj).reduce(function (acc, key) { + acc[key] = fn(obj[key]); + return acc; + }, {}); +} +/** + * Given a spec object recursively mapping properties to functions, creates a + * function producing an object of the same structure, by mapping each property + * to the result of calling its associated function with the supplied arguments. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Function + * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v}) + * @param {Object} spec an object recursively mapping properties to functions for + * producing the values for these properties. + * @return {Function} A function that returns an object of the same structure + * as `spec', with each property set to the value returned by calling its + * associated function with the supplied arguments. + * @see R.converge, R.juxt + * @example + * + * const getMetrics = R.applySpec({ + * sum: R.add, + * nested: { mul: R.multiply } + * }); + * getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } } + * @symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } } + */ + + +var applySpec = +/*#__PURE__*/ +_curry1(function applySpec(spec) { + spec = mapValues(function (v) { + return typeof v == 'function' ? v : applySpec(v); + }, spec); + return curryN(reduce(max, 0, pluck('length', values(spec))), function () { + var args = arguments; + return mapValues(function (f) { + return apply(f, args); + }, spec); + }); +}); + +export default applySpec; \ No newline at end of file diff --git a/node_modules/ramda/es/applyTo.js b/node_modules/ramda/es/applyTo.js new file mode 100644 index 0000000..837c87b --- /dev/null +++ b/node_modules/ramda/es/applyTo.js @@ -0,0 +1,28 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Takes a value and applies a function to it. + * + * This function is also known as the `thrush` combinator. + * + * @func + * @memberOf R + * @since v0.25.0 + * @category Function + * @sig a -> (a -> b) -> b + * @param {*} x The value + * @param {Function} f The function to apply + * @return {*} The result of applying `f` to `x` + * @example + * + * const t42 = R.applyTo(42); + * t42(R.identity); //=> 42 + * t42(R.add(1)); //=> 43 + */ + +var applyTo = +/*#__PURE__*/ +_curry2(function applyTo(x, f) { + return f(x); +}); + +export default applyTo; \ No newline at end of file diff --git a/node_modules/ramda/es/ascend.js b/node_modules/ramda/es/ascend.js new file mode 100644 index 0000000..c6cf38b --- /dev/null +++ b/node_modules/ramda/es/ascend.js @@ -0,0 +1,36 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Makes an ascending comparator function out of a function that returns a value + * that can be compared with `<` and `>`. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Function + * @sig Ord b => (a -> b) -> a -> a -> Number + * @param {Function} fn A function of arity one that returns a value that can be compared + * @param {*} a The first item to be compared. + * @param {*} b The second item to be compared. + * @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0` + * @see R.descend + * @example + * + * const byAge = R.ascend(R.prop('age')); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByYoungestFirst = R.sort(byAge, people); + * //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }] + */ + +var ascend = +/*#__PURE__*/ +_curry3(function ascend(fn, a, b) { + var aa = fn(a); + var bb = fn(b); + return aa < bb ? -1 : aa > bb ? 1 : 0; +}); + +export default ascend; \ No newline at end of file diff --git a/node_modules/ramda/es/assoc.js b/node_modules/ramda/es/assoc.js new file mode 100644 index 0000000..ef0b606 --- /dev/null +++ b/node_modules/ramda/es/assoc.js @@ -0,0 +1,36 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Makes a shallow clone of an object, setting or overriding the specified + * property with the given value. Note that this copies and flattens prototype + * properties onto the new object as well. All non-primitive properties are + * copied by reference. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @sig String -> a -> {k: v} -> {k: v} + * @param {String} prop The property name to set + * @param {*} val The new value + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original except for the changed property. + * @see R.dissoc, R.pick + * @example + * + * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} + */ + +var assoc = +/*#__PURE__*/ +_curry3(function assoc(prop, val, obj) { + var result = {}; + + for (var p in obj) { + result[p] = obj[p]; + } + + result[prop] = val; + return result; +}); + +export default assoc; \ No newline at end of file diff --git a/node_modules/ramda/es/assocPath.js b/node_modules/ramda/es/assocPath.js new file mode 100644 index 0000000..e1c1c49 --- /dev/null +++ b/node_modules/ramda/es/assocPath.js @@ -0,0 +1,55 @@ +import _curry3 from "./internal/_curry3.js"; +import _has from "./internal/_has.js"; +import _isArray from "./internal/_isArray.js"; +import _isInteger from "./internal/_isInteger.js"; +import assoc from "./assoc.js"; +import isNil from "./isNil.js"; +/** + * Makes a shallow clone of an object, setting or overriding the nodes required + * to create the given path, and placing the specific value at the tail end of + * that path. Note that this copies and flattens prototype properties onto the + * new object as well. All non-primitive properties are copied by reference. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> a -> {a} -> {a} + * @param {Array} path the path to set + * @param {*} val The new value + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original except along the specified path. + * @see R.dissocPath + * @example + * + * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} + * + * // Any missing or non-object keys in path will be overridden + * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}} + */ + +var assocPath = +/*#__PURE__*/ +_curry3(function assocPath(path, val, obj) { + if (path.length === 0) { + return val; + } + + var idx = path[0]; + + if (path.length > 1) { + var nextObj = !isNil(obj) && _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {}; + val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj); + } + + if (_isInteger(idx) && _isArray(obj)) { + var arr = [].concat(obj); + arr[idx] = val; + return arr; + } else { + return assoc(idx, val, obj); + } +}); + +export default assocPath; \ No newline at end of file diff --git a/node_modules/ramda/es/binary.js b/node_modules/ramda/es/binary.js new file mode 100644 index 0000000..15638d3 --- /dev/null +++ b/node_modules/ramda/es/binary.js @@ -0,0 +1,38 @@ +import _curry1 from "./internal/_curry1.js"; +import nAry from "./nAry.js"; +/** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly 2 parameters. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Function + * @sig (* -> c) -> (a, b -> c) + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity 2. + * @see R.nAry, R.unary + * @example + * + * const takesThreeArgs = function(a, b, c) { + * return [a, b, c]; + * }; + * takesThreeArgs.length; //=> 3 + * takesThreeArgs(1, 2, 3); //=> [1, 2, 3] + * + * const takesTwoArgs = R.binary(takesThreeArgs); + * takesTwoArgs.length; //=> 2 + * // Only 2 arguments are passed to the wrapped function + * takesTwoArgs(1, 2, 3); //=> [1, 2, undefined] + * @symb R.binary(f)(a, b, c) = f(a, b) + */ + +var binary = +/*#__PURE__*/ +_curry1(function binary(fn) { + return nAry(2, fn); +}); + +export default binary; \ No newline at end of file diff --git a/node_modules/ramda/es/bind.js b/node_modules/ramda/es/bind.js new file mode 100644 index 0000000..78a1fc5 --- /dev/null +++ b/node_modules/ramda/es/bind.js @@ -0,0 +1,34 @@ +import _arity from "./internal/_arity.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Creates a function that is bound to a context. + * Note: `R.bind` does not provide the additional argument-binding capabilities of + * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Function + * @category Object + * @sig (* -> *) -> {*} -> (* -> *) + * @param {Function} fn The function to bind to context + * @param {Object} thisObj The context to bind `fn` to + * @return {Function} A function that will execute in the context of `thisObj`. + * @see R.partial + * @example + * + * const log = R.bind(console.log, console); + * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} + * // logs {a: 2} + * @symb R.bind(f, o)(a, b) = f.call(o, a, b) + */ + +var bind = +/*#__PURE__*/ +_curry2(function bind(fn, thisObj) { + return _arity(fn.length, function () { + return fn.apply(thisObj, arguments); + }); +}); + +export default bind; \ No newline at end of file diff --git a/node_modules/ramda/es/both.js b/node_modules/ramda/es/both.js new file mode 100644 index 0000000..98e1c40 --- /dev/null +++ b/node_modules/ramda/es/both.js @@ -0,0 +1,45 @@ +import _curry2 from "./internal/_curry2.js"; +import _isFunction from "./internal/_isFunction.js"; +import and from "./and.js"; +import lift from "./lift.js"; +/** + * A function which calls the two provided functions and returns the `&&` + * of the results. + * It returns the result of the first function if it is false-y and the result + * of the second function otherwise. Note that this is short-circuited, + * meaning that the second function will not be invoked if the first returns a + * false-y value. + * + * In addition to functions, `R.both` also accepts any fantasy-land compatible + * applicative functor. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) + * @param {Function} f A predicate + * @param {Function} g Another predicate + * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together. + * @see R.and + * @example + * + * const gt10 = R.gt(R.__, 10) + * const lt20 = R.lt(R.__, 20) + * const f = R.both(gt10, lt20); + * f(15); //=> true + * f(30); //=> false + * + * R.both(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(false) + * R.both([false, false, 'a'], [11]); //=> [false, false, 11] + */ + +var both = +/*#__PURE__*/ +_curry2(function both(f, g) { + return _isFunction(f) ? function _both() { + return f.apply(this, arguments) && g.apply(this, arguments); + } : lift(and)(f, g); +}); + +export default both; \ No newline at end of file diff --git a/node_modules/ramda/es/call.js b/node_modules/ramda/es/call.js new file mode 100644 index 0000000..2825695 --- /dev/null +++ b/node_modules/ramda/es/call.js @@ -0,0 +1,40 @@ +import curry from "./curry.js"; +/** + * Returns the result of calling its first argument with the remaining + * arguments. This is occasionally useful as a converging function for + * [`R.converge`](#converge): the first branch can produce a function while the + * remaining branches produce values to be passed to that function as its + * arguments. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig (*... -> a),*... -> a + * @param {Function} fn The function to apply to the remaining arguments. + * @param {...*} args Any number of positional arguments. + * @return {*} + * @see R.apply + * @example + * + * R.call(R.add, 1, 2); //=> 3 + * + * const indentN = R.pipe(R.repeat(' '), + * R.join(''), + * R.replace(/^(?!$)/gm)); + * + * const format = R.converge(R.call, [ + * R.pipe(R.prop('indent'), indentN), + * R.prop('value') + * ]); + * + * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' + * @symb R.call(f, a, b) = f(a, b) + */ + +var call = +/*#__PURE__*/ +curry(function call(fn) { + return fn.apply(this, Array.prototype.slice.call(arguments, 1)); +}); +export default call; \ No newline at end of file diff --git a/node_modules/ramda/es/chain.js b/node_modules/ramda/es/chain.js new file mode 100644 index 0000000..f9697eb --- /dev/null +++ b/node_modules/ramda/es/chain.js @@ -0,0 +1,47 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _makeFlat from "./internal/_makeFlat.js"; +import _xchain from "./internal/_xchain.js"; +import map from "./map.js"; +/** + * `chain` maps a function over a list and concatenates the results. `chain` + * is also known as `flatMap` in some libraries. + * + * Dispatches to the `chain` method of the second argument, if present, + * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). + * + * If second argument is a function, `chain(f, g)(x)` is equivalent to `f(g(x), x)`. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain m => (a -> m b) -> m a -> m b + * @param {Function} fn The function to map with + * @param {Array} list The list to map over + * @return {Array} The result of flat-mapping `list` with `fn` + * @example + * + * const duplicate = n => [n, n]; + * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + * + * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] + */ + +var chain = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { + if (typeof monad === 'function') { + return function (x) { + return fn(monad(x))(x); + }; + } + + return _makeFlat(false)(map(fn, monad)); +})); + +export default chain; \ No newline at end of file diff --git a/node_modules/ramda/es/clamp.js b/node_modules/ramda/es/clamp.js new file mode 100644 index 0000000..7a3cb78 --- /dev/null +++ b/node_modules/ramda/es/clamp.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Restricts a number to be within a range. + * + * Also works for other ordered types such as Strings and Dates. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Relation + * @sig Ord a => a -> a -> a -> a + * @param {Number} minimum The lower limit of the clamp (inclusive) + * @param {Number} maximum The upper limit of the clamp (inclusive) + * @param {Number} value Value to be clamped + * @return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise + * @example + * + * R.clamp(1, 10, -5) // => 1 + * R.clamp(1, 10, 15) // => 10 + * R.clamp(1, 10, 4) // => 4 + */ + +var clamp = +/*#__PURE__*/ +_curry3(function clamp(min, max, value) { + if (min > max) { + throw new Error('min must not be greater than max in clamp(min, max, value)'); + } + + return value < min ? min : value > max ? max : value; +}); + +export default clamp; \ No newline at end of file diff --git a/node_modules/ramda/es/clone.js b/node_modules/ramda/es/clone.js new file mode 100644 index 0000000..0ab2d17 --- /dev/null +++ b/node_modules/ramda/es/clone.js @@ -0,0 +1,31 @@ +import _clone from "./internal/_clone.js"; +import _curry1 from "./internal/_curry1.js"; +/** + * Creates a deep copy of the value which may contain (nested) `Array`s and + * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are + * assigned by reference rather than copied + * + * Dispatches to a `clone` method if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {*} -> {*} + * @param {*} value The object or array to clone + * @return {*} A deeply cloned copy of `val` + * @example + * + * const objects = [{}, {}, {}]; + * const objectsClone = R.clone(objects); + * objects === objectsClone; //=> false + * objects[0] === objectsClone[0]; //=> false + */ + +var clone = +/*#__PURE__*/ +_curry1(function clone(value) { + return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true); +}); + +export default clone; \ No newline at end of file diff --git a/node_modules/ramda/es/comparator.js b/node_modules/ramda/es/comparator.js new file mode 100644 index 0000000..9936d66 --- /dev/null +++ b/node_modules/ramda/es/comparator.js @@ -0,0 +1,34 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Makes a comparator function out of a function that reports whether the first + * element is less than the second. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b) -> Boolean) -> ((a, b) -> Number) + * @param {Function} pred A predicate function of arity two which will return `true` if the first argument + * is less than the second, `false` otherwise + * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0` + * @example + * + * const byAge = R.comparator((a, b) => a.age < b.age); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByIncreasingAge = R.sort(byAge, people); + * //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }] + */ + +var comparator = +/*#__PURE__*/ +_curry1(function comparator(pred) { + return function (a, b) { + return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; + }; +}); + +export default comparator; \ No newline at end of file diff --git a/node_modules/ramda/es/complement.js b/node_modules/ramda/es/complement.js new file mode 100644 index 0000000..cbc7ecf --- /dev/null +++ b/node_modules/ramda/es/complement.js @@ -0,0 +1,29 @@ +import lift from "./lift.js"; +import not from "./not.js"; +/** + * Takes a function `f` and returns a function `g` such that if called with the same arguments + * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. + * + * `R.complement` may be applied to any functor + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> *) -> (*... -> Boolean) + * @param {Function} f + * @return {Function} + * @see R.not + * @example + * + * const isNotNil = R.complement(R.isNil); + * isNil(null); //=> true + * isNotNil(null); //=> false + * isNil(7); //=> false + * isNotNil(7); //=> true + */ + +var complement = +/*#__PURE__*/ +lift(not); +export default complement; \ No newline at end of file diff --git a/node_modules/ramda/es/compose.js b/node_modules/ramda/es/compose.js new file mode 100644 index 0000000..7bb0ee5 --- /dev/null +++ b/node_modules/ramda/es/compose.js @@ -0,0 +1,34 @@ +import pipe from "./pipe.js"; +import reverse from "./reverse.js"; +/** + * Performs right-to-left function composition. The last argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of compose is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipe + * @example + * + * const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName + * const yellGreeting = R.compose(R.toUpper, classyGreeting); + * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 + * + * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) + */ + +export default function compose() { + if (arguments.length === 0) { + throw new Error('compose requires at least one argument'); + } + + return pipe.apply(this, reverse(arguments)); +} \ No newline at end of file diff --git a/node_modules/ramda/es/composeK.js b/node_modules/ramda/es/composeK.js new file mode 100644 index 0000000..7c9beba --- /dev/null +++ b/node_modules/ramda/es/composeK.js @@ -0,0 +1,44 @@ +import chain from "./chain.js"; +import compose from "./compose.js"; +import map from "./map.js"; +/** + * Returns the right-to-left Kleisli composition of the provided functions, + * each of which must return a value of a type supported by [`chain`](#chain). + * + * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), f)`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Function + * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipeK + * @deprecated since v0.26.0 + * @example + * + * // get :: String -> Object -> Maybe * + * const get = R.curry((propName, obj) => Maybe(obj[propName])) + * + * // getStateCode :: Maybe String -> Maybe String + * const getStateCode = R.composeK( + * R.compose(Maybe.of, R.toUpper), + * get('state'), + * get('address'), + * get('user'), + * ); + * getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY") + * getStateCode({}); //=> Maybe.Nothing() + * @symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a))) + */ + +export default function composeK() { + if (arguments.length === 0) { + throw new Error('composeK requires at least one argument'); + } + + var init = Array.prototype.slice.call(arguments); + var last = init.pop(); + return compose(compose.apply(this, map(chain, init)), last); +} \ No newline at end of file diff --git a/node_modules/ramda/es/composeP.js b/node_modules/ramda/es/composeP.js new file mode 100644 index 0000000..36b202b --- /dev/null +++ b/node_modules/ramda/es/composeP.js @@ -0,0 +1,45 @@ +import pipeP from "./pipeP.js"; +import reverse from "./reverse.js"; +/** + * Performs right-to-left composition of one or more Promise-returning + * functions. The last arguments may have any arity; the remaining + * arguments must be unary. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z) + * @param {...Function} functions The functions to compose + * @return {Function} + * @see R.pipeP + * @deprecated since v0.26.0 + * @example + * + * const db = { + * users: { + * JOE: { + * name: 'Joe', + * followers: ['STEVE', 'SUZY'] + * } + * } + * } + * + * // We'll pretend to do a db lookup which returns a promise + * const lookupUser = (userId) => Promise.resolve(db.users[userId]) + * const lookupFollowers = (user) => Promise.resolve(user.followers) + * lookupUser('JOE').then(lookupFollowers) + * + * // followersForUser :: String -> Promise [UserId] + * const followersForUser = R.composeP(lookupFollowers, lookupUser); + * followersForUser('JOE').then(followers => console.log('Followers:', followers)) + * // Followers: ["STEVE","SUZY"] + */ + +export default function composeP() { + if (arguments.length === 0) { + throw new Error('composeP requires at least one argument'); + } + + return pipeP.apply(this, reverse(arguments)); +} \ No newline at end of file diff --git a/node_modules/ramda/es/composeWith.js b/node_modules/ramda/es/composeWith.js new file mode 100644 index 0000000..21531a9 --- /dev/null +++ b/node_modules/ramda/es/composeWith.js @@ -0,0 +1,35 @@ +import _curry2 from "./internal/_curry2.js"; +import pipeWith from "./pipeWith.js"; +import reverse from "./reverse.js"; +/** + * Performs right-to-left function composition using transforming function. The last argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of compose is not automatically curried. Transforming function is not used on the + * last argument. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((* -> *), [(y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)]) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.compose, R.pipeWith + * @example + * + * const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res)); + * + * composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2 + * composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined + * + * @symb R.composeWith(f)([g, h, i])(...args) = f(g, f(h, i(...args))) + */ + +var composeWith = +/*#__PURE__*/ +_curry2(function composeWith(xf, list) { + return pipeWith.apply(this, [xf, reverse(list)]); +}); + +export default composeWith; \ No newline at end of file diff --git a/node_modules/ramda/es/concat.js b/node_modules/ramda/es/concat.js new file mode 100644 index 0000000..198f073 --- /dev/null +++ b/node_modules/ramda/es/concat.js @@ -0,0 +1,65 @@ +import _curry2 from "./internal/_curry2.js"; +import _isArray from "./internal/_isArray.js"; +import _isFunction from "./internal/_isFunction.js"; +import _isString from "./internal/_isString.js"; +import toString from "./toString.js"; +/** + * Returns the result of concatenating the given lists or strings. + * + * Note: `R.concat` expects both arguments to be of the same type, + * unlike the native `Array.prototype.concat` method. It will throw + * an error if you `concat` an Array with a non-Array value. + * + * Dispatches to the `concat` method of the first argument, if present. + * Can also concatenate two members of a [fantasy-land + * compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] -> [a] + * @sig String -> String -> String + * @param {Array|String} firstList The first list + * @param {Array|String} secondList The second list + * @return {Array|String} A list consisting of the elements of `firstList` followed by the elements of + * `secondList`. + * + * @example + * + * R.concat('ABC', 'DEF'); // 'ABCDEF' + * R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + * R.concat([], []); //=> [] + */ + +var concat = +/*#__PURE__*/ +_curry2(function concat(a, b) { + if (_isArray(a)) { + if (_isArray(b)) { + return a.concat(b); + } + + throw new TypeError(toString(b) + ' is not an array'); + } + + if (_isString(a)) { + if (_isString(b)) { + return a + b; + } + + throw new TypeError(toString(b) + ' is not a string'); + } + + if (a != null && _isFunction(a['fantasy-land/concat'])) { + return a['fantasy-land/concat'](b); + } + + if (a != null && _isFunction(a.concat)) { + return a.concat(b); + } + + throw new TypeError(toString(a) + ' does not have a method named "concat" or "fantasy-land/concat"'); +}); + +export default concat; \ No newline at end of file diff --git a/node_modules/ramda/es/cond.js b/node_modules/ramda/es/cond.js new file mode 100644 index 0000000..922d2b8 --- /dev/null +++ b/node_modules/ramda/es/cond.js @@ -0,0 +1,53 @@ +import _arity from "./internal/_arity.js"; +import _curry1 from "./internal/_curry1.js"; +import map from "./map.js"; +import max from "./max.js"; +import reduce from "./reduce.js"; +/** + * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic. + * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments + * to `fn` are applied to each of the predicates in turn until one returns a + * "truthy" value, at which point `fn` returns the result of applying its + * arguments to the corresponding transformer. If none of the predicates + * matches, `fn` returns undefined. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Logic + * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *) + * @param {Array} pairs A list of [predicate, transformer] + * @return {Function} + * @see R.ifElse, R.unless, R.when + * @example + * + * const fn = R.cond([ + * [R.equals(0), R.always('water freezes at 0°C')], + * [R.equals(100), R.always('water boils at 100°C')], + * [R.T, temp => 'nothing special happens at ' + temp + '°C'] + * ]); + * fn(0); //=> 'water freezes at 0°C' + * fn(50); //=> 'nothing special happens at 50°C' + * fn(100); //=> 'water boils at 100°C' + */ + +var cond = +/*#__PURE__*/ +_curry1(function cond(pairs) { + var arity = reduce(max, 0, map(function (pair) { + return pair[0].length; + }, pairs)); + return _arity(arity, function () { + var idx = 0; + + while (idx < pairs.length) { + if (pairs[idx][0].apply(this, arguments)) { + return pairs[idx][1].apply(this, arguments); + } + + idx += 1; + } + }); +}); + +export default cond; \ No newline at end of file diff --git a/node_modules/ramda/es/construct.js b/node_modules/ramda/es/construct.js new file mode 100644 index 0000000..523d573 --- /dev/null +++ b/node_modules/ramda/es/construct.js @@ -0,0 +1,42 @@ +import _curry1 from "./internal/_curry1.js"; +import constructN from "./constructN.js"; +/** + * Wraps a constructor function inside a curried function that can be called + * with the same arguments and returns the same type. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> {*}) -> (* -> {*}) + * @param {Function} fn The constructor function to wrap. + * @return {Function} A wrapped, curried constructor function. + * @see R.invoker + * @example + * + * // Constructor function + * function Animal(kind) { + * this.kind = kind; + * }; + * Animal.prototype.sighting = function() { + * return "It's a " + this.kind + "!"; + * } + * + * const AnimalConstructor = R.construct(Animal) + * + * // Notice we no longer need the 'new' keyword: + * AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}}; + * + * const animalTypes = ["Lion", "Tiger", "Bear"]; + * const animalSighting = R.invoker(0, 'sighting'); + * const sightNewAnimal = R.compose(animalSighting, AnimalConstructor); + * R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"] + */ + +var construct = +/*#__PURE__*/ +_curry1(function construct(Fn) { + return constructN(Fn.length, Fn); +}); + +export default construct; \ No newline at end of file diff --git a/node_modules/ramda/es/constructN.js b/node_modules/ramda/es/constructN.js new file mode 100644 index 0000000..8aa5fae --- /dev/null +++ b/node_modules/ramda/es/constructN.js @@ -0,0 +1,88 @@ +import _curry2 from "./internal/_curry2.js"; +import curry from "./curry.js"; +import nAry from "./nAry.js"; +/** + * Wraps a constructor function inside a curried function that can be called + * with the same arguments and returns the same type. The arity of the function + * returned is specified to allow using variadic constructor functions. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Function + * @sig Number -> (* -> {*}) -> (* -> {*}) + * @param {Number} n The arity of the constructor function. + * @param {Function} Fn The constructor function to wrap. + * @return {Function} A wrapped, curried constructor function. + * @example + * + * // Variadic Constructor function + * function Salad() { + * this.ingredients = arguments; + * } + * + * Salad.prototype.recipe = function() { + * const instructions = R.map(ingredient => 'Add a dollop of ' + ingredient, this.ingredients); + * return R.join('\n', instructions); + * }; + * + * const ThreeLayerSalad = R.constructN(3, Salad); + * + * // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments. + * const salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup'); + * + * console.log(salad.recipe()); + * // Add a dollop of Mayonnaise + * // Add a dollop of Potato Chips + * // Add a dollop of Ketchup + */ + +var constructN = +/*#__PURE__*/ +_curry2(function constructN(n, Fn) { + if (n > 10) { + throw new Error('Constructor with greater than ten arguments'); + } + + if (n === 0) { + return function () { + return new Fn(); + }; + } + + return curry(nAry(n, function ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) { + switch (arguments.length) { + case 1: + return new Fn($0); + + case 2: + return new Fn($0, $1); + + case 3: + return new Fn($0, $1, $2); + + case 4: + return new Fn($0, $1, $2, $3); + + case 5: + return new Fn($0, $1, $2, $3, $4); + + case 6: + return new Fn($0, $1, $2, $3, $4, $5); + + case 7: + return new Fn($0, $1, $2, $3, $4, $5, $6); + + case 8: + return new Fn($0, $1, $2, $3, $4, $5, $6, $7); + + case 9: + return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8); + + case 10: + return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9); + } + })); +}); + +export default constructN; \ No newline at end of file diff --git a/node_modules/ramda/es/contains.js b/node_modules/ramda/es/contains.js new file mode 100644 index 0000000..63530f8 --- /dev/null +++ b/node_modules/ramda/es/contains.js @@ -0,0 +1,31 @@ +import _includes from "./internal/_includes.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if the specified value is equal, in [`R.equals`](#equals) + * terms, to at least one element of the given list; `false` otherwise. + * Works also with strings. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Boolean + * @param {Object} a The item to compare against. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. + * @see R.includes + * @deprecated since v0.26.0 + * @example + * + * R.contains(3, [1, 2, 3]); //=> true + * R.contains(4, [1, 2, 3]); //=> false + * R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + * R.contains([42], [[42]]); //=> true + * R.contains('ba', 'banana'); //=>true + */ + +var contains = +/*#__PURE__*/ +_curry2(_includes); + +export default contains; \ No newline at end of file diff --git a/node_modules/ramda/es/converge.js b/node_modules/ramda/es/converge.js new file mode 100644 index 0000000..1886995 --- /dev/null +++ b/node_modules/ramda/es/converge.js @@ -0,0 +1,48 @@ +import _curry2 from "./internal/_curry2.js"; +import _map from "./internal/_map.js"; +import curryN from "./curryN.js"; +import max from "./max.js"; +import pluck from "./pluck.js"; +import reduce from "./reduce.js"; +/** + * Accepts a converging function and a list of branching functions and returns + * a new function. The arity of the new function is the same as the arity of + * the longest branching function. When invoked, this new function is applied + * to some arguments, and each branching function is applied to those same + * arguments. The results of each branching function are passed as arguments + * to the converging function to produce the return value. + * + * @func + * @memberOf R + * @since v0.4.2 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} after A function. `after` will be invoked with the return values of + * `fn1` and `fn2` as its arguments. + * @param {Array} functions A list of functions. + * @return {Function} A new function. + * @see R.useWith + * @example + * + * const average = R.converge(R.divide, [R.sum, R.length]) + * average([1, 2, 3, 4, 5, 6, 7]) //=> 4 + * + * const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]) + * strangeConcat("Yodel") //=> "YODELyodel" + * + * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) + */ + +var converge = +/*#__PURE__*/ +_curry2(function converge(after, fns) { + return curryN(reduce(max, 0, pluck('length', fns)), function () { + var args = arguments; + var context = this; + return after.apply(context, _map(function (fn) { + return fn.apply(context, args); + }, fns)); + }); +}); + +export default converge; \ No newline at end of file diff --git a/node_modules/ramda/es/countBy.js b/node_modules/ramda/es/countBy.js new file mode 100644 index 0000000..6ce42c8 --- /dev/null +++ b/node_modules/ramda/es/countBy.js @@ -0,0 +1,32 @@ +import reduceBy from "./reduceBy.js"; +/** + * Counts the elements of a list according to how many match each value of a + * key generated by the supplied function. Returns an object mapping the keys + * produced by `fn` to the number of occurrences in the list. Note that all + * keys are coerced to strings because of how JavaScript objects work. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig (a -> String) -> [a] -> {*} + * @param {Function} fn The function used to map values to keys. + * @param {Array} list The list to count elements from. + * @return {Object} An object mapping keys to number of occurrences in the list. + * @example + * + * const numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; + * R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + * + * const letters = ['a', 'b', 'A', 'a', 'B', 'c']; + * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} + */ + +var countBy = +/*#__PURE__*/ +reduceBy(function (acc, elem) { + return acc + 1; +}, 0); +export default countBy; \ No newline at end of file diff --git a/node_modules/ramda/es/curry.js b/node_modules/ramda/es/curry.js new file mode 100644 index 0000000..643edb9 --- /dev/null +++ b/node_modules/ramda/es/curry.js @@ -0,0 +1,51 @@ +import _curry1 from "./internal/_curry1.js"; +import curryN from "./curryN.js"; +/** + * Returns a curried equivalent of the provided function. The curried function + * has two unusual capabilities. First, its arguments needn't be provided one + * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> a) -> (* -> a) + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curryN, R.partial + * @example + * + * const addFourNumbers = (a, b, c, d) => a + b + c + d; + * + * const curriedAddFourNumbers = R.curry(addFourNumbers); + * const f = curriedAddFourNumbers(1, 2); + * const g = f(3); + * g(4); //=> 10 + */ + +var curry = +/*#__PURE__*/ +_curry1(function curry(fn) { + return curryN(fn.length, fn); +}); + +export default curry; \ No newline at end of file diff --git a/node_modules/ramda/es/curryN.js b/node_modules/ramda/es/curryN.js new file mode 100644 index 0000000..bcf634f --- /dev/null +++ b/node_modules/ramda/es/curryN.js @@ -0,0 +1,58 @@ +import _arity from "./internal/_arity.js"; +import _curry1 from "./internal/_curry1.js"; +import _curry2 from "./internal/_curry2.js"; +import _curryN from "./internal/_curryN.js"; +/** + * Returns a curried equivalent of the provided function, with the specified + * arity. The curried function has two unusual capabilities. First, its + * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.5.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curry + * @example + * + * const sumArgs = (...args) => R.sum(args); + * + * const curriedAddFourNumbers = R.curryN(4, sumArgs); + * const f = curriedAddFourNumbers(1, 2); + * const g = f(3); + * g(4); //=> 10 + */ + +var curryN = +/*#__PURE__*/ +_curry2(function curryN(length, fn) { + if (length === 1) { + return _curry1(fn); + } + + return _arity(length, _curryN(length, [], fn)); +}); + +export default curryN; \ No newline at end of file diff --git a/node_modules/ramda/es/dec.js b/node_modules/ramda/es/dec.js new file mode 100644 index 0000000..f911fa8 --- /dev/null +++ b/node_modules/ramda/es/dec.js @@ -0,0 +1,21 @@ +import add from "./add.js"; +/** + * Decrements its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n - 1 + * @see R.inc + * @example + * + * R.dec(42); //=> 41 + */ + +var dec = +/*#__PURE__*/ +add(-1); +export default dec; \ No newline at end of file diff --git a/node_modules/ramda/es/defaultTo.js b/node_modules/ramda/es/defaultTo.js new file mode 100644 index 0000000..4d0fb9e --- /dev/null +++ b/node_modules/ramda/es/defaultTo.js @@ -0,0 +1,32 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns the second argument if it is not `null`, `undefined` or `NaN`; + * otherwise the first argument is returned. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Logic + * @sig a -> b -> a | b + * @param {a} default The default value. + * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`. + * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value + * @example + * + * const defaultTo42 = R.defaultTo(42); + * + * defaultTo42(null); //=> 42 + * defaultTo42(undefined); //=> 42 + * defaultTo42(false); //=> false + * defaultTo42('Ramda'); //=> 'Ramda' + * // parseInt('string') results in NaN + * defaultTo42(parseInt('string')); //=> 42 + */ + +var defaultTo = +/*#__PURE__*/ +_curry2(function defaultTo(d, v) { + return v == null || v !== v ? d : v; +}); + +export default defaultTo; \ No newline at end of file diff --git a/node_modules/ramda/es/descend.js b/node_modules/ramda/es/descend.js new file mode 100644 index 0000000..af051fd --- /dev/null +++ b/node_modules/ramda/es/descend.js @@ -0,0 +1,36 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Makes a descending comparator function out of a function that returns a value + * that can be compared with `<` and `>`. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Function + * @sig Ord b => (a -> b) -> a -> a -> Number + * @param {Function} fn A function of arity one that returns a value that can be compared + * @param {*} a The first item to be compared. + * @param {*} b The second item to be compared. + * @return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0` + * @see R.ascend + * @example + * + * const byAge = R.descend(R.prop('age')); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByOldestFirst = R.sort(byAge, people); + * //=> [{ name: 'Peter', age: 78 }, { name: 'Emma', age: 70 }, { name: 'Mikhail', age: 62 }] + */ + +var descend = +/*#__PURE__*/ +_curry3(function descend(fn, a, b) { + var aa = fn(a); + var bb = fn(b); + return aa > bb ? -1 : aa < bb ? 1 : 0; +}); + +export default descend; \ No newline at end of file diff --git a/node_modules/ramda/es/difference.js b/node_modules/ramda/es/difference.js new file mode 100644 index 0000000..ed3ce98 --- /dev/null +++ b/node_modules/ramda/es/difference.js @@ -0,0 +1,48 @@ +import _curry2 from "./internal/_curry2.js"; +import _Set from "./internal/_Set.js"; +/** + * Finds the set (i.e. no duplicates) of all elements in the first list not + * contained in the second list. Objects and Arrays are compared in terms of + * value equality, not reference equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` that are not in `list2`. + * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without + * @example + * + * R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2] + * R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5] + * R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}] + */ + +var difference = +/*#__PURE__*/ +_curry2(function difference(first, second) { + var out = []; + var idx = 0; + var firstLen = first.length; + var secondLen = second.length; + var toFilterOut = new _Set(); + + for (var i = 0; i < secondLen; i += 1) { + toFilterOut.add(second[i]); + } + + while (idx < firstLen) { + if (toFilterOut.add(first[idx])) { + out[out.length] = first[idx]; + } + + idx += 1; + } + + return out; +}); + +export default difference; \ No newline at end of file diff --git a/node_modules/ramda/es/differenceWith.js b/node_modules/ramda/es/differenceWith.js new file mode 100644 index 0000000..5c1791d --- /dev/null +++ b/node_modules/ramda/es/differenceWith.js @@ -0,0 +1,44 @@ +import _includesWith from "./internal/_includesWith.js"; +import _curry3 from "./internal/_curry3.js"; +/** + * Finds the set (i.e. no duplicates) of all elements in the first list not + * contained in the second list. Duplication is determined according to the + * value returned by applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` that are not in `list2`. + * @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith + * @example + * + * const cmp = (x, y) => x.a === y.a; + * const l1 = [{a: 1}, {a: 2}, {a: 3}]; + * const l2 = [{a: 3}, {a: 4}]; + * R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] + */ + +var differenceWith = +/*#__PURE__*/ +_curry3(function differenceWith(pred, first, second) { + var out = []; + var idx = 0; + var firstLen = first.length; + + while (idx < firstLen) { + if (!_includesWith(pred, first[idx], second) && !_includesWith(pred, first[idx], out)) { + out.push(first[idx]); + } + + idx += 1; + } + + return out; +}); + +export default differenceWith; \ No newline at end of file diff --git a/node_modules/ramda/es/dissoc.js b/node_modules/ramda/es/dissoc.js new file mode 100644 index 0000000..2bf8e8f --- /dev/null +++ b/node_modules/ramda/es/dissoc.js @@ -0,0 +1,32 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a new object that does not contain a `prop` property. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Object + * @sig String -> {k: v} -> {k: v} + * @param {String} prop The name of the property to dissociate + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original but without the specified property + * @see R.assoc, R.omit + * @example + * + * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3} + */ + +var dissoc = +/*#__PURE__*/ +_curry2(function dissoc(prop, obj) { + var result = {}; + + for (var p in obj) { + result[p] = obj[p]; + } + + delete result[prop]; + return result; +}); + +export default dissoc; \ No newline at end of file diff --git a/node_modules/ramda/es/dissocPath.js b/node_modules/ramda/es/dissocPath.js new file mode 100644 index 0000000..427477b --- /dev/null +++ b/node_modules/ramda/es/dissocPath.js @@ -0,0 +1,53 @@ +import _curry2 from "./internal/_curry2.js"; +import _isInteger from "./internal/_isInteger.js"; +import _isArray from "./internal/_isArray.js"; +import assoc from "./assoc.js"; +import dissoc from "./dissoc.js"; +import remove from "./remove.js"; +import update from "./update.js"; +/** + * Makes a shallow clone of an object, omitting the property at the given path. + * Note that this copies and flattens prototype properties onto the new object + * as well. All non-primitive properties are copied by reference. + * + * @func + * @memberOf R + * @since v0.11.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {k: v} -> {k: v} + * @param {Array} path The path to the value to omit + * @param {Object} obj The object to clone + * @return {Object} A new object without the property at path + * @see R.assocPath + * @example + * + * R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} + */ + +var dissocPath = +/*#__PURE__*/ +_curry2(function dissocPath(path, obj) { + switch (path.length) { + case 0: + return obj; + + case 1: + return _isInteger(path[0]) && _isArray(obj) ? remove(path[0], 1, obj) : dissoc(path[0], obj); + + default: + var head = path[0]; + var tail = Array.prototype.slice.call(path, 1); + + if (obj[head] == null) { + return obj; + } else if (_isInteger(head) && _isArray(obj)) { + return update(head, dissocPath(tail, obj[head]), obj); + } else { + return assoc(head, dissocPath(tail, obj[head]), obj); + } + + } +}); + +export default dissocPath; \ No newline at end of file diff --git a/node_modules/ramda/es/divide.js b/node_modules/ramda/es/divide.js new file mode 100644 index 0000000..6d949e2 --- /dev/null +++ b/node_modules/ramda/es/divide.js @@ -0,0 +1,31 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Divides two numbers. Equivalent to `a / b`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a / b`. + * @see R.multiply + * @example + * + * R.divide(71, 100); //=> 0.71 + * + * const half = R.divide(R.__, 2); + * half(42); //=> 21 + * + * const reciprocal = R.divide(1); + * reciprocal(4); //=> 0.25 + */ + +var divide = +/*#__PURE__*/ +_curry2(function divide(a, b) { + return a / b; +}); + +export default divide; \ No newline at end of file diff --git a/node_modules/ramda/es/drop.js b/node_modules/ramda/es/drop.js new file mode 100644 index 0000000..62e6fd2 --- /dev/null +++ b/node_modules/ramda/es/drop.js @@ -0,0 +1,38 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xdrop from "./internal/_xdrop.js"; +import slice from "./slice.js"; +/** + * Returns all but the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `drop` method). + * + * Dispatches to the `drop` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} A copy of list without the first `n` elements + * @see R.take, R.transduce, R.dropLast, R.dropWhile + * @example + * + * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz'] + * R.drop(3, ['foo', 'bar', 'baz']); //=> [] + * R.drop(4, ['foo', 'bar', 'baz']); //=> [] + * R.drop(3, 'ramda'); //=> 'da' + */ + +var drop = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['drop'], _xdrop, function drop(n, xs) { + return slice(Math.max(0, n), Infinity, xs); +})); + +export default drop; \ No newline at end of file diff --git a/node_modules/ramda/es/dropLast.js b/node_modules/ramda/es/dropLast.js new file mode 100644 index 0000000..de0b54a --- /dev/null +++ b/node_modules/ramda/es/dropLast.js @@ -0,0 +1,35 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _dropLast from "./internal/_dropLast.js"; +import _xdropLast from "./internal/_xdropLast.js"; +/** + * Returns a list containing all but the last `n` elements of the given `list`. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements of `list` to skip. + * @param {Array} list The list of elements to consider. + * @return {Array} A copy of the list with only the first `list.length - n` elements + * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile + * @example + * + * R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.dropLast(3, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(4, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(3, 'ramda'); //=> 'ra' + */ + +var dropLast = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xdropLast, _dropLast)); + +export default dropLast; \ No newline at end of file diff --git a/node_modules/ramda/es/dropLastWhile.js b/node_modules/ramda/es/dropLastWhile.js new file mode 100644 index 0000000..bfec24f --- /dev/null +++ b/node_modules/ramda/es/dropLastWhile.js @@ -0,0 +1,39 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _dropLastWhile from "./internal/_dropLastWhile.js"; +import _xdropLastWhile from "./internal/_xdropLastWhile.js"; +/** + * Returns a new list excluding all the tailing elements of a given list which + * satisfy the supplied predicate function. It passes each value from the right + * to the supplied predicate function, skipping elements until the predicate + * function returns a `falsy` value. The predicate function is applied to one argument: + * *(value)*. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} predicate The function to be called on each element + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`. + * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile + * @example + * + * const lteThree = x => x <= 3; + * + * R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4] + * + * R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd' + */ + +var dropLastWhile = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xdropLastWhile, _dropLastWhile)); + +export default dropLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/dropRepeats.js b/node_modules/ramda/es/dropRepeats.js new file mode 100644 index 0000000..3481025 --- /dev/null +++ b/node_modules/ramda/es/dropRepeats.js @@ -0,0 +1,35 @@ +import _curry1 from "./internal/_curry1.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xdropRepeatsWith from "./internal/_xdropRepeatsWith.js"; +import dropRepeatsWith from "./dropRepeatsWith.js"; +import equals from "./equals.js"; +/** + * Returns a new list without any consecutively repeating elements. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] + */ + +var dropRepeats = +/*#__PURE__*/ +_curry1( +/*#__PURE__*/ +_dispatchable([], +/*#__PURE__*/ +_xdropRepeatsWith(equals), +/*#__PURE__*/ +dropRepeatsWith(equals))); + +export default dropRepeats; \ No newline at end of file diff --git a/node_modules/ramda/es/dropRepeatsWith.js b/node_modules/ramda/es/dropRepeatsWith.js new file mode 100644 index 0000000..dab3554 --- /dev/null +++ b/node_modules/ramda/es/dropRepeatsWith.js @@ -0,0 +1,51 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xdropRepeatsWith from "./internal/_xdropRepeatsWith.js"; +import last from "./last.js"; +/** + * Returns a new list without any consecutively repeating elements. Equality is + * determined by applying the supplied predicate to each pair of consecutive elements. The + * first element in a series of equal elements will be preserved. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] + */ + +var dropRepeatsWith = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { + var result = []; + var idx = 1; + var len = list.length; + + if (len !== 0) { + result[0] = list[0]; + + while (idx < len) { + if (!pred(last(result), list[idx])) { + result[result.length] = list[idx]; + } + + idx += 1; + } + } + + return result; +})); + +export default dropRepeatsWith; \ No newline at end of file diff --git a/node_modules/ramda/es/dropWhile.js b/node_modules/ramda/es/dropWhile.js new file mode 100644 index 0000000..d3b336c --- /dev/null +++ b/node_modules/ramda/es/dropWhile.js @@ -0,0 +1,49 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xdropWhile from "./internal/_xdropWhile.js"; +import slice from "./slice.js"; +/** + * Returns a new list excluding the leading elements of a given list which + * satisfy the supplied predicate function. It passes each value to the supplied + * predicate function, skipping elements while the predicate function returns + * `true`. The predicate function is applied to one argument: *(value)*. + * + * Dispatches to the `dropWhile` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.takeWhile, R.transduce, R.addIndex + * @example + * + * const lteTwo = x => x <= 2; + * + * R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1] + * + * R.dropWhile(x => x !== 'd' , 'Ramda'); //=> 'da' + */ + +var dropWhile = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['dropWhile'], _xdropWhile, function dropWhile(pred, xs) { + var idx = 0; + var len = xs.length; + + while (idx < len && pred(xs[idx])) { + idx += 1; + } + + return slice(idx, Infinity, xs); +})); + +export default dropWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/either.js b/node_modules/ramda/es/either.js new file mode 100644 index 0000000..9f6ba85 --- /dev/null +++ b/node_modules/ramda/es/either.js @@ -0,0 +1,44 @@ +import _curry2 from "./internal/_curry2.js"; +import _isFunction from "./internal/_isFunction.js"; +import lift from "./lift.js"; +import or from "./or.js"; +/** + * A function wrapping calls to the two functions in an `||` operation, + * returning the result of the first function if it is truth-y and the result + * of the second function otherwise. Note that this is short-circuited, + * meaning that the second function will not be invoked if the first returns a + * truth-y value. + * + * In addition to functions, `R.either` also accepts any fantasy-land compatible + * applicative functor. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) + * @param {Function} f a predicate + * @param {Function} g another predicate + * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together. + * @see R.or + * @example + * + * const gt10 = x => x > 10; + * const even = x => x % 2 === 0; + * const f = R.either(gt10, even); + * f(101); //=> true + * f(8); //=> true + * + * R.either(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(55) + * R.either([false, false, 'a'], [11]) // => [11, 11, "a"] + */ + +var either = +/*#__PURE__*/ +_curry2(function either(f, g) { + return _isFunction(f) ? function _either() { + return f.apply(this, arguments) || g.apply(this, arguments); + } : lift(or)(f, g); +}); + +export default either; \ No newline at end of file diff --git a/node_modules/ramda/es/empty.js b/node_modules/ramda/es/empty.js new file mode 100644 index 0000000..e22cfe6 --- /dev/null +++ b/node_modules/ramda/es/empty.js @@ -0,0 +1,39 @@ +import _curry1 from "./internal/_curry1.js"; +import _isArguments from "./internal/_isArguments.js"; +import _isArray from "./internal/_isArray.js"; +import _isObject from "./internal/_isObject.js"; +import _isString from "./internal/_isString.js"; +/** + * Returns the empty value of its argument's type. Ramda defines the empty + * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other + * types are supported if they define `.empty`, + * `.prototype.empty` or implement the + * [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid). + * + * Dispatches to the `empty` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig a -> a + * @param {*} x + * @return {*} + * @example + * + * R.empty(Just(42)); //=> Nothing() + * R.empty([1, 2, 3]); //=> [] + * R.empty('unicorns'); //=> '' + * R.empty({x: 1, y: 2}); //=> {} + */ + +var empty = +/*#__PURE__*/ +_curry1(function empty(x) { + return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () { + return arguments; + }() : void 0 // else + ; +}); + +export default empty; \ No newline at end of file diff --git a/node_modules/ramda/es/endsWith.js b/node_modules/ramda/es/endsWith.js new file mode 100644 index 0000000..af8d754 --- /dev/null +++ b/node_modules/ramda/es/endsWith.js @@ -0,0 +1,33 @@ +import _curry2 from "./internal/_curry2.js"; +import equals from "./equals.js"; +import takeLast from "./takeLast.js"; +/** + * Checks if a list ends with the provided sublist. + * + * Similarly, checks if a string ends with the provided substring. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category List + * @sig [a] -> [a] -> Boolean + * @sig String -> String -> Boolean + * @param {*} suffix + * @param {*} list + * @return {Boolean} + * @see R.startsWith + * @example + * + * R.endsWith('c', 'abc') //=> true + * R.endsWith('b', 'abc') //=> false + * R.endsWith(['c'], ['a', 'b', 'c']) //=> true + * R.endsWith(['b'], ['a', 'b', 'c']) //=> false + */ + +var endsWith = +/*#__PURE__*/ +_curry2(function (suffix, list) { + return equals(takeLast(suffix.length, list), suffix); +}); + +export default endsWith; \ No newline at end of file diff --git a/node_modules/ramda/es/eqBy.js b/node_modules/ramda/es/eqBy.js new file mode 100644 index 0000000..83b9f3a --- /dev/null +++ b/node_modules/ramda/es/eqBy.js @@ -0,0 +1,27 @@ +import _curry3 from "./internal/_curry3.js"; +import equals from "./equals.js"; +/** + * Takes a function and two values in its domain and returns `true` if the + * values map to the same value in the codomain; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Relation + * @sig (a -> b) -> a -> a -> Boolean + * @param {Function} f + * @param {*} x + * @param {*} y + * @return {Boolean} + * @example + * + * R.eqBy(Math.abs, 5, -5); //=> true + */ + +var eqBy = +/*#__PURE__*/ +_curry3(function eqBy(f, x, y) { + return equals(f(x), f(y)); +}); + +export default eqBy; \ No newline at end of file diff --git a/node_modules/ramda/es/eqProps.js b/node_modules/ramda/es/eqProps.js new file mode 100644 index 0000000..4739f5d --- /dev/null +++ b/node_modules/ramda/es/eqProps.js @@ -0,0 +1,31 @@ +import _curry3 from "./internal/_curry3.js"; +import equals from "./equals.js"; +/** + * Reports whether two objects have the same value, in [`R.equals`](#equals) + * terms, for the specified property. Useful as a curried predicate. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig k -> {k: v} -> {k: v} -> Boolean + * @param {String} prop The name of the property to compare + * @param {Object} obj1 + * @param {Object} obj2 + * @return {Boolean} + * + * @example + * + * const o1 = { a: 1, b: 2, c: 3, d: 4 }; + * const o2 = { a: 10, b: 20, c: 3, d: 40 }; + * R.eqProps('a', o1, o2); //=> false + * R.eqProps('c', o1, o2); //=> true + */ + +var eqProps = +/*#__PURE__*/ +_curry3(function eqProps(prop, obj1, obj2) { + return equals(obj1[prop], obj2[prop]); +}); + +export default eqProps; \ No newline at end of file diff --git a/node_modules/ramda/es/equals.js b/node_modules/ramda/es/equals.js new file mode 100644 index 0000000..7e832e4 --- /dev/null +++ b/node_modules/ramda/es/equals.js @@ -0,0 +1,35 @@ +import _curry2 from "./internal/_curry2.js"; +import _equals from "./internal/_equals.js"; +/** + * Returns `true` if its arguments are equivalent, `false` otherwise. Handles + * cyclical data structures. + * + * Dispatches symmetrically to the `equals` methods of both arguments, if + * present. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> b -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * R.equals(1, 1); //=> true + * R.equals(1, '1'); //=> false + * R.equals([1, 2, 3], [1, 2, 3]); //=> true + * + * const a = {}; a.v = a; + * const b = {}; b.v = b; + * R.equals(a, b); //=> true + */ + +var equals = +/*#__PURE__*/ +_curry2(function equals(a, b) { + return _equals(a, b, [], []); +}); + +export default equals; \ No newline at end of file diff --git a/node_modules/ramda/es/evolve.js b/node_modules/ramda/es/evolve.js new file mode 100644 index 0000000..fb8ce25 --- /dev/null +++ b/node_modules/ramda/es/evolve.js @@ -0,0 +1,45 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Creates a new object by recursively evolving a shallow copy of `object`, + * according to the `transformation` functions. All non-primitive properties + * are copied by reference. + * + * A `transformation` function will not be invoked if its corresponding key + * does not exist in the evolved object. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {k: (v -> v)} -> {k: v} -> {k: v} + * @param {Object} transformations The object specifying transformation functions to apply + * to the object. + * @param {Object} object The object to be transformed. + * @return {Object} The transformed object. + * @example + * + * const tomato = {firstName: ' Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; + * const transformations = { + * firstName: R.trim, + * lastName: R.trim, // Will not get invoked. + * data: {elapsed: R.add(1), remaining: R.add(-1)} + * }; + * R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} + */ + +var evolve = +/*#__PURE__*/ +_curry2(function evolve(transformations, object) { + var result = object instanceof Array ? [] : {}; + var transformation, key, type; + + for (key in object) { + transformation = transformations[key]; + type = typeof transformation; + result[key] = type === 'function' ? transformation(object[key]) : transformation && type === 'object' ? evolve(transformation, object[key]) : object[key]; + } + + return result; +}); + +export default evolve; \ No newline at end of file diff --git a/node_modules/ramda/es/filter.js b/node_modules/ramda/es/filter.js new file mode 100644 index 0000000..6512708 --- /dev/null +++ b/node_modules/ramda/es/filter.js @@ -0,0 +1,51 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _filter from "./internal/_filter.js"; +import _isObject from "./internal/_isObject.js"; +import _reduce from "./internal/_reduce.js"; +import _xfilter from "./internal/_xfilter.js"; +import keys from "./keys.js"; +/** + * Takes a predicate and a `Filterable`, and returns a new filterable of the + * same type containing the members of the given filterable which satisfy the + * given predicate. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * Dispatches to the `filter` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} Filterable + * @see R.reject, R.transduce, R.addIndex + * @example + * + * const isEven = n => n % 2 === 0; + * + * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + * + * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + +var filter = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['filter'], _xfilter, function (pred, filterable) { + return _isObject(filterable) ? _reduce(function (acc, key) { + if (pred(filterable[key])) { + acc[key] = filterable[key]; + } + + return acc; + }, {}, keys(filterable)) : // else + _filter(pred, filterable); +})); + +export default filter; \ No newline at end of file diff --git a/node_modules/ramda/es/find.js b/node_modules/ramda/es/find.js new file mode 100644 index 0000000..f312bcc --- /dev/null +++ b/node_modules/ramda/es/find.js @@ -0,0 +1,46 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xfind from "./internal/_xfind.js"; +/** + * Returns the first element of the list which matches the predicate, or + * `undefined` if no element matches. + * + * Dispatches to the `find` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> a | undefined + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Object} The element found, or `undefined`. + * @see R.transduce + * @example + * + * const xs = [{a: 1}, {a: 2}, {a: 3}]; + * R.find(R.propEq('a', 2))(xs); //=> {a: 2} + * R.find(R.propEq('a', 4))(xs); //=> undefined + */ + +var find = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['find'], _xfind, function find(fn, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (fn(list[idx])) { + return list[idx]; + } + + idx += 1; + } +})); + +export default find; \ No newline at end of file diff --git a/node_modules/ramda/es/findIndex.js b/node_modules/ramda/es/findIndex.js new file mode 100644 index 0000000..5df1726 --- /dev/null +++ b/node_modules/ramda/es/findIndex.js @@ -0,0 +1,46 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xfindIndex from "./internal/_xfindIndex.js"; +/** + * Returns the index of the first element of the list which matches the + * predicate, or `-1` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> Number + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Number} The index of the element found, or `-1`. + * @see R.transduce + * @example + * + * const xs = [{a: 1}, {a: 2}, {a: 3}]; + * R.findIndex(R.propEq('a', 2))(xs); //=> 1 + * R.findIndex(R.propEq('a', 4))(xs); //=> -1 + */ + +var findIndex = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xfindIndex, function findIndex(fn, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (fn(list[idx])) { + return idx; + } + + idx += 1; + } + + return -1; +})); + +export default findIndex; \ No newline at end of file diff --git a/node_modules/ramda/es/findLast.js b/node_modules/ramda/es/findLast.js new file mode 100644 index 0000000..709e5b4 --- /dev/null +++ b/node_modules/ramda/es/findLast.js @@ -0,0 +1,43 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xfindLast from "./internal/_xfindLast.js"; +/** + * Returns the last element of the list which matches the predicate, or + * `undefined` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> a | undefined + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Object} The element found, or `undefined`. + * @see R.transduce + * @example + * + * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; + * R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} + * R.findLast(R.propEq('a', 4))(xs); //=> undefined + */ + +var findLast = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xfindLast, function findLast(fn, list) { + var idx = list.length - 1; + + while (idx >= 0) { + if (fn(list[idx])) { + return list[idx]; + } + + idx -= 1; + } +})); + +export default findLast; \ No newline at end of file diff --git a/node_modules/ramda/es/findLastIndex.js b/node_modules/ramda/es/findLastIndex.js new file mode 100644 index 0000000..2012abb --- /dev/null +++ b/node_modules/ramda/es/findLastIndex.js @@ -0,0 +1,45 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xfindLastIndex from "./internal/_xfindLastIndex.js"; +/** + * Returns the index of the last element of the list which matches the + * predicate, or `-1` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> Number + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Number} The index of the element found, or `-1`. + * @see R.transduce + * @example + * + * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; + * R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 + * R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 + */ + +var findLastIndex = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xfindLastIndex, function findLastIndex(fn, list) { + var idx = list.length - 1; + + while (idx >= 0) { + if (fn(list[idx])) { + return idx; + } + + idx -= 1; + } + + return -1; +})); + +export default findLastIndex; \ No newline at end of file diff --git a/node_modules/ramda/es/flatten.js b/node_modules/ramda/es/flatten.js new file mode 100644 index 0000000..7d7ef6b --- /dev/null +++ b/node_modules/ramda/es/flatten.js @@ -0,0 +1,27 @@ +import _curry1 from "./internal/_curry1.js"; +import _makeFlat from "./internal/_makeFlat.js"; +/** + * Returns a new list by pulling every item out of it (and all its sub-arrays) + * and putting them in a new array, depth-first. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] + * @param {Array} list The array to consider. + * @return {Array} The flattened list. + * @see R.unnest + * @example + * + * R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]); + * //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + */ + +var flatten = +/*#__PURE__*/ +_curry1( +/*#__PURE__*/ +_makeFlat(true)); + +export default flatten; \ No newline at end of file diff --git a/node_modules/ramda/es/flip.js b/node_modules/ramda/es/flip.js new file mode 100644 index 0000000..69f08f8 --- /dev/null +++ b/node_modules/ramda/es/flip.js @@ -0,0 +1,35 @@ +import _curry1 from "./internal/_curry1.js"; +import curryN from "./curryN.js"; +/** + * Returns a new function much like the supplied one, except that the first two + * arguments' order is reversed. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b, c, ...) -> z) -> (b -> a -> c -> ... -> z) + * @param {Function} fn The function to invoke with its first two parameters reversed. + * @return {*} The result of invoking `fn` with its first two parameters' order reversed. + * @example + * + * const mergeThree = (a, b, c) => [].concat(a, b, c); + * + * mergeThree(1, 2, 3); //=> [1, 2, 3] + * + * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] + * @symb R.flip(f)(a, b, c) = f(b, a, c) + */ + +var flip = +/*#__PURE__*/ +_curry1(function flip(fn) { + return curryN(fn.length, function (a, b) { + var args = Array.prototype.slice.call(arguments, 0); + args[0] = b; + args[1] = a; + return fn.apply(this, args); + }); +}); + +export default flip; \ No newline at end of file diff --git a/node_modules/ramda/es/forEach.js b/node_modules/ramda/es/forEach.js new file mode 100644 index 0000000..40978fe --- /dev/null +++ b/node_modules/ramda/es/forEach.js @@ -0,0 +1,54 @@ +import _checkForMethod from "./internal/_checkForMethod.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Iterate over an input `list`, calling a provided function `fn` for each + * element in the list. + * + * `fn` receives one argument: *(value)*. + * + * Note: `R.forEach` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.forEach` method. For more + * details on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description + * + * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns + * the original array. In some libraries this function is named `each`. + * + * Dispatches to the `forEach` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> *) -> [a] -> [a] + * @param {Function} fn The function to invoke. Receives one argument, `value`. + * @param {Array} list The list to iterate over. + * @return {Array} The original list. + * @see R.addIndex + * @example + * + * const printXPlusFive = x => console.log(x + 5); + * R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3] + * // logs 6 + * // logs 7 + * // logs 8 + * @symb R.forEach(f, [a, b, c]) = [a, b, c] + */ + +var forEach = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_checkForMethod('forEach', function forEach(fn, list) { + var len = list.length; + var idx = 0; + + while (idx < len) { + fn(list[idx]); + idx += 1; + } + + return list; +})); + +export default forEach; \ No newline at end of file diff --git a/node_modules/ramda/es/forEachObjIndexed.js b/node_modules/ramda/es/forEachObjIndexed.js new file mode 100644 index 0000000..33adfd9 --- /dev/null +++ b/node_modules/ramda/es/forEachObjIndexed.js @@ -0,0 +1,41 @@ +import _curry2 from "./internal/_curry2.js"; +import keys from "./keys.js"; +/** + * Iterate over an input `object`, calling a provided function `fn` for each + * key and value in the object. + * + * `fn` receives three argument: *(value, key, obj)*. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Object + * @sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a + * @param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`. + * @param {Object} obj The object to iterate over. + * @return {Object} The original object. + * @example + * + * const printKeyConcatValue = (value, key) => console.log(key + ':' + value); + * R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2} + * // logs x:1 + * // logs y:2 + * @symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b} + */ + +var forEachObjIndexed = +/*#__PURE__*/ +_curry2(function forEachObjIndexed(fn, obj) { + var keyList = keys(obj); + var idx = 0; + + while (idx < keyList.length) { + var key = keyList[idx]; + fn(obj[key], key, obj); + idx += 1; + } + + return obj; +}); + +export default forEachObjIndexed; \ No newline at end of file diff --git a/node_modules/ramda/es/fromPairs.js b/node_modules/ramda/es/fromPairs.js new file mode 100644 index 0000000..14a3ec0 --- /dev/null +++ b/node_modules/ramda/es/fromPairs.js @@ -0,0 +1,33 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Creates a new object from a list key-value pairs. If a key appears in + * multiple pairs, the rightmost pair is included in the object. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [[k,v]] -> {k: v} + * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object. + * @return {Object} The object made by pairing up `keys` and `values`. + * @see R.toPairs, R.pair + * @example + * + * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} + */ + +var fromPairs = +/*#__PURE__*/ +_curry1(function fromPairs(pairs) { + var result = {}; + var idx = 0; + + while (idx < pairs.length) { + result[pairs[idx][0]] = pairs[idx][1]; + idx += 1; + } + + return result; +}); + +export default fromPairs; \ No newline at end of file diff --git a/node_modules/ramda/es/groupBy.js b/node_modules/ramda/es/groupBy.js new file mode 100644 index 0000000..0f7bbcd --- /dev/null +++ b/node_modules/ramda/es/groupBy.js @@ -0,0 +1,60 @@ +import _checkForMethod from "./internal/_checkForMethod.js"; +import _curry2 from "./internal/_curry2.js"; +import reduceBy from "./reduceBy.js"; +/** + * Splits a list into sub-lists stored in an object, based on the result of + * calling a String-returning function on each element, and grouping the + * results according to values returned. + * + * Dispatches to the `groupBy` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> String) -> [a] -> {String: [a]} + * @param {Function} fn Function :: a -> String + * @param {Array} list The array to group + * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements + * that produced that key when passed to `fn`. + * @see R.reduceBy, R.transduce + * @example + * + * const byGrade = R.groupBy(function(student) { + * const score = student.score; + * return score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A'; + * }); + * const students = [{name: 'Abby', score: 84}, + * {name: 'Eddy', score: 58}, + * // ... + * {name: 'Jack', score: 69}]; + * byGrade(students); + * // { + * // 'A': [{name: 'Dianne', score: 99}], + * // 'B': [{name: 'Abby', score: 84}] + * // // ..., + * // 'F': [{name: 'Eddy', score: 58}] + * // } + */ + +var groupBy = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_checkForMethod('groupBy', +/*#__PURE__*/ +reduceBy(function (acc, item) { + if (acc == null) { + acc = []; + } + + acc.push(item); + return acc; +}, null))); + +export default groupBy; \ No newline at end of file diff --git a/node_modules/ramda/es/groupWith.js b/node_modules/ramda/es/groupWith.js new file mode 100644 index 0000000..0961852 --- /dev/null +++ b/node_modules/ramda/es/groupWith.js @@ -0,0 +1,54 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Takes a list and returns a list of lists where each sublist's elements are + * all satisfied pairwise comparison according to the provided function. + * Only adjacent elements are passed to the comparison function. + * + * @func + * @memberOf R + * @since v0.21.0 + * @category List + * @sig ((a, a) → Boolean) → [a] → [[a]] + * @param {Function} fn Function for determining whether two given (adjacent) + * elements should be in the same group + * @param {Array} list The array to group. Also accepts a string, which will be + * treated as a list of characters. + * @return {List} A list that contains sublists of elements, + * whose concatenations are equal to the original list. + * @example + * + * R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]] + * + * R.groupWith((a, b) => a + 1 === b, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0, 1], [1, 2, 3], [5], [8], [13], [21]] + * + * R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]] + * + * R.groupWith(R.eqBy(isVowel), 'aestiou') + * //=> ['ae', 'st', 'iou'] + */ + +var groupWith = +/*#__PURE__*/ +_curry2(function (fn, list) { + var res = []; + var idx = 0; + var len = list.length; + + while (idx < len) { + var nextidx = idx + 1; + + while (nextidx < len && fn(list[nextidx - 1], list[nextidx])) { + nextidx += 1; + } + + res.push(list.slice(idx, nextidx)); + idx = nextidx; + } + + return res; +}); + +export default groupWith; \ No newline at end of file diff --git a/node_modules/ramda/es/gt.js b/node_modules/ramda/es/gt.js new file mode 100644 index 0000000..94a7180 --- /dev/null +++ b/node_modules/ramda/es/gt.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if the first argument is greater than the second; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @see R.lt + * @example + * + * R.gt(2, 1); //=> true + * R.gt(2, 2); //=> false + * R.gt(2, 3); //=> false + * R.gt('a', 'z'); //=> false + * R.gt('z', 'a'); //=> true + */ + +var gt = +/*#__PURE__*/ +_curry2(function gt(a, b) { + return a > b; +}); + +export default gt; \ No newline at end of file diff --git a/node_modules/ramda/es/gte.js b/node_modules/ramda/es/gte.js new file mode 100644 index 0000000..53ac728 --- /dev/null +++ b/node_modules/ramda/es/gte.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if the first argument is greater than or equal to the second; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {Number} a + * @param {Number} b + * @return {Boolean} + * @see R.lte + * @example + * + * R.gte(2, 1); //=> true + * R.gte(2, 2); //=> true + * R.gte(2, 3); //=> false + * R.gte('a', 'z'); //=> false + * R.gte('z', 'a'); //=> true + */ + +var gte = +/*#__PURE__*/ +_curry2(function gte(a, b) { + return a >= b; +}); + +export default gte; \ No newline at end of file diff --git a/node_modules/ramda/es/has.js b/node_modules/ramda/es/has.js new file mode 100644 index 0000000..6e91105 --- /dev/null +++ b/node_modules/ramda/es/has.js @@ -0,0 +1,34 @@ +import _curry2 from "./internal/_curry2.js"; +import hasPath from "./hasPath.js"; +/** + * Returns whether or not an object has an own property with the specified name + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Object + * @sig s -> {s: x} -> Boolean + * @param {String} prop The name of the property to check for. + * @param {Object} obj The object to query. + * @return {Boolean} Whether the property exists. + * @example + * + * const hasName = R.has('name'); + * hasName({name: 'alice'}); //=> true + * hasName({name: 'bob'}); //=> true + * hasName({}); //=> false + * + * const point = {x: 0, y: 0}; + * const pointHas = R.has(R.__, point); + * pointHas('x'); //=> true + * pointHas('y'); //=> true + * pointHas('z'); //=> false + */ + +var has = +/*#__PURE__*/ +_curry2(function has(prop, obj) { + return hasPath([prop], obj); +}); + +export default has; \ No newline at end of file diff --git a/node_modules/ramda/es/hasIn.js b/node_modules/ramda/es/hasIn.js new file mode 100644 index 0000000..8281e3d --- /dev/null +++ b/node_modules/ramda/es/hasIn.js @@ -0,0 +1,35 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns whether or not an object or its prototype chain has a property with + * the specified name + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Object + * @sig s -> {s: x} -> Boolean + * @param {String} prop The name of the property to check for. + * @param {Object} obj The object to query. + * @return {Boolean} Whether the property exists. + * @example + * + * function Rectangle(width, height) { + * this.width = width; + * this.height = height; + * } + * Rectangle.prototype.area = function() { + * return this.width * this.height; + * }; + * + * const square = new Rectangle(2, 2); + * R.hasIn('width', square); //=> true + * R.hasIn('area', square); //=> true + */ + +var hasIn = +/*#__PURE__*/ +_curry2(function hasIn(prop, obj) { + return prop in obj; +}); + +export default hasIn; \ No newline at end of file diff --git a/node_modules/ramda/es/hasPath.js b/node_modules/ramda/es/hasPath.js new file mode 100644 index 0000000..c471663 --- /dev/null +++ b/node_modules/ramda/es/hasPath.js @@ -0,0 +1,48 @@ +import _curry2 from "./internal/_curry2.js"; +import _has from "./internal/_has.js"; +import isNil from "./isNil.js"; +/** + * Returns whether or not a path exists in an object. Only the object's + * own properties are checked. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> Boolean + * @param {Array} path The path to use. + * @param {Object} obj The object to check the path in. + * @return {Boolean} Whether the path exists. + * @see R.has + * @example + * + * R.hasPath(['a', 'b'], {a: {b: 2}}); // => true + * R.hasPath(['a', 'b'], {a: {b: undefined}}); // => true + * R.hasPath(['a', 'b'], {a: {c: 2}}); // => false + * R.hasPath(['a', 'b'], {}); // => false + */ + +var hasPath = +/*#__PURE__*/ +_curry2(function hasPath(_path, obj) { + if (_path.length === 0 || isNil(obj)) { + return false; + } + + var val = obj; + var idx = 0; + + while (idx < _path.length) { + if (!isNil(val) && _has(_path[idx], val)) { + val = val[_path[idx]]; + idx += 1; + } else { + return false; + } + } + + return true; +}); + +export default hasPath; \ No newline at end of file diff --git a/node_modules/ramda/es/head.js b/node_modules/ramda/es/head.js new file mode 100644 index 0000000..1fefa1a --- /dev/null +++ b/node_modules/ramda/es/head.js @@ -0,0 +1,27 @@ +import nth from "./nth.js"; +/** + * Returns the first element of the given list or string. In some libraries + * this function is named `first`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {Array|String} list + * @return {*} + * @see R.tail, R.init, R.last + * @example + * + * R.head(['fi', 'fo', 'fum']); //=> 'fi' + * R.head([]); //=> undefined + * + * R.head('abc'); //=> 'a' + * R.head(''); //=> '' + */ + +var head = +/*#__PURE__*/ +nth(0); +export default head; \ No newline at end of file diff --git a/node_modules/ramda/es/identical.js b/node_modules/ramda/es/identical.js new file mode 100644 index 0000000..a904825 --- /dev/null +++ b/node_modules/ramda/es/identical.js @@ -0,0 +1,33 @@ +import _objectIs from "./internal/_objectIs.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns true if its arguments are identical, false otherwise. Values are + * identical if they reference the same memory. `NaN` is identical to `NaN`; + * `0` and `-0` are not identical. + * + * Note this is merely a curried version of ES6 `Object.is`. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * const o = {}; + * R.identical(o, o); //=> true + * R.identical(1, 1); //=> true + * R.identical(1, '1'); //=> false + * R.identical([], []); //=> false + * R.identical(0, -0); //=> false + * R.identical(NaN, NaN); //=> true + */ + +var identical = +/*#__PURE__*/ +_curry2(_objectIs); + +export default identical; \ No newline at end of file diff --git a/node_modules/ramda/es/identity.js b/node_modules/ramda/es/identity.js new file mode 100644 index 0000000..7a3584d --- /dev/null +++ b/node_modules/ramda/es/identity.js @@ -0,0 +1,27 @@ +import _curry1 from "./internal/_curry1.js"; +import _identity from "./internal/_identity.js"; +/** + * A function that does nothing but return the parameter supplied to it. Good + * as a default or placeholder function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> a + * @param {*} x The value to return. + * @return {*} The input value, `x`. + * @example + * + * R.identity(1); //=> 1 + * + * const obj = {}; + * R.identity(obj) === obj; //=> true + * @symb R.identity(a) = a + */ + +var identity = +/*#__PURE__*/ +_curry1(_identity); + +export default identity; \ No newline at end of file diff --git a/node_modules/ramda/es/ifElse.js b/node_modules/ramda/es/ifElse.js new file mode 100644 index 0000000..c198f5e --- /dev/null +++ b/node_modules/ramda/es/ifElse.js @@ -0,0 +1,37 @@ +import _curry3 from "./internal/_curry3.js"; +import curryN from "./curryN.js"; +/** + * Creates a function that will process either the `onTrue` or the `onFalse` + * function depending upon the result of the `condition` predicate. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *) + * @param {Function} condition A predicate function + * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value. + * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value. + * @return {Function} A new function that will process either the `onTrue` or the `onFalse` + * function depending upon the result of the `condition` predicate. + * @see R.unless, R.when, R.cond + * @example + * + * const incCount = R.ifElse( + * R.has('count'), + * R.over(R.lensProp('count'), R.inc), + * R.assoc('count', 1) + * ); + * incCount({}); //=> { count: 1 } + * incCount({ count: 1 }); //=> { count: 2 } + */ + +var ifElse = +/*#__PURE__*/ +_curry3(function ifElse(condition, onTrue, onFalse) { + return curryN(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() { + return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments); + }); +}); + +export default ifElse; \ No newline at end of file diff --git a/node_modules/ramda/es/inc.js b/node_modules/ramda/es/inc.js new file mode 100644 index 0000000..2b5ef33 --- /dev/null +++ b/node_modules/ramda/es/inc.js @@ -0,0 +1,21 @@ +import add from "./add.js"; +/** + * Increments its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n + 1 + * @see R.dec + * @example + * + * R.inc(42); //=> 43 + */ + +var inc = +/*#__PURE__*/ +add(1); +export default inc; \ No newline at end of file diff --git a/node_modules/ramda/es/includes.js b/node_modules/ramda/es/includes.js new file mode 100644 index 0000000..d00d884 --- /dev/null +++ b/node_modules/ramda/es/includes.js @@ -0,0 +1,30 @@ +import _includes from "./internal/_includes.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if the specified value is equal, in [`R.equals`](#equals) + * terms, to at least one element of the given list; `false` otherwise. + * Works also with strings. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category List + * @sig a -> [a] -> Boolean + * @param {Object} a The item to compare against. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. + * @see R.any + * @example + * + * R.includes(3, [1, 2, 3]); //=> true + * R.includes(4, [1, 2, 3]); //=> false + * R.includes({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + * R.includes([42], [[42]]); //=> true + * R.includes('ba', 'banana'); //=>true + */ + +var includes = +/*#__PURE__*/ +_curry2(_includes); + +export default includes; \ No newline at end of file diff --git a/node_modules/ramda/es/index.js b/node_modules/ramda/es/index.js new file mode 100644 index 0000000..d139d5f --- /dev/null +++ b/node_modules/ramda/es/index.js @@ -0,0 +1,257 @@ +export { default as F } from "./F.js"; +export { default as T } from "./T.js"; +export { default as __ } from "./__.js"; +export { default as add } from "./add.js"; +export { default as addIndex } from "./addIndex.js"; +export { default as adjust } from "./adjust.js"; +export { default as all } from "./all.js"; +export { default as allPass } from "./allPass.js"; +export { default as always } from "./always.js"; +export { default as and } from "./and.js"; +export { default as any } from "./any.js"; +export { default as anyPass } from "./anyPass.js"; +export { default as ap } from "./ap.js"; +export { default as aperture } from "./aperture.js"; +export { default as append } from "./append.js"; +export { default as apply } from "./apply.js"; +export { default as applySpec } from "./applySpec.js"; +export { default as applyTo } from "./applyTo.js"; +export { default as ascend } from "./ascend.js"; +export { default as assoc } from "./assoc.js"; +export { default as assocPath } from "./assocPath.js"; +export { default as binary } from "./binary.js"; +export { default as bind } from "./bind.js"; +export { default as both } from "./both.js"; +export { default as call } from "./call.js"; +export { default as chain } from "./chain.js"; +export { default as clamp } from "./clamp.js"; +export { default as clone } from "./clone.js"; +export { default as comparator } from "./comparator.js"; +export { default as complement } from "./complement.js"; +export { default as compose } from "./compose.js"; +export { default as composeK } from "./composeK.js"; +export { default as composeP } from "./composeP.js"; +export { default as composeWith } from "./composeWith.js"; +export { default as concat } from "./concat.js"; +export { default as cond } from "./cond.js"; +export { default as construct } from "./construct.js"; +export { default as constructN } from "./constructN.js"; +export { default as contains } from "./contains.js"; +export { default as converge } from "./converge.js"; +export { default as countBy } from "./countBy.js"; +export { default as curry } from "./curry.js"; +export { default as curryN } from "./curryN.js"; +export { default as dec } from "./dec.js"; +export { default as defaultTo } from "./defaultTo.js"; +export { default as descend } from "./descend.js"; +export { default as difference } from "./difference.js"; +export { default as differenceWith } from "./differenceWith.js"; +export { default as dissoc } from "./dissoc.js"; +export { default as dissocPath } from "./dissocPath.js"; +export { default as divide } from "./divide.js"; +export { default as drop } from "./drop.js"; +export { default as dropLast } from "./dropLast.js"; +export { default as dropLastWhile } from "./dropLastWhile.js"; +export { default as dropRepeats } from "./dropRepeats.js"; +export { default as dropRepeatsWith } from "./dropRepeatsWith.js"; +export { default as dropWhile } from "./dropWhile.js"; +export { default as either } from "./either.js"; +export { default as empty } from "./empty.js"; +export { default as endsWith } from "./endsWith.js"; +export { default as eqBy } from "./eqBy.js"; +export { default as eqProps } from "./eqProps.js"; +export { default as equals } from "./equals.js"; +export { default as evolve } from "./evolve.js"; +export { default as filter } from "./filter.js"; +export { default as find } from "./find.js"; +export { default as findIndex } from "./findIndex.js"; +export { default as findLast } from "./findLast.js"; +export { default as findLastIndex } from "./findLastIndex.js"; +export { default as flatten } from "./flatten.js"; +export { default as flip } from "./flip.js"; +export { default as forEach } from "./forEach.js"; +export { default as forEachObjIndexed } from "./forEachObjIndexed.js"; +export { default as fromPairs } from "./fromPairs.js"; +export { default as groupBy } from "./groupBy.js"; +export { default as groupWith } from "./groupWith.js"; +export { default as gt } from "./gt.js"; +export { default as gte } from "./gte.js"; +export { default as has } from "./has.js"; +export { default as hasIn } from "./hasIn.js"; +export { default as hasPath } from "./hasPath.js"; +export { default as head } from "./head.js"; +export { default as identical } from "./identical.js"; +export { default as identity } from "./identity.js"; +export { default as ifElse } from "./ifElse.js"; +export { default as inc } from "./inc.js"; +export { default as includes } from "./includes.js"; +export { default as indexBy } from "./indexBy.js"; +export { default as indexOf } from "./indexOf.js"; +export { default as init } from "./init.js"; +export { default as innerJoin } from "./innerJoin.js"; +export { default as insert } from "./insert.js"; +export { default as insertAll } from "./insertAll.js"; +export { default as intersection } from "./intersection.js"; +export { default as intersperse } from "./intersperse.js"; +export { default as into } from "./into.js"; +export { default as invert } from "./invert.js"; +export { default as invertObj } from "./invertObj.js"; +export { default as invoker } from "./invoker.js"; +export { default as is } from "./is.js"; +export { default as isEmpty } from "./isEmpty.js"; +export { default as isNil } from "./isNil.js"; +export { default as join } from "./join.js"; +export { default as juxt } from "./juxt.js"; +export { default as keys } from "./keys.js"; +export { default as keysIn } from "./keysIn.js"; +export { default as last } from "./last.js"; +export { default as lastIndexOf } from "./lastIndexOf.js"; +export { default as length } from "./length.js"; +export { default as lens } from "./lens.js"; +export { default as lensIndex } from "./lensIndex.js"; +export { default as lensPath } from "./lensPath.js"; +export { default as lensProp } from "./lensProp.js"; +export { default as lift } from "./lift.js"; +export { default as liftN } from "./liftN.js"; +export { default as lt } from "./lt.js"; +export { default as lte } from "./lte.js"; +export { default as map } from "./map.js"; +export { default as mapAccum } from "./mapAccum.js"; +export { default as mapAccumRight } from "./mapAccumRight.js"; +export { default as mapObjIndexed } from "./mapObjIndexed.js"; +export { default as match } from "./match.js"; +export { default as mathMod } from "./mathMod.js"; +export { default as max } from "./max.js"; +export { default as maxBy } from "./maxBy.js"; +export { default as mean } from "./mean.js"; +export { default as median } from "./median.js"; +export { default as memoizeWith } from "./memoizeWith.js"; +export { default as merge } from "./merge.js"; +export { default as mergeAll } from "./mergeAll.js"; +export { default as mergeDeepLeft } from "./mergeDeepLeft.js"; +export { default as mergeDeepRight } from "./mergeDeepRight.js"; +export { default as mergeDeepWith } from "./mergeDeepWith.js"; +export { default as mergeDeepWithKey } from "./mergeDeepWithKey.js"; +export { default as mergeLeft } from "./mergeLeft.js"; +export { default as mergeRight } from "./mergeRight.js"; +export { default as mergeWith } from "./mergeWith.js"; +export { default as mergeWithKey } from "./mergeWithKey.js"; +export { default as min } from "./min.js"; +export { default as minBy } from "./minBy.js"; +export { default as modulo } from "./modulo.js"; +export { default as move } from "./move.js"; +export { default as multiply } from "./multiply.js"; +export { default as nAry } from "./nAry.js"; +export { default as negate } from "./negate.js"; +export { default as none } from "./none.js"; +export { default as not } from "./not.js"; +export { default as nth } from "./nth.js"; +export { default as nthArg } from "./nthArg.js"; +export { default as o } from "./o.js"; +export { default as objOf } from "./objOf.js"; +export { default as of } from "./of.js"; +export { default as omit } from "./omit.js"; +export { default as once } from "./once.js"; +export { default as or } from "./or.js"; +export { default as otherwise } from "./otherwise.js"; +export { default as over } from "./over.js"; +export { default as pair } from "./pair.js"; +export { default as partial } from "./partial.js"; +export { default as partialRight } from "./partialRight.js"; +export { default as partition } from "./partition.js"; +export { default as path } from "./path.js"; +export { default as paths } from "./paths.js"; +export { default as pathEq } from "./pathEq.js"; +export { default as pathOr } from "./pathOr.js"; +export { default as pathSatisfies } from "./pathSatisfies.js"; +export { default as pick } from "./pick.js"; +export { default as pickAll } from "./pickAll.js"; +export { default as pickBy } from "./pickBy.js"; +export { default as pipe } from "./pipe.js"; +export { default as pipeK } from "./pipeK.js"; +export { default as pipeP } from "./pipeP.js"; +export { default as pipeWith } from "./pipeWith.js"; +export { default as pluck } from "./pluck.js"; +export { default as prepend } from "./prepend.js"; +export { default as product } from "./product.js"; +export { default as project } from "./project.js"; +export { default as prop } from "./prop.js"; +export { default as propEq } from "./propEq.js"; +export { default as propIs } from "./propIs.js"; +export { default as propOr } from "./propOr.js"; +export { default as propSatisfies } from "./propSatisfies.js"; +export { default as props } from "./props.js"; +export { default as range } from "./range.js"; +export { default as reduce } from "./reduce.js"; +export { default as reduceBy } from "./reduceBy.js"; +export { default as reduceRight } from "./reduceRight.js"; +export { default as reduceWhile } from "./reduceWhile.js"; +export { default as reduced } from "./reduced.js"; +export { default as reject } from "./reject.js"; +export { default as remove } from "./remove.js"; +export { default as repeat } from "./repeat.js"; +export { default as replace } from "./replace.js"; +export { default as reverse } from "./reverse.js"; +export { default as scan } from "./scan.js"; +export { default as sequence } from "./sequence.js"; +export { default as set } from "./set.js"; +export { default as slice } from "./slice.js"; +export { default as sort } from "./sort.js"; +export { default as sortBy } from "./sortBy.js"; +export { default as sortWith } from "./sortWith.js"; +export { default as split } from "./split.js"; +export { default as splitAt } from "./splitAt.js"; +export { default as splitEvery } from "./splitEvery.js"; +export { default as splitWhen } from "./splitWhen.js"; +export { default as startsWith } from "./startsWith.js"; +export { default as subtract } from "./subtract.js"; +export { default as sum } from "./sum.js"; +export { default as symmetricDifference } from "./symmetricDifference.js"; +export { default as symmetricDifferenceWith } from "./symmetricDifferenceWith.js"; +export { default as tail } from "./tail.js"; +export { default as take } from "./take.js"; +export { default as takeLast } from "./takeLast.js"; +export { default as takeLastWhile } from "./takeLastWhile.js"; +export { default as takeWhile } from "./takeWhile.js"; +export { default as tap } from "./tap.js"; +export { default as test } from "./test.js"; +export { default as andThen } from "./andThen.js"; +export { default as times } from "./times.js"; +export { default as toLower } from "./toLower.js"; +export { default as toPairs } from "./toPairs.js"; +export { default as toPairsIn } from "./toPairsIn.js"; +export { default as toString } from "./toString.js"; +export { default as toUpper } from "./toUpper.js"; +export { default as transduce } from "./transduce.js"; +export { default as transpose } from "./transpose.js"; +export { default as traverse } from "./traverse.js"; +export { default as trim } from "./trim.js"; +export { default as tryCatch } from "./tryCatch.js"; +export { default as type } from "./type.js"; +export { default as unapply } from "./unapply.js"; +export { default as unary } from "./unary.js"; +export { default as uncurryN } from "./uncurryN.js"; +export { default as unfold } from "./unfold.js"; +export { default as union } from "./union.js"; +export { default as unionWith } from "./unionWith.js"; +export { default as uniq } from "./uniq.js"; +export { default as uniqBy } from "./uniqBy.js"; +export { default as uniqWith } from "./uniqWith.js"; +export { default as unless } from "./unless.js"; +export { default as unnest } from "./unnest.js"; +export { default as until } from "./until.js"; +export { default as update } from "./update.js"; +export { default as useWith } from "./useWith.js"; +export { default as values } from "./values.js"; +export { default as valuesIn } from "./valuesIn.js"; +export { default as view } from "./view.js"; +export { default as when } from "./when.js"; +export { default as where } from "./where.js"; +export { default as whereEq } from "./whereEq.js"; +export { default as without } from "./without.js"; +export { default as xor } from "./xor.js"; +export { default as xprod } from "./xprod.js"; +export { default as zip } from "./zip.js"; +export { default as zipObj } from "./zipObj.js"; +export { default as zipWith } from "./zipWith.js"; +export { default as thunkify } from "./thunkify.js"; \ No newline at end of file diff --git a/node_modules/ramda/es/indexBy.js b/node_modules/ramda/es/indexBy.js new file mode 100644 index 0000000..23281e9 --- /dev/null +++ b/node_modules/ramda/es/indexBy.js @@ -0,0 +1,30 @@ +import reduceBy from "./reduceBy.js"; +/** + * Given a function that generates a key, turns a list of objects into an + * object indexing the objects by the given key. Note that if multiple + * objects generate the same value for the indexing key only the last value + * will be included in the generated object. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> String) -> [{k: v}] -> {k: {k: v}} + * @param {Function} fn Function :: a -> String + * @param {Array} array The array of objects to index + * @return {Object} An object indexing each array element by the given property. + * @example + * + * const list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; + * R.indexBy(R.prop('id'), list); + * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} + */ + +var indexBy = +/*#__PURE__*/ +reduceBy(function (acc, elem) { + return elem; +}, null); +export default indexBy; \ No newline at end of file diff --git a/node_modules/ramda/es/indexOf.js b/node_modules/ramda/es/indexOf.js new file mode 100644 index 0000000..f968769 --- /dev/null +++ b/node_modules/ramda/es/indexOf.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +import _indexOf from "./internal/_indexOf.js"; +import _isArray from "./internal/_isArray.js"; +/** + * Returns the position of the first occurrence of an item in an array, or -1 + * if the item is not included in the array. [`R.equals`](#equals) is used to + * determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Number + * @param {*} target The item to find. + * @param {Array} xs The array to search in. + * @return {Number} the index of the target, or -1 if the target is not found. + * @see R.lastIndexOf + * @example + * + * R.indexOf(3, [1,2,3,4]); //=> 2 + * R.indexOf(10, [1,2,3,4]); //=> -1 + */ + +var indexOf = +/*#__PURE__*/ +_curry2(function indexOf(target, xs) { + return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0); +}); + +export default indexOf; \ No newline at end of file diff --git a/node_modules/ramda/es/init.js b/node_modules/ramda/es/init.js new file mode 100644 index 0000000..6b774ad --- /dev/null +++ b/node_modules/ramda/es/init.js @@ -0,0 +1,30 @@ +import slice from "./slice.js"; +/** + * Returns all but the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.last, R.head, R.tail + * @example + * + * R.init([1, 2, 3]); //=> [1, 2] + * R.init([1, 2]); //=> [1] + * R.init([1]); //=> [] + * R.init([]); //=> [] + * + * R.init('abc'); //=> 'ab' + * R.init('ab'); //=> 'a' + * R.init('a'); //=> '' + * R.init(''); //=> '' + */ + +var init = +/*#__PURE__*/ +slice(0, -1); +export default init; \ No newline at end of file diff --git a/node_modules/ramda/es/innerJoin.js b/node_modules/ramda/es/innerJoin.js new file mode 100644 index 0000000..fbdfa0e --- /dev/null +++ b/node_modules/ramda/es/innerJoin.js @@ -0,0 +1,48 @@ +import _includesWith from "./internal/_includesWith.js"; +import _curry3 from "./internal/_curry3.js"; +import _filter from "./internal/_filter.js"; +/** + * Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list + * `xs'` comprising each of the elements of `xs` which is equal to one or more + * elements of `ys` according to `pred`. + * + * `pred` must be a binary function expecting an element from each list. + * + * `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should + * not be significant, but since `xs'` is ordered the implementation guarantees + * that its values are in the same order as they appear in `xs`. Duplicates are + * not removed, so `xs'` may contain duplicates if `xs` contains duplicates. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Relation + * @sig ((a, b) -> Boolean) -> [a] -> [b] -> [a] + * @param {Function} pred + * @param {Array} xs + * @param {Array} ys + * @return {Array} + * @see R.intersection + * @example + * + * R.innerJoin( + * (record, id) => record.id === id, + * [{id: 824, name: 'Richie Furay'}, + * {id: 956, name: 'Dewey Martin'}, + * {id: 313, name: 'Bruce Palmer'}, + * {id: 456, name: 'Stephen Stills'}, + * {id: 177, name: 'Neil Young'}], + * [177, 456, 999] + * ); + * //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] + */ + +var innerJoin = +/*#__PURE__*/ +_curry3(function innerJoin(pred, xs, ys) { + return _filter(function (x) { + return _includesWith(pred, x, ys); + }, xs); +}); + +export default innerJoin; \ No newline at end of file diff --git a/node_modules/ramda/es/insert.js b/node_modules/ramda/es/insert.js new file mode 100644 index 0000000..70e9acf --- /dev/null +++ b/node_modules/ramda/es/insert.js @@ -0,0 +1,31 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Inserts the supplied element into the list, at the specified `index`. _Note that + + * this is not destructive_: it returns a copy of the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.2.2 + * @category List + * @sig Number -> a -> [a] -> [a] + * @param {Number} index The position to insert the element + * @param {*} elt The element to insert into the Array + * @param {Array} list The list to insert into + * @return {Array} A new Array with `elt` inserted at `index`. + * @example + * + * R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4] + */ + +var insert = +/*#__PURE__*/ +_curry3(function insert(idx, elt, list) { + idx = idx < list.length && idx >= 0 ? idx : list.length; + var result = Array.prototype.slice.call(list, 0); + result.splice(idx, 0, elt); + return result; +}); + +export default insert; \ No newline at end of file diff --git a/node_modules/ramda/es/insertAll.js b/node_modules/ramda/es/insertAll.js new file mode 100644 index 0000000..1d2498e --- /dev/null +++ b/node_modules/ramda/es/insertAll.js @@ -0,0 +1,28 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Inserts the sub-list into the list, at the specified `index`. _Note that this is not + * destructive_: it returns a copy of the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig Number -> [a] -> [a] -> [a] + * @param {Number} index The position to insert the sub-list + * @param {Array} elts The sub-list to insert into the Array + * @param {Array} list The list to insert the sub-list into + * @return {Array} A new Array with `elts` inserted starting at `index`. + * @example + * + * R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4] + */ + +var insertAll = +/*#__PURE__*/ +_curry3(function insertAll(idx, elts, list) { + idx = idx < list.length && idx >= 0 ? idx : list.length; + return [].concat(Array.prototype.slice.call(list, 0, idx), elts, Array.prototype.slice.call(list, idx)); +}); + +export default insertAll; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_Set.js b/node_modules/ramda/es/internal/_Set.js new file mode 100644 index 0000000..008e8ee --- /dev/null +++ b/node_modules/ramda/es/internal/_Set.js @@ -0,0 +1,201 @@ +import _includes from "./_includes.js"; + +var _Set = +/*#__PURE__*/ +function () { + function _Set() { + /* globals Set */ + this._nativeSet = typeof Set === 'function' ? new Set() : null; + this._items = {}; + } + + // until we figure out why jsdoc chokes on this + // @param item The item to add to the Set + // @returns {boolean} true if the item did not exist prior, otherwise false + // + _Set.prototype.add = function (item) { + return !hasOrAdd(item, true, this); + }; // + // @param item The item to check for existence in the Set + // @returns {boolean} true if the item exists in the Set, otherwise false + // + + + _Set.prototype.has = function (item) { + return hasOrAdd(item, false, this); + }; // + // Combines the logic for checking whether an item is a member of the set and + // for adding a new item to the set. + // + // @param item The item to check or add to the Set instance. + // @param shouldAdd If true, the item will be added to the set if it doesn't + // already exist. + // @param set The set instance to check or add to. + // @return {boolean} true if the item already existed, otherwise false. + // + + + return _Set; +}(); + +function hasOrAdd(item, shouldAdd, set) { + var type = typeof item; + var prevSize, newSize; + + switch (type) { + case 'string': + case 'number': + // distinguish between +0 and -0 + if (item === 0 && 1 / item === -Infinity) { + if (set._items['-0']) { + return true; + } else { + if (shouldAdd) { + set._items['-0'] = true; + } + + return false; + } + } // these types can all utilise the native Set + + + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + + set._nativeSet.add(item); + + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = {}; + set._items[type][item] = true; + } + + return false; + } else if (item in set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type][item] = true; + } + + return false; + } + } + + case 'boolean': + // set._items['boolean'] holds a two element array + // representing [ falseExists, trueExists ] + if (type in set._items) { + var bIdx = item ? 1 : 0; + + if (set._items[type][bIdx]) { + return true; + } else { + if (shouldAdd) { + set._items[type][bIdx] = true; + } + + return false; + } + } else { + if (shouldAdd) { + set._items[type] = item ? [false, true] : [true, false]; + } + + return false; + } + + case 'function': + // compare functions for reference equality + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + + set._nativeSet.add(item); + + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + + return false; + } + + if (!_includes(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + + return false; + } + + return true; + } + + case 'undefined': + if (set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type] = true; + } + + return false; + } + + case 'object': + if (item === null) { + if (!set._items['null']) { + if (shouldAdd) { + set._items['null'] = true; + } + + return false; + } + + return true; + } + + /* falls through */ + + default: + // reduce the search size of heterogeneous sets by creating buckets + // for each type. + type = Object.prototype.toString.call(item); + + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + + return false; + } // scan through all previously applied items + + + if (!_includes(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + + return false; + } + + return true; + } +} // A simple Set type that honours R.equals semantics + + +export default _Set; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_aperture.js b/node_modules/ramda/es/internal/_aperture.js new file mode 100644 index 0000000..e971a61 --- /dev/null +++ b/node_modules/ramda/es/internal/_aperture.js @@ -0,0 +1,12 @@ +export default function _aperture(n, list) { + var idx = 0; + var limit = list.length - (n - 1); + var acc = new Array(limit >= 0 ? limit : 0); + + while (idx < limit) { + acc[idx] = Array.prototype.slice.call(list, idx, idx + n); + idx += 1; + } + + return acc; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_arity.js b/node_modules/ramda/es/internal/_arity.js new file mode 100644 index 0000000..10cac37 --- /dev/null +++ b/node_modules/ramda/es/internal/_arity.js @@ -0,0 +1,62 @@ +export default function _arity(n, fn) { + /* eslint-disable no-unused-vars */ + switch (n) { + case 0: + return function () { + return fn.apply(this, arguments); + }; + + case 1: + return function (a0) { + return fn.apply(this, arguments); + }; + + case 2: + return function (a0, a1) { + return fn.apply(this, arguments); + }; + + case 3: + return function (a0, a1, a2) { + return fn.apply(this, arguments); + }; + + case 4: + return function (a0, a1, a2, a3) { + return fn.apply(this, arguments); + }; + + case 5: + return function (a0, a1, a2, a3, a4) { + return fn.apply(this, arguments); + }; + + case 6: + return function (a0, a1, a2, a3, a4, a5) { + return fn.apply(this, arguments); + }; + + case 7: + return function (a0, a1, a2, a3, a4, a5, a6) { + return fn.apply(this, arguments); + }; + + case 8: + return function (a0, a1, a2, a3, a4, a5, a6, a7) { + return fn.apply(this, arguments); + }; + + case 9: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { + return fn.apply(this, arguments); + }; + + case 10: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return fn.apply(this, arguments); + }; + + default: + throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); + } +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_arrayFromIterator.js b/node_modules/ramda/es/internal/_arrayFromIterator.js new file mode 100644 index 0000000..f57c595 --- /dev/null +++ b/node_modules/ramda/es/internal/_arrayFromIterator.js @@ -0,0 +1,10 @@ +export default function _arrayFromIterator(iter) { + var list = []; + var next; + + while (!(next = iter.next()).done) { + list.push(next.value); + } + + return list; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_assertPromise.js b/node_modules/ramda/es/internal/_assertPromise.js new file mode 100644 index 0000000..645ffac --- /dev/null +++ b/node_modules/ramda/es/internal/_assertPromise.js @@ -0,0 +1,7 @@ +import _isFunction from "./_isFunction.js"; +import _toString from "./_toString.js"; +export default function _assertPromise(name, p) { + if (p == null || !_isFunction(p.then)) { + throw new TypeError('`' + name + '` expected a Promise, received ' + _toString(p, [])); + } +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_checkForMethod.js b/node_modules/ramda/es/internal/_checkForMethod.js new file mode 100644 index 0000000..2b7ef9f --- /dev/null +++ b/node_modules/ramda/es/internal/_checkForMethod.js @@ -0,0 +1,24 @@ +import _isArray from "./_isArray.js"; +/** + * This checks whether a function has a [methodname] function. If it isn't an + * array it will execute that function otherwise it will default to the ramda + * implementation. + * + * @private + * @param {Function} fn ramda implemtation + * @param {String} methodname property to check for a custom implementation + * @return {Object} Whatever the return value of the method is. + */ + +export default function _checkForMethod(methodname, fn) { + return function () { + var length = arguments.length; + + if (length === 0) { + return fn(); + } + + var obj = arguments[length - 1]; + return _isArray(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1)); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_clone.js b/node_modules/ramda/es/internal/_clone.js new file mode 100644 index 0000000..a6451d5 --- /dev/null +++ b/node_modules/ramda/es/internal/_clone.js @@ -0,0 +1,53 @@ +import _cloneRegExp from "./_cloneRegExp.js"; +import type from "../type.js"; +/** + * Copies an object. + * + * @private + * @param {*} value The value to be copied + * @param {Array} refFrom Array containing the source references + * @param {Array} refTo Array containing the copied source references + * @param {Boolean} deep Whether or not to perform deep cloning. + * @return {*} The copied value. + */ + +export default function _clone(value, refFrom, refTo, deep) { + var copy = function copy(copiedValue) { + var len = refFrom.length; + var idx = 0; + + while (idx < len) { + if (value === refFrom[idx]) { + return refTo[idx]; + } + + idx += 1; + } + + refFrom[idx + 1] = value; + refTo[idx + 1] = copiedValue; + + for (var key in value) { + copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key]; + } + + return copiedValue; + }; + + switch (type(value)) { + case 'Object': + return copy({}); + + case 'Array': + return copy([]); + + case 'Date': + return new Date(value.valueOf()); + + case 'RegExp': + return _cloneRegExp(value); + + default: + return value; + } +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_cloneRegExp.js b/node_modules/ramda/es/internal/_cloneRegExp.js new file mode 100644 index 0000000..dba849f --- /dev/null +++ b/node_modules/ramda/es/internal/_cloneRegExp.js @@ -0,0 +1,3 @@ +export default function _cloneRegExp(pattern) { + return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : '')); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_complement.js b/node_modules/ramda/es/internal/_complement.js new file mode 100644 index 0000000..0f06b0d --- /dev/null +++ b/node_modules/ramda/es/internal/_complement.js @@ -0,0 +1,5 @@ +export default function _complement(f) { + return function () { + return !f.apply(this, arguments); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_concat.js b/node_modules/ramda/es/internal/_concat.js new file mode 100644 index 0000000..f751441 --- /dev/null +++ b/node_modules/ramda/es/internal/_concat.js @@ -0,0 +1,34 @@ +/** + * Private `concat` function to merge two array-like objects. + * + * @private + * @param {Array|Arguments} [set1=[]] An array-like object. + * @param {Array|Arguments} [set2=[]] An array-like object. + * @return {Array} A new, merged array. + * @example + * + * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + */ +export default function _concat(set1, set2) { + set1 = set1 || []; + set2 = set2 || []; + var idx; + var len1 = set1.length; + var len2 = set2.length; + var result = []; + idx = 0; + + while (idx < len1) { + result[result.length] = set1[idx]; + idx += 1; + } + + idx = 0; + + while (idx < len2) { + result[result.length] = set2[idx]; + idx += 1; + } + + return result; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_createPartialApplicator.js b/node_modules/ramda/es/internal/_createPartialApplicator.js new file mode 100644 index 0000000..4d2b790 --- /dev/null +++ b/node_modules/ramda/es/internal/_createPartialApplicator.js @@ -0,0 +1,9 @@ +import _arity from "./_arity.js"; +import _curry2 from "./_curry2.js"; +export default function _createPartialApplicator(concat) { + return _curry2(function (fn, args) { + return _arity(Math.max(0, fn.length - args.length), function () { + return fn.apply(this, concat(args, arguments)); + }); + }); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_curry1.js b/node_modules/ramda/es/internal/_curry1.js new file mode 100644 index 0000000..c126949 --- /dev/null +++ b/node_modules/ramda/es/internal/_curry1.js @@ -0,0 +1,19 @@ +import _isPlaceholder from "./_isPlaceholder.js"; +/** + * Optimized internal one-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + +export default function _curry1(fn) { + return function f1(a) { + if (arguments.length === 0 || _isPlaceholder(a)) { + return f1; + } else { + return fn.apply(this, arguments); + } + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_curry2.js b/node_modules/ramda/es/internal/_curry2.js new file mode 100644 index 0000000..4290edd --- /dev/null +++ b/node_modules/ramda/es/internal/_curry2.js @@ -0,0 +1,31 @@ +import _curry1 from "./_curry1.js"; +import _isPlaceholder from "./_isPlaceholder.js"; +/** + * Optimized internal two-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + +export default function _curry2(fn) { + return function f2(a, b) { + switch (arguments.length) { + case 0: + return f2; + + case 1: + return _isPlaceholder(a) ? f2 : _curry1(function (_b) { + return fn(a, _b); + }); + + default: + return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) { + return fn(_a, b); + }) : _isPlaceholder(b) ? _curry1(function (_b) { + return fn(a, _b); + }) : fn(a, b); + } + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_curry3.js b/node_modules/ramda/es/internal/_curry3.js new file mode 100644 index 0000000..3c104c8 --- /dev/null +++ b/node_modules/ramda/es/internal/_curry3.js @@ -0,0 +1,49 @@ +import _curry1 from "./_curry1.js"; +import _curry2 from "./_curry2.js"; +import _isPlaceholder from "./_isPlaceholder.js"; +/** + * Optimized internal three-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + +export default function _curry3(fn) { + return function f3(a, b, c) { + switch (arguments.length) { + case 0: + return f3; + + case 1: + return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) { + return fn(a, _b, _c); + }); + + case 2: + return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) { + return fn(_a, b, _c); + }) : _isPlaceholder(b) ? _curry2(function (_b, _c) { + return fn(a, _b, _c); + }) : _curry1(function (_c) { + return fn(a, b, _c); + }); + + default: + return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) { + return fn(_a, _b, c); + }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) { + return fn(_a, b, _c); + }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) { + return fn(a, _b, _c); + }) : _isPlaceholder(a) ? _curry1(function (_a) { + return fn(_a, b, c); + }) : _isPlaceholder(b) ? _curry1(function (_b) { + return fn(a, _b, c); + }) : _isPlaceholder(c) ? _curry1(function (_c) { + return fn(a, b, _c); + }) : fn(a, b, c); + } + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_curryN.js b/node_modules/ramda/es/internal/_curryN.js new file mode 100644 index 0000000..f489104 --- /dev/null +++ b/node_modules/ramda/es/internal/_curryN.js @@ -0,0 +1,42 @@ +import _arity from "./_arity.js"; +import _isPlaceholder from "./_isPlaceholder.js"; +/** + * Internal curryN function. + * + * @private + * @category Function + * @param {Number} length The arity of the curried function. + * @param {Array} received An array of arguments received thus far. + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + +export default function _curryN(length, received, fn) { + return function () { + var combined = []; + var argsIdx = 0; + var left = length; + var combinedIdx = 0; + + while (combinedIdx < received.length || argsIdx < arguments.length) { + var result; + + if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) { + result = received[combinedIdx]; + } else { + result = arguments[argsIdx]; + argsIdx += 1; + } + + combined[combinedIdx] = result; + + if (!_isPlaceholder(result)) { + left -= 1; + } + + combinedIdx += 1; + } + + return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn)); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_dispatchable.js b/node_modules/ramda/es/internal/_dispatchable.js new file mode 100644 index 0000000..0051926 --- /dev/null +++ b/node_modules/ramda/es/internal/_dispatchable.js @@ -0,0 +1,46 @@ +import _isArray from "./_isArray.js"; +import _isTransformer from "./_isTransformer.js"; +/** + * Returns a function that dispatches with different strategies based on the + * object in list position (last argument). If it is an array, executes [fn]. + * Otherwise, if it has a function with one of the given method names, it will + * execute that function (functor case). Otherwise, if it is a transformer, + * uses transducer [xf] to return a new transformer (transducer case). + * Otherwise, it will default to executing [fn]. + * + * @private + * @param {Array} methodNames properties to check for a custom implementation + * @param {Function} xf transducer to initialize if object is transformer + * @param {Function} fn default ramda implementation + * @return {Function} A function that dispatches on object in list position + */ + +export default function _dispatchable(methodNames, xf, fn) { + return function () { + if (arguments.length === 0) { + return fn(); + } + + var args = Array.prototype.slice.call(arguments, 0); + var obj = args.pop(); + + if (!_isArray(obj)) { + var idx = 0; + + while (idx < methodNames.length) { + if (typeof obj[methodNames[idx]] === 'function') { + return obj[methodNames[idx]].apply(obj, args); + } + + idx += 1; + } + + if (_isTransformer(obj)) { + var transducer = xf.apply(null, args); + return transducer(obj); + } + } + + return fn.apply(this, arguments); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_dropLast.js b/node_modules/ramda/es/internal/_dropLast.js new file mode 100644 index 0000000..59ba5f8 --- /dev/null +++ b/node_modules/ramda/es/internal/_dropLast.js @@ -0,0 +1,4 @@ +import take from "../take.js"; +export default function dropLast(n, xs) { + return take(n < xs.length ? xs.length - n : 0, xs); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_dropLastWhile.js b/node_modules/ramda/es/internal/_dropLastWhile.js new file mode 100644 index 0000000..f67bc14 --- /dev/null +++ b/node_modules/ramda/es/internal/_dropLastWhile.js @@ -0,0 +1,10 @@ +import slice from "../slice.js"; +export default function dropLastWhile(pred, xs) { + var idx = xs.length - 1; + + while (idx >= 0 && pred(xs[idx])) { + idx -= 1; + } + + return slice(0, idx + 1, xs); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_equals.js b/node_modules/ramda/es/internal/_equals.js new file mode 100644 index 0000000..d28bd8e --- /dev/null +++ b/node_modules/ramda/es/internal/_equals.js @@ -0,0 +1,166 @@ +import _arrayFromIterator from "./_arrayFromIterator.js"; +import _includesWith from "./_includesWith.js"; +import _functionName from "./_functionName.js"; +import _has from "./_has.js"; +import _objectIs from "./_objectIs.js"; +import keys from "../keys.js"; +import type from "../type.js"; +/** + * private _uniqContentEquals function. + * That function is checking equality of 2 iterator contents with 2 assumptions + * - iterators lengths are the same + * - iterators values are unique + * + * false-positive result will be returned for comparision of, e.g. + * - [1,2,3] and [1,2,3,4] + * - [1,1,1] and [1,2,3] + * */ + +function _uniqContentEquals(aIterator, bIterator, stackA, stackB) { + var a = _arrayFromIterator(aIterator); + + var b = _arrayFromIterator(bIterator); + + function eq(_a, _b) { + return _equals(_a, _b, stackA.slice(), stackB.slice()); + } // if *a* array contains any element that is not included in *b* + + + return !_includesWith(function (b, aItem) { + return !_includesWith(eq, aItem, b); + }, b, a); +} + +export default function _equals(a, b, stackA, stackB) { + if (_objectIs(a, b)) { + return true; + } + + var typeA = type(a); + + if (typeA !== type(b)) { + return false; + } + + if (a == null || b == null) { + return false; + } + + if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') { + return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a); + } + + if (typeof a.equals === 'function' || typeof b.equals === 'function') { + return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a); + } + + switch (typeA) { + case 'Arguments': + case 'Array': + case 'Object': + if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') { + return a === b; + } + + break; + + case 'Boolean': + case 'Number': + case 'String': + if (!(typeof a === typeof b && _objectIs(a.valueOf(), b.valueOf()))) { + return false; + } + + break; + + case 'Date': + if (!_objectIs(a.valueOf(), b.valueOf())) { + return false; + } + + break; + + case 'Error': + return a.name === b.name && a.message === b.message; + + case 'RegExp': + if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) { + return false; + } + + break; + } + + var idx = stackA.length - 1; + + while (idx >= 0) { + if (stackA[idx] === a) { + return stackB[idx] === b; + } + + idx -= 1; + } + + switch (typeA) { + case 'Map': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b])); + + case 'Set': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b])); + + case 'Arguments': + case 'Array': + case 'Object': + case 'Boolean': + case 'Number': + case 'String': + case 'Date': + case 'Error': + case 'RegExp': + case 'Int8Array': + case 'Uint8Array': + case 'Uint8ClampedArray': + case 'Int16Array': + case 'Uint16Array': + case 'Int32Array': + case 'Uint32Array': + case 'Float32Array': + case 'Float64Array': + case 'ArrayBuffer': + break; + + default: + // Values of other types are only equal if identical. + return false; + } + + var keysA = keys(a); + + if (keysA.length !== keys(b).length) { + return false; + } + + var extendedStackA = stackA.concat([a]); + var extendedStackB = stackB.concat([b]); + idx = keysA.length - 1; + + while (idx >= 0) { + var key = keysA[idx]; + + if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { + return false; + } + + idx -= 1; + } + + return true; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_filter.js b/node_modules/ramda/es/internal/_filter.js new file mode 100644 index 0000000..d9abc4a --- /dev/null +++ b/node_modules/ramda/es/internal/_filter.js @@ -0,0 +1,15 @@ +export default function _filter(fn, list) { + var idx = 0; + var len = list.length; + var result = []; + + while (idx < len) { + if (fn(list[idx])) { + result[result.length] = list[idx]; + } + + idx += 1; + } + + return result; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_flatCat.js b/node_modules/ramda/es/internal/_flatCat.js new file mode 100644 index 0000000..26e141a --- /dev/null +++ b/node_modules/ramda/es/internal/_flatCat.js @@ -0,0 +1,32 @@ +import _forceReduced from "./_forceReduced.js"; +import _isArrayLike from "./_isArrayLike.js"; +import _reduce from "./_reduce.js"; +import _xfBase from "./_xfBase.js"; + +var preservingReduced = function (xf) { + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function (result) { + return xf['@@transducer/result'](result); + }, + '@@transducer/step': function (result, input) { + var ret = xf['@@transducer/step'](result, input); + return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret; + } + }; +}; + +var _flatCat = function _xcat(xf) { + var rxf = preservingReduced(xf); + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function (result) { + return rxf['@@transducer/result'](result); + }, + '@@transducer/step': function (result, input) { + return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input); + } + }; +}; + +export default _flatCat; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_forceReduced.js b/node_modules/ramda/es/internal/_forceReduced.js new file mode 100644 index 0000000..7c59c78 --- /dev/null +++ b/node_modules/ramda/es/internal/_forceReduced.js @@ -0,0 +1,6 @@ +export default function _forceReduced(x) { + return { + '@@transducer/value': x, + '@@transducer/reduced': true + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_functionName.js b/node_modules/ramda/es/internal/_functionName.js new file mode 100644 index 0000000..17c7718 --- /dev/null +++ b/node_modules/ramda/es/internal/_functionName.js @@ -0,0 +1,5 @@ +export default function _functionName(f) { + // String(x => x) evaluates to "x => x", so the pattern may not match. + var match = String(f).match(/^function (\w*)/); + return match == null ? '' : match[1]; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_functionsWith.js b/node_modules/ramda/es/internal/_functionsWith.js new file mode 100644 index 0000000..829eb6b --- /dev/null +++ b/node_modules/ramda/es/internal/_functionsWith.js @@ -0,0 +1,14 @@ +import _filter from "./_filter.js"; +/** + * @private + * @param {Function} fn The strategy for extracting function names from an object + * @return {Function} A function that takes an object and returns an array of function names. + */ + +export default function _functionsWith(fn) { + return function (obj) { + return _filter(function (key) { + return typeof obj[key] === 'function'; + }, fn(obj)); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_has.js b/node_modules/ramda/es/internal/_has.js new file mode 100644 index 0000000..71363cf --- /dev/null +++ b/node_modules/ramda/es/internal/_has.js @@ -0,0 +1,3 @@ +export default function _has(prop, obj) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_identity.js b/node_modules/ramda/es/internal/_identity.js new file mode 100644 index 0000000..a1e7e4c --- /dev/null +++ b/node_modules/ramda/es/internal/_identity.js @@ -0,0 +1,3 @@ +export default function _identity(x) { + return x; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_includes.js b/node_modules/ramda/es/internal/_includes.js new file mode 100644 index 0000000..e932f9d --- /dev/null +++ b/node_modules/ramda/es/internal/_includes.js @@ -0,0 +1,4 @@ +import _indexOf from "./_indexOf.js"; +export default function _includes(a, list) { + return _indexOf(list, a, 0) >= 0; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_includesWith.js b/node_modules/ramda/es/internal/_includesWith.js new file mode 100644 index 0000000..e13a214 --- /dev/null +++ b/node_modules/ramda/es/internal/_includesWith.js @@ -0,0 +1,14 @@ +export default function _includesWith(pred, x, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (pred(x, list[idx])) { + return true; + } + + idx += 1; + } + + return false; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_indexOf.js b/node_modules/ramda/es/internal/_indexOf.js new file mode 100644 index 0000000..80305d4 --- /dev/null +++ b/node_modules/ramda/es/internal/_indexOf.js @@ -0,0 +1,67 @@ +import equals from "../equals.js"; +export default function _indexOf(list, a, idx) { + var inf, item; // Array.prototype.indexOf doesn't exist below IE9 + + if (typeof list.indexOf === 'function') { + switch (typeof a) { + case 'number': + if (a === 0) { + // manually crawl the list to distinguish between +0 and -0 + inf = 1 / a; + + while (idx < list.length) { + item = list[idx]; + + if (item === 0 && 1 / item === inf) { + return idx; + } + + idx += 1; + } + + return -1; + } else if (a !== a) { + // NaN + while (idx < list.length) { + item = list[idx]; + + if (typeof item === 'number' && item !== item) { + return idx; + } + + idx += 1; + } + + return -1; + } // non-zero numbers can utilise Set + + + return list.indexOf(a, idx); + // all these types can utilise Set + + case 'string': + case 'boolean': + case 'function': + case 'undefined': + return list.indexOf(a, idx); + + case 'object': + if (a === null) { + // null can utilise Set + return list.indexOf(a, idx); + } + + } + } // anything else not covered above, defer to R.equals + + + while (idx < list.length) { + if (equals(list[idx], a)) { + return idx; + } + + idx += 1; + } + + return -1; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isArguments.js b/node_modules/ramda/es/internal/_isArguments.js new file mode 100644 index 0000000..15df0be --- /dev/null +++ b/node_modules/ramda/es/internal/_isArguments.js @@ -0,0 +1,14 @@ +import _has from "./_has.js"; +var toString = Object.prototype.toString; + +var _isArguments = +/*#__PURE__*/ +function () { + return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) { + return toString.call(x) === '[object Arguments]'; + } : function _isArguments(x) { + return _has('callee', x); + }; +}(); + +export default _isArguments; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isArray.js b/node_modules/ramda/es/internal/_isArray.js new file mode 100644 index 0000000..762faf2 --- /dev/null +++ b/node_modules/ramda/es/internal/_isArray.js @@ -0,0 +1,15 @@ +/** + * Tests whether or not an object is an array. + * + * @private + * @param {*} val The object to test. + * @return {Boolean} `true` if `val` is an array, `false` otherwise. + * @example + * + * _isArray([]); //=> true + * _isArray(null); //=> false + * _isArray({}); //=> false + */ +export default Array.isArray || function _isArray(val) { + return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]'; +}; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isArrayLike.js b/node_modules/ramda/es/internal/_isArrayLike.js new file mode 100644 index 0000000..d2ce956 --- /dev/null +++ b/node_modules/ramda/es/internal/_isArrayLike.js @@ -0,0 +1,56 @@ +import _curry1 from "./_curry1.js"; +import _isArray from "./_isArray.js"; +import _isString from "./_isString.js"; +/** + * Tests whether or not an object is similar to an array. + * + * @private + * @category Type + * @category List + * @sig * -> Boolean + * @param {*} x The object to test. + * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. + * @example + * + * _isArrayLike([]); //=> true + * _isArrayLike(true); //=> false + * _isArrayLike({}); //=> false + * _isArrayLike({length: 10}); //=> false + * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true + */ + +var _isArrayLike = +/*#__PURE__*/ +_curry1(function isArrayLike(x) { + if (_isArray(x)) { + return true; + } + + if (!x) { + return false; + } + + if (typeof x !== 'object') { + return false; + } + + if (_isString(x)) { + return false; + } + + if (x.nodeType === 1) { + return !!x.length; + } + + if (x.length === 0) { + return true; + } + + if (x.length > 0) { + return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); + } + + return false; +}); + +export default _isArrayLike; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isFunction.js b/node_modules/ramda/es/internal/_isFunction.js new file mode 100644 index 0000000..de7c232 --- /dev/null +++ b/node_modules/ramda/es/internal/_isFunction.js @@ -0,0 +1,4 @@ +export default function _isFunction(x) { + var type = Object.prototype.toString.call(x); + return type === '[object Function]' || type === '[object AsyncFunction]' || type === '[object GeneratorFunction]' || type === '[object AsyncGeneratorFunction]'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isInteger.js b/node_modules/ramda/es/internal/_isInteger.js new file mode 100644 index 0000000..64cbfc6 --- /dev/null +++ b/node_modules/ramda/es/internal/_isInteger.js @@ -0,0 +1,11 @@ +/** + * Determine if the passed argument is an integer. + * + * @private + * @param {*} n + * @category Type + * @return {Boolean} + */ +export default Number.isInteger || function _isInteger(n) { + return n << 0 === n; +}; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isNumber.js b/node_modules/ramda/es/internal/_isNumber.js new file mode 100644 index 0000000..9dc1df2 --- /dev/null +++ b/node_modules/ramda/es/internal/_isNumber.js @@ -0,0 +1,3 @@ +export default function _isNumber(x) { + return Object.prototype.toString.call(x) === '[object Number]'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isObject.js b/node_modules/ramda/es/internal/_isObject.js new file mode 100644 index 0000000..b85dc15 --- /dev/null +++ b/node_modules/ramda/es/internal/_isObject.js @@ -0,0 +1,3 @@ +export default function _isObject(x) { + return Object.prototype.toString.call(x) === '[object Object]'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isPlaceholder.js b/node_modules/ramda/es/internal/_isPlaceholder.js new file mode 100644 index 0000000..23e63cc --- /dev/null +++ b/node_modules/ramda/es/internal/_isPlaceholder.js @@ -0,0 +1,3 @@ +export default function _isPlaceholder(a) { + return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isRegExp.js b/node_modules/ramda/es/internal/_isRegExp.js new file mode 100644 index 0000000..07e7e1e --- /dev/null +++ b/node_modules/ramda/es/internal/_isRegExp.js @@ -0,0 +1,3 @@ +export default function _isRegExp(x) { + return Object.prototype.toString.call(x) === '[object RegExp]'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isString.js b/node_modules/ramda/es/internal/_isString.js new file mode 100644 index 0000000..a5985ee --- /dev/null +++ b/node_modules/ramda/es/internal/_isString.js @@ -0,0 +1,3 @@ +export default function _isString(x) { + return Object.prototype.toString.call(x) === '[object String]'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_isTransformer.js b/node_modules/ramda/es/internal/_isTransformer.js new file mode 100644 index 0000000..cc3ceeb --- /dev/null +++ b/node_modules/ramda/es/internal/_isTransformer.js @@ -0,0 +1,3 @@ +export default function _isTransformer(obj) { + return obj != null && typeof obj['@@transducer/step'] === 'function'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_makeFlat.js b/node_modules/ramda/es/internal/_makeFlat.js new file mode 100644 index 0000000..aff90d3 --- /dev/null +++ b/node_modules/ramda/es/internal/_makeFlat.js @@ -0,0 +1,35 @@ +import _isArrayLike from "./_isArrayLike.js"; +/** + * `_makeFlat` is a helper function that returns a one-level or fully recursive + * function based on the flag passed in. + * + * @private + */ + +export default function _makeFlat(recursive) { + return function flatt(list) { + var value, jlen, j; + var result = []; + var idx = 0; + var ilen = list.length; + + while (idx < ilen) { + if (_isArrayLike(list[idx])) { + value = recursive ? flatt(list[idx]) : list[idx]; + j = 0; + jlen = value.length; + + while (j < jlen) { + result[result.length] = value[j]; + j += 1; + } + } else { + result[result.length] = list[idx]; + } + + idx += 1; + } + + return result; + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_map.js b/node_modules/ramda/es/internal/_map.js new file mode 100644 index 0000000..ad4fc01 --- /dev/null +++ b/node_modules/ramda/es/internal/_map.js @@ -0,0 +1,12 @@ +export default function _map(fn, functor) { + var idx = 0; + var len = functor.length; + var result = Array(len); + + while (idx < len) { + result[idx] = fn(functor[idx]); + idx += 1; + } + + return result; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_objectAssign.js b/node_modules/ramda/es/internal/_objectAssign.js new file mode 100644 index 0000000..324aafd --- /dev/null +++ b/node_modules/ramda/es/internal/_objectAssign.js @@ -0,0 +1,29 @@ +import _has from "./_has.js"; // Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + +function _objectAssign(target) { + if (target == null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + var idx = 1; + var length = arguments.length; + + while (idx < length) { + var source = arguments[idx]; + + if (source != null) { + for (var nextKey in source) { + if (_has(nextKey, source)) { + output[nextKey] = source[nextKey]; + } + } + } + + idx += 1; + } + + return output; +} + +export default typeof Object.assign === 'function' ? Object.assign : _objectAssign; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_objectIs.js b/node_modules/ramda/es/internal/_objectIs.js new file mode 100644 index 0000000..6167f8e --- /dev/null +++ b/node_modules/ramda/es/internal/_objectIs.js @@ -0,0 +1,14 @@ +// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is +function _objectIs(a, b) { + // SameValue algorithm + if (a === b) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return a !== 0 || 1 / a === 1 / b; + } else { + // Step 6.a: NaN == NaN + return a !== a && b !== b; + } +} + +export default typeof Object.is === 'function' ? Object.is : _objectIs; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_of.js b/node_modules/ramda/es/internal/_of.js new file mode 100644 index 0000000..68ea63a --- /dev/null +++ b/node_modules/ramda/es/internal/_of.js @@ -0,0 +1,3 @@ +export default function _of(x) { + return [x]; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_pipe.js b/node_modules/ramda/es/internal/_pipe.js new file mode 100644 index 0000000..01fb777 --- /dev/null +++ b/node_modules/ramda/es/internal/_pipe.js @@ -0,0 +1,5 @@ +export default function _pipe(f, g) { + return function () { + return g.call(this, f.apply(this, arguments)); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_pipeP.js b/node_modules/ramda/es/internal/_pipeP.js new file mode 100644 index 0000000..a624764 --- /dev/null +++ b/node_modules/ramda/es/internal/_pipeP.js @@ -0,0 +1,8 @@ +export default function _pipeP(f, g) { + return function () { + var ctx = this; + return f.apply(ctx, arguments).then(function (x) { + return g.call(ctx, x); + }); + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_quote.js b/node_modules/ramda/es/internal/_quote.js new file mode 100644 index 0000000..a7fd4d9 --- /dev/null +++ b/node_modules/ramda/es/internal/_quote.js @@ -0,0 +1,5 @@ +export default function _quote(s) { + var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace + .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0'); + return '"' + escaped.replace(/"/g, '\\"') + '"'; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_reduce.js b/node_modules/ramda/es/internal/_reduce.js new file mode 100644 index 0000000..f173326 --- /dev/null +++ b/node_modules/ramda/es/internal/_reduce.js @@ -0,0 +1,71 @@ +import _isArrayLike from "./_isArrayLike.js"; +import _xwrap from "./_xwrap.js"; +import bind from "../bind.js"; + +function _arrayReduce(xf, acc, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + acc = xf['@@transducer/step'](acc, list[idx]); + + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + + idx += 1; + } + + return xf['@@transducer/result'](acc); +} + +function _iterableReduce(xf, acc, iter) { + var step = iter.next(); + + while (!step.done) { + acc = xf['@@transducer/step'](acc, step.value); + + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + + step = iter.next(); + } + + return xf['@@transducer/result'](acc); +} + +function _methodReduce(xf, acc, obj, methodName) { + return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc)); +} + +var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator'; +export default function _reduce(fn, acc, list) { + if (typeof fn === 'function') { + fn = _xwrap(fn); + } + + if (_isArrayLike(list)) { + return _arrayReduce(fn, acc, list); + } + + if (typeof list['fantasy-land/reduce'] === 'function') { + return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); + } + + if (list[symIterator] != null) { + return _iterableReduce(fn, acc, list[symIterator]()); + } + + if (typeof list.next === 'function') { + return _iterableReduce(fn, acc, list); + } + + if (typeof list.reduce === 'function') { + return _methodReduce(fn, acc, list, 'reduce'); + } + + throw new TypeError('reduce: list must be array or iterable'); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_reduced.js b/node_modules/ramda/es/internal/_reduced.js new file mode 100644 index 0000000..0f065cc --- /dev/null +++ b/node_modules/ramda/es/internal/_reduced.js @@ -0,0 +1,6 @@ +export default function _reduced(x) { + return x && x['@@transducer/reduced'] ? x : { + '@@transducer/value': x, + '@@transducer/reduced': true + }; +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_stepCat.js b/node_modules/ramda/es/internal/_stepCat.js new file mode 100644 index 0000000..a67c030 --- /dev/null +++ b/node_modules/ramda/es/internal/_stepCat.js @@ -0,0 +1,46 @@ +import _objectAssign from "./_objectAssign.js"; +import _identity from "./_identity.js"; +import _isArrayLike from "./_isArrayLike.js"; +import _isTransformer from "./_isTransformer.js"; +import objOf from "../objOf.js"; +var _stepCatArray = { + '@@transducer/init': Array, + '@@transducer/step': function (xs, x) { + xs.push(x); + return xs; + }, + '@@transducer/result': _identity +}; +var _stepCatString = { + '@@transducer/init': String, + '@@transducer/step': function (a, b) { + return a + b; + }, + '@@transducer/result': _identity +}; +var _stepCatObject = { + '@@transducer/init': Object, + '@@transducer/step': function (result, input) { + return _objectAssign(result, _isArrayLike(input) ? objOf(input[0], input[1]) : input); + }, + '@@transducer/result': _identity +}; +export default function _stepCat(obj) { + if (_isTransformer(obj)) { + return obj; + } + + if (_isArrayLike(obj)) { + return _stepCatArray; + } + + if (typeof obj === 'string') { + return _stepCatString; + } + + if (typeof obj === 'object') { + return _stepCatObject; + } + + throw new Error('Cannot create transformer for ' + obj); +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_toISOString.js b/node_modules/ramda/es/internal/_toISOString.js new file mode 100644 index 0000000..dbd8119 --- /dev/null +++ b/node_modules/ramda/es/internal/_toISOString.js @@ -0,0 +1,14 @@ +/** + * Polyfill from . + */ +var pad = function pad(n) { + return (n < 10 ? '0' : '') + n; +}; + +var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) { + return d.toISOString(); +} : function _toISOString(d) { + return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; +}; + +export default _toISOString; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_toString.js b/node_modules/ramda/es/internal/_toString.js new file mode 100644 index 0000000..c14c39c --- /dev/null +++ b/node_modules/ramda/es/internal/_toString.js @@ -0,0 +1,58 @@ +import _includes from "./_includes.js"; +import _map from "./_map.js"; +import _quote from "./_quote.js"; +import _toISOString from "./_toISOString.js"; +import keys from "../keys.js"; +import reject from "../reject.js"; +export default function _toString(x, seen) { + var recur = function recur(y) { + var xs = seen.concat([x]); + return _includes(y, xs) ? '' : _toString(y, xs); + }; // mapPairs :: (Object, [String]) -> [String] + + + var mapPairs = function (obj, keys) { + return _map(function (k) { + return _quote(k) + ': ' + recur(obj[k]); + }, keys.slice().sort()); + }; + + switch (Object.prototype.toString.call(x)) { + case '[object Arguments]': + return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))'; + + case '[object Array]': + return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) { + return /^\d+$/.test(k); + }, keys(x)))).join(', ') + ']'; + + case '[object Boolean]': + return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); + + case '[object Date]': + return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')'; + + case '[object Null]': + return 'null'; + + case '[object Number]': + return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); + + case '[object String]': + return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); + + case '[object Undefined]': + return 'undefined'; + + default: + if (typeof x.toString === 'function') { + var repr = x.toString(); + + if (repr !== '[object Object]') { + return repr; + } + } + + return '{' + mapPairs(x, keys(x)).join(', ') + '}'; + } +} \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xall.js b/node_modules/ramda/es/internal/_xall.js new file mode 100644 index 0000000..69c367a --- /dev/null +++ b/node_modules/ramda/es/internal/_xall.js @@ -0,0 +1,42 @@ +import _curry2 from "./_curry2.js"; +import _reduced from "./_reduced.js"; +import _xfBase from "./_xfBase.js"; + +var XAll = +/*#__PURE__*/ +function () { + function XAll(f, xf) { + this.xf = xf; + this.f = f; + this.all = true; + } + + XAll.prototype['@@transducer/init'] = _xfBase.init; + + XAll.prototype['@@transducer/result'] = function (result) { + if (this.all) { + result = this.xf['@@transducer/step'](result, true); + } + + return this.xf['@@transducer/result'](result); + }; + + XAll.prototype['@@transducer/step'] = function (result, input) { + if (!this.f(input)) { + this.all = false; + result = _reduced(this.xf['@@transducer/step'](result, false)); + } + + return result; + }; + + return XAll; +}(); + +var _xall = +/*#__PURE__*/ +_curry2(function _xall(f, xf) { + return new XAll(f, xf); +}); + +export default _xall; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xany.js b/node_modules/ramda/es/internal/_xany.js new file mode 100644 index 0000000..36f9bb8 --- /dev/null +++ b/node_modules/ramda/es/internal/_xany.js @@ -0,0 +1,42 @@ +import _curry2 from "./_curry2.js"; +import _reduced from "./_reduced.js"; +import _xfBase from "./_xfBase.js"; + +var XAny = +/*#__PURE__*/ +function () { + function XAny(f, xf) { + this.xf = xf; + this.f = f; + this.any = false; + } + + XAny.prototype['@@transducer/init'] = _xfBase.init; + + XAny.prototype['@@transducer/result'] = function (result) { + if (!this.any) { + result = this.xf['@@transducer/step'](result, false); + } + + return this.xf['@@transducer/result'](result); + }; + + XAny.prototype['@@transducer/step'] = function (result, input) { + if (this.f(input)) { + this.any = true; + result = _reduced(this.xf['@@transducer/step'](result, true)); + } + + return result; + }; + + return XAny; +}(); + +var _xany = +/*#__PURE__*/ +_curry2(function _xany(f, xf) { + return new XAny(f, xf); +}); + +export default _xany; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xaperture.js b/node_modules/ramda/es/internal/_xaperture.js new file mode 100644 index 0000000..32718dd --- /dev/null +++ b/node_modules/ramda/es/internal/_xaperture.js @@ -0,0 +1,50 @@ +import _concat from "./_concat.js"; +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XAperture = +/*#__PURE__*/ +function () { + function XAperture(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + + XAperture.prototype['@@transducer/init'] = _xfBase.init; + + XAperture.prototype['@@transducer/result'] = function (result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + + XAperture.prototype['@@transducer/step'] = function (result, input) { + this.store(input); + return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result; + }; + + XAperture.prototype.store = function (input) { + this.acc[this.pos] = input; + this.pos += 1; + + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + + XAperture.prototype.getCopy = function () { + return _concat(Array.prototype.slice.call(this.acc, this.pos), Array.prototype.slice.call(this.acc, 0, this.pos)); + }; + + return XAperture; +}(); + +var _xaperture = +/*#__PURE__*/ +_curry2(function _xaperture(n, xf) { + return new XAperture(n, xf); +}); + +export default _xaperture; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xchain.js b/node_modules/ramda/es/internal/_xchain.js new file mode 100644 index 0000000..0903e48 --- /dev/null +++ b/node_modules/ramda/es/internal/_xchain.js @@ -0,0 +1,11 @@ +import _curry2 from "./_curry2.js"; +import _flatCat from "./_flatCat.js"; +import map from "../map.js"; + +var _xchain = +/*#__PURE__*/ +_curry2(function _xchain(f, xf) { + return map(f, _flatCat(xf)); +}); + +export default _xchain; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xdrop.js b/node_modules/ramda/es/internal/_xdrop.js new file mode 100644 index 0000000..f21a9e1 --- /dev/null +++ b/node_modules/ramda/es/internal/_xdrop.js @@ -0,0 +1,33 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XDrop = +/*#__PURE__*/ +function () { + function XDrop(n, xf) { + this.xf = xf; + this.n = n; + } + + XDrop.prototype['@@transducer/init'] = _xfBase.init; + XDrop.prototype['@@transducer/result'] = _xfBase.result; + + XDrop.prototype['@@transducer/step'] = function (result, input) { + if (this.n > 0) { + this.n -= 1; + return result; + } + + return this.xf['@@transducer/step'](result, input); + }; + + return XDrop; +}(); + +var _xdrop = +/*#__PURE__*/ +_curry2(function _xdrop(n, xf) { + return new XDrop(n, xf); +}); + +export default _xdrop; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xdropLast.js b/node_modules/ramda/es/internal/_xdropLast.js new file mode 100644 index 0000000..40ab8ef --- /dev/null +++ b/node_modules/ramda/es/internal/_xdropLast.js @@ -0,0 +1,49 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XDropLast = +/*#__PURE__*/ +function () { + function XDropLast(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + + XDropLast.prototype['@@transducer/init'] = _xfBase.init; + + XDropLast.prototype['@@transducer/result'] = function (result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + + XDropLast.prototype['@@transducer/step'] = function (result, input) { + if (this.full) { + result = this.xf['@@transducer/step'](result, this.acc[this.pos]); + } + + this.store(input); + return result; + }; + + XDropLast.prototype.store = function (input) { + this.acc[this.pos] = input; + this.pos += 1; + + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + + return XDropLast; +}(); + +var _xdropLast = +/*#__PURE__*/ +_curry2(function _xdropLast(n, xf) { + return new XDropLast(n, xf); +}); + +export default _xdropLast; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xdropLastWhile.js b/node_modules/ramda/es/internal/_xdropLastWhile.js new file mode 100644 index 0000000..5ec0b5b --- /dev/null +++ b/node_modules/ramda/es/internal/_xdropLastWhile.js @@ -0,0 +1,45 @@ +import _curry2 from "./_curry2.js"; +import _reduce from "./_reduce.js"; +import _xfBase from "./_xfBase.js"; + +var XDropLastWhile = +/*#__PURE__*/ +function () { + function XDropLastWhile(fn, xf) { + this.f = fn; + this.retained = []; + this.xf = xf; + } + + XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init; + + XDropLastWhile.prototype['@@transducer/result'] = function (result) { + this.retained = null; + return this.xf['@@transducer/result'](result); + }; + + XDropLastWhile.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.retain(result, input) : this.flush(result, input); + }; + + XDropLastWhile.prototype.flush = function (result, input) { + result = _reduce(this.xf['@@transducer/step'], result, this.retained); + this.retained = []; + return this.xf['@@transducer/step'](result, input); + }; + + XDropLastWhile.prototype.retain = function (result, input) { + this.retained.push(input); + return result; + }; + + return XDropLastWhile; +}(); + +var _xdropLastWhile = +/*#__PURE__*/ +_curry2(function _xdropLastWhile(fn, xf) { + return new XDropLastWhile(fn, xf); +}); + +export default _xdropLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xdropRepeatsWith.js b/node_modules/ramda/es/internal/_xdropRepeatsWith.js new file mode 100644 index 0000000..bc86bda --- /dev/null +++ b/node_modules/ramda/es/internal/_xdropRepeatsWith.js @@ -0,0 +1,39 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XDropRepeatsWith = +/*#__PURE__*/ +function () { + function XDropRepeatsWith(pred, xf) { + this.xf = xf; + this.pred = pred; + this.lastValue = undefined; + this.seenFirstValue = false; + } + + XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; + XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; + + XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) { + var sameAsLast = false; + + if (!this.seenFirstValue) { + this.seenFirstValue = true; + } else if (this.pred(this.lastValue, input)) { + sameAsLast = true; + } + + this.lastValue = input; + return sameAsLast ? result : this.xf['@@transducer/step'](result, input); + }; + + return XDropRepeatsWith; +}(); + +var _xdropRepeatsWith = +/*#__PURE__*/ +_curry2(function _xdropRepeatsWith(pred, xf) { + return new XDropRepeatsWith(pred, xf); +}); + +export default _xdropRepeatsWith; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xdropWhile.js b/node_modules/ramda/es/internal/_xdropWhile.js new file mode 100644 index 0000000..ee65fd9 --- /dev/null +++ b/node_modules/ramda/es/internal/_xdropWhile.js @@ -0,0 +1,36 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XDropWhile = +/*#__PURE__*/ +function () { + function XDropWhile(f, xf) { + this.xf = xf; + this.f = f; + } + + XDropWhile.prototype['@@transducer/init'] = _xfBase.init; + XDropWhile.prototype['@@transducer/result'] = _xfBase.result; + + XDropWhile.prototype['@@transducer/step'] = function (result, input) { + if (this.f) { + if (this.f(input)) { + return result; + } + + this.f = null; + } + + return this.xf['@@transducer/step'](result, input); + }; + + return XDropWhile; +}(); + +var _xdropWhile = +/*#__PURE__*/ +_curry2(function _xdropWhile(f, xf) { + return new XDropWhile(f, xf); +}); + +export default _xdropWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xfBase.js b/node_modules/ramda/es/internal/_xfBase.js new file mode 100644 index 0000000..97f6e2e --- /dev/null +++ b/node_modules/ramda/es/internal/_xfBase.js @@ -0,0 +1,8 @@ +export default { + init: function () { + return this.xf['@@transducer/init'](); + }, + result: function (result) { + return this.xf['@@transducer/result'](result); + } +}; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xfilter.js b/node_modules/ramda/es/internal/_xfilter.js new file mode 100644 index 0000000..5c3449e --- /dev/null +++ b/node_modules/ramda/es/internal/_xfilter.js @@ -0,0 +1,28 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XFilter = +/*#__PURE__*/ +function () { + function XFilter(f, xf) { + this.xf = xf; + this.f = f; + } + + XFilter.prototype['@@transducer/init'] = _xfBase.init; + XFilter.prototype['@@transducer/result'] = _xfBase.result; + + XFilter.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; + }; + + return XFilter; +}(); + +var _xfilter = +/*#__PURE__*/ +_curry2(function _xfilter(f, xf) { + return new XFilter(f, xf); +}); + +export default _xfilter; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xfind.js b/node_modules/ramda/es/internal/_xfind.js new file mode 100644 index 0000000..af5a84c --- /dev/null +++ b/node_modules/ramda/es/internal/_xfind.js @@ -0,0 +1,42 @@ +import _curry2 from "./_curry2.js"; +import _reduced from "./_reduced.js"; +import _xfBase from "./_xfBase.js"; + +var XFind = +/*#__PURE__*/ +function () { + function XFind(f, xf) { + this.xf = xf; + this.f = f; + this.found = false; + } + + XFind.prototype['@@transducer/init'] = _xfBase.init; + + XFind.prototype['@@transducer/result'] = function (result) { + if (!this.found) { + result = this.xf['@@transducer/step'](result, void 0); + } + + return this.xf['@@transducer/result'](result); + }; + + XFind.prototype['@@transducer/step'] = function (result, input) { + if (this.f(input)) { + this.found = true; + result = _reduced(this.xf['@@transducer/step'](result, input)); + } + + return result; + }; + + return XFind; +}(); + +var _xfind = +/*#__PURE__*/ +_curry2(function _xfind(f, xf) { + return new XFind(f, xf); +}); + +export default _xfind; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xfindIndex.js b/node_modules/ramda/es/internal/_xfindIndex.js new file mode 100644 index 0000000..21fca61 --- /dev/null +++ b/node_modules/ramda/es/internal/_xfindIndex.js @@ -0,0 +1,45 @@ +import _curry2 from "./_curry2.js"; +import _reduced from "./_reduced.js"; +import _xfBase from "./_xfBase.js"; + +var XFindIndex = +/*#__PURE__*/ +function () { + function XFindIndex(f, xf) { + this.xf = xf; + this.f = f; + this.idx = -1; + this.found = false; + } + + XFindIndex.prototype['@@transducer/init'] = _xfBase.init; + + XFindIndex.prototype['@@transducer/result'] = function (result) { + if (!this.found) { + result = this.xf['@@transducer/step'](result, -1); + } + + return this.xf['@@transducer/result'](result); + }; + + XFindIndex.prototype['@@transducer/step'] = function (result, input) { + this.idx += 1; + + if (this.f(input)) { + this.found = true; + result = _reduced(this.xf['@@transducer/step'](result, this.idx)); + } + + return result; + }; + + return XFindIndex; +}(); + +var _xfindIndex = +/*#__PURE__*/ +_curry2(function _xfindIndex(f, xf) { + return new XFindIndex(f, xf); +}); + +export default _xfindIndex; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xfindLast.js b/node_modules/ramda/es/internal/_xfindLast.js new file mode 100644 index 0000000..5be0240 --- /dev/null +++ b/node_modules/ramda/es/internal/_xfindLast.js @@ -0,0 +1,35 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XFindLast = +/*#__PURE__*/ +function () { + function XFindLast(f, xf) { + this.xf = xf; + this.f = f; + } + + XFindLast.prototype['@@transducer/init'] = _xfBase.init; + + XFindLast.prototype['@@transducer/result'] = function (result) { + return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last)); + }; + + XFindLast.prototype['@@transducer/step'] = function (result, input) { + if (this.f(input)) { + this.last = input; + } + + return result; + }; + + return XFindLast; +}(); + +var _xfindLast = +/*#__PURE__*/ +_curry2(function _xfindLast(f, xf) { + return new XFindLast(f, xf); +}); + +export default _xfindLast; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xfindLastIndex.js b/node_modules/ramda/es/internal/_xfindLastIndex.js new file mode 100644 index 0000000..e82fcb9 --- /dev/null +++ b/node_modules/ramda/es/internal/_xfindLastIndex.js @@ -0,0 +1,39 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XFindLastIndex = +/*#__PURE__*/ +function () { + function XFindLastIndex(f, xf) { + this.xf = xf; + this.f = f; + this.idx = -1; + this.lastIdx = -1; + } + + XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init; + + XFindLastIndex.prototype['@@transducer/result'] = function (result) { + return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx)); + }; + + XFindLastIndex.prototype['@@transducer/step'] = function (result, input) { + this.idx += 1; + + if (this.f(input)) { + this.lastIdx = this.idx; + } + + return result; + }; + + return XFindLastIndex; +}(); + +var _xfindLastIndex = +/*#__PURE__*/ +_curry2(function _xfindLastIndex(f, xf) { + return new XFindLastIndex(f, xf); +}); + +export default _xfindLastIndex; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xmap.js b/node_modules/ramda/es/internal/_xmap.js new file mode 100644 index 0000000..b41ec32 --- /dev/null +++ b/node_modules/ramda/es/internal/_xmap.js @@ -0,0 +1,28 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XMap = +/*#__PURE__*/ +function () { + function XMap(f, xf) { + this.xf = xf; + this.f = f; + } + + XMap.prototype['@@transducer/init'] = _xfBase.init; + XMap.prototype['@@transducer/result'] = _xfBase.result; + + XMap.prototype['@@transducer/step'] = function (result, input) { + return this.xf['@@transducer/step'](result, this.f(input)); + }; + + return XMap; +}(); + +var _xmap = +/*#__PURE__*/ +_curry2(function _xmap(f, xf) { + return new XMap(f, xf); +}); + +export default _xmap; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xreduceBy.js b/node_modules/ramda/es/internal/_xreduceBy.js new file mode 100644 index 0000000..bacfdb2 --- /dev/null +++ b/node_modules/ramda/es/internal/_xreduceBy.js @@ -0,0 +1,52 @@ +import _curryN from "./_curryN.js"; +import _has from "./_has.js"; +import _xfBase from "./_xfBase.js"; + +var XReduceBy = +/*#__PURE__*/ +function () { + function XReduceBy(valueFn, valueAcc, keyFn, xf) { + this.valueFn = valueFn; + this.valueAcc = valueAcc; + this.keyFn = keyFn; + this.xf = xf; + this.inputs = {}; + } + + XReduceBy.prototype['@@transducer/init'] = _xfBase.init; + + XReduceBy.prototype['@@transducer/result'] = function (result) { + var key; + + for (key in this.inputs) { + if (_has(key, this.inputs)) { + result = this.xf['@@transducer/step'](result, this.inputs[key]); + + if (result['@@transducer/reduced']) { + result = result['@@transducer/value']; + break; + } + } + } + + this.inputs = null; + return this.xf['@@transducer/result'](result); + }; + + XReduceBy.prototype['@@transducer/step'] = function (result, input) { + var key = this.keyFn(input); + this.inputs[key] = this.inputs[key] || [key, this.valueAcc]; + this.inputs[key][1] = this.valueFn(this.inputs[key][1], input); + return result; + }; + + return XReduceBy; +}(); + +var _xreduceBy = +/*#__PURE__*/ +_curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) { + return new XReduceBy(valueFn, valueAcc, keyFn, xf); +}); + +export default _xreduceBy; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xtake.js b/node_modules/ramda/es/internal/_xtake.js new file mode 100644 index 0000000..0495669 --- /dev/null +++ b/node_modules/ramda/es/internal/_xtake.js @@ -0,0 +1,32 @@ +import _curry2 from "./_curry2.js"; +import _reduced from "./_reduced.js"; +import _xfBase from "./_xfBase.js"; + +var XTake = +/*#__PURE__*/ +function () { + function XTake(n, xf) { + this.xf = xf; + this.n = n; + this.i = 0; + } + + XTake.prototype['@@transducer/init'] = _xfBase.init; + XTake.prototype['@@transducer/result'] = _xfBase.result; + + XTake.prototype['@@transducer/step'] = function (result, input) { + this.i += 1; + var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input); + return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret; + }; + + return XTake; +}(); + +var _xtake = +/*#__PURE__*/ +_curry2(function _xtake(n, xf) { + return new XTake(n, xf); +}); + +export default _xtake; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xtakeWhile.js b/node_modules/ramda/es/internal/_xtakeWhile.js new file mode 100644 index 0000000..1ee8fa1 --- /dev/null +++ b/node_modules/ramda/es/internal/_xtakeWhile.js @@ -0,0 +1,29 @@ +import _curry2 from "./_curry2.js"; +import _reduced from "./_reduced.js"; +import _xfBase from "./_xfBase.js"; + +var XTakeWhile = +/*#__PURE__*/ +function () { + function XTakeWhile(f, xf) { + this.xf = xf; + this.f = f; + } + + XTakeWhile.prototype['@@transducer/init'] = _xfBase.init; + XTakeWhile.prototype['@@transducer/result'] = _xfBase.result; + + XTakeWhile.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result); + }; + + return XTakeWhile; +}(); + +var _xtakeWhile = +/*#__PURE__*/ +_curry2(function _xtakeWhile(f, xf) { + return new XTakeWhile(f, xf); +}); + +export default _xtakeWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xtap.js b/node_modules/ramda/es/internal/_xtap.js new file mode 100644 index 0000000..a0e733c --- /dev/null +++ b/node_modules/ramda/es/internal/_xtap.js @@ -0,0 +1,29 @@ +import _curry2 from "./_curry2.js"; +import _xfBase from "./_xfBase.js"; + +var XTap = +/*#__PURE__*/ +function () { + function XTap(f, xf) { + this.xf = xf; + this.f = f; + } + + XTap.prototype['@@transducer/init'] = _xfBase.init; + XTap.prototype['@@transducer/result'] = _xfBase.result; + + XTap.prototype['@@transducer/step'] = function (result, input) { + this.f(input); + return this.xf['@@transducer/step'](result, input); + }; + + return XTap; +}(); + +var _xtap = +/*#__PURE__*/ +_curry2(function _xtap(f, xf) { + return new XTap(f, xf); +}); + +export default _xtap; \ No newline at end of file diff --git a/node_modules/ramda/es/internal/_xwrap.js b/node_modules/ramda/es/internal/_xwrap.js new file mode 100644 index 0000000..ab1e8d5 --- /dev/null +++ b/node_modules/ramda/es/internal/_xwrap.js @@ -0,0 +1,25 @@ +var XWrap = +/*#__PURE__*/ +function () { + function XWrap(fn) { + this.f = fn; + } + + XWrap.prototype['@@transducer/init'] = function () { + throw new Error('init not implemented on XWrap'); + }; + + XWrap.prototype['@@transducer/result'] = function (acc) { + return acc; + }; + + XWrap.prototype['@@transducer/step'] = function (acc, x) { + return this.f(acc, x); + }; + + return XWrap; +}(); + +export default function _xwrap(fn) { + return new XWrap(fn); +} \ No newline at end of file diff --git a/node_modules/ramda/es/intersection.js b/node_modules/ramda/es/intersection.js new file mode 100644 index 0000000..667fc21 --- /dev/null +++ b/node_modules/ramda/es/intersection.js @@ -0,0 +1,40 @@ +import _includes from "./internal/_includes.js"; +import _curry2 from "./internal/_curry2.js"; +import _filter from "./internal/_filter.js"; +import flip from "./flip.js"; +import uniq from "./uniq.js"; +/** + * Combines two lists into a set (i.e. no duplicates) composed of those + * elements common to both lists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The list of elements found in both `list1` and `list2`. + * @see R.innerJoin + * @example + * + * R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3] + */ + +var intersection = +/*#__PURE__*/ +_curry2(function intersection(list1, list2) { + var lookupList, filteredList; + + if (list1.length > list2.length) { + lookupList = list1; + filteredList = list2; + } else { + lookupList = list2; + filteredList = list1; + } + + return uniq(_filter(flip(_includes)(lookupList), filteredList)); +}); + +export default intersection; \ No newline at end of file diff --git a/node_modules/ramda/es/intersperse.js b/node_modules/ramda/es/intersperse.js new file mode 100644 index 0000000..fc9db39 --- /dev/null +++ b/node_modules/ramda/es/intersperse.js @@ -0,0 +1,43 @@ +import _checkForMethod from "./internal/_checkForMethod.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Creates a new list with the separator interposed between elements. + * + * Dispatches to the `intersperse` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} separator The element to add to the list. + * @param {Array} list The list to be interposed. + * @return {Array} The new list. + * @example + * + * R.intersperse('a', ['b', 'n', 'n', 's']); //=> ['b', 'a', 'n', 'a', 'n', 'a', 's'] + */ + +var intersperse = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_checkForMethod('intersperse', function intersperse(separator, list) { + var out = []; + var idx = 0; + var length = list.length; + + while (idx < length) { + if (idx === length - 1) { + out.push(list[idx]); + } else { + out.push(list[idx], separator); + } + + idx += 1; + } + + return out; +})); + +export default intersperse; \ No newline at end of file diff --git a/node_modules/ramda/es/into.js b/node_modules/ramda/es/into.js new file mode 100644 index 0000000..1bb07bc --- /dev/null +++ b/node_modules/ramda/es/into.js @@ -0,0 +1,52 @@ +import _clone from "./internal/_clone.js"; +import _curry3 from "./internal/_curry3.js"; +import _isTransformer from "./internal/_isTransformer.js"; +import _reduce from "./internal/_reduce.js"; +import _stepCat from "./internal/_stepCat.js"; +/** + * Transforms the items of the list with the transducer and appends the + * transformed items to the accumulator using an appropriate iterator function + * based on the accumulator type. + * + * The accumulator can be an array, string, object or a transformer. Iterated + * items will be appended to arrays and concatenated to strings. Objects will + * be merged directly or 2-item arrays will be merged as key, value pairs. + * + * The accumulator can also be a transformer object that provides a 2-arity + * reducing iterator function, step, 0-arity initial value function, init, and + * 1-arity result extraction function result. The step function is used as the + * iterator function in reduce. The result function is used to convert the + * final accumulator into the return type and in most cases is R.identity. The + * init function is used to provide the initial accumulator. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the + * transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig a -> (b -> b) -> [c] -> a + * @param {*} acc The initial accumulator value. + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.transduce + * @example + * + * const numbers = [1, 2, 3, 4]; + * const transducer = R.compose(R.map(R.add(1)), R.take(2)); + * + * R.into([], transducer, numbers); //=> [2, 3] + * + * const intoArray = R.into([]); + * intoArray(transducer, numbers); //=> [2, 3] + */ + +var into = +/*#__PURE__*/ +_curry3(function into(acc, xf, list) { + return _isTransformer(acc) ? _reduce(xf(acc), acc['@@transducer/init'](), list) : _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list); +}); + +export default into; \ No newline at end of file diff --git a/node_modules/ramda/es/invert.js b/node_modules/ramda/es/invert.js new file mode 100644 index 0000000..99d5d1d --- /dev/null +++ b/node_modules/ramda/es/invert.js @@ -0,0 +1,46 @@ +import _curry1 from "./internal/_curry1.js"; +import _has from "./internal/_has.js"; +import keys from "./keys.js"; +/** + * Same as [`R.invertObj`](#invertObj), however this accounts for objects with + * duplicate values by putting the values into an array. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {s: x} -> {x: [ s, ... ]} + * @param {Object} obj The object or array to invert + * @return {Object} out A new object with keys in an array. + * @see R.invertObj + * @example + * + * const raceResultsByFirstName = { + * first: 'alice', + * second: 'jake', + * third: 'alice', + * }; + * R.invert(raceResultsByFirstName); + * //=> { 'alice': ['first', 'third'], 'jake':['second'] } + */ + +var invert = +/*#__PURE__*/ +_curry1(function invert(obj) { + var props = keys(obj); + var len = props.length; + var idx = 0; + var out = {}; + + while (idx < len) { + var key = props[idx]; + var val = obj[key]; + var list = _has(val, out) ? out[val] : out[val] = []; + list[list.length] = key; + idx += 1; + } + + return out; +}); + +export default invert; \ No newline at end of file diff --git a/node_modules/ramda/es/invertObj.js b/node_modules/ramda/es/invertObj.js new file mode 100644 index 0000000..1dd4a3e --- /dev/null +++ b/node_modules/ramda/es/invertObj.js @@ -0,0 +1,48 @@ +import _curry1 from "./internal/_curry1.js"; +import keys from "./keys.js"; +/** + * Returns a new object with the keys of the given object as values, and the + * values of the given object, which are coerced to strings, as keys. Note + * that the last key found is preferred when handling the same value. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {s: x} -> {x: s} + * @param {Object} obj The object or array to invert + * @return {Object} out A new object + * @see R.invert + * @example + * + * const raceResults = { + * first: 'alice', + * second: 'jake' + * }; + * R.invertObj(raceResults); + * //=> { 'alice': 'first', 'jake':'second' } + * + * // Alternatively: + * const raceResults = ['alice', 'jake']; + * R.invertObj(raceResults); + * //=> { 'alice': '0', 'jake':'1' } + */ + +var invertObj = +/*#__PURE__*/ +_curry1(function invertObj(obj) { + var props = keys(obj); + var len = props.length; + var idx = 0; + var out = {}; + + while (idx < len) { + var key = props[idx]; + out[obj[key]] = key; + idx += 1; + } + + return out; +}); + +export default invertObj; \ No newline at end of file diff --git a/node_modules/ramda/es/invoker.js b/node_modules/ramda/es/invoker.js new file mode 100644 index 0000000..f2eaf0b --- /dev/null +++ b/node_modules/ramda/es/invoker.js @@ -0,0 +1,54 @@ +import _curry2 from "./internal/_curry2.js"; +import _isFunction from "./internal/_isFunction.js"; +import curryN from "./curryN.js"; +import toString from "./toString.js"; +/** + * Turns a named method with a specified arity into a function that can be + * called directly supplied with arguments and a target object. + * + * The returned function is curried and accepts `arity + 1` parameters where + * the final parameter is the target object. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *) + * @param {Number} arity Number of arguments the returned function should take + * before the target object. + * @param {String} method Name of any of the target object's methods to call. + * @return {Function} A new curried function. + * @see R.construct + * @example + * + * const sliceFrom = R.invoker(1, 'slice'); + * sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm' + * const sliceFrom6 = R.invoker(2, 'slice')(6); + * sliceFrom6(8, 'abcdefghijklm'); //=> 'gh' + * + * const dog = { + * speak: async () => 'Woof!' + * }; + * const speak = R.invoker(0, 'speak'); + * speak(dog).then(console.log) //~> 'Woof!' + * + * @symb R.invoker(0, 'method')(o) = o['method']() + * @symb R.invoker(1, 'method')(a, o) = o['method'](a) + * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) + */ + +var invoker = +/*#__PURE__*/ +_curry2(function invoker(arity, method) { + return curryN(arity + 1, function () { + var target = arguments[arity]; + + if (target != null && _isFunction(target[method])) { + return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity)); + } + + throw new TypeError(toString(target) + ' does not have a method named "' + method + '"'); + }); +}); + +export default invoker; \ No newline at end of file diff --git a/node_modules/ramda/es/is.js b/node_modules/ramda/es/is.js new file mode 100644 index 0000000..96b0d59 --- /dev/null +++ b/node_modules/ramda/es/is.js @@ -0,0 +1,32 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * See if an object (`val`) is an instance of the supplied constructor. This + * function will check up the inheritance chain, if any. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Type + * @sig (* -> {*}) -> a -> Boolean + * @param {Object} ctor A constructor + * @param {*} val The value to test + * @return {Boolean} + * @example + * + * R.is(Object, {}); //=> true + * R.is(Number, 1); //=> true + * R.is(Object, 1); //=> false + * R.is(String, 's'); //=> true + * R.is(String, new String('')); //=> true + * R.is(Object, new String('')); //=> true + * R.is(Object, 's'); //=> false + * R.is(Number, {}); //=> false + */ + +var is = +/*#__PURE__*/ +_curry2(function is(Ctor, val) { + return val != null && val.constructor === Ctor || val instanceof Ctor; +}); + +export default is; \ No newline at end of file diff --git a/node_modules/ramda/es/isEmpty.js b/node_modules/ramda/es/isEmpty.js new file mode 100644 index 0000000..d53e0dc --- /dev/null +++ b/node_modules/ramda/es/isEmpty.js @@ -0,0 +1,32 @@ +import _curry1 from "./internal/_curry1.js"; +import empty from "./empty.js"; +import equals from "./equals.js"; +/** + * Returns `true` if the given value is its type's empty value; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> Boolean + * @param {*} x + * @return {Boolean} + * @see R.empty + * @example + * + * R.isEmpty([1, 2, 3]); //=> false + * R.isEmpty([]); //=> true + * R.isEmpty(''); //=> true + * R.isEmpty(null); //=> false + * R.isEmpty({}); //=> true + * R.isEmpty({length: 0}); //=> false + */ + +var isEmpty = +/*#__PURE__*/ +_curry1(function isEmpty(x) { + return x != null && equals(x, empty(x)); +}); + +export default isEmpty; \ No newline at end of file diff --git a/node_modules/ramda/es/isNil.js b/node_modules/ramda/es/isNil.js new file mode 100644 index 0000000..e3ffaa3 --- /dev/null +++ b/node_modules/ramda/es/isNil.js @@ -0,0 +1,26 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Checks if the input value is `null` or `undefined`. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Type + * @sig * -> Boolean + * @param {*} x The value to test. + * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`. + * @example + * + * R.isNil(null); //=> true + * R.isNil(undefined); //=> true + * R.isNil(0); //=> false + * R.isNil([]); //=> false + */ + +var isNil = +/*#__PURE__*/ +_curry1(function isNil(x) { + return x == null; +}); + +export default isNil; \ No newline at end of file diff --git a/node_modules/ramda/es/join.js b/node_modules/ramda/es/join.js new file mode 100644 index 0000000..d3a3aca --- /dev/null +++ b/node_modules/ramda/es/join.js @@ -0,0 +1,25 @@ +import invoker from "./invoker.js"; +/** + * Returns a string made by inserting the `separator` between each element and + * concatenating all the elements into a single string. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig String -> [a] -> String + * @param {Number|String} separator The string used to separate the elements. + * @param {Array} xs The elements to join into a string. + * @return {String} str The string made by concatenating `xs` with `separator`. + * @see R.split + * @example + * + * const spacer = R.join(' '); + * spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + * R.join('|', [1, 2, 3]); //=> '1|2|3' + */ + +var join = +/*#__PURE__*/ +invoker(1, 'join'); +export default join; \ No newline at end of file diff --git a/node_modules/ramda/es/juxt.js b/node_modules/ramda/es/juxt.js new file mode 100644 index 0000000..27701a0 --- /dev/null +++ b/node_modules/ramda/es/juxt.js @@ -0,0 +1,29 @@ +import _curry1 from "./internal/_curry1.js"; +import converge from "./converge.js"; +/** + * juxt applies a list of functions to a list of values. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Function + * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n]) + * @param {Array} fns An array of functions + * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters. + * @see R.applySpec + * @example + * + * const getRange = R.juxt([Math.min, Math.max]); + * getRange(3, 4, 9, -3); //=> [-3, 9] + * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] + */ + +var juxt = +/*#__PURE__*/ +_curry1(function juxt(fns) { + return converge(function () { + return Array.prototype.slice.call(arguments, 0); + }, fns); +}); + +export default juxt; \ No newline at end of file diff --git a/node_modules/ramda/es/keys.js b/node_modules/ramda/es/keys.js new file mode 100644 index 0000000..117ca8e --- /dev/null +++ b/node_modules/ramda/es/keys.js @@ -0,0 +1,91 @@ +import _curry1 from "./internal/_curry1.js"; +import _has from "./internal/_has.js"; +import _isArguments from "./internal/_isArguments.js"; // cover IE < 9 keys issues + +var hasEnumBug = ! +/*#__PURE__*/ +{ + toString: null +}.propertyIsEnumerable('toString'); +var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug + +var hasArgsEnumBug = +/*#__PURE__*/ +function () { + 'use strict'; + + return arguments.propertyIsEnumerable('length'); +}(); + +var contains = function contains(list, item) { + var idx = 0; + + while (idx < list.length) { + if (list[idx] === item) { + return true; + } + + idx += 1; + } + + return false; +}; +/** + * Returns a list containing the names of all the enumerable own properties of + * the supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own properties. + * @see R.keysIn, R.values + * @example + * + * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] + */ + + +var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? +/*#__PURE__*/ +_curry1(function keys(obj) { + return Object(obj) !== obj ? [] : Object.keys(obj); +}) : +/*#__PURE__*/ +_curry1(function keys(obj) { + if (Object(obj) !== obj) { + return []; + } + + var prop, nIdx; + var ks = []; + + var checkArgsLength = hasArgsEnumBug && _isArguments(obj); + + for (prop in obj) { + if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) { + ks[ks.length] = prop; + } + } + + if (hasEnumBug) { + nIdx = nonEnumerableProps.length - 1; + + while (nIdx >= 0) { + prop = nonEnumerableProps[nIdx]; + + if (_has(prop, obj) && !contains(ks, prop)) { + ks[ks.length] = prop; + } + + nIdx -= 1; + } + } + + return ks; +}); +export default keys; \ No newline at end of file diff --git a/node_modules/ramda/es/keysIn.js b/node_modules/ramda/es/keysIn.js new file mode 100644 index 0000000..9d9937d --- /dev/null +++ b/node_modules/ramda/es/keysIn.js @@ -0,0 +1,37 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Returns a list containing the names of all the properties of the supplied + * object, including prototype properties. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own and prototype properties. + * @see R.keys, R.valuesIn + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.keysIn(f); //=> ['x', 'y'] + */ + +var keysIn = +/*#__PURE__*/ +_curry1(function keysIn(obj) { + var prop; + var ks = []; + + for (prop in obj) { + ks[ks.length] = prop; + } + + return ks; +}); + +export default keysIn; \ No newline at end of file diff --git a/node_modules/ramda/es/last.js b/node_modules/ramda/es/last.js new file mode 100644 index 0000000..8ee7c11 --- /dev/null +++ b/node_modules/ramda/es/last.js @@ -0,0 +1,26 @@ +import nth from "./nth.js"; +/** + * Returns the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.init, R.head, R.tail + * @example + * + * R.last(['fi', 'fo', 'fum']); //=> 'fum' + * R.last([]); //=> undefined + * + * R.last('abc'); //=> 'c' + * R.last(''); //=> '' + */ + +var last = +/*#__PURE__*/ +nth(-1); +export default last; \ No newline at end of file diff --git a/node_modules/ramda/es/lastIndexOf.js b/node_modules/ramda/es/lastIndexOf.js new file mode 100644 index 0000000..4601f30 --- /dev/null +++ b/node_modules/ramda/es/lastIndexOf.js @@ -0,0 +1,44 @@ +import _curry2 from "./internal/_curry2.js"; +import _isArray from "./internal/_isArray.js"; +import equals from "./equals.js"; +/** + * Returns the position of the last occurrence of an item in an array, or -1 if + * the item is not included in the array. [`R.equals`](#equals) is used to + * determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Number + * @param {*} target The item to find. + * @param {Array} xs The array to search in. + * @return {Number} the index of the target, or -1 if the target is not found. + * @see R.indexOf + * @example + * + * R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6 + * R.lastIndexOf(10, [1,2,3,4]); //=> -1 + */ + +var lastIndexOf = +/*#__PURE__*/ +_curry2(function lastIndexOf(target, xs) { + if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) { + return xs.lastIndexOf(target); + } else { + var idx = xs.length - 1; + + while (idx >= 0) { + if (equals(xs[idx], target)) { + return idx; + } + + idx -= 1; + } + + return -1; + } +}); + +export default lastIndexOf; \ No newline at end of file diff --git a/node_modules/ramda/es/length.js b/node_modules/ramda/es/length.js new file mode 100644 index 0000000..c3c7b98 --- /dev/null +++ b/node_modules/ramda/es/length.js @@ -0,0 +1,25 @@ +import _curry1 from "./internal/_curry1.js"; +import _isNumber from "./internal/_isNumber.js"; +/** + * Returns the number of elements in the array by returning `list.length`. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [a] -> Number + * @param {Array} list The array to inspect. + * @return {Number} The length of the array. + * @example + * + * R.length([]); //=> 0 + * R.length([1, 2, 3]); //=> 3 + */ + +var length = +/*#__PURE__*/ +_curry1(function length(list) { + return list != null && _isNumber(list.length) ? list.length : NaN; +}); + +export default length; \ No newline at end of file diff --git a/node_modules/ramda/es/lens.js b/node_modules/ramda/es/lens.js new file mode 100644 index 0000000..4bc179c --- /dev/null +++ b/node_modules/ramda/es/lens.js @@ -0,0 +1,39 @@ +import _curry2 from "./internal/_curry2.js"; +import map from "./map.js"; +/** + * Returns a lens for the given getter and setter functions. The getter "gets" + * the value of the focus; the setter "sets" the value of the focus. The setter + * should not mutate the data structure. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig (s -> a) -> ((a, s) -> s) -> Lens s a + * @param {Function} getter + * @param {Function} setter + * @return {Lens} + * @see R.view, R.set, R.over, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lens(R.prop('x'), R.assoc('x')); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} + */ + +var lens = +/*#__PURE__*/ +_curry2(function lens(getter, setter) { + return function (toFunctorFn) { + return function (target) { + return map(function (focus) { + return setter(focus, target); + }, toFunctorFn(getter(target))); + }; + }; +}); + +export default lens; \ No newline at end of file diff --git a/node_modules/ramda/es/lensIndex.js b/node_modules/ramda/es/lensIndex.js new file mode 100644 index 0000000..47cfaf2 --- /dev/null +++ b/node_modules/ramda/es/lensIndex.js @@ -0,0 +1,32 @@ +import _curry1 from "./internal/_curry1.js"; +import lens from "./lens.js"; +import nth from "./nth.js"; +import update from "./update.js"; +/** + * Returns a lens whose focus is the specified index. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Number -> Lens s a + * @param {Number} n + * @return {Lens} + * @see R.view, R.set, R.over, R.nth + * @example + * + * const headLens = R.lensIndex(0); + * + * R.view(headLens, ['a', 'b', 'c']); //=> 'a' + * R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] + * R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] + */ + +var lensIndex = +/*#__PURE__*/ +_curry1(function lensIndex(n) { + return lens(nth(n), update(n)); +}); + +export default lensIndex; \ No newline at end of file diff --git a/node_modules/ramda/es/lensPath.js b/node_modules/ramda/es/lensPath.js new file mode 100644 index 0000000..7f7b0a3 --- /dev/null +++ b/node_modules/ramda/es/lensPath.js @@ -0,0 +1,36 @@ +import _curry1 from "./internal/_curry1.js"; +import assocPath from "./assocPath.js"; +import lens from "./lens.js"; +import path from "./path.js"; +/** + * Returns a lens whose focus is the specified path. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @typedefn Idx = String | Int + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig [Idx] -> Lens s a + * @param {Array} path The path to use. + * @return {Lens} + * @see R.view, R.set, R.over + * @example + * + * const xHeadYLens = R.lensPath(['x', 0, 'y']); + * + * R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> 2 + * R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]} + * R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]} + */ + +var lensPath = +/*#__PURE__*/ +_curry1(function lensPath(p) { + return lens(path(p), assocPath(p)); +}); + +export default lensPath; \ No newline at end of file diff --git a/node_modules/ramda/es/lensProp.js b/node_modules/ramda/es/lensProp.js new file mode 100644 index 0000000..2f4a12b --- /dev/null +++ b/node_modules/ramda/es/lensProp.js @@ -0,0 +1,32 @@ +import _curry1 from "./internal/_curry1.js"; +import assoc from "./assoc.js"; +import lens from "./lens.js"; +import prop from "./prop.js"; +/** + * Returns a lens whose focus is the specified property. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig String -> Lens s a + * @param {String} k + * @return {Lens} + * @see R.view, R.set, R.over + * @example + * + * const xLens = R.lensProp('x'); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} + */ + +var lensProp = +/*#__PURE__*/ +_curry1(function lensProp(k) { + return lens(prop(k), assoc(k)); +}); + +export default lensProp; \ No newline at end of file diff --git a/node_modules/ramda/es/lift.js b/node_modules/ramda/es/lift.js new file mode 100644 index 0000000..c75e38d --- /dev/null +++ b/node_modules/ramda/es/lift.js @@ -0,0 +1,32 @@ +import _curry1 from "./internal/_curry1.js"; +import liftN from "./liftN.js"; +/** + * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other + * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.liftN + * @example + * + * const madd3 = R.lift((a, b, c) => a + b + c); + * + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + * + * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e); + * + * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] + */ + +var lift = +/*#__PURE__*/ +_curry1(function lift(fn) { + return liftN(fn.length, fn); +}); + +export default lift; \ No newline at end of file diff --git a/node_modules/ramda/es/liftN.js b/node_modules/ramda/es/liftN.js new file mode 100644 index 0000000..6a9c4c7 --- /dev/null +++ b/node_modules/ramda/es/liftN.js @@ -0,0 +1,33 @@ +import _curry2 from "./internal/_curry2.js"; +import _reduce from "./internal/_reduce.js"; +import ap from "./ap.js"; +import curryN from "./curryN.js"; +import map from "./map.js"; +/** + * "lifts" a function to be the specified arity, so that it may "map over" that + * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig Number -> (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.lift, R.ap + * @example + * + * const madd3 = R.liftN(3, (...args) => R.sum(args)); + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + */ + +var liftN = +/*#__PURE__*/ +_curry2(function liftN(arity, fn) { + var lifted = curryN(arity, fn); + return curryN(arity, function () { + return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); + }); +}); + +export default liftN; \ No newline at end of file diff --git a/node_modules/ramda/es/lt.js b/node_modules/ramda/es/lt.js new file mode 100644 index 0000000..a4452a8 --- /dev/null +++ b/node_modules/ramda/es/lt.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if the first argument is less than the second; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @see R.gt + * @example + * + * R.lt(2, 1); //=> false + * R.lt(2, 2); //=> false + * R.lt(2, 3); //=> true + * R.lt('a', 'z'); //=> true + * R.lt('z', 'a'); //=> false + */ + +var lt = +/*#__PURE__*/ +_curry2(function lt(a, b) { + return a < b; +}); + +export default lt; \ No newline at end of file diff --git a/node_modules/ramda/es/lte.js b/node_modules/ramda/es/lte.js new file mode 100644 index 0000000..a76603e --- /dev/null +++ b/node_modules/ramda/es/lte.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if the first argument is less than or equal to the second; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {Number} a + * @param {Number} b + * @return {Boolean} + * @see R.gte + * @example + * + * R.lte(2, 1); //=> false + * R.lte(2, 2); //=> true + * R.lte(2, 3); //=> true + * R.lte('a', 'z'); //=> true + * R.lte('z', 'a'); //=> false + */ + +var lte = +/*#__PURE__*/ +_curry2(function lte(a, b) { + return a <= b; +}); + +export default lte; \ No newline at end of file diff --git a/node_modules/ramda/es/map.js b/node_modules/ramda/es/map.js new file mode 100644 index 0000000..330f291 --- /dev/null +++ b/node_modules/ramda/es/map.js @@ -0,0 +1,66 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _map from "./internal/_map.js"; +import _reduce from "./internal/_reduce.js"; +import _xmap from "./internal/_xmap.js"; +import curryN from "./curryN.js"; +import keys from "./keys.js"; +/** + * Takes a function and + * a [functor](https://github.com/fantasyland/fantasy-land#functor), + * applies the function to each of the functor's values, and returns + * a functor of the same shape. + * + * Ramda provides suitable `map` implementations for `Array` and `Object`, + * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. + * + * Dispatches to the `map` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * Also treats functions as functors and will compose them together. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => (a -> b) -> f a -> f b + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {Array} list The list to be iterated over. + * @return {Array} The new list. + * @see R.transduce, R.addIndex + * @example + * + * const double = x => x * 2; + * + * R.map(double, [1, 2, 3]); //=> [2, 4, 6] + * + * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} + * @symb R.map(f, [a, b]) = [f(a), f(b)] + * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } + * @symb R.map(f, functor_o) = functor_o.map(f) + */ + +var map = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { + switch (Object.prototype.toString.call(functor)) { + case '[object Function]': + return curryN(functor.length, function () { + return fn.call(this, functor.apply(this, arguments)); + }); + + case '[object Object]': + return _reduce(function (acc, key) { + acc[key] = fn(functor[key]); + return acc; + }, {}, keys(functor)); + + default: + return _map(fn, functor); + } +})); + +export default map; \ No newline at end of file diff --git a/node_modules/ramda/es/mapAccum.js b/node_modules/ramda/es/mapAccum.js new file mode 100644 index 0000000..d131ee4 --- /dev/null +++ b/node_modules/ramda/es/mapAccum.js @@ -0,0 +1,54 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * The `mapAccum` function behaves like a combination of map and reduce; it + * applies a function to each element of a list, passing an accumulating + * parameter from left to right, and returning a final value of this + * accumulator together with the new list. + * + * The iterator function receives two arguments, *acc* and *value*, and should + * return a tuple *[acc, value]*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y]) + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.scan, R.addIndex, R.mapAccumRight + * @example + * + * const digits = ['1', '2', '3', '4']; + * const appender = (a, b) => [a + b, a + b]; + * + * R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']] + * @symb R.mapAccum(f, a, [b, c, d]) = [ + * f(f(f(a, b)[0], c)[0], d)[0], + * [ + * f(a, b)[1], + * f(f(a, b)[0], c)[1], + * f(f(f(a, b)[0], c)[0], d)[1] + * ] + * ] + */ + +var mapAccum = +/*#__PURE__*/ +_curry3(function mapAccum(fn, acc, list) { + var idx = 0; + var len = list.length; + var result = []; + var tuple = [acc]; + + while (idx < len) { + tuple = fn(tuple[0], list[idx]); + result[idx] = tuple[1]; + idx += 1; + } + + return [tuple[0], result]; +}); + +export default mapAccum; \ No newline at end of file diff --git a/node_modules/ramda/es/mapAccumRight.js b/node_modules/ramda/es/mapAccumRight.js new file mode 100644 index 0000000..93b9a06 --- /dev/null +++ b/node_modules/ramda/es/mapAccumRight.js @@ -0,0 +1,56 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * The `mapAccumRight` function behaves like a combination of map and reduce; it + * applies a function to each element of a list, passing an accumulating + * parameter from right to left, and returning a final value of this + * accumulator together with the new list. + * + * Similar to [`mapAccum`](#mapAccum), except moves through the input list from + * the right to the left. + * + * The iterator function receives two arguments, *acc* and *value*, and should + * return a tuple *[acc, value]*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y]) + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.addIndex, R.mapAccum + * @example + * + * const digits = ['1', '2', '3', '4']; + * const appender = (a, b) => [b + a, b + a]; + * + * R.mapAccumRight(appender, 5, digits); //=> ['12345', ['12345', '2345', '345', '45']] + * @symb R.mapAccumRight(f, a, [b, c, d]) = [ + * f(f(f(a, d)[0], c)[0], b)[0], + * [ + * f(a, d)[1], + * f(f(a, d)[0], c)[1], + * f(f(f(a, d)[0], c)[0], b)[1] + * ] + * ] + */ + +var mapAccumRight = +/*#__PURE__*/ +_curry3(function mapAccumRight(fn, acc, list) { + var idx = list.length - 1; + var result = []; + var tuple = [acc]; + + while (idx >= 0) { + tuple = fn(tuple[0], list[idx]); + result[idx] = tuple[1]; + idx -= 1; + } + + return [tuple[0], result]; +}); + +export default mapAccumRight; \ No newline at end of file diff --git a/node_modules/ramda/es/mapObjIndexed.js b/node_modules/ramda/es/mapObjIndexed.js new file mode 100644 index 0000000..2916b29 --- /dev/null +++ b/node_modules/ramda/es/mapObjIndexed.js @@ -0,0 +1,35 @@ +import _curry2 from "./internal/_curry2.js"; +import _reduce from "./internal/_reduce.js"; +import keys from "./keys.js"; +/** + * An Object-specific version of [`map`](#map). The function is applied to three + * arguments: *(value, key, obj)*. If only the value is significant, use + * [`map`](#map) instead. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig ((*, String, Object) -> *) -> Object -> Object + * @param {Function} fn + * @param {Object} obj + * @return {Object} + * @see R.map + * @example + * + * const xyz = { x: 1, y: 2, z: 3 }; + * const prependKeyAndDouble = (num, key, obj) => key + (num * 2); + * + * R.mapObjIndexed(prependKeyAndDouble, xyz); //=> { x: 'x2', y: 'y4', z: 'z6' } + */ + +var mapObjIndexed = +/*#__PURE__*/ +_curry2(function mapObjIndexed(fn, obj) { + return _reduce(function (acc, key) { + acc[key] = fn(obj[key], key, obj); + return acc; + }, {}, keys(obj)); +}); + +export default mapObjIndexed; \ No newline at end of file diff --git a/node_modules/ramda/es/match.js b/node_modules/ramda/es/match.js new file mode 100644 index 0000000..468ce35 --- /dev/null +++ b/node_modules/ramda/es/match.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Tests a regular expression against a String. Note that this function will + * return an empty array when there are no matches. This differs from + * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) + * which returns `null` when there are no matches. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig RegExp -> String -> [String | Undefined] + * @param {RegExp} rx A regular expression. + * @param {String} str The string to match against + * @return {Array} The list of matches or empty array. + * @see R.test + * @example + * + * R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] + * R.match(/a/, 'b'); //=> [] + * R.match(/a/, null); //=> TypeError: null does not have a method named "match" + */ + +var match = +/*#__PURE__*/ +_curry2(function match(rx, str) { + return str.match(rx) || []; +}); + +export default match; \ No newline at end of file diff --git a/node_modules/ramda/es/mathMod.js b/node_modules/ramda/es/mathMod.js new file mode 100644 index 0000000..3238de5 --- /dev/null +++ b/node_modules/ramda/es/mathMod.js @@ -0,0 +1,51 @@ +import _curry2 from "./internal/_curry2.js"; +import _isInteger from "./internal/_isInteger.js"; +/** + * `mathMod` behaves like the modulo operator should mathematically, unlike the + * `%` operator (and by extension, [`R.modulo`](#modulo)). So while + * `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. `mathMod` requires Integer + * arguments, and returns NaN when the modulus is zero or negative. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} m The dividend. + * @param {Number} p the modulus. + * @return {Number} The result of `b mod a`. + * @see R.modulo + * @example + * + * R.mathMod(-17, 5); //=> 3 + * R.mathMod(17, 5); //=> 2 + * R.mathMod(17, -5); //=> NaN + * R.mathMod(17, 0); //=> NaN + * R.mathMod(17.2, 5); //=> NaN + * R.mathMod(17, 5.3); //=> NaN + * + * const clock = R.mathMod(R.__, 12); + * clock(15); //=> 3 + * clock(24); //=> 0 + * + * const seventeenMod = R.mathMod(17); + * seventeenMod(3); //=> 2 + * seventeenMod(4); //=> 1 + * seventeenMod(10); //=> 7 + */ + +var mathMod = +/*#__PURE__*/ +_curry2(function mathMod(m, p) { + if (!_isInteger(m)) { + return NaN; + } + + if (!_isInteger(p) || p < 1) { + return NaN; + } + + return (m % p + p) % p; +}); + +export default mathMod; \ No newline at end of file diff --git a/node_modules/ramda/es/max.js b/node_modules/ramda/es/max.js new file mode 100644 index 0000000..5b0baf3 --- /dev/null +++ b/node_modules/ramda/es/max.js @@ -0,0 +1,26 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns the larger of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.maxBy, R.min + * @example + * + * R.max(789, 123); //=> 789 + * R.max('a', 'b'); //=> 'b' + */ + +var max = +/*#__PURE__*/ +_curry2(function max(a, b) { + return b > a ? b : a; +}); + +export default max; \ No newline at end of file diff --git a/node_modules/ramda/es/maxBy.js b/node_modules/ramda/es/maxBy.js new file mode 100644 index 0000000..c28266d --- /dev/null +++ b/node_modules/ramda/es/maxBy.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Takes a function and two values, and returns whichever value produces the + * larger result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.max, R.minBy + * @example + * + * // square :: Number -> Number + * const square = n => n * n; + * + * R.maxBy(square, -3, 2); //=> -3 + * + * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5 + * R.reduce(R.maxBy(square), 0, []); //=> 0 + */ + +var maxBy = +/*#__PURE__*/ +_curry3(function maxBy(f, a, b) { + return f(b) > f(a) ? b : a; +}); + +export default maxBy; \ No newline at end of file diff --git a/node_modules/ramda/es/mean.js b/node_modules/ramda/es/mean.js new file mode 100644 index 0000000..11d5b1e --- /dev/null +++ b/node_modules/ramda/es/mean.js @@ -0,0 +1,26 @@ +import _curry1 from "./internal/_curry1.js"; +import sum from "./sum.js"; +/** + * Returns the mean of the given list of numbers. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list + * @return {Number} + * @see R.median + * @example + * + * R.mean([2, 7, 9]); //=> 6 + * R.mean([]); //=> NaN + */ + +var mean = +/*#__PURE__*/ +_curry1(function mean(list) { + return sum(list) / list.length; +}); + +export default mean; \ No newline at end of file diff --git a/node_modules/ramda/es/median.js b/node_modules/ramda/es/median.js new file mode 100644 index 0000000..c5f5e5d --- /dev/null +++ b/node_modules/ramda/es/median.js @@ -0,0 +1,37 @@ +import _curry1 from "./internal/_curry1.js"; +import mean from "./mean.js"; +/** + * Returns the median of the given list of numbers. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list + * @return {Number} + * @see R.mean + * @example + * + * R.median([2, 9, 7]); //=> 7 + * R.median([7, 2, 10, 9]); //=> 8 + * R.median([]); //=> NaN + */ + +var median = +/*#__PURE__*/ +_curry1(function median(list) { + var len = list.length; + + if (len === 0) { + return NaN; + } + + var width = 2 - len % 2; + var idx = (len - width) / 2; + return mean(Array.prototype.slice.call(list, 0).sort(function (a, b) { + return a < b ? -1 : a > b ? 1 : 0; + }).slice(idx, idx + width)); +}); + +export default median; \ No newline at end of file diff --git a/node_modules/ramda/es/memoizeWith.js b/node_modules/ramda/es/memoizeWith.js new file mode 100644 index 0000000..a777db7 --- /dev/null +++ b/node_modules/ramda/es/memoizeWith.js @@ -0,0 +1,48 @@ +import _arity from "./internal/_arity.js"; +import _curry2 from "./internal/_curry2.js"; +import _has from "./internal/_has.js"; +/** + * Creates a new function that, when invoked, caches the result of calling `fn` + * for a given argument set and returns the result. Subsequent calls to the + * memoized `fn` with the same argument set will not result in an additional + * call to `fn`; instead, the cached result for that set of arguments will be + * returned. + * + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (*... -> String) -> (*... -> a) -> (*... -> a) + * @param {Function} fn The function to generate the cache key. + * @param {Function} fn The function to memoize. + * @return {Function} Memoized version of `fn`. + * @example + * + * let count = 0; + * const factorial = R.memoizeWith(R.identity, n => { + * count += 1; + * return R.product(R.range(1, n + 1)); + * }); + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * count; //=> 1 + */ + +var memoizeWith = +/*#__PURE__*/ +_curry2(function memoizeWith(mFn, fn) { + var cache = {}; + return _arity(fn.length, function () { + var key = mFn.apply(this, arguments); + + if (!_has(key, cache)) { + cache[key] = fn.apply(this, arguments); + } + + return cache[key]; + }); +}); + +export default memoizeWith; \ No newline at end of file diff --git a/node_modules/ramda/es/merge.js b/node_modules/ramda/es/merge.js new file mode 100644 index 0000000..651d9e4 --- /dev/null +++ b/node_modules/ramda/es/merge.js @@ -0,0 +1,34 @@ +import _objectAssign from "./internal/_objectAssign.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeRight, R.mergeDeepRight, R.mergeWith, R.mergeWithKey + * @deprecated since v0.26.0 + * @example + * + * R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const withDefaults = R.merge({x: 0, y: 0}); + * withDefaults({y: 2}); //=> {x: 0, y: 2} + * @symb R.merge(a, b) = {...a, ...b} + */ + +var merge = +/*#__PURE__*/ +_curry2(function merge(l, r) { + return _objectAssign({}, l, r); +}); + +export default merge; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeAll.js b/node_modules/ramda/es/mergeAll.js new file mode 100644 index 0000000..72254e6 --- /dev/null +++ b/node_modules/ramda/es/mergeAll.js @@ -0,0 +1,27 @@ +import _objectAssign from "./internal/_objectAssign.js"; +import _curry1 from "./internal/_curry1.js"; +/** + * Merges a list of objects together into one object. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig [{k: v}] -> {k: v} + * @param {Array} list An array of objects + * @return {Object} A merged object. + * @see R.reduce + * @example + * + * R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3} + * R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2} + * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 } + */ + +var mergeAll = +/*#__PURE__*/ +_curry1(function mergeAll(list) { + return _objectAssign.apply(null, [{}].concat(list)); +}); + +export default mergeAll; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeDeepLeft.js b/node_modules/ramda/es/mergeDeepLeft.js new file mode 100644 index 0000000..5b5227c --- /dev/null +++ b/node_modules/ramda/es/mergeDeepLeft.js @@ -0,0 +1,33 @@ +import _curry2 from "./internal/_curry2.js"; +import mergeDeepWithKey from "./mergeDeepWithKey.js"; +/** + * Creates a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects: + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the first object will be used. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig {a} -> {a} -> {a} + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.merge, R.mergeDeepRight, R.mergeDeepWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepLeft({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + * { age: 40, contact: { email: 'baa@example.com' }}); + * //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }} + */ + +var mergeDeepLeft = +/*#__PURE__*/ +_curry2(function mergeDeepLeft(lObj, rObj) { + return mergeDeepWithKey(function (k, lVal, rVal) { + return lVal; + }, lObj, rObj); +}); + +export default mergeDeepLeft; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeDeepRight.js b/node_modules/ramda/es/mergeDeepRight.js new file mode 100644 index 0000000..1b754c7 --- /dev/null +++ b/node_modules/ramda/es/mergeDeepRight.js @@ -0,0 +1,33 @@ +import _curry2 from "./internal/_curry2.js"; +import mergeDeepWithKey from "./mergeDeepWithKey.js"; +/** + * Creates a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects: + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig {a} -> {a} -> {a} + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + * { age: 40, contact: { email: 'baa@example.com' }}); + * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }} + */ + +var mergeDeepRight = +/*#__PURE__*/ +_curry2(function mergeDeepRight(lObj, rObj) { + return mergeDeepWithKey(function (k, lVal, rVal) { + return rVal; + }, lObj, rObj); +}); + +export default mergeDeepRight; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeDeepWith.js b/node_modules/ramda/es/mergeDeepWith.js new file mode 100644 index 0000000..853c461 --- /dev/null +++ b/node_modules/ramda/es/mergeDeepWith.js @@ -0,0 +1,39 @@ +import _curry3 from "./internal/_curry3.js"; +import mergeDeepWithKey from "./mergeDeepWithKey.js"; +/** + * Creates a new object with the own properties of the two provided objects. + * If a key exists in both objects: + * - and both associated values are also objects then the values will be + * recursively merged. + * - otherwise the provided function is applied to associated values using the + * resulting value as the new value associated with the key. + * If a key only exists in one object, the value will be associated with the key + * of the resulting object. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig ((a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.mergeWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepWith(R.concat, + * { a: true, c: { values: [10, 20] }}, + * { b: true, c: { values: [15, 35] }}); + * //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }} + */ + +var mergeDeepWith = +/*#__PURE__*/ +_curry3(function mergeDeepWith(fn, lObj, rObj) { + return mergeDeepWithKey(function (k, lVal, rVal) { + return fn(lVal, rVal); + }, lObj, rObj); +}); + +export default mergeDeepWith; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeDeepWithKey.js b/node_modules/ramda/es/mergeDeepWithKey.js new file mode 100644 index 0000000..0cfc1fd --- /dev/null +++ b/node_modules/ramda/es/mergeDeepWithKey.js @@ -0,0 +1,45 @@ +import _curry3 from "./internal/_curry3.js"; +import _isObject from "./internal/_isObject.js"; +import mergeWithKey from "./mergeWithKey.js"; +/** + * Creates a new object with the own properties of the two provided objects. + * If a key exists in both objects: + * - and both associated values are also objects then the values will be + * recursively merged. + * - otherwise the provided function is applied to the key and associated values + * using the resulting value as the new value associated with the key. + * If a key only exists in one object, the value will be associated with the key + * of the resulting object. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.mergeWithKey, R.mergeDeepWith + * @example + * + * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + * R.mergeDeepWithKey(concatValues, + * { a: true, c: { thing: 'foo', values: [10, 20] }}, + * { b: true, c: { thing: 'bar', values: [15, 35] }}); + * //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }} + */ + +var mergeDeepWithKey = +/*#__PURE__*/ +_curry3(function mergeDeepWithKey(fn, lObj, rObj) { + return mergeWithKey(function (k, lVal, rVal) { + if (_isObject(lVal) && _isObject(rVal)) { + return mergeDeepWithKey(fn, lVal, rVal); + } else { + return fn(k, lVal, rVal); + } + }, lObj, rObj); +}); + +export default mergeDeepWithKey; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeLeft.js b/node_modules/ramda/es/mergeLeft.js new file mode 100644 index 0000000..52cc798 --- /dev/null +++ b/node_modules/ramda/es/mergeLeft.js @@ -0,0 +1,33 @@ +import _objectAssign from "./internal/_objectAssign.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the first object will be used. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeRight, R.mergeDeepLeft, R.mergeWith, R.mergeWithKey + * @example + * + * R.mergeLeft({ 'age': 40 }, { 'name': 'fred', 'age': 10 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const resetToDefault = R.mergeLeft({x: 0}); + * resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2} + * @symb R.mergeLeft(a, b) = {...b, ...a} + */ + +var mergeLeft = +/*#__PURE__*/ +_curry2(function mergeLeft(l, r) { + return _objectAssign({}, r, l); +}); + +export default mergeLeft; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeRight.js b/node_modules/ramda/es/mergeRight.js new file mode 100644 index 0000000..5912c14 --- /dev/null +++ b/node_modules/ramda/es/mergeRight.js @@ -0,0 +1,33 @@ +import _objectAssign from "./internal/_objectAssign.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeLeft, R.mergeDeepRight, R.mergeWith, R.mergeWithKey + * @example + * + * R.mergeRight({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const withDefaults = R.mergeRight({x: 0, y: 0}); + * withDefaults({y: 2}); //=> {x: 0, y: 2} + * @symb R.mergeRight(a, b) = {...a, ...b} + */ + +var mergeRight = +/*#__PURE__*/ +_curry2(function mergeRight(l, r) { + return _objectAssign({}, l, r); +}); + +export default mergeRight; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeWith.js b/node_modules/ramda/es/mergeWith.js new file mode 100644 index 0000000..d5be1c8 --- /dev/null +++ b/node_modules/ramda/es/mergeWith.js @@ -0,0 +1,35 @@ +import _curry3 from "./internal/_curry3.js"; +import mergeWithKey from "./mergeWithKey.js"; +/** + * Creates a new object with the own properties of the two provided objects. If + * a key exists in both objects, the provided function is applied to the values + * associated with the key in each object, with the result being used as the + * value associated with the key in the returned object. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @sig ((a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeDeepWith, R.merge, R.mergeWithKey + * @example + * + * R.mergeWith(R.concat, + * { a: true, values: [10, 20] }, + * { b: true, values: [15, 35] }); + * //=> { a: true, b: true, values: [10, 20, 15, 35] } + */ + +var mergeWith = +/*#__PURE__*/ +_curry3(function mergeWith(fn, l, r) { + return mergeWithKey(function (_, _l, _r) { + return fn(_l, _r); + }, l, r); +}); + +export default mergeWith; \ No newline at end of file diff --git a/node_modules/ramda/es/mergeWithKey.js b/node_modules/ramda/es/mergeWithKey.js new file mode 100644 index 0000000..ce34d1f --- /dev/null +++ b/node_modules/ramda/es/mergeWithKey.js @@ -0,0 +1,50 @@ +import _curry3 from "./internal/_curry3.js"; +import _has from "./internal/_has.js"; +/** + * Creates a new object with the own properties of the two provided objects. If + * a key exists in both objects, the provided function is applied to the key + * and the values associated with the key in each object, with the result being + * used as the value associated with the key in the returned object. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeDeepWithKey, R.merge, R.mergeWith + * @example + * + * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + * R.mergeWithKey(concatValues, + * { a: true, thing: 'foo', values: [10, 20] }, + * { b: true, thing: 'bar', values: [15, 35] }); + * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] } + * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 } + */ + +var mergeWithKey = +/*#__PURE__*/ +_curry3(function mergeWithKey(fn, l, r) { + var result = {}; + var k; + + for (k in l) { + if (_has(k, l)) { + result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k]; + } + } + + for (k in r) { + if (_has(k, r) && !_has(k, result)) { + result[k] = r[k]; + } + } + + return result; +}); + +export default mergeWithKey; \ No newline at end of file diff --git a/node_modules/ramda/es/min.js b/node_modules/ramda/es/min.js new file mode 100644 index 0000000..1c6aef2 --- /dev/null +++ b/node_modules/ramda/es/min.js @@ -0,0 +1,26 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns the smaller of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.minBy, R.max + * @example + * + * R.min(789, 123); //=> 123 + * R.min('a', 'b'); //=> 'a' + */ + +var min = +/*#__PURE__*/ +_curry2(function min(a, b) { + return b < a ? b : a; +}); + +export default min; \ No newline at end of file diff --git a/node_modules/ramda/es/minBy.js b/node_modules/ramda/es/minBy.js new file mode 100644 index 0000000..f669627 --- /dev/null +++ b/node_modules/ramda/es/minBy.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Takes a function and two values, and returns whichever value produces the + * smaller result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.min, R.maxBy + * @example + * + * // square :: Number -> Number + * const square = n => n * n; + * + * R.minBy(square, -3, 2); //=> 2 + * + * R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1 + * R.reduce(R.minBy(square), Infinity, []); //=> Infinity + */ + +var minBy = +/*#__PURE__*/ +_curry3(function minBy(f, a, b) { + return f(b) < f(a) ? b : a; +}); + +export default minBy; \ No newline at end of file diff --git a/node_modules/ramda/es/modulo.js b/node_modules/ramda/es/modulo.js new file mode 100644 index 0000000..2977491 --- /dev/null +++ b/node_modules/ramda/es/modulo.js @@ -0,0 +1,34 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Divides the first parameter by the second and returns the remainder. Note + * that this function preserves the JavaScript-style behavior for modulo. For + * mathematical modulo see [`mathMod`](#mathMod). + * + * @func + * @memberOf R + * @since v0.1.1 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The value to the divide. + * @param {Number} b The pseudo-modulus + * @return {Number} The result of `b % a`. + * @see R.mathMod + * @example + * + * R.modulo(17, 3); //=> 2 + * // JS behavior: + * R.modulo(-17, 3); //=> -2 + * R.modulo(17, -3); //=> 2 + * + * const isOdd = R.modulo(R.__, 2); + * isOdd(42); //=> 0 + * isOdd(21); //=> 1 + */ + +var modulo = +/*#__PURE__*/ +_curry2(function modulo(a, b) { + return a % b; +}); + +export default modulo; \ No newline at end of file diff --git a/node_modules/ramda/es/move.js b/node_modules/ramda/es/move.js new file mode 100644 index 0000000..ce1e41c --- /dev/null +++ b/node_modules/ramda/es/move.js @@ -0,0 +1,32 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Move an item, at index `from`, to index `to`, in a list of elements. + * A new list will be created containing the new elements order. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @param {Number} from The source index + * @param {Number} to The destination index + * @param {Array} list The list which will serve to realise the move + * @return {Array} The new list reordered + * @example + * + * R.move(0, 2, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['b', 'c', 'a', 'd', 'e', 'f'] + * R.move(-1, 0, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['f', 'a', 'b', 'c', 'd', 'e'] list rotation + */ + +var move = +/*#__PURE__*/ +_curry3(function (from, to, list) { + var length = list.length; + var result = list.slice(); + var positiveFrom = from < 0 ? length + from : from; + var positiveTo = to < 0 ? length + to : to; + var item = result.splice(positiveFrom, 1); + return positiveFrom < 0 || positiveFrom >= list.length || positiveTo < 0 || positiveTo >= list.length ? list : [].concat(result.slice(0, positiveTo)).concat(item).concat(result.slice(positiveTo, list.length)); +}); + +export default move; \ No newline at end of file diff --git a/node_modules/ramda/es/multiply.js b/node_modules/ramda/es/multiply.js new file mode 100644 index 0000000..e51b7f5 --- /dev/null +++ b/node_modules/ramda/es/multiply.js @@ -0,0 +1,29 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Multiplies two numbers. Equivalent to `a * b` but curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a * b`. + * @see R.divide + * @example + * + * const double = R.multiply(2); + * const triple = R.multiply(3); + * double(3); //=> 6 + * triple(4); //=> 12 + * R.multiply(2, 5); //=> 10 + */ + +var multiply = +/*#__PURE__*/ +_curry2(function multiply(a, b) { + return a * b; +}); + +export default multiply; \ No newline at end of file diff --git a/node_modules/ramda/es/nAry.js b/node_modules/ramda/es/nAry.js new file mode 100644 index 0000000..d386eca --- /dev/null +++ b/node_modules/ramda/es/nAry.js @@ -0,0 +1,97 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly `n` parameters. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} n The desired arity of the new function. + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity `n`. + * @see R.binary, R.unary + * @example + * + * const takesTwoArgs = (a, b) => [a, b]; + * + * takesTwoArgs.length; //=> 2 + * takesTwoArgs(1, 2); //=> [1, 2] + * + * const takesOneArg = R.nAry(1, takesTwoArgs); + * takesOneArg.length; //=> 1 + * // Only `n` arguments are passed to the wrapped function + * takesOneArg(1, 2); //=> [1, undefined] + * @symb R.nAry(0, f)(a, b) = f() + * @symb R.nAry(1, f)(a, b) = f(a) + * @symb R.nAry(2, f)(a, b) = f(a, b) + */ + +var nAry = +/*#__PURE__*/ +_curry2(function nAry(n, fn) { + switch (n) { + case 0: + return function () { + return fn.call(this); + }; + + case 1: + return function (a0) { + return fn.call(this, a0); + }; + + case 2: + return function (a0, a1) { + return fn.call(this, a0, a1); + }; + + case 3: + return function (a0, a1, a2) { + return fn.call(this, a0, a1, a2); + }; + + case 4: + return function (a0, a1, a2, a3) { + return fn.call(this, a0, a1, a2, a3); + }; + + case 5: + return function (a0, a1, a2, a3, a4) { + return fn.call(this, a0, a1, a2, a3, a4); + }; + + case 6: + return function (a0, a1, a2, a3, a4, a5) { + return fn.call(this, a0, a1, a2, a3, a4, a5); + }; + + case 7: + return function (a0, a1, a2, a3, a4, a5, a6) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6); + }; + + case 8: + return function (a0, a1, a2, a3, a4, a5, a6, a7) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7); + }; + + case 9: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8); + }; + + case 10: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); + }; + + default: + throw new Error('First argument to nAry must be a non-negative integer no greater than ten'); + } +}); + +export default nAry; \ No newline at end of file diff --git a/node_modules/ramda/es/negate.js b/node_modules/ramda/es/negate.js new file mode 100644 index 0000000..1841331 --- /dev/null +++ b/node_modules/ramda/es/negate.js @@ -0,0 +1,23 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Negates its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} + * @example + * + * R.negate(42); //=> -42 + */ + +var negate = +/*#__PURE__*/ +_curry1(function negate(n) { + return -n; +}); + +export default negate; \ No newline at end of file diff --git a/node_modules/ramda/es/none.js b/node_modules/ramda/es/none.js new file mode 100644 index 0000000..f2c1ad4 --- /dev/null +++ b/node_modules/ramda/es/none.js @@ -0,0 +1,36 @@ +import _complement from "./internal/_complement.js"; +import _curry2 from "./internal/_curry2.js"; +import all from "./all.js"; +/** + * Returns `true` if no elements of the list match the predicate, `false` + * otherwise. + * + * Dispatches to the `all` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise. + * @see R.all, R.any + * @example + * + * const isEven = n => n % 2 === 0; + * const isOdd = n => n % 2 === 1; + * + * R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true + * R.none(isOdd, [1, 3, 5, 7, 8, 11]); //=> false + */ + +var none = +/*#__PURE__*/ +_curry2(function none(fn, input) { + return all(_complement(fn), input); +}); + +export default none; \ No newline at end of file diff --git a/node_modules/ramda/es/not.js b/node_modules/ramda/es/not.js new file mode 100644 index 0000000..841bac4 --- /dev/null +++ b/node_modules/ramda/es/not.js @@ -0,0 +1,28 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * A function that returns the `!` of its argument. It will return `true` when + * passed false-y value, and `false` when passed a truth-y one. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig * -> Boolean + * @param {*} a any value + * @return {Boolean} the logical inverse of passed argument. + * @see R.complement + * @example + * + * R.not(true); //=> false + * R.not(false); //=> true + * R.not(0); //=> true + * R.not(1); //=> false + */ + +var not = +/*#__PURE__*/ +_curry1(function not(a) { + return !a; +}); + +export default not; \ No newline at end of file diff --git a/node_modules/ramda/es/nth.js b/node_modules/ramda/es/nth.js new file mode 100644 index 0000000..3f7bdca --- /dev/null +++ b/node_modules/ramda/es/nth.js @@ -0,0 +1,37 @@ +import _curry2 from "./internal/_curry2.js"; +import _isString from "./internal/_isString.js"; +/** + * Returns the nth element of the given list or string. If n is negative the + * element at index length + n is returned. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> a | Undefined + * @sig Number -> String -> String + * @param {Number} offset + * @param {*} list + * @return {*} + * @example + * + * const list = ['foo', 'bar', 'baz', 'quux']; + * R.nth(1, list); //=> 'bar' + * R.nth(-1, list); //=> 'quux' + * R.nth(-99, list); //=> undefined + * + * R.nth(2, 'abc'); //=> 'c' + * R.nth(3, 'abc'); //=> '' + * @symb R.nth(-1, [a, b, c]) = c + * @symb R.nth(0, [a, b, c]) = a + * @symb R.nth(1, [a, b, c]) = b + */ + +var nth = +/*#__PURE__*/ +_curry2(function nth(offset, list) { + var idx = offset < 0 ? list.length + offset : offset; + return _isString(list) ? list.charAt(idx) : list[idx]; +}); + +export default nth; \ No newline at end of file diff --git a/node_modules/ramda/es/nthArg.js b/node_modules/ramda/es/nthArg.js new file mode 100644 index 0000000..417eb2d --- /dev/null +++ b/node_modules/ramda/es/nthArg.js @@ -0,0 +1,32 @@ +import _curry1 from "./internal/_curry1.js"; +import curryN from "./curryN.js"; +import nth from "./nth.js"; +/** + * Returns a function which returns its nth argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig Number -> *... -> * + * @param {Number} n + * @return {Function} + * @example + * + * R.nthArg(1)('a', 'b', 'c'); //=> 'b' + * R.nthArg(-1)('a', 'b', 'c'); //=> 'c' + * @symb R.nthArg(-1)(a, b, c) = c + * @symb R.nthArg(0)(a, b, c) = a + * @symb R.nthArg(1)(a, b, c) = b + */ + +var nthArg = +/*#__PURE__*/ +_curry1(function nthArg(n) { + var arity = n < 0 ? 1 : n + 1; + return curryN(arity, function () { + return nth(n, arguments); + }); +}); + +export default nthArg; \ No newline at end of file diff --git a/node_modules/ramda/es/o.js b/node_modules/ramda/es/o.js new file mode 100644 index 0000000..516fa7e --- /dev/null +++ b/node_modules/ramda/es/o.js @@ -0,0 +1,36 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * `o` is a curried composition function that returns a unary function. + * Like [`compose`](#compose), `o` performs right-to-left function composition. + * Unlike [`compose`](#compose), the rightmost function passed to `o` will be + * invoked with only one argument. Also, unlike [`compose`](#compose), `o` is + * limited to accepting only 2 unary functions. The name o was chosen because + * of its similarity to the mathematical composition operator ∘. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (b -> c) -> (a -> b) -> a -> c + * @param {Function} f + * @param {Function} g + * @return {Function} + * @see R.compose, R.pipe + * @example + * + * const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last + * const yellGreeting = R.o(R.toUpper, classyGreeting); + * yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.o(R.multiply(10), R.add(10))(-4) //=> 60 + * + * @symb R.o(f, g, x) = f(g(x)) + */ + +var o = +/*#__PURE__*/ +_curry3(function o(f, g, x) { + return f(g(x)); +}); + +export default o; \ No newline at end of file diff --git a/node_modules/ramda/es/objOf.js b/node_modules/ramda/es/objOf.js new file mode 100644 index 0000000..c905087 --- /dev/null +++ b/node_modules/ramda/es/objOf.js @@ -0,0 +1,31 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Creates an object containing a single key:value pair. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Object + * @sig String -> a -> {String:a} + * @param {String} key + * @param {*} val + * @return {Object} + * @see R.pair + * @example + * + * const matchPhrases = R.compose( + * R.objOf('must'), + * R.map(R.objOf('match_phrase')) + * ); + * matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]} + */ + +var objOf = +/*#__PURE__*/ +_curry2(function objOf(key, val) { + var obj = {}; + obj[key] = val; + return obj; +}); + +export default objOf; \ No newline at end of file diff --git a/node_modules/ramda/es/of.js b/node_modules/ramda/es/of.js new file mode 100644 index 0000000..fc2586a --- /dev/null +++ b/node_modules/ramda/es/of.js @@ -0,0 +1,26 @@ +import _curry1 from "./internal/_curry1.js"; +import _of from "./internal/_of.js"; +/** + * Returns a singleton array containing the value provided. + * + * Note this `of` is different from the ES6 `of`; See + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig a -> [a] + * @param {*} x any value + * @return {Array} An array wrapping `x`. + * @example + * + * R.of(null); //=> [null] + * R.of([42]); //=> [[42]] + */ + +var of = +/*#__PURE__*/ +_curry1(_of); + +export default of; \ No newline at end of file diff --git a/node_modules/ramda/es/omit.js b/node_modules/ramda/es/omit.js new file mode 100644 index 0000000..e40f168 --- /dev/null +++ b/node_modules/ramda/es/omit.js @@ -0,0 +1,41 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a partial copy of an object omitting the keys specified. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [String] -> {String: *} -> {String: *} + * @param {Array} names an array of String property names to omit from the new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with properties from `names` not on it. + * @see R.pick + * @example + * + * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3} + */ + +var omit = +/*#__PURE__*/ +_curry2(function omit(names, obj) { + var result = {}; + var index = {}; + var idx = 0; + var len = names.length; + + while (idx < len) { + index[names[idx]] = 1; + idx += 1; + } + + for (var prop in obj) { + if (!index.hasOwnProperty(prop)) { + result[prop] = obj[prop]; + } + } + + return result; +}); + +export default omit; \ No newline at end of file diff --git a/node_modules/ramda/es/once.js b/node_modules/ramda/es/once.js new file mode 100644 index 0000000..b0ab044 --- /dev/null +++ b/node_modules/ramda/es/once.js @@ -0,0 +1,39 @@ +import _arity from "./internal/_arity.js"; +import _curry1 from "./internal/_curry1.js"; +/** + * Accepts a function `fn` and returns a function that guards invocation of + * `fn` such that `fn` can only ever be called once, no matter how many times + * the returned function is invoked. The first value calculated is returned in + * subsequent invocations. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (a... -> b) -> (a... -> b) + * @param {Function} fn The function to wrap in a call-only-once wrapper. + * @return {Function} The wrapped function. + * @example + * + * const addOneOnce = R.once(x => x + 1); + * addOneOnce(10); //=> 11 + * addOneOnce(addOneOnce(50)); //=> 11 + */ + +var once = +/*#__PURE__*/ +_curry1(function once(fn) { + var called = false; + var result; + return _arity(fn.length, function () { + if (called) { + return result; + } + + called = true; + result = fn.apply(this, arguments); + return result; + }); +}); + +export default once; \ No newline at end of file diff --git a/node_modules/ramda/es/or.js b/node_modules/ramda/es/or.js new file mode 100644 index 0000000..63b52a8 --- /dev/null +++ b/node_modules/ramda/es/or.js @@ -0,0 +1,29 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns `true` if one or both of its arguments are `true`. Returns `false` + * if both arguments are `false`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> b -> a | b + * @param {Any} a + * @param {Any} b + * @return {Any} the first argument if truthy, otherwise the second argument. + * @see R.either, R.xor + * @example + * + * R.or(true, true); //=> true + * R.or(true, false); //=> true + * R.or(false, true); //=> true + * R.or(false, false); //=> false + */ + +var or = +/*#__PURE__*/ +_curry2(function or(a, b) { + return a || b; +}); + +export default or; \ No newline at end of file diff --git a/node_modules/ramda/es/otherwise.js b/node_modules/ramda/es/otherwise.js new file mode 100644 index 0000000..e68c1da --- /dev/null +++ b/node_modules/ramda/es/otherwise.js @@ -0,0 +1,40 @@ +import _curry2 from "./internal/_curry2.js"; +import _assertPromise from "./internal/_assertPromise.js"; +/** + * Returns the result of applying the onFailure function to the value inside + * a failed promise. This is useful for handling rejected promises + * inside function compositions. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig (e -> b) -> (Promise e a) -> (Promise e b) + * @sig (e -> (Promise f b)) -> (Promise e a) -> (Promise f b) + * @param {Function} onFailure The function to apply. Can return a value or a promise of a value. + * @param {Promise} p + * @return {Promise} The result of calling `p.then(null, onFailure)` + * @see R.then + * @example + * + * var failedFetch = (id) => Promise.reject('bad ID'); + * var useDefault = () => ({ firstName: 'Bob', lastName: 'Loblaw' }) + * + * //recoverFromFailure :: String -> Promise ({firstName, lastName}) + * var recoverFromFailure = R.pipe( + * failedFetch, + * R.otherwise(useDefault), + * R.then(R.pick(['firstName', 'lastName'])), + * ); + * recoverFromFailure(12345).then(console.log) + */ + +var otherwise = +/*#__PURE__*/ +_curry2(function otherwise(f, p) { + _assertPromise('otherwise', p); + + return p.then(null, f); +}); + +export default otherwise; \ No newline at end of file diff --git a/node_modules/ramda/es/over.js b/node_modules/ramda/es/over.js new file mode 100644 index 0000000..3646309 --- /dev/null +++ b/node_modules/ramda/es/over.js @@ -0,0 +1,47 @@ +import _curry3 from "./internal/_curry3.js"; // `Identity` is a functor that holds a single value, where `map` simply +// transforms the held value with the provided function. + +var Identity = function (x) { + return { + value: x, + map: function (f) { + return Identity(f(x)); + } + }; +}; +/** + * Returns the result of "setting" the portion of the given data structure + * focused by the given lens to the result of applying the given function to + * the focused value. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> (a -> a) -> s -> s + * @param {Lens} lens + * @param {*} v + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const headLens = R.lensIndex(0); + * + * R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz'] + */ + + +var over = +/*#__PURE__*/ +_curry3(function over(lens, f, x) { + // The value returned by the getter function is first transformed with `f`, + // then set as the value of an `Identity`. This is then mapped over with the + // setter function of the lens. + return lens(function (y) { + return Identity(f(y)); + })(x).value; +}); + +export default over; \ No newline at end of file diff --git a/node_modules/ramda/es/pair.js b/node_modules/ramda/es/pair.js new file mode 100644 index 0000000..c6508fa --- /dev/null +++ b/node_modules/ramda/es/pair.js @@ -0,0 +1,25 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category List + * @sig a -> b -> (a,b) + * @param {*} fst + * @param {*} snd + * @return {Array} + * @see R.objOf, R.of + * @example + * + * R.pair('foo', 'bar'); //=> ['foo', 'bar'] + */ + +var pair = +/*#__PURE__*/ +_curry2(function pair(fst, snd) { + return [fst, snd]; +}); + +export default pair; \ No newline at end of file diff --git a/node_modules/ramda/es/partial.js b/node_modules/ramda/es/partial.js new file mode 100644 index 0000000..fcd8ced --- /dev/null +++ b/node_modules/ramda/es/partial.js @@ -0,0 +1,36 @@ +import _concat from "./internal/_concat.js"; +import _createPartialApplicator from "./internal/_createPartialApplicator.js"; +/** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided initially followed by the arguments provided to `g`. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partialRight, R.curry + * @example + * + * const multiply2 = (a, b) => a * b; + * const double = R.partial(multiply2, [2]); + * double(2); //=> 4 + * + * const greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * const sayHello = R.partial(greet, ['Hello']); + * const sayHelloToMs = R.partial(sayHello, ['Ms.']); + * sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d) + */ + +var partial = +/*#__PURE__*/ +_createPartialApplicator(_concat); + +export default partial; \ No newline at end of file diff --git a/node_modules/ramda/es/partialRight.js b/node_modules/ramda/es/partialRight.js new file mode 100644 index 0000000..8bae291 --- /dev/null +++ b/node_modules/ramda/es/partialRight.js @@ -0,0 +1,35 @@ +import _concat from "./internal/_concat.js"; +import _createPartialApplicator from "./internal/_createPartialApplicator.js"; +import flip from "./flip.js"; +/** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided to `g` followed by the arguments provided initially. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partial + * @example + * + * const greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + * + * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) + */ + +var partialRight = +/*#__PURE__*/ +_createPartialApplicator( +/*#__PURE__*/ +flip(_concat)); + +export default partialRight; \ No newline at end of file diff --git a/node_modules/ramda/es/partition.js b/node_modules/ramda/es/partition.js new file mode 100644 index 0000000..8923385 --- /dev/null +++ b/node_modules/ramda/es/partition.js @@ -0,0 +1,32 @@ +import filter from "./filter.js"; +import juxt from "./juxt.js"; +import reject from "./reject.js"; +/** + * Takes a predicate and a list or other `Filterable` object and returns the + * pair of filterable objects of the same type of elements which do and do not + * satisfy, the predicate, respectively. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a] + * @param {Function} pred A predicate to determine which side the element belongs to. + * @param {Array} filterable the list (or other filterable) to partition. + * @return {Array} An array, containing first the subset of elements that satisfy the + * predicate, and second the subset of elements that do not satisfy. + * @see R.filter, R.reject + * @example + * + * R.partition(R.includes('s'), ['sss', 'ttt', 'foo', 'bars']); + * // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ] + * + * R.partition(R.includes('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); + * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] + */ + +var partition = +/*#__PURE__*/ +juxt([filter, reject]); +export default partition; \ No newline at end of file diff --git a/node_modules/ramda/es/path.js b/node_modules/ramda/es/path.js new file mode 100644 index 0000000..b687271 --- /dev/null +++ b/node_modules/ramda/es/path.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +import paths from "./paths.js"; +/** + * Retrieve the value at a given path. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> a | Undefined + * @param {Array} path The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path`. + * @see R.prop, R.nth + * @example + * + * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 + * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined + * R.path(['a', 'b', 0], {a: {b: [1, 2, 3]}}); //=> 1 + * R.path(['a', 'b', -2], {a: {b: [1, 2, 3]}}); //=> 2 + */ + +var path = +/*#__PURE__*/ +_curry2(function path(pathAr, obj) { + return paths([pathAr], obj)[0]; +}); + +export default path; \ No newline at end of file diff --git a/node_modules/ramda/es/pathEq.js b/node_modules/ramda/es/pathEq.js new file mode 100644 index 0000000..cee4dc8 --- /dev/null +++ b/node_modules/ramda/es/pathEq.js @@ -0,0 +1,35 @@ +import _curry3 from "./internal/_curry3.js"; +import equals from "./equals.js"; +import path from "./path.js"; +/** + * Determines whether a nested path on an object has a specific value, in + * [`R.equals`](#equals) terms. Most likely used to filter a list. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Relation + * @typedefn Idx = String | Int + * @sig [Idx] -> a -> {a} -> Boolean + * @param {Array} path The path of the nested property to use + * @param {*} val The value to compare the nested property with + * @param {Object} obj The object to check the nested property in + * @return {Boolean} `true` if the value equals the nested object property, + * `false` otherwise. + * @example + * + * const user1 = { address: { zipCode: 90210 } }; + * const user2 = { address: { zipCode: 55555 } }; + * const user3 = { name: 'Bob' }; + * const users = [ user1, user2, user3 ]; + * const isFamous = R.pathEq(['address', 'zipCode'], 90210); + * R.filter(isFamous, users); //=> [ user1 ] + */ + +var pathEq = +/*#__PURE__*/ +_curry3(function pathEq(_path, val, obj) { + return equals(path(_path, obj), val); +}); + +export default pathEq; \ No newline at end of file diff --git a/node_modules/ramda/es/pathOr.js b/node_modules/ramda/es/pathOr.js new file mode 100644 index 0000000..9729b8f --- /dev/null +++ b/node_modules/ramda/es/pathOr.js @@ -0,0 +1,30 @@ +import _curry3 from "./internal/_curry3.js"; +import defaultTo from "./defaultTo.js"; +import path from "./path.js"; +/** + * If the given, non-null object has a value at the given path, returns the + * value at that path. Otherwise returns the provided default value. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Object + * @typedefn Idx = String | Int + * @sig a -> [Idx] -> {a} -> a + * @param {*} d The default value. + * @param {Array} p The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path` of the supplied object or the default value. + * @example + * + * R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2 + * R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A" + */ + +var pathOr = +/*#__PURE__*/ +_curry3(function pathOr(d, p, obj) { + return defaultTo(d, path(p, obj)); +}); + +export default pathOr; \ No newline at end of file diff --git a/node_modules/ramda/es/pathSatisfies.js b/node_modules/ramda/es/pathSatisfies.js new file mode 100644 index 0000000..1789006 --- /dev/null +++ b/node_modules/ramda/es/pathSatisfies.js @@ -0,0 +1,30 @@ +import _curry3 from "./internal/_curry3.js"; +import path from "./path.js"; +/** + * Returns `true` if the specified object property at given path satisfies the + * given predicate; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Logic + * @typedefn Idx = String | Int + * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean + * @param {Function} pred + * @param {Array} propPath + * @param {*} obj + * @return {Boolean} + * @see R.propSatisfies, R.path + * @example + * + * R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true + * R.pathSatisfies(R.is(Object), [], {x: {y: 2}}); //=> true + */ + +var pathSatisfies = +/*#__PURE__*/ +_curry3(function pathSatisfies(pred, propPath, obj) { + return pred(path(propPath, obj)); +}); + +export default pathSatisfies; \ No newline at end of file diff --git a/node_modules/ramda/es/paths.js b/node_modules/ramda/es/paths.js new file mode 100644 index 0000000..d916688 --- /dev/null +++ b/node_modules/ramda/es/paths.js @@ -0,0 +1,45 @@ +import _curry2 from "./internal/_curry2.js"; +import _isInteger from "./internal/_isInteger.js"; +import nth from "./nth.js"; +/** + * Retrieves the values at given paths of an object. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Object + * @typedefn Idx = [String | Int] + * @sig [Idx] -> {a} -> [a | Undefined] + * @param {Array} pathsArray The array of paths to be fetched. + * @param {Object} obj The object to retrieve the nested properties from. + * @return {Array} A list consisting of values at paths specified by "pathsArray". + * @see R.path + * @example + * + * R.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, 3] + * R.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, undefined] + */ + +var paths = +/*#__PURE__*/ +_curry2(function paths(pathsArray, obj) { + return pathsArray.map(function (paths) { + var val = obj; + var idx = 0; + var p; + + while (idx < paths.length) { + if (val == null) { + return; + } + + p = paths[idx]; + val = _isInteger(p) ? nth(p, val) : val[p]; + idx += 1; + } + + return val; + }); +}); + +export default paths; \ No newline at end of file diff --git a/node_modules/ramda/es/pick.js b/node_modules/ramda/es/pick.js new file mode 100644 index 0000000..59a4ed0 --- /dev/null +++ b/node_modules/ramda/es/pick.js @@ -0,0 +1,38 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a partial copy of an object containing only the keys specified. If + * the key does not exist, the property is ignored. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.omit, R.props + * @example + * + * R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1} + */ + +var pick = +/*#__PURE__*/ +_curry2(function pick(names, obj) { + var result = {}; + var idx = 0; + + while (idx < names.length) { + if (names[idx] in obj) { + result[names[idx]] = obj[names[idx]]; + } + + idx += 1; + } + + return result; +}); + +export default pick; \ No newline at end of file diff --git a/node_modules/ramda/es/pickAll.js b/node_modules/ramda/es/pickAll.js new file mode 100644 index 0000000..91d223b --- /dev/null +++ b/node_modules/ramda/es/pickAll.js @@ -0,0 +1,37 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Similar to `pick` except that this one includes a `key: undefined` pair for + * properties that don't exist. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.pick + * @example + * + * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} + */ + +var pickAll = +/*#__PURE__*/ +_curry2(function pickAll(names, obj) { + var result = {}; + var idx = 0; + var len = names.length; + + while (idx < len) { + var name = names[idx]; + result[name] = obj[name]; + idx += 1; + } + + return result; +}); + +export default pickAll; \ No newline at end of file diff --git a/node_modules/ramda/es/pickBy.js b/node_modules/ramda/es/pickBy.js new file mode 100644 index 0000000..9bdbda9 --- /dev/null +++ b/node_modules/ramda/es/pickBy.js @@ -0,0 +1,37 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a partial copy of an object containing only the keys that satisfy + * the supplied predicate. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @sig ((v, k) -> Boolean) -> {k: v} -> {k: v} + * @param {Function} pred A predicate to determine whether or not a key + * should be included on the output object. + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties that satisfy `pred` + * on it. + * @see R.pick, R.filter + * @example + * + * const isUpperCase = (val, key) => key.toUpperCase() === key; + * R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4} + */ + +var pickBy = +/*#__PURE__*/ +_curry2(function pickBy(test, obj) { + var result = {}; + + for (var prop in obj) { + if (test(obj[prop], prop, obj)) { + result[prop] = obj[prop]; + } + } + + return result; +}); + +export default pickBy; \ No newline at end of file diff --git a/node_modules/ramda/es/pipe.js b/node_modules/ramda/es/pipe.js new file mode 100644 index 0000000..3a74d8d --- /dev/null +++ b/node_modules/ramda/es/pipe.js @@ -0,0 +1,35 @@ +import _arity from "./internal/_arity.js"; +import _pipe from "./internal/_pipe.js"; +import reduce from "./reduce.js"; +import tail from "./tail.js"; +/** + * Performs left-to-right function composition. The first argument may have + * any arity; the remaining arguments must be unary. + * + * In some libraries this function is named `sequence`. + * + * **Note:** The result of pipe is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.compose + * @example + * + * const f = R.pipe(Math.pow, R.negate, R.inc); + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) + */ + +export default function pipe() { + if (arguments.length === 0) { + throw new Error('pipe requires at least one argument'); + } + + return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments))); +} \ No newline at end of file diff --git a/node_modules/ramda/es/pipeK.js b/node_modules/ramda/es/pipeK.js new file mode 100644 index 0000000..579e218 --- /dev/null +++ b/node_modules/ramda/es/pipeK.js @@ -0,0 +1,45 @@ +import composeK from "./composeK.js"; +import reverse from "./reverse.js"; +/** + * Returns the left-to-right Kleisli composition of the provided functions, + * each of which must return a value of a type supported by [`chain`](#chain). + * + * `R.pipeK(f, g, h)` is equivalent to `R.pipe(f, R.chain(g), R.chain(h))`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Function + * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z) + * @param {...Function} + * @return {Function} + * @see R.composeK + * @deprecated since v0.26.0 + * @example + * + * // parseJson :: String -> Maybe * + * // get :: String -> Object -> Maybe * + * + * // getStateCode :: Maybe String -> Maybe String + * const getStateCode = R.pipeK( + * parseJson, + * get('user'), + * get('address'), + * get('state'), + * R.compose(Maybe.of, R.toUpper) + * ); + * + * getStateCode('{"user":{"address":{"state":"ny"}}}'); + * //=> Just('NY') + * getStateCode('[Invalid JSON]'); + * //=> Nothing() + * @symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a))) + */ + +export default function pipeK() { + if (arguments.length === 0) { + throw new Error('pipeK requires at least one argument'); + } + + return composeK.apply(this, reverse(arguments)); +} \ No newline at end of file diff --git a/node_modules/ramda/es/pipeP.js b/node_modules/ramda/es/pipeP.js new file mode 100644 index 0000000..584b261 --- /dev/null +++ b/node_modules/ramda/es/pipeP.js @@ -0,0 +1,31 @@ +import _arity from "./internal/_arity.js"; +import _pipeP from "./internal/_pipeP.js"; +import reduce from "./reduce.js"; +import tail from "./tail.js"; +/** + * Performs left-to-right composition of one or more Promise-returning + * functions. The first argument may have any arity; the remaining arguments + * must be unary. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z) + * @param {...Function} functions + * @return {Function} + * @see R.composeP + * @deprecated since v0.26.0 + * @example + * + * // followersForUser :: String -> Promise [User] + * const followersForUser = R.pipeP(db.getUserById, db.getFollowers); + */ + +export default function pipeP() { + if (arguments.length === 0) { + throw new Error('pipeP requires at least one argument'); + } + + return _arity(arguments[0].length, reduce(_pipeP, arguments[0], tail(arguments))); +} \ No newline at end of file diff --git a/node_modules/ramda/es/pipeWith.js b/node_modules/ramda/es/pipeWith.js new file mode 100644 index 0000000..7a84740 --- /dev/null +++ b/node_modules/ramda/es/pipeWith.js @@ -0,0 +1,47 @@ +import _arity from "./internal/_arity.js"; +import _curry2 from "./internal/_curry2.js"; +import head from "./head.js"; +import _reduce from "./internal/_reduce.js"; +import tail from "./tail.js"; +import identity from "./identity.js"; +/** + * Performs left-to-right function composition using transforming function. The first argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of pipeWith is not automatically curried. Transforming function is not used on the + * first argument. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((* -> *), [((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)]) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.composeWith, R.pipe + * @example + * + * const pipeWhileNotNil = R.pipeWith((f, res) => R.isNil(res) ? res : f(res)); + * const f = pipeWhileNotNil([Math.pow, R.negate, R.inc]) + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipeWith(f)([g, h, i])(...args) = f(i, f(h, g(...args))) + */ + +var pipeWith = +/*#__PURE__*/ +_curry2(function pipeWith(xf, list) { + if (list.length <= 0) { + return identity; + } + + var headList = head(list); + var tailList = tail(list); + return _arity(headList.length, function () { + return _reduce(function (result, f) { + return xf.call(this, f, result); + }, headList.apply(this, arguments), tailList); + }); +}); + +export default pipeWith; \ No newline at end of file diff --git a/node_modules/ramda/es/pluck.js b/node_modules/ramda/es/pluck.js new file mode 100644 index 0000000..b4b4dc5 --- /dev/null +++ b/node_modules/ramda/es/pluck.js @@ -0,0 +1,38 @@ +import _curry2 from "./internal/_curry2.js"; +import map from "./map.js"; +import prop from "./prop.js"; +/** + * Returns a new list by plucking the same named property off all objects in + * the list supplied. + * + * `pluck` will work on + * any [functor](https://github.com/fantasyland/fantasy-land#functor) in + * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => k -> f {k: v} -> f v + * @param {Number|String} key The key name to pluck off of each object. + * @param {Array} f The array or functor to consider. + * @return {Array} The list of values for the given key. + * @see R.props + * @example + * + * var getAges = R.pluck('age'); + * getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27] + * + * R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3] + * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5} + * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] + * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] + */ + +var pluck = +/*#__PURE__*/ +_curry2(function pluck(p, list) { + return map(prop(p), list); +}); + +export default pluck; \ No newline at end of file diff --git a/node_modules/ramda/es/prepend.js b/node_modules/ramda/es/prepend.js new file mode 100644 index 0000000..f8de4a2 --- /dev/null +++ b/node_modules/ramda/es/prepend.js @@ -0,0 +1,27 @@ +import _concat from "./internal/_concat.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a new list with the given element at the front, followed by the + * contents of the list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} el The item to add to the head of the output list. + * @param {Array} list The array to add to the tail of the output list. + * @return {Array} A new array. + * @see R.append + * @example + * + * R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] + */ + +var prepend = +/*#__PURE__*/ +_curry2(function prepend(el, list) { + return _concat([el], list); +}); + +export default prepend; \ No newline at end of file diff --git a/node_modules/ramda/es/product.js b/node_modules/ramda/es/product.js new file mode 100644 index 0000000..88d7492 --- /dev/null +++ b/node_modules/ramda/es/product.js @@ -0,0 +1,22 @@ +import multiply from "./multiply.js"; +import reduce from "./reduce.js"; +/** + * Multiplies together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The product of all the numbers in the list. + * @see R.reduce + * @example + * + * R.product([2,4,6,8,100,1]); //=> 38400 + */ + +var product = +/*#__PURE__*/ +reduce(multiply, 1); +export default product; \ No newline at end of file diff --git a/node_modules/ramda/es/project.js b/node_modules/ramda/es/project.js new file mode 100644 index 0000000..d819b99 --- /dev/null +++ b/node_modules/ramda/es/project.js @@ -0,0 +1,29 @@ +import _map from "./internal/_map.js"; +import identity from "./identity.js"; +import pickAll from "./pickAll.js"; +import useWith from "./useWith.js"; +/** + * Reasonable analog to SQL `select` statement. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @category Relation + * @sig [k] -> [{k: v}] -> [{k: v}] + * @param {Array} props The property names to project + * @param {Array} objs The objects to query + * @return {Array} An array of objects with just the `props` properties. + * @example + * + * const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; + * const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; + * const kids = [abby, fred]; + * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] + */ + +var project = +/*#__PURE__*/ +useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity + +export default project; \ No newline at end of file diff --git a/node_modules/ramda/es/prop.js b/node_modules/ramda/es/prop.js new file mode 100644 index 0000000..9fa805f --- /dev/null +++ b/node_modules/ramda/es/prop.js @@ -0,0 +1,31 @@ +import _curry2 from "./internal/_curry2.js"; +import path from "./path.js"; +/** + * Returns a function that when supplied an object returns the indicated + * property of that object, if it exists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @typedefn Idx = String | Int + * @sig Idx -> {s: a} -> a | Undefined + * @param {String|Number} p The property name or array index + * @param {Object} obj The object to query + * @return {*} The value at `obj.p`. + * @see R.path, R.nth + * @example + * + * R.prop('x', {x: 100}); //=> 100 + * R.prop('x', {}); //=> undefined + * R.prop(0, [100]); //=> 100 + * R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4 + */ + +var prop = +/*#__PURE__*/ +_curry2(function prop(p, obj) { + return path([p], obj); +}); + +export default prop; \ No newline at end of file diff --git a/node_modules/ramda/es/propEq.js b/node_modules/ramda/es/propEq.js new file mode 100644 index 0000000..43e889e --- /dev/null +++ b/node_modules/ramda/es/propEq.js @@ -0,0 +1,35 @@ +import _curry3 from "./internal/_curry3.js"; +import equals from "./equals.js"; +/** + * Returns `true` if the specified object property is equal, in + * [`R.equals`](#equals) terms, to the given value; `false` otherwise. + * You can test multiple properties with [`R.whereEq`](#whereEq). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig String -> a -> Object -> Boolean + * @param {String} name + * @param {*} val + * @param {*} obj + * @return {Boolean} + * @see R.whereEq, R.propSatisfies, R.equals + * @example + * + * const abby = {name: 'Abby', age: 7, hair: 'blond'}; + * const fred = {name: 'Fred', age: 12, hair: 'brown'}; + * const rusty = {name: 'Rusty', age: 10, hair: 'brown'}; + * const alois = {name: 'Alois', age: 15, disposition: 'surly'}; + * const kids = [abby, fred, rusty, alois]; + * const hasBrownHair = R.propEq('hair', 'brown'); + * R.filter(hasBrownHair, kids); //=> [fred, rusty] + */ + +var propEq = +/*#__PURE__*/ +_curry3(function propEq(name, val, obj) { + return equals(val, obj[name]); +}); + +export default propEq; \ No newline at end of file diff --git a/node_modules/ramda/es/propIs.js b/node_modules/ramda/es/propIs.js new file mode 100644 index 0000000..932bafb --- /dev/null +++ b/node_modules/ramda/es/propIs.js @@ -0,0 +1,30 @@ +import _curry3 from "./internal/_curry3.js"; +import is from "./is.js"; +/** + * Returns `true` if the specified object property is of the given type; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Type + * @sig Type -> String -> Object -> Boolean + * @param {Function} type + * @param {String} name + * @param {*} obj + * @return {Boolean} + * @see R.is, R.propSatisfies + * @example + * + * R.propIs(Number, 'x', {x: 1, y: 2}); //=> true + * R.propIs(Number, 'x', {x: 'foo'}); //=> false + * R.propIs(Number, 'x', {}); //=> false + */ + +var propIs = +/*#__PURE__*/ +_curry3(function propIs(type, name, obj) { + return is(type, obj[name]); +}); + +export default propIs; \ No newline at end of file diff --git a/node_modules/ramda/es/propOr.js b/node_modules/ramda/es/propOr.js new file mode 100644 index 0000000..6793fb4 --- /dev/null +++ b/node_modules/ramda/es/propOr.js @@ -0,0 +1,36 @@ +import _curry3 from "./internal/_curry3.js"; +import pathOr from "./pathOr.js"; +/** + * If the given, non-null object has an own property with the specified name, + * returns the value of that property. Otherwise returns the provided default + * value. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Object + * @sig a -> String -> Object -> a + * @param {*} val The default value. + * @param {String} p The name of the property to return. + * @param {Object} obj The object to query. + * @return {*} The value of given property of the supplied object or the default value. + * @example + * + * const alice = { + * name: 'ALICE', + * age: 101 + * }; + * const favorite = R.prop('favoriteLibrary'); + * const favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary'); + * + * favorite(alice); //=> undefined + * favoriteWithDefault(alice); //=> 'Ramda' + */ + +var propOr = +/*#__PURE__*/ +_curry3(function propOr(val, p, obj) { + return pathOr(val, [p], obj); +}); + +export default propOr; \ No newline at end of file diff --git a/node_modules/ramda/es/propSatisfies.js b/node_modules/ramda/es/propSatisfies.js new file mode 100644 index 0000000..f48df46 --- /dev/null +++ b/node_modules/ramda/es/propSatisfies.js @@ -0,0 +1,28 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Returns `true` if the specified object property satisfies the given + * predicate; `false` otherwise. You can test multiple properties with + * [`R.where`](#where). + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Logic + * @sig (a -> Boolean) -> String -> {String: a} -> Boolean + * @param {Function} pred + * @param {String} name + * @param {*} obj + * @return {Boolean} + * @see R.where, R.propEq, R.propIs + * @example + * + * R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true + */ + +var propSatisfies = +/*#__PURE__*/ +_curry3(function propSatisfies(pred, name, obj) { + return pred(obj[name]); +}); + +export default propSatisfies; \ No newline at end of file diff --git a/node_modules/ramda/es/props.js b/node_modules/ramda/es/props.js new file mode 100644 index 0000000..7605401 --- /dev/null +++ b/node_modules/ramda/es/props.js @@ -0,0 +1,32 @@ +import _curry2 from "./internal/_curry2.js"; +import path from "./path.js"; +/** + * Acts as multiple `prop`: array of keys in, array of values out. Preserves + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> [v] + * @param {Array} ps The property names to fetch + * @param {Object} obj The object to query + * @return {Array} The corresponding values or partially applied function. + * @example + * + * R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2] + * R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2] + * + * const fullName = R.compose(R.join(' '), R.props(['first', 'last'])); + * fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth' + */ + +var props = +/*#__PURE__*/ +_curry2(function props(ps, obj) { + return ps.map(function (p) { + return path([p], obj); + }); +}); + +export default props; \ No newline at end of file diff --git a/node_modules/ramda/es/range.js b/node_modules/ramda/es/range.js new file mode 100644 index 0000000..4fab10f --- /dev/null +++ b/node_modules/ramda/es/range.js @@ -0,0 +1,38 @@ +import _curry2 from "./internal/_curry2.js"; +import _isNumber from "./internal/_isNumber.js"; +/** + * Returns a list of numbers from `from` (inclusive) to `to` (exclusive). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> Number -> [Number] + * @param {Number} from The first number in the list. + * @param {Number} to One more than the last number in the list. + * @return {Array} The list of numbers in the set `[a, b)`. + * @example + * + * R.range(1, 5); //=> [1, 2, 3, 4] + * R.range(50, 53); //=> [50, 51, 52] + */ + +var range = +/*#__PURE__*/ +_curry2(function range(from, to) { + if (!(_isNumber(from) && _isNumber(to))) { + throw new TypeError('Both arguments to range must be numbers'); + } + + var result = []; + var n = from; + + while (n < to) { + result.push(n); + n += 1; + } + + return result; +}); + +export default range; \ No newline at end of file diff --git a/node_modules/ramda/es/reduce.js b/node_modules/ramda/es/reduce.js new file mode 100644 index 0000000..4d2adf6 --- /dev/null +++ b/node_modules/ramda/es/reduce.js @@ -0,0 +1,54 @@ +import _curry3 from "./internal/_curry3.js"; +import _reduce from "./internal/_reduce.js"; +/** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It may use + * [`R.reduced`](#reduced) to shortcut the iteration. + * + * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function + * is *(value, acc)*. + * + * Note: `R.reduce` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduce` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description + * + * Dispatches to the `reduce` method of the third argument, if present. When + * doing so, it is up to the user to handle the [`R.reduced`](#reduced) + * shortcuting, as this is not implemented by `reduce`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> a + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduced, R.addIndex, R.reduceRight + * @example + * + * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 + * // - -10 + * // / \ / \ + * // - 4 -6 4 + * // / \ / \ + * // - 3 ==> -3 3 + * // / \ / \ + * // - 2 -1 2 + * // / \ / \ + * // 0 1 0 1 + * + * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) + */ + +var reduce = +/*#__PURE__*/ +_curry3(_reduce); + +export default reduce; \ No newline at end of file diff --git a/node_modules/ramda/es/reduceBy.js b/node_modules/ramda/es/reduceBy.js new file mode 100644 index 0000000..4c940dc --- /dev/null +++ b/node_modules/ramda/es/reduceBy.js @@ -0,0 +1,61 @@ +import _clone from "./internal/_clone.js"; +import _curryN from "./internal/_curryN.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _has from "./internal/_has.js"; +import _reduce from "./internal/_reduce.js"; +import _xreduceBy from "./internal/_xreduceBy.js"; +/** + * Groups the elements of the list according to the result of calling + * the String-returning function `keyFn` on each element and reduces the elements + * of each group to a single value via the reducer function `valueFn`. + * + * This function is basically a more general [`groupBy`](#groupBy) function. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category List + * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} + * @param {Function} valueFn The function that reduces the elements of each group to a single + * value. Receives two values, accumulator for a particular group and the current element. + * @param {*} acc The (initial) accumulator value for each group. + * @param {Function} keyFn The function that maps the list's element into a key. + * @param {Array} list The array to group. + * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of + * `valueFn` for elements which produced that key when passed to `keyFn`. + * @see R.groupBy, R.reduce + * @example + * + * const groupNames = (acc, {name}) => acc.concat(name) + * const toGrade = ({score}) => + * score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A' + * + * var students = [ + * {name: 'Abby', score: 83}, + * {name: 'Bart', score: 62}, + * {name: 'Curt', score: 88}, + * {name: 'Dora', score: 92}, + * ] + * + * reduceBy(groupNames, [], toGrade, students) + * //=> {"A": ["Dora"], "B": ["Abby", "Curt"], "F": ["Bart"]} + */ + +var reduceBy = +/*#__PURE__*/ +_curryN(4, [], +/*#__PURE__*/ +_dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) { + return _reduce(function (acc, elt) { + var key = keyFn(elt); + acc[key] = valueFn(_has(key, acc) ? acc[key] : _clone(valueAcc, [], [], false), elt); + return acc; + }, {}, list); +})); + +export default reduceBy; \ No newline at end of file diff --git a/node_modules/ramda/es/reduceRight.js b/node_modules/ramda/es/reduceRight.js new file mode 100644 index 0000000..82e8bac --- /dev/null +++ b/node_modules/ramda/es/reduceRight.js @@ -0,0 +1,58 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * Similar to [`reduce`](#reduce), except moves through the input list from the + * right to the left. + * + * The iterator function receives two values: *(value, acc)*, while the arguments' + * order of `reduce`'s iterator function is *(acc, value)*. + * + * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduceRight` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> b) -> b -> [a] -> b + * @param {Function} fn The iterator function. Receives two values, the current element from the array + * and the accumulator. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.addIndex + * @example + * + * R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2 + * // - -2 + * // / \ / \ + * // 1 - 1 3 + * // / \ / \ + * // 2 - ==> 2 -1 + * // / \ / \ + * // 3 - 3 4 + * // / \ / \ + * // 4 0 4 0 + * + * @symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a))) + */ + +var reduceRight = +/*#__PURE__*/ +_curry3(function reduceRight(fn, acc, list) { + var idx = list.length - 1; + + while (idx >= 0) { + acc = fn(list[idx], acc); + idx -= 1; + } + + return acc; +}); + +export default reduceRight; \ No newline at end of file diff --git a/node_modules/ramda/es/reduceWhile.js b/node_modules/ramda/es/reduceWhile.js new file mode 100644 index 0000000..f8f29ad --- /dev/null +++ b/node_modules/ramda/es/reduceWhile.js @@ -0,0 +1,42 @@ +import _curryN from "./internal/_curryN.js"; +import _reduce from "./internal/_reduce.js"; +import _reduced from "./internal/_reduced.js"; +/** + * Like [`reduce`](#reduce), `reduceWhile` returns a single item by iterating + * through the list, successively calling the iterator function. `reduceWhile` + * also takes a predicate that is evaluated before each step. If the predicate + * returns `false`, it "short-circuits" the iteration and returns the current + * value of the accumulator. + * + * @func + * @memberOf R + * @since v0.22.0 + * @category List + * @sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} pred The predicate. It is passed the accumulator and the + * current element. + * @param {Function} fn The iterator function. Receives two values, the + * accumulator and the current element. + * @param {*} a The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced + * @example + * + * const isOdd = (acc, x) => x % 2 === 1; + * const xs = [1, 3, 5, 60, 777, 800]; + * R.reduceWhile(isOdd, R.add, 0, xs); //=> 9 + * + * const ys = [2, 4, 6] + * R.reduceWhile(isOdd, R.add, 111, ys); //=> 111 + */ + +var reduceWhile = +/*#__PURE__*/ +_curryN(4, [], function _reduceWhile(pred, fn, a, list) { + return _reduce(function (acc, x) { + return pred(acc, x) ? fn(acc, x) : _reduced(acc); + }, a, list); +}); + +export default reduceWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/reduced.js b/node_modules/ramda/es/reduced.js new file mode 100644 index 0000000..4e04afd --- /dev/null +++ b/node_modules/ramda/es/reduced.js @@ -0,0 +1,33 @@ +import _curry1 from "./internal/_curry1.js"; +import _reduced from "./internal/_reduced.js"; +/** + * Returns a value wrapped to indicate that it is the final value of the reduce + * and transduce functions. The returned value should be considered a black + * box: the internal structure is not guaranteed to be stable. + * + * Note: this optimization is only available to the below functions: + * - [`reduce`](#reduce) + * - [`reduceWhile`](#reduceWhile) + * - [`transduce`](#transduce) + * + * @func + * @memberOf R + * @since v0.15.0 + * @category List + * @sig a -> * + * @param {*} x The final value of the reduce. + * @return {*} The wrapped value. + * @see R.reduce, R.reduceWhile, R.transduce + * @example + * + * R.reduce( + * (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item), + * [], + * [1, 2, 3, 4, 5]) // [1, 2, 3] + */ + +var reduced = +/*#__PURE__*/ +_curry1(_reduced); + +export default reduced; \ No newline at end of file diff --git a/node_modules/ramda/es/reject.js b/node_modules/ramda/es/reject.js new file mode 100644 index 0000000..1a5f361 --- /dev/null +++ b/node_modules/ramda/es/reject.js @@ -0,0 +1,35 @@ +import _complement from "./internal/_complement.js"; +import _curry2 from "./internal/_curry2.js"; +import filter from "./filter.js"; +/** + * The complement of [`filter`](#filter). + * + * Acts as a transducer if a transformer is given in list position. Filterable + * objects include plain objects or any object that has a filter method such + * as `Array`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} + * @see R.filter, R.transduce, R.addIndex + * @example + * + * const isOdd = (n) => n % 2 === 1; + * + * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + * + * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + +var reject = +/*#__PURE__*/ +_curry2(function reject(pred, filterable) { + return filter(_complement(pred), filterable); +}); + +export default reject; \ No newline at end of file diff --git a/node_modules/ramda/es/remove.js b/node_modules/ramda/es/remove.js new file mode 100644 index 0000000..fda6751 --- /dev/null +++ b/node_modules/ramda/es/remove.js @@ -0,0 +1,31 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Removes the sub-list of `list` starting at index `start` and containing + * `count` elements. _Note that this is not destructive_: it returns a copy of + * the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.2.2 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @param {Number} start The position to start removing elements + * @param {Number} count The number of elements to remove + * @param {Array} list The list to remove from + * @return {Array} A new Array with `count` elements from `start` removed. + * @see R.without + * @example + * + * R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8] + */ + +var remove = +/*#__PURE__*/ +_curry3(function remove(start, count, list) { + var result = Array.prototype.slice.call(list, 0); + result.splice(start, count); + return result; +}); + +export default remove; \ No newline at end of file diff --git a/node_modules/ramda/es/repeat.js b/node_modules/ramda/es/repeat.js new file mode 100644 index 0000000..e2308d5 --- /dev/null +++ b/node_modules/ramda/es/repeat.js @@ -0,0 +1,34 @@ +import _curry2 from "./internal/_curry2.js"; +import always from "./always.js"; +import times from "./times.js"; +/** + * Returns a fixed list of size `n` containing a specified identical value. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig a -> n -> [a] + * @param {*} value The value to repeat. + * @param {Number} n The desired size of the output list. + * @return {Array} A new array containing `n` `value`s. + * @see R.times + * @example + * + * R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi'] + * + * const obj = {}; + * const repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}] + * repeatedObjs[0] === repeatedObjs[1]; //=> true + * @symb R.repeat(a, 0) = [] + * @symb R.repeat(a, 1) = [a] + * @symb R.repeat(a, 2) = [a, a] + */ + +var repeat = +/*#__PURE__*/ +_curry2(function repeat(value, n) { + return times(always(value), n); +}); + +export default repeat; \ No newline at end of file diff --git a/node_modules/ramda/es/replace.js b/node_modules/ramda/es/replace.js new file mode 100644 index 0000000..43ba78e --- /dev/null +++ b/node_modules/ramda/es/replace.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Replace a substring or regex match in a string with a replacement. + * + * The first two parameters correspond to the parameters of the + * `String.prototype.replace()` function, so the second parameter can also be a + * function. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category String + * @sig RegExp|String -> String -> String -> String + * @param {RegExp|String} pattern A regular expression or a substring to match. + * @param {String} replacement The string to replace the matches with. + * @param {String} str The String to do the search and replacement in. + * @return {String} The result. + * @example + * + * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo' + * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo' + * + * // Use the "g" (global) flag to replace all occurrences: + * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar' + */ + +var replace = +/*#__PURE__*/ +_curry3(function replace(regex, replacement, str) { + return str.replace(regex, replacement); +}); + +export default replace; \ No newline at end of file diff --git a/node_modules/ramda/es/reverse.js b/node_modules/ramda/es/reverse.js new file mode 100644 index 0000000..7d4bd4d --- /dev/null +++ b/node_modules/ramda/es/reverse.js @@ -0,0 +1,34 @@ +import _curry1 from "./internal/_curry1.js"; +import _isString from "./internal/_isString.js"; +/** + * Returns a new list or string with the elements or characters in reverse + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {Array|String} list + * @return {Array|String} + * @example + * + * R.reverse([1, 2, 3]); //=> [3, 2, 1] + * R.reverse([1, 2]); //=> [2, 1] + * R.reverse([1]); //=> [1] + * R.reverse([]); //=> [] + * + * R.reverse('abc'); //=> 'cba' + * R.reverse('ab'); //=> 'ba' + * R.reverse('a'); //=> 'a' + * R.reverse(''); //=> '' + */ + +var reverse = +/*#__PURE__*/ +_curry1(function reverse(list) { + return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse(); +}); + +export default reverse; \ No newline at end of file diff --git a/node_modules/ramda/es/scan.js b/node_modules/ramda/es/scan.js new file mode 100644 index 0000000..fb6b908 --- /dev/null +++ b/node_modules/ramda/es/scan.js @@ -0,0 +1,40 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Scan is similar to [`reduce`](#reduce), but returns a list of successively + * reduced values from the left + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> [a] + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {Array} A list of all intermediately reduced values. + * @see R.reduce, R.mapAccum + * @example + * + * const numbers = [1, 2, 3, 4]; + * const factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24] + * @symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)] + */ + +var scan = +/*#__PURE__*/ +_curry3(function scan(fn, acc, list) { + var idx = 0; + var len = list.length; + var result = [acc]; + + while (idx < len) { + acc = fn(acc, list[idx]); + result[idx + 1] = acc; + idx += 1; + } + + return result; +}); + +export default scan; \ No newline at end of file diff --git a/node_modules/ramda/es/sequence.js b/node_modules/ramda/es/sequence.js new file mode 100644 index 0000000..965f728 --- /dev/null +++ b/node_modules/ramda/es/sequence.js @@ -0,0 +1,39 @@ +import _curry2 from "./internal/_curry2.js"; +import ap from "./ap.js"; +import map from "./map.js"; +import prepend from "./prepend.js"; +import reduceRight from "./reduceRight.js"; +/** + * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) + * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an + * Applicative of Traversable. + * + * Dispatches to the `sequence` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a) + * @param {Function} of + * @param {*} traversable + * @return {*} + * @see R.traverse + * @example + * + * R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]); //=> Just([1, 2, 3]) + * R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing() + * + * R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)] + * R.sequence(R.of, Nothing()); //=> [Nothing()] + */ + +var sequence = +/*#__PURE__*/ +_curry2(function sequence(of, traversable) { + return typeof traversable.sequence === 'function' ? traversable.sequence(of) : reduceRight(function (x, acc) { + return ap(map(prepend, x), acc); + }, of([]), traversable); +}); + +export default sequence; \ No newline at end of file diff --git a/node_modules/ramda/es/set.js b/node_modules/ramda/es/set.js new file mode 100644 index 0000000..aaabea3 --- /dev/null +++ b/node_modules/ramda/es/set.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +import always from "./always.js"; +import over from "./over.js"; +/** + * Returns the result of "setting" the portion of the given data structure + * focused by the given lens to the given value. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> a -> s -> s + * @param {Lens} lens + * @param {*} v + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lensProp('x'); + * + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2} + */ + +var set = +/*#__PURE__*/ +_curry3(function set(lens, v, x) { + return over(lens, always(v), x); +}); + +export default set; \ No newline at end of file diff --git a/node_modules/ramda/es/slice.js b/node_modules/ramda/es/slice.js new file mode 100644 index 0000000..1f09feb --- /dev/null +++ b/node_modules/ramda/es/slice.js @@ -0,0 +1,36 @@ +import _checkForMethod from "./internal/_checkForMethod.js"; +import _curry3 from "./internal/_curry3.js"; +/** + * Returns the elements of the given list or string (or object with a `slice` + * method) from `fromIndex` (inclusive) to `toIndex` (exclusive). + * + * Dispatches to the `slice` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @sig Number -> Number -> String -> String + * @param {Number} fromIndex The start index (inclusive). + * @param {Number} toIndex The end index (exclusive). + * @param {*} list + * @return {*} + * @example + * + * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd'] + * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c'] + * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(0, 3, 'ramda'); //=> 'ram' + */ + +var slice = +/*#__PURE__*/ +_curry3( +/*#__PURE__*/ +_checkForMethod('slice', function slice(fromIndex, toIndex, list) { + return Array.prototype.slice.call(list, fromIndex, toIndex); +})); + +export default slice; \ No newline at end of file diff --git a/node_modules/ramda/es/sort.js b/node_modules/ramda/es/sort.js new file mode 100644 index 0000000..8995b34 --- /dev/null +++ b/node_modules/ramda/es/sort.js @@ -0,0 +1,29 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a copy of the list, sorted according to the comparator function, + * which should accept two values at a time and return a negative number if the + * first value is smaller, a positive number if it's larger, and zero if they + * are equal. Please note that this is a **copy** of the list. It does not + * modify the original. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, a) -> Number) -> [a] -> [a] + * @param {Function} comparator A sorting function :: a -> b -> Int + * @param {Array} list The list to sort + * @return {Array} a new array with its elements sorted by the comparator function. + * @example + * + * const diff = function(a, b) { return a - b; }; + * R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7] + */ + +var sort = +/*#__PURE__*/ +_curry2(function sort(comparator, list) { + return Array.prototype.slice.call(list, 0).sort(comparator); +}); + +export default sort; \ No newline at end of file diff --git a/node_modules/ramda/es/sortBy.js b/node_modules/ramda/es/sortBy.js new file mode 100644 index 0000000..c3da03a --- /dev/null +++ b/node_modules/ramda/es/sortBy.js @@ -0,0 +1,46 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Sorts the list according to the supplied function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord b => (a -> b) -> [a] -> [a] + * @param {Function} fn + * @param {Array} list The list to sort. + * @return {Array} A new list sorted by the keys generated by `fn`. + * @example + * + * const sortByFirstItem = R.sortBy(R.prop(0)); + * const pairs = [[-1, 1], [-2, 2], [-3, 3]]; + * sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]] + * + * const sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name'))); + * const alice = { + * name: 'ALICE', + * age: 101 + * }; + * const bob = { + * name: 'Bob', + * age: -10 + * }; + * const clara = { + * name: 'clara', + * age: 314.159 + * }; + * const people = [clara, bob, alice]; + * sortByNameCaseInsensitive(people); //=> [alice, bob, clara] + */ + +var sortBy = +/*#__PURE__*/ +_curry2(function sortBy(fn, list) { + return Array.prototype.slice.call(list, 0).sort(function (a, b) { + var aa = fn(a); + var bb = fn(b); + return aa < bb ? -1 : aa > bb ? 1 : 0; + }); +}); + +export default sortBy; \ No newline at end of file diff --git a/node_modules/ramda/es/sortWith.js b/node_modules/ramda/es/sortWith.js new file mode 100644 index 0000000..d9d1f6c --- /dev/null +++ b/node_modules/ramda/es/sortWith.js @@ -0,0 +1,51 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Sorts a list according to a list of comparators. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Relation + * @sig [(a, a) -> Number] -> [a] -> [a] + * @param {Array} functions A list of comparator functions. + * @param {Array} list The list to sort. + * @return {Array} A new list sorted according to the comarator functions. + * @example + * + * const alice = { + * name: 'alice', + * age: 40 + * }; + * const bob = { + * name: 'bob', + * age: 30 + * }; + * const clara = { + * name: 'clara', + * age: 40 + * }; + * const people = [clara, bob, alice]; + * const ageNameSort = R.sortWith([ + * R.descend(R.prop('age')), + * R.ascend(R.prop('name')) + * ]); + * ageNameSort(people); //=> [alice, clara, bob] + */ + +var sortWith = +/*#__PURE__*/ +_curry2(function sortWith(fns, list) { + return Array.prototype.slice.call(list, 0).sort(function (a, b) { + var result = 0; + var i = 0; + + while (result === 0 && i < fns.length) { + result = fns[i](a, b); + i += 1; + } + + return result; + }); +}); + +export default sortWith; \ No newline at end of file diff --git a/node_modules/ramda/es/split.js b/node_modules/ramda/es/split.js new file mode 100644 index 0000000..2585985 --- /dev/null +++ b/node_modules/ramda/es/split.js @@ -0,0 +1,26 @@ +import invoker from "./invoker.js"; +/** + * Splits a string into an array of strings based on the given + * separator. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig (String | RegExp) -> String -> [String] + * @param {String|RegExp} sep The pattern. + * @param {String} str The string to separate into an array. + * @return {Array} The array of strings from `str` separated by `sep`. + * @see R.join + * @example + * + * const pathComponents = R.split('/'); + * R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + * + * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] + */ + +var split = +/*#__PURE__*/ +invoker(1, 'split'); +export default split; \ No newline at end of file diff --git a/node_modules/ramda/es/splitAt.js b/node_modules/ramda/es/splitAt.js new file mode 100644 index 0000000..de54fe1 --- /dev/null +++ b/node_modules/ramda/es/splitAt.js @@ -0,0 +1,29 @@ +import _curry2 from "./internal/_curry2.js"; +import length from "./length.js"; +import slice from "./slice.js"; +/** + * Splits a given list or string at a given index. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig Number -> [a] -> [[a], [a]] + * @sig Number -> String -> [String, String] + * @param {Number} index The index where the array/string is split. + * @param {Array|String} array The array/string to be split. + * @return {Array} + * @example + * + * R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] + * R.splitAt(5, 'hello world'); //=> ['hello', ' world'] + * R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] + */ + +var splitAt = +/*#__PURE__*/ +_curry2(function splitAt(index, array) { + return [slice(0, index, array), slice(index, length(array), array)]; +}); + +export default splitAt; \ No newline at end of file diff --git a/node_modules/ramda/es/splitEvery.js b/node_modules/ramda/es/splitEvery.js new file mode 100644 index 0000000..018650e --- /dev/null +++ b/node_modules/ramda/es/splitEvery.js @@ -0,0 +1,38 @@ +import _curry2 from "./internal/_curry2.js"; +import slice from "./slice.js"; +/** + * Splits a collection into slices of the specified length. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [[a]] + * @sig Number -> String -> [String] + * @param {Number} n + * @param {Array} list + * @return {Array} + * @example + * + * R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]] + * R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz'] + */ + +var splitEvery = +/*#__PURE__*/ +_curry2(function splitEvery(n, list) { + if (n <= 0) { + throw new Error('First argument to splitEvery must be a positive integer'); + } + + var result = []; + var idx = 0; + + while (idx < list.length) { + result.push(slice(idx, idx += n, list)); + } + + return result; +}); + +export default splitEvery; \ No newline at end of file diff --git a/node_modules/ramda/es/splitWhen.js b/node_modules/ramda/es/splitWhen.js new file mode 100644 index 0000000..6bc9baf --- /dev/null +++ b/node_modules/ramda/es/splitWhen.js @@ -0,0 +1,37 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Takes a list and a predicate and returns a pair of lists with the following properties: + * + * - the result of concatenating the two output lists is equivalent to the input list; + * - none of the elements of the first output list satisfies the predicate; and + * - if the second output list is non-empty, its first element satisfies the predicate. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [[a], [a]] + * @param {Function} pred The predicate that determines where the array is split. + * @param {Array} list The array to be split. + * @return {Array} + * @example + * + * R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] + */ + +var splitWhen = +/*#__PURE__*/ +_curry2(function splitWhen(pred, list) { + var idx = 0; + var len = list.length; + var prefix = []; + + while (idx < len && !pred(list[idx])) { + prefix.push(list[idx]); + idx += 1; + } + + return [prefix, Array.prototype.slice.call(list, idx)]; +}); + +export default splitWhen; \ No newline at end of file diff --git a/node_modules/ramda/es/startsWith.js b/node_modules/ramda/es/startsWith.js new file mode 100644 index 0000000..dc3ec5b --- /dev/null +++ b/node_modules/ramda/es/startsWith.js @@ -0,0 +1,33 @@ +import _curry2 from "./internal/_curry2.js"; +import equals from "./equals.js"; +import take from "./take.js"; +/** + * Checks if a list starts with the provided sublist. + * + * Similarly, checks if a string starts with the provided substring. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category List + * @sig [a] -> [a] -> Boolean + * @sig String -> String -> Boolean + * @param {*} prefix + * @param {*} list + * @return {Boolean} + * @see R.endsWith + * @example + * + * R.startsWith('a', 'abc') //=> true + * R.startsWith('b', 'abc') //=> false + * R.startsWith(['a'], ['a', 'b', 'c']) //=> true + * R.startsWith(['b'], ['a', 'b', 'c']) //=> false + */ + +var startsWith = +/*#__PURE__*/ +_curry2(function (prefix, list) { + return equals(take(prefix.length, list), prefix); +}); + +export default startsWith; \ No newline at end of file diff --git a/node_modules/ramda/es/subtract.js b/node_modules/ramda/es/subtract.js new file mode 100644 index 0000000..7d69372 --- /dev/null +++ b/node_modules/ramda/es/subtract.js @@ -0,0 +1,32 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Subtracts its second argument from its first argument. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a - b`. + * @see R.add + * @example + * + * R.subtract(10, 8); //=> 2 + * + * const minus5 = R.subtract(R.__, 5); + * minus5(17); //=> 12 + * + * const complementaryAngle = R.subtract(90); + * complementaryAngle(30); //=> 60 + * complementaryAngle(72); //=> 18 + */ + +var subtract = +/*#__PURE__*/ +_curry2(function subtract(a, b) { + return Number(a) - Number(b); +}); + +export default subtract; \ No newline at end of file diff --git a/node_modules/ramda/es/sum.js b/node_modules/ramda/es/sum.js new file mode 100644 index 0000000..483f1e2 --- /dev/null +++ b/node_modules/ramda/es/sum.js @@ -0,0 +1,22 @@ +import add from "./add.js"; +import reduce from "./reduce.js"; +/** + * Adds together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The sum of all the numbers in the list. + * @see R.reduce + * @example + * + * R.sum([2,4,6,8,100,1]); //=> 121 + */ + +var sum = +/*#__PURE__*/ +reduce(add, 0); +export default sum; \ No newline at end of file diff --git a/node_modules/ramda/es/symmetricDifference.js b/node_modules/ramda/es/symmetricDifference.js new file mode 100644 index 0000000..090d7c9 --- /dev/null +++ b/node_modules/ramda/es/symmetricDifference.js @@ -0,0 +1,29 @@ +import _curry2 from "./internal/_curry2.js"; +import concat from "./concat.js"; +import difference from "./difference.js"; +/** + * Finds the set (i.e. no duplicates) of all elements contained in the first or + * second list, but not both. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` or `list2`, but not both. + * @see R.symmetricDifferenceWith, R.difference, R.differenceWith + * @example + * + * R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5] + * R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2] + */ + +var symmetricDifference = +/*#__PURE__*/ +_curry2(function symmetricDifference(list1, list2) { + return concat(difference(list1, list2), difference(list2, list1)); +}); + +export default symmetricDifference; \ No newline at end of file diff --git a/node_modules/ramda/es/symmetricDifferenceWith.js b/node_modules/ramda/es/symmetricDifferenceWith.js new file mode 100644 index 0000000..b061398 --- /dev/null +++ b/node_modules/ramda/es/symmetricDifferenceWith.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +import concat from "./concat.js"; +import differenceWith from "./differenceWith.js"; +/** + * Finds the set (i.e. no duplicates) of all elements contained in the first or + * second list, but not both. Duplication is determined according to the value + * returned by applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` or `list2`, but not both. + * @see R.symmetricDifference, R.difference, R.differenceWith + * @example + * + * const eqA = R.eqBy(R.prop('a')); + * const l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}]; + * const l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}]; + * R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + */ + +var symmetricDifferenceWith = +/*#__PURE__*/ +_curry3(function symmetricDifferenceWith(pred, list1, list2) { + return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1)); +}); + +export default symmetricDifferenceWith; \ No newline at end of file diff --git a/node_modules/ramda/es/tail.js b/node_modules/ramda/es/tail.js new file mode 100644 index 0000000..6729639 --- /dev/null +++ b/node_modules/ramda/es/tail.js @@ -0,0 +1,40 @@ +import _checkForMethod from "./internal/_checkForMethod.js"; +import _curry1 from "./internal/_curry1.js"; +import slice from "./slice.js"; +/** + * Returns all but the first element of the given list or string (or object + * with a `tail` method). + * + * Dispatches to the `slice` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.head, R.init, R.last + * @example + * + * R.tail([1, 2, 3]); //=> [2, 3] + * R.tail([1, 2]); //=> [2] + * R.tail([1]); //=> [] + * R.tail([]); //=> [] + * + * R.tail('abc'); //=> 'bc' + * R.tail('ab'); //=> 'b' + * R.tail('a'); //=> '' + * R.tail(''); //=> '' + */ + +var tail = +/*#__PURE__*/ +_curry1( +/*#__PURE__*/ +_checkForMethod('tail', +/*#__PURE__*/ +slice(1, Infinity))); + +export default tail; \ No newline at end of file diff --git a/node_modules/ramda/es/take.js b/node_modules/ramda/es/take.js new file mode 100644 index 0000000..5ef0968 --- /dev/null +++ b/node_modules/ramda/es/take.js @@ -0,0 +1,57 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xtake from "./internal/_xtake.js"; +import slice from "./slice.js"; +/** + * Returns the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `take` method). + * + * Dispatches to the `take` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} + * @see R.drop + * @example + * + * R.take(1, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(3, 'ramda'); //=> 'ram' + * + * const personnel = [ + * 'Dave Brubeck', + * 'Paul Desmond', + * 'Eugene Wright', + * 'Joe Morello', + * 'Gerry Mulligan', + * 'Bob Bates', + * 'Joe Dodge', + * 'Ron Crotty' + * ]; + * + * const takeFive = R.take(5); + * takeFive(personnel); + * //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan'] + * @symb R.take(-1, [a, b]) = [a, b] + * @symb R.take(0, [a, b]) = [] + * @symb R.take(1, [a, b]) = [a] + * @symb R.take(2, [a, b]) = [a, b] + */ + +var take = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['take'], _xtake, function take(n, xs) { + return slice(0, n < 0 ? Infinity : n, xs); +})); + +export default take; \ No newline at end of file diff --git a/node_modules/ramda/es/takeLast.js b/node_modules/ramda/es/takeLast.js new file mode 100644 index 0000000..5f5cf66 --- /dev/null +++ b/node_modules/ramda/es/takeLast.js @@ -0,0 +1,32 @@ +import _curry2 from "./internal/_curry2.js"; +import drop from "./drop.js"; +/** + * Returns a new list containing the last `n` elements of the given list. + * If `n > list.length`, returns a list of `list.length` elements. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements to return. + * @param {Array} xs The collection to consider. + * @return {Array} + * @see R.dropLast + * @example + * + * R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] + * R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + * R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.takeLast(3, 'ramda'); //=> 'mda' + */ + +var takeLast = +/*#__PURE__*/ +_curry2(function takeLast(n, xs) { + return drop(n >= 0 ? xs.length - n : 0, xs); +}); + +export default takeLast; \ No newline at end of file diff --git a/node_modules/ramda/es/takeLastWhile.js b/node_modules/ramda/es/takeLastWhile.js new file mode 100644 index 0000000..2c65ca7 --- /dev/null +++ b/node_modules/ramda/es/takeLastWhile.js @@ -0,0 +1,41 @@ +import _curry2 from "./internal/_curry2.js"; +import slice from "./slice.js"; +/** + * Returns a new list containing the last `n` elements of a given list, passing + * each value to the supplied predicate function, and terminating when the + * predicate function returns `false`. Excludes the element that caused the + * predicate function to fail. The predicate function is passed one argument: + * *(value)*. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.dropLastWhile, R.addIndex + * @example + * + * const isNotOne = x => x !== 1; + * + * R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4] + * + * R.takeLastWhile(x => x !== 'R' , 'Ramda'); //=> 'amda' + */ + +var takeLastWhile = +/*#__PURE__*/ +_curry2(function takeLastWhile(fn, xs) { + var idx = xs.length - 1; + + while (idx >= 0 && fn(xs[idx])) { + idx -= 1; + } + + return slice(idx + 1, Infinity, xs); +}); + +export default takeLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/takeWhile.js b/node_modules/ramda/es/takeWhile.js new file mode 100644 index 0000000..ecf0b8d --- /dev/null +++ b/node_modules/ramda/es/takeWhile.js @@ -0,0 +1,50 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xtakeWhile from "./internal/_xtakeWhile.js"; +import slice from "./slice.js"; +/** + * Returns a new list containing the first `n` elements of a given list, + * passing each value to the supplied predicate function, and terminating when + * the predicate function returns `false`. Excludes the element that caused the + * predicate function to fail. The predicate function is passed one argument: + * *(value)*. + * + * Dispatches to the `takeWhile` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.dropWhile, R.transduce, R.addIndex + * @example + * + * const isNotFour = x => x !== 4; + * + * R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3] + * + * R.takeWhile(x => x !== 'd' , 'Ramda'); //=> 'Ram' + */ + +var takeWhile = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['takeWhile'], _xtakeWhile, function takeWhile(fn, xs) { + var idx = 0; + var len = xs.length; + + while (idx < len && fn(xs[idx])) { + idx += 1; + } + + return slice(0, idx, xs); +})); + +export default takeWhile; \ No newline at end of file diff --git a/node_modules/ramda/es/tap.js b/node_modules/ramda/es/tap.js new file mode 100644 index 0000000..acc9c66 --- /dev/null +++ b/node_modules/ramda/es/tap.js @@ -0,0 +1,34 @@ +import _curry2 from "./internal/_curry2.js"; +import _dispatchable from "./internal/_dispatchable.js"; +import _xtap from "./internal/_xtap.js"; +/** + * Runs the given function with the supplied object, then returns the object. + * + * Acts as a transducer if a transformer is given as second parameter. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (a -> *) -> a -> a + * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away. + * @param {*} x + * @return {*} `x`. + * @example + * + * const sayX = x => console.log('x is ' + x); + * R.tap(sayX, 100); //=> 100 + * // logs 'x is 100' + * @symb R.tap(f, a) = a + */ + +var tap = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xtap, function tap(fn, x) { + fn(x); + return x; +})); + +export default tap; \ No newline at end of file diff --git a/node_modules/ramda/es/test.js b/node_modules/ramda/es/test.js new file mode 100644 index 0000000..7644f09 --- /dev/null +++ b/node_modules/ramda/es/test.js @@ -0,0 +1,33 @@ +import _cloneRegExp from "./internal/_cloneRegExp.js"; +import _curry2 from "./internal/_curry2.js"; +import _isRegExp from "./internal/_isRegExp.js"; +import toString from "./toString.js"; +/** + * Determines whether a given string matches a given regular expression. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category String + * @sig RegExp -> String -> Boolean + * @param {RegExp} pattern + * @param {String} str + * @return {Boolean} + * @see R.match + * @example + * + * R.test(/^x/, 'xyz'); //=> true + * R.test(/^y/, 'xyz'); //=> false + */ + +var test = +/*#__PURE__*/ +_curry2(function test(pattern, str) { + if (!_isRegExp(pattern)) { + throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received ' + toString(pattern)); + } + + return _cloneRegExp(pattern).test(str); +}); + +export default test; \ No newline at end of file diff --git a/node_modules/ramda/es/thunkify.js b/node_modules/ramda/es/thunkify.js new file mode 100644 index 0000000..8cf55a1 --- /dev/null +++ b/node_modules/ramda/es/thunkify.js @@ -0,0 +1,33 @@ +import curryN from "./curryN.js"; +import _curry1 from "./internal/_curry1.js"; +/** + * Creates a thunk out of a function. A thunk delays a calculation until + * its result is needed, providing lazy evaluation of arguments. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((a, b, ..., j) -> k) -> (a, b, ..., j) -> (() -> k) + * @param {Function} fn A function to wrap in a thunk + * @return {Function} Expects arguments for `fn` and returns a new function + * that, when called, applies those arguments to `fn`. + * @see R.partial, R.partialRight + * @example + * + * R.thunkify(R.identity)(42)(); //=> 42 + * R.thunkify((a, b) => a + b)(25, 17)(); //=> 42 + */ + +var thunkify = +/*#__PURE__*/ +_curry1(function thunkify(fn) { + return curryN(fn.length, function createThunk() { + var fnArgs = arguments; + return function invokeThunk() { + return fn.apply(this, fnArgs); + }; + }); +}); + +export default thunkify; \ No newline at end of file diff --git a/node_modules/ramda/es/times.js b/node_modules/ramda/es/times.js new file mode 100644 index 0000000..0b29379 --- /dev/null +++ b/node_modules/ramda/es/times.js @@ -0,0 +1,47 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Calls an input function `n` times, returning an array containing the results + * of those function calls. + * + * `fn` is passed one argument: The current value of `n`, which begins at `0` + * and is gradually incremented to `n - 1`. + * + * @func + * @memberOf R + * @since v0.2.3 + * @category List + * @sig (Number -> a) -> Number -> [a] + * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`. + * @param {Number} n A value between `0` and `n - 1`. Increments after each function call. + * @return {Array} An array containing the return values of all calls to `fn`. + * @see R.repeat + * @example + * + * R.times(R.identity, 5); //=> [0, 1, 2, 3, 4] + * @symb R.times(f, 0) = [] + * @symb R.times(f, 1) = [f(0)] + * @symb R.times(f, 2) = [f(0), f(1)] + */ + +var times = +/*#__PURE__*/ +_curry2(function times(fn, n) { + var len = Number(n); + var idx = 0; + var list; + + if (len < 0 || isNaN(len)) { + throw new RangeError('n must be a non-negative number'); + } + + list = new Array(len); + + while (idx < len) { + list[idx] = fn(idx); + idx += 1; + } + + return list; +}); + +export default times; \ No newline at end of file diff --git a/node_modules/ramda/es/toLower.js b/node_modules/ramda/es/toLower.js new file mode 100644 index 0000000..ae4b2d6 --- /dev/null +++ b/node_modules/ramda/es/toLower.js @@ -0,0 +1,21 @@ +import invoker from "./invoker.js"; +/** + * The lower case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to lower case. + * @return {String} The lower case version of `str`. + * @see R.toUpper + * @example + * + * R.toLower('XYZ'); //=> 'xyz' + */ + +var toLower = +/*#__PURE__*/ +invoker(0, 'toLowerCase'); +export default toLower; \ No newline at end of file diff --git a/node_modules/ramda/es/toPairs.js b/node_modules/ramda/es/toPairs.js new file mode 100644 index 0000000..ac84839 --- /dev/null +++ b/node_modules/ramda/es/toPairs.js @@ -0,0 +1,36 @@ +import _curry1 from "./internal/_curry1.js"; +import _has from "./internal/_has.js"; +/** + * Converts an object into an array of key, value arrays. Only the object's + * own properties are used. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own properties. + * @see R.fromPairs + * @example + * + * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] + */ + +var toPairs = +/*#__PURE__*/ +_curry1(function toPairs(obj) { + var pairs = []; + + for (var prop in obj) { + if (_has(prop, obj)) { + pairs[pairs.length] = [prop, obj[prop]]; + } + } + + return pairs; +}); + +export default toPairs; \ No newline at end of file diff --git a/node_modules/ramda/es/toPairsIn.js b/node_modules/ramda/es/toPairsIn.js new file mode 100644 index 0000000..c73a66c --- /dev/null +++ b/node_modules/ramda/es/toPairsIn.js @@ -0,0 +1,36 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Converts an object into an array of key, value arrays. The object's own + * properties and prototype properties are used. Note that the order of the + * output array is not guaranteed to be consistent across different JS + * platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own + * and prototype properties. + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.toPairsIn(f); //=> [['x','X'], ['y','Y']] + */ + +var toPairsIn = +/*#__PURE__*/ +_curry1(function toPairsIn(obj) { + var pairs = []; + + for (var prop in obj) { + pairs[pairs.length] = [prop, obj[prop]]; + } + + return pairs; +}); + +export default toPairsIn; \ No newline at end of file diff --git a/node_modules/ramda/es/toString.js b/node_modules/ramda/es/toString.js new file mode 100644 index 0000000..553e47a --- /dev/null +++ b/node_modules/ramda/es/toString.js @@ -0,0 +1,46 @@ +import _curry1 from "./internal/_curry1.js"; +import _toString from "./internal/_toString.js"; +/** + * Returns the string representation of the given value. `eval`'ing the output + * should result in a value equivalent to the input value. Many of the built-in + * `toString` methods do not satisfy this requirement. + * + * If the given value is an `[object Object]` with a `toString` method other + * than `Object.prototype.toString`, this method is invoked with no arguments + * to produce the return value. This means user-defined constructor functions + * can provide a suitable `toString` method. For example: + * + * function Point(x, y) { + * this.x = x; + * this.y = y; + * } + * + * Point.prototype.toString = function() { + * return 'new Point(' + this.x + ', ' + this.y + ')'; + * }; + * + * R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + * + * @func + * @memberOf R + * @since v0.14.0 + * @category String + * @sig * -> String + * @param {*} val + * @return {String} + * @example + * + * R.toString(42); //=> '42' + * R.toString('abc'); //=> '"abc"' + * R.toString([1, 2, 3]); //=> '[1, 2, 3]' + * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' + * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' + */ + +var toString = +/*#__PURE__*/ +_curry1(function toString(val) { + return _toString(val, []); +}); + +export default toString; \ No newline at end of file diff --git a/node_modules/ramda/es/toUpper.js b/node_modules/ramda/es/toUpper.js new file mode 100644 index 0000000..63ae014 --- /dev/null +++ b/node_modules/ramda/es/toUpper.js @@ -0,0 +1,21 @@ +import invoker from "./invoker.js"; +/** + * The upper case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to upper case. + * @return {String} The upper case version of `str`. + * @see R.toLower + * @example + * + * R.toUpper('abc'); //=> 'ABC' + */ + +var toUpper = +/*#__PURE__*/ +invoker(0, 'toUpperCase'); +export default toUpper; \ No newline at end of file diff --git a/node_modules/ramda/es/transduce.js b/node_modules/ramda/es/transduce.js new file mode 100644 index 0000000..7e63894 --- /dev/null +++ b/node_modules/ramda/es/transduce.js @@ -0,0 +1,57 @@ +import _reduce from "./internal/_reduce.js"; +import _xwrap from "./internal/_xwrap.js"; +import curryN from "./curryN.js"; +/** + * Initializes a transducer using supplied iterator function. Returns a single + * item by iterating through the list, successively calling the transformed + * iterator function and passing it an accumulator value and the current value + * from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It will be + * wrapped as a transformer to initialize the transducer. A transformer can be + * passed directly in place of an iterator function. In both cases, iteration + * may be stopped early with the [`R.reduced`](#reduced) function. + * + * A transducer is a function that accepts a transformer and returns a + * transformer and can be composed directly. + * + * A transformer is an an object that provides a 2-arity reducing iterator + * function, step, 0-arity initial value function, init, and 1-arity result + * extraction function, result. The step function is used as the iterator + * function in reduce. The result function is used to convert the final + * accumulator into the return type and in most cases is + * [`R.identity`](#identity). The init function can be used to provide an + * initial accumulator, but is ignored by transduce. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. Wrapped as transformer, if necessary, and used to + * initialize the transducer + * @param {*} acc The initial accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced, R.into + * @example + * + * const numbers = [1, 2, 3, 4]; + * const transducer = R.compose(R.map(R.add(1)), R.take(2)); + * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] + * + * const isOdd = (x) => x % 2 === 1; + * const firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); + * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] + */ + +var transduce = +/*#__PURE__*/ +curryN(4, function transduce(xf, fn, acc, list) { + return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); +}); +export default transduce; \ No newline at end of file diff --git a/node_modules/ramda/es/transpose.js b/node_modules/ramda/es/transpose.js new file mode 100644 index 0000000..c914186 --- /dev/null +++ b/node_modules/ramda/es/transpose.js @@ -0,0 +1,52 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Transposes the rows and columns of a 2D list. + * When passed a list of `n` lists of length `x`, + * returns a list of `x` lists of length `n`. + * + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig [[a]] -> [[a]] + * @param {Array} list A 2D list + * @return {Array} A 2D list + * @example + * + * R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']] + * R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']] + * + * // If some of the rows are shorter than the following rows, their elements are skipped: + * R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]] + * @symb R.transpose([[a], [b], [c]]) = [a, b, c] + * @symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]] + * @symb R.transpose([[a, b], [c]]) = [[a, c], [b]] + */ + +var transpose = +/*#__PURE__*/ +_curry1(function transpose(outerlist) { + var i = 0; + var result = []; + + while (i < outerlist.length) { + var innerlist = outerlist[i]; + var j = 0; + + while (j < innerlist.length) { + if (typeof result[j] === 'undefined') { + result[j] = []; + } + + result[j].push(innerlist[j]); + j += 1; + } + + i += 1; + } + + return result; +}); + +export default transpose; \ No newline at end of file diff --git a/node_modules/ramda/es/traverse.js b/node_modules/ramda/es/traverse.js new file mode 100644 index 0000000..5080f2b --- /dev/null +++ b/node_modules/ramda/es/traverse.js @@ -0,0 +1,37 @@ +import _curry3 from "./internal/_curry3.js"; +import map from "./map.js"; +import sequence from "./sequence.js"; +/** + * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning + * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable), + * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative + * into an Applicative of Traversable. + * + * Dispatches to the `traverse` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b) + * @param {Function} of + * @param {Function} f + * @param {*} traversable + * @return {*} + * @see R.sequence + * @example + * + * // Returns `Maybe.Nothing` if the given divisor is `0` + * const safeDiv = n => d => d === 0 ? Maybe.Nothing() : Maybe.Just(n / d) + * + * R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Maybe.Just([5, 2.5, 2]) + * R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Maybe.Nothing + */ + +var traverse = +/*#__PURE__*/ +_curry3(function traverse(of, f, traversable) { + return typeof traversable['fantasy-land/traverse'] === 'function' ? traversable['fantasy-land/traverse'](f, of) : sequence(of, map(f, traversable)); +}); + +export default traverse; \ No newline at end of file diff --git a/node_modules/ramda/es/trim.js b/node_modules/ramda/es/trim.js new file mode 100644 index 0000000..683d617 --- /dev/null +++ b/node_modules/ramda/es/trim.js @@ -0,0 +1,36 @@ +import _curry1 from "./internal/_curry1.js"; +var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + '\u2029\uFEFF'; +var zeroWidth = '\u200b'; +var hasProtoTrim = typeof String.prototype.trim === 'function'; +/** + * Removes (strips) whitespace from both ends of the string. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category String + * @sig String -> String + * @param {String} str The string to trim. + * @return {String} Trimmed version of `str`. + * @example + * + * R.trim(' xyz '); //=> 'xyz' + * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] + */ + +var trim = !hasProtoTrim || +/*#__PURE__*/ +ws.trim() || ! +/*#__PURE__*/ +zeroWidth.trim() ? +/*#__PURE__*/ +_curry1(function trim(str) { + var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); + var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); + return str.replace(beginRx, '').replace(endRx, ''); +}) : +/*#__PURE__*/ +_curry1(function trim(str) { + return str.trim(); +}); +export default trim; \ No newline at end of file diff --git a/node_modules/ramda/es/tryCatch.js b/node_modules/ramda/es/tryCatch.js new file mode 100644 index 0000000..d91a937 --- /dev/null +++ b/node_modules/ramda/es/tryCatch.js @@ -0,0 +1,40 @@ +import _arity from "./internal/_arity.js"; +import _concat from "./internal/_concat.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned + * function evaluates the `tryer`; if it does not throw, it simply returns the + * result. If the `tryer` *does* throw, the returned function evaluates the + * `catcher` function and returns its result. Note that for effective + * composition with this function, both the `tryer` and `catcher` functions + * must return the same type of results. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Function + * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a) + * @param {Function} tryer The function that may throw. + * @param {Function} catcher The function that will be evaluated if `tryer` throws. + * @return {Function} A new function that will catch exceptions and send then to the catcher. + * @example + * + * R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true + * R.tryCatch(() => { throw 'foo'}, R.always('catched'))('bar') // => 'catched' + * R.tryCatch(R.times(R.identity), R.always([]))('s') // => [] + * R.tryCatch(() => { throw 'this is not a valid value'}, (err, value)=>({error : err, value }))('bar') // => {'error': 'this is not a valid value', 'value': 'bar'} + */ + +var tryCatch = +/*#__PURE__*/ +_curry2(function _tryCatch(tryer, catcher) { + return _arity(tryer.length, function () { + try { + return tryer.apply(this, arguments); + } catch (e) { + return catcher.apply(this, _concat([e], arguments)); + } + }); +}); + +export default tryCatch; \ No newline at end of file diff --git a/node_modules/ramda/es/type.js b/node_modules/ramda/es/type.js new file mode 100644 index 0000000..0ab2aab --- /dev/null +++ b/node_modules/ramda/es/type.js @@ -0,0 +1,34 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Gives a single-word string description of the (native) type of a value, + * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not + * attempt to distinguish user Object types any further, reporting them all as + * 'Object'. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Type + * @sig (* -> {*}) -> String + * @param {*} val The value to test + * @return {String} + * @example + * + * R.type({}); //=> "Object" + * R.type(1); //=> "Number" + * R.type(false); //=> "Boolean" + * R.type('s'); //=> "String" + * R.type(null); //=> "Null" + * R.type([]); //=> "Array" + * R.type(/[A-z]/); //=> "RegExp" + * R.type(() => {}); //=> "Function" + * R.type(undefined); //=> "Undefined" + */ + +var type = +/*#__PURE__*/ +_curry1(function type(val) { + return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1); +}); + +export default type; \ No newline at end of file diff --git a/node_modules/ramda/es/unapply.js b/node_modules/ramda/es/unapply.js new file mode 100644 index 0000000..9d90321 --- /dev/null +++ b/node_modules/ramda/es/unapply.js @@ -0,0 +1,35 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Takes a function `fn`, which takes a single array argument, and returns a + * function which: + * + * - takes any number of positional arguments; + * - passes these arguments to `fn` as an array; and + * - returns the result. + * + * In other words, `R.unapply` derives a variadic function from a function which + * takes an array. `R.unapply` is the inverse of [`R.apply`](#apply). + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Function + * @sig ([*...] -> a) -> (*... -> a) + * @param {Function} fn + * @return {Function} + * @see R.apply + * @example + * + * R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]' + * @symb R.unapply(f)(a, b) = f([a, b]) + */ + +var unapply = +/*#__PURE__*/ +_curry1(function unapply(fn) { + return function () { + return fn(Array.prototype.slice.call(arguments, 0)); + }; +}); + +export default unapply; \ No newline at end of file diff --git a/node_modules/ramda/es/unary.js b/node_modules/ramda/es/unary.js new file mode 100644 index 0000000..fd7d4f1 --- /dev/null +++ b/node_modules/ramda/es/unary.js @@ -0,0 +1,38 @@ +import _curry1 from "./internal/_curry1.js"; +import nAry from "./nAry.js"; +/** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly 1 parameter. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Function + * @sig (* -> b) -> (a -> b) + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity 1. + * @see R.binary, R.nAry + * @example + * + * const takesTwoArgs = function(a, b) { + * return [a, b]; + * }; + * takesTwoArgs.length; //=> 2 + * takesTwoArgs(1, 2); //=> [1, 2] + * + * const takesOneArg = R.unary(takesTwoArgs); + * takesOneArg.length; //=> 1 + * // Only 1 argument is passed to the wrapped function + * takesOneArg(1, 2); //=> [1, undefined] + * @symb R.unary(f)(a, b, c) = f(a) + */ + +var unary = +/*#__PURE__*/ +_curry1(function unary(fn) { + return nAry(1, fn); +}); + +export default unary; \ No newline at end of file diff --git a/node_modules/ramda/es/uncurryN.js b/node_modules/ramda/es/uncurryN.js new file mode 100644 index 0000000..0bbcb03 --- /dev/null +++ b/node_modules/ramda/es/uncurryN.js @@ -0,0 +1,43 @@ +import _curry2 from "./internal/_curry2.js"; +import curryN from "./curryN.js"; +/** + * Returns a function of arity `n` from a (manually) curried function. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Function + * @sig Number -> (a -> b) -> (a -> c) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to uncurry. + * @return {Function} A new function. + * @see R.curry + * @example + * + * const addFour = a => b => c => d => a + b + c + d; + * + * const uncurriedAddFour = R.uncurryN(4, addFour); + * uncurriedAddFour(1, 2, 3, 4); //=> 10 + */ + +var uncurryN = +/*#__PURE__*/ +_curry2(function uncurryN(depth, fn) { + return curryN(depth, function () { + var currentDepth = 1; + var value = fn; + var idx = 0; + var endIdx; + + while (currentDepth <= depth && typeof value === 'function') { + endIdx = currentDepth === depth ? arguments.length : idx + value.length; + value = value.apply(this, Array.prototype.slice.call(arguments, idx, endIdx)); + currentDepth += 1; + idx = endIdx; + } + + return value; + }); +}); + +export default uncurryN; \ No newline at end of file diff --git a/node_modules/ramda/es/unfold.js b/node_modules/ramda/es/unfold.js new file mode 100644 index 0000000..b4f7ca2 --- /dev/null +++ b/node_modules/ramda/es/unfold.js @@ -0,0 +1,42 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Builds a list from a seed value. Accepts an iterator function, which returns + * either false to stop iteration or an array of length 2 containing the value + * to add to the resulting list and the seed to be used in the next call to the + * iterator function. + * + * The iterator function receives one argument: *(seed)*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig (a -> [b]) -> * -> [b] + * @param {Function} fn The iterator function. receives one argument, `seed`, and returns + * either false to quit iteration or an array of length two to proceed. The element + * at index 0 of this array will be added to the resulting array, and the element + * at index 1 will be passed to the next call to `fn`. + * @param {*} seed The seed value. + * @return {Array} The final list. + * @example + * + * const f = n => n > 50 ? false : [-n, n + 10]; + * R.unfold(f, 10); //=> [-10, -20, -30, -40, -50] + * @symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...] + */ + +var unfold = +/*#__PURE__*/ +_curry2(function unfold(fn, seed) { + var pair = fn(seed); + var result = []; + + while (pair && pair.length) { + result[result.length] = pair[0]; + pair = fn(pair[1]); + } + + return result; +}); + +export default unfold; \ No newline at end of file diff --git a/node_modules/ramda/es/union.js b/node_modules/ramda/es/union.js new file mode 100644 index 0000000..15fd45d --- /dev/null +++ b/node_modules/ramda/es/union.js @@ -0,0 +1,29 @@ +import _concat from "./internal/_concat.js"; +import _curry2 from "./internal/_curry2.js"; +import compose from "./compose.js"; +import uniq from "./uniq.js"; +/** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @example + * + * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] + */ + +var union = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +compose(uniq, _concat)); + +export default union; \ No newline at end of file diff --git a/node_modules/ramda/es/unionWith.js b/node_modules/ramda/es/unionWith.js new file mode 100644 index 0000000..c3f3ba0 --- /dev/null +++ b/node_modules/ramda/es/unionWith.js @@ -0,0 +1,33 @@ +import _concat from "./internal/_concat.js"; +import _curry3 from "./internal/_curry3.js"; +import uniqWith from "./uniqWith.js"; +/** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. Duplication is determined according to the value returned by + * applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [*] -> [*] -> [*] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @see R.union + * @example + * + * const l1 = [{a: 1}, {a: 2}]; + * const l2 = [{a: 1}, {a: 4}]; + * R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}] + */ + +var unionWith = +/*#__PURE__*/ +_curry3(function unionWith(pred, list1, list2) { + return uniqWith(pred, _concat(list1, list2)); +}); + +export default unionWith; \ No newline at end of file diff --git a/node_modules/ramda/es/uniq.js b/node_modules/ramda/es/uniq.js new file mode 100644 index 0000000..2b751bb --- /dev/null +++ b/node_modules/ramda/es/uniq.js @@ -0,0 +1,24 @@ +import identity from "./identity.js"; +import uniqBy from "./uniqBy.js"; +/** + * Returns a new list containing only one copy of each element in the original + * list. [`R.equals`](#equals) is used to determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniq([1, 1, 2, 1]); //=> [1, 2] + * R.uniq([1, '1']); //=> [1, '1'] + * R.uniq([[42], [42]]); //=> [[42]] + */ + +var uniq = +/*#__PURE__*/ +uniqBy(identity); +export default uniq; \ No newline at end of file diff --git a/node_modules/ramda/es/uniqBy.js b/node_modules/ramda/es/uniqBy.js new file mode 100644 index 0000000..9dd0de7 --- /dev/null +++ b/node_modules/ramda/es/uniqBy.js @@ -0,0 +1,44 @@ +import _Set from "./internal/_Set.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied function to + * each list element. Prefers the first item if the supplied function produces + * the same value on two items. [`R.equals`](#equals) is used for comparison. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> b) -> [a] -> [a] + * @param {Function} fn A function used to produce a value to use during comparisons. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] + */ + +var uniqBy = +/*#__PURE__*/ +_curry2(function uniqBy(fn, list) { + var set = new _Set(); + var result = []; + var idx = 0; + var appliedItem, item; + + while (idx < list.length) { + item = list[idx]; + appliedItem = fn(item); + + if (set.add(appliedItem)) { + result.push(item); + } + + idx += 1; + } + + return result; +}); + +export default uniqBy; \ No newline at end of file diff --git a/node_modules/ramda/es/uniqWith.js b/node_modules/ramda/es/uniqWith.js new file mode 100644 index 0000000..534a379 --- /dev/null +++ b/node_modules/ramda/es/uniqWith.js @@ -0,0 +1,47 @@ +import _includesWith from "./internal/_includesWith.js"; +import _curry2 from "./internal/_curry2.js"; +/** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied predicate to + * two list elements. Prefers the first item if two items compare equal based + * on the predicate. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * const strEq = R.eqBy(String); + * R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2] + * R.uniqWith(strEq)([{}, {}]); //=> [{}] + * R.uniqWith(strEq)([1, '1', 1]); //=> [1] + * R.uniqWith(strEq)(['1', 1, 1]); //=> ['1'] + */ + +var uniqWith = +/*#__PURE__*/ +_curry2(function uniqWith(pred, list) { + var idx = 0; + var len = list.length; + var result = []; + var item; + + while (idx < len) { + item = list[idx]; + + if (!_includesWith(pred, item, result)) { + result[result.length] = item; + } + + idx += 1; + } + + return result; +}); + +export default uniqWith; \ No newline at end of file diff --git a/node_modules/ramda/es/unless.js b/node_modules/ramda/es/unless.js new file mode 100644 index 0000000..8b63057 --- /dev/null +++ b/node_modules/ramda/es/unless.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Tests the final argument by passing it to the given predicate function. If + * the predicate is not satisfied, the function will return the result of + * calling the `whenFalseFn` function with the same argument. If the predicate + * is satisfied, the argument is returned as is. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates + * to a falsy value. + * @param {*} x An object to test with the `pred` function and + * pass to `whenFalseFn` if necessary. + * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`. + * @see R.ifElse, R.when, R.cond + * @example + * + * let safeInc = R.unless(R.isNil, R.inc); + * safeInc(null); //=> null + * safeInc(1); //=> 2 + */ + +var unless = +/*#__PURE__*/ +_curry3(function unless(pred, whenFalseFn, x) { + return pred(x) ? x : whenFalseFn(x); +}); + +export default unless; \ No newline at end of file diff --git a/node_modules/ramda/es/unnest.js b/node_modules/ramda/es/unnest.js new file mode 100644 index 0000000..718d010 --- /dev/null +++ b/node_modules/ramda/es/unnest.js @@ -0,0 +1,24 @@ +import _identity from "./internal/_identity.js"; +import chain from "./chain.js"; +/** + * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from + * any [Chain](https://github.com/fantasyland/fantasy-land#chain). + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain c => c (c a) -> c a + * @param {*} list + * @return {*} + * @see R.flatten, R.chain + * @example + * + * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] + * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] + */ + +var unnest = +/*#__PURE__*/ +chain(_identity); +export default unnest; \ No newline at end of file diff --git a/node_modules/ramda/es/until.js b/node_modules/ramda/es/until.js new file mode 100644 index 0000000..abb744e --- /dev/null +++ b/node_modules/ramda/es/until.js @@ -0,0 +1,34 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Takes a predicate, a transformation function, and an initial value, + * and returns a value of the same type as the initial value. + * It does so by applying the transformation until the predicate is satisfied, + * at which point it returns the satisfactory value. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} fn The iterator function + * @param {*} init Initial value + * @return {*} Final value that satisfies predicate + * @example + * + * R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128 + */ + +var until = +/*#__PURE__*/ +_curry3(function until(pred, fn, init) { + var val = init; + + while (!pred(val)) { + val = fn(val); + } + + return val; +}); + +export default until; \ No newline at end of file diff --git a/node_modules/ramda/es/update.js b/node_modules/ramda/es/update.js new file mode 100644 index 0000000..7f8a5bd --- /dev/null +++ b/node_modules/ramda/es/update.js @@ -0,0 +1,33 @@ +import _curry3 from "./internal/_curry3.js"; +import adjust from "./adjust.js"; +import always from "./always.js"; +/** + * Returns a new copy of the array with the element at the provided index + * replaced with the given value. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig Number -> a -> [a] -> [a] + * @param {Number} idx The index to update. + * @param {*} x The value to exist at the given index of the returned array. + * @param {Array|Arguments} list The source array-like object to be updated. + * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`. + * @see R.adjust + * @example + * + * R.update(1, '_', ['a', 'b', 'c']); //=> ['a', '_', 'c'] + * R.update(-1, '_', ['a', 'b', 'c']); //=> ['a', 'b', '_'] + * @symb R.update(-1, a, [b, c]) = [b, a] + * @symb R.update(0, a, [b, c]) = [a, c] + * @symb R.update(1, a, [b, c]) = [b, a] + */ + +var update = +/*#__PURE__*/ +_curry3(function update(idx, x, list) { + return adjust(idx, always(x), list); +}); + +export default update; \ No newline at end of file diff --git a/node_modules/ramda/es/useWith.js b/node_modules/ramda/es/useWith.js new file mode 100644 index 0000000..550c170 --- /dev/null +++ b/node_modules/ramda/es/useWith.js @@ -0,0 +1,49 @@ +import _curry2 from "./internal/_curry2.js"; +import curryN from "./curryN.js"; +/** + * Accepts a function `fn` and a list of transformer functions and returns a + * new curried function. When the new function is invoked, it calls the + * function `fn` with parameters consisting of the result of calling each + * supplied handler on successive arguments to the new function. + * + * If more arguments are passed to the returned function than transformer + * functions, those arguments are passed directly to `fn` as additional + * parameters. If you expect additional arguments that don't need to be + * transformed, although you can ignore them, it's best to pass an identity + * function so that the new function reports the correct arity. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} fn The function to wrap. + * @param {Array} transformers A list of transformer functions + * @return {Function} The wrapped function. + * @see R.converge + * @example + * + * R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + * R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + * R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 + * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) + */ + +var useWith = +/*#__PURE__*/ +_curry2(function useWith(fn, transformers) { + return curryN(transformers.length, function () { + var args = []; + var idx = 0; + + while (idx < transformers.length) { + args.push(transformers[idx].call(this, arguments[idx])); + idx += 1; + } + + return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length))); + }); +}); + +export default useWith; \ No newline at end of file diff --git a/node_modules/ramda/es/values.js b/node_modules/ramda/es/values.js new file mode 100644 index 0000000..432f019 --- /dev/null +++ b/node_modules/ramda/es/values.js @@ -0,0 +1,37 @@ +import _curry1 from "./internal/_curry1.js"; +import keys from "./keys.js"; +/** + * Returns a list of all the enumerable own properties of the supplied object. + * Note that the order of the output array is not guaranteed across different + * JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [v] + * @param {Object} obj The object to extract values from + * @return {Array} An array of the values of the object's own properties. + * @see R.valuesIn, R.keys + * @example + * + * R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3] + */ + +var values = +/*#__PURE__*/ +_curry1(function values(obj) { + var props = keys(obj); + var len = props.length; + var vals = []; + var idx = 0; + + while (idx < len) { + vals[idx] = obj[props[idx]]; + idx += 1; + } + + return vals; +}); + +export default values; \ No newline at end of file diff --git a/node_modules/ramda/es/valuesIn.js b/node_modules/ramda/es/valuesIn.js new file mode 100644 index 0000000..e419304 --- /dev/null +++ b/node_modules/ramda/es/valuesIn.js @@ -0,0 +1,37 @@ +import _curry1 from "./internal/_curry1.js"; +/** + * Returns a list of all the properties, including prototype properties, of the + * supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @sig {k: v} -> [v] + * @param {Object} obj The object to extract values from + * @return {Array} An array of the values of the object's own and prototype properties. + * @see R.values, R.keysIn + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.valuesIn(f); //=> ['X', 'Y'] + */ + +var valuesIn = +/*#__PURE__*/ +_curry1(function valuesIn(obj) { + var prop; + var vs = []; + + for (prop in obj) { + vs[vs.length] = obj[prop]; + } + + return vs; +}); + +export default valuesIn; \ No newline at end of file diff --git a/node_modules/ramda/es/view.js b/node_modules/ramda/es/view.js new file mode 100644 index 0000000..c6a1374 --- /dev/null +++ b/node_modules/ramda/es/view.js @@ -0,0 +1,42 @@ +import _curry2 from "./internal/_curry2.js"; // `Const` is a functor that effectively ignores the function given to `map`. + +var Const = function (x) { + return { + value: x, + 'fantasy-land/map': function () { + return this; + } + }; +}; +/** + * Returns a "view" of the given data structure, determined by the given lens. + * The lens's focus determines which portion of the data structure is visible. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> s -> a + * @param {Lens} lens + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lensProp('x'); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.view(xLens, {x: 4, y: 2}); //=> 4 + */ + + +var view = +/*#__PURE__*/ +_curry2(function view(lens, x) { + // Using `Const` effectively ignores the setter function of the `lens`, + // leaving the value returned by the getter function unmodified. + return lens(Const)(x).value; +}); + +export default view; \ No newline at end of file diff --git a/node_modules/ramda/es/when.js b/node_modules/ramda/es/when.js new file mode 100644 index 0000000..e7b8796 --- /dev/null +++ b/node_modules/ramda/es/when.js @@ -0,0 +1,37 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Tests the final argument by passing it to the given predicate function. If + * the predicate is satisfied, the function will return the result of calling + * the `whenTrueFn` function with the same argument. If the predicate is not + * satisfied, the argument is returned as is. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} whenTrueFn A function to invoke when the `condition` + * evaluates to a truthy value. + * @param {*} x An object to test with the `pred` function and + * pass to `whenTrueFn` if necessary. + * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`. + * @see R.ifElse, R.unless, R.cond + * @example + * + * // truncate :: String -> String + * const truncate = R.when( + * R.propSatisfies(R.gt(R.__, 10), 'length'), + * R.pipe(R.take(10), R.append('…'), R.join('')) + * ); + * truncate('12345'); //=> '12345' + * truncate('0123456789ABC'); //=> '0123456789…' + */ + +var when = +/*#__PURE__*/ +_curry3(function when(pred, whenTrueFn, x) { + return pred(x) ? whenTrueFn(x) : x; +}); + +export default when; \ No newline at end of file diff --git a/node_modules/ramda/es/where.js b/node_modules/ramda/es/where.js new file mode 100644 index 0000000..deb4058 --- /dev/null +++ b/node_modules/ramda/es/where.js @@ -0,0 +1,51 @@ +import _curry2 from "./internal/_curry2.js"; +import _has from "./internal/_has.js"; +/** + * Takes a spec object and a test object; returns true if the test satisfies + * the spec. Each of the spec's own properties must be a predicate function. + * Each predicate is applied to the value of the corresponding property of the + * test object. `where` returns true if all the predicates return true, false + * otherwise. + * + * `where` is well suited to declaratively expressing constraints for other + * functions such as [`filter`](#filter) and [`find`](#find). + * + * @func + * @memberOf R + * @since v0.1.1 + * @category Object + * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean + * @param {Object} spec + * @param {Object} testObj + * @return {Boolean} + * @see R.propSatisfies, R.whereEq + * @example + * + * // pred :: Object -> Boolean + * const pred = R.where({ + * a: R.equals('foo'), + * b: R.complement(R.equals('bar')), + * x: R.gt(R.__, 10), + * y: R.lt(R.__, 20) + * }); + * + * pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true + * pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false + * pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false + * pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false + * pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false + */ + +var where = +/*#__PURE__*/ +_curry2(function where(spec, testObj) { + for (var prop in spec) { + if (_has(prop, spec) && !spec[prop](testObj[prop])) { + return false; + } + } + + return true; +}); + +export default where; \ No newline at end of file diff --git a/node_modules/ramda/es/whereEq.js b/node_modules/ramda/es/whereEq.js new file mode 100644 index 0000000..60ec210 --- /dev/null +++ b/node_modules/ramda/es/whereEq.js @@ -0,0 +1,40 @@ +import _curry2 from "./internal/_curry2.js"; +import equals from "./equals.js"; +import map from "./map.js"; +import where from "./where.js"; +/** + * Takes a spec object and a test object; returns true if the test satisfies + * the spec, false otherwise. An object satisfies the spec if, for each of the + * spec's own properties, accessing that property of the object gives the same + * value (in [`R.equals`](#equals) terms) as accessing that property of the + * spec. + * + * `whereEq` is a specialization of [`where`](#where). + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @sig {String: *} -> {String: *} -> Boolean + * @param {Object} spec + * @param {Object} testObj + * @return {Boolean} + * @see R.propEq, R.where + * @example + * + * // pred :: Object -> Boolean + * const pred = R.whereEq({a: 1, b: 2}); + * + * pred({a: 1}); //=> false + * pred({a: 1, b: 2}); //=> true + * pred({a: 1, b: 2, c: 3}); //=> true + * pred({a: 1, b: 1}); //=> false + */ + +var whereEq = +/*#__PURE__*/ +_curry2(function whereEq(spec, testObj) { + return where(map(equals, spec), testObj); +}); + +export default whereEq; \ No newline at end of file diff --git a/node_modules/ramda/es/without.js b/node_modules/ramda/es/without.js new file mode 100644 index 0000000..695bd29 --- /dev/null +++ b/node_modules/ramda/es/without.js @@ -0,0 +1,31 @@ +import _includes from "./internal/_includes.js"; +import _curry2 from "./internal/_curry2.js"; +import flip from "./flip.js"; +import reject from "./reject.js"; +/** + * Returns a new list without values in the first argument. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig [a] -> [a] -> [a] + * @param {Array} list1 The values to be removed from `list2`. + * @param {Array} list2 The array to remove values from. + * @return {Array} The new array without values in `list1`. + * @see R.transduce, R.difference, R.remove + * @example + * + * R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4] + */ + +var without = +/*#__PURE__*/ +_curry2(function (xs, list) { + return reject(flip(_includes)(xs), list); +}); + +export default without; \ No newline at end of file diff --git a/node_modules/ramda/es/xor.js b/node_modules/ramda/es/xor.js new file mode 100644 index 0000000..1748128 --- /dev/null +++ b/node_modules/ramda/es/xor.js @@ -0,0 +1,30 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Exclusive disjunction logical operation. + * Returns `true` if one of the arguments is truthy and the other is falsy. + * Otherwise, it returns `false`. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Logic + * @sig a -> b -> Boolean + * @param {Any} a + * @param {Any} b + * @return {Boolean} true if one of the arguments is truthy and the other is falsy + * @see R.or, R.and + * @example + * + * R.xor(true, true); //=> false + * R.xor(true, false); //=> true + * R.xor(false, true); //=> true + * R.xor(false, false); //=> false + */ + +var xor = +/*#__PURE__*/ +_curry2(function xor(a, b) { + return Boolean(!a ^ !b); +}); + +export default xor; \ No newline at end of file diff --git a/node_modules/ramda/es/xprod.js b/node_modules/ramda/es/xprod.js new file mode 100644 index 0000000..c831017 --- /dev/null +++ b/node_modules/ramda/es/xprod.js @@ -0,0 +1,45 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Creates a new list out of the two supplied by creating each possible pair + * from the lists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] -> [[a,b]] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The list made by combining each possible pair from + * `as` and `bs` into pairs (`[a, b]`). + * @example + * + * R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]] + */ + +var xprod = +/*#__PURE__*/ +_curry2(function xprod(a, b) { + // = xprodWith(prepend); (takes about 3 times as long...) + var idx = 0; + var ilen = a.length; + var j; + var jlen = b.length; + var result = []; + + while (idx < ilen) { + j = 0; + + while (j < jlen) { + result[result.length] = [a[idx], b[j]]; + j += 1; + } + + idx += 1; + } + + return result; +}); + +export default xprod; \ No newline at end of file diff --git a/node_modules/ramda/es/zip.js b/node_modules/ramda/es/zip.js new file mode 100644 index 0000000..22da39c --- /dev/null +++ b/node_modules/ramda/es/zip.js @@ -0,0 +1,37 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Creates a new list out of the two supplied by pairing up equally-positioned + * items from both lists. The returned list is truncated to the length of the + * shorter of the two input lists. + * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] -> [[a,b]] + * @param {Array} list1 The first array to consider. + * @param {Array} list2 The second array to consider. + * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`. + * @example + * + * R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + * @symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]] + */ + +var zip = +/*#__PURE__*/ +_curry2(function zip(a, b) { + var rv = []; + var idx = 0; + var len = Math.min(a.length, b.length); + + while (idx < len) { + rv[idx] = [a[idx], b[idx]]; + idx += 1; + } + + return rv; +}); + +export default zip; \ No newline at end of file diff --git a/node_modules/ramda/es/zipObj.js b/node_modules/ramda/es/zipObj.js new file mode 100644 index 0000000..e8aca45 --- /dev/null +++ b/node_modules/ramda/es/zipObj.js @@ -0,0 +1,35 @@ +import _curry2 from "./internal/_curry2.js"; +/** + * Creates a new object out of a list of keys and a list of values. + * Key/value pairing is truncated to the length of the shorter of the two lists. + * Note: `zipObj` is equivalent to `pipe(zip, fromPairs)`. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [String] -> [*] -> {String: *} + * @param {Array} keys The array that will be properties on the output object. + * @param {Array} values The list of values on the output object. + * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`. + * @example + * + * R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} + */ + +var zipObj = +/*#__PURE__*/ +_curry2(function zipObj(keys, values) { + var idx = 0; + var len = Math.min(keys.length, values.length); + var out = {}; + + while (idx < len) { + out[keys[idx]] = values[idx]; + idx += 1; + } + + return out; +}); + +export default zipObj; \ No newline at end of file diff --git a/node_modules/ramda/es/zipWith.js b/node_modules/ramda/es/zipWith.js new file mode 100644 index 0000000..4901cd5 --- /dev/null +++ b/node_modules/ramda/es/zipWith.js @@ -0,0 +1,42 @@ +import _curry3 from "./internal/_curry3.js"; +/** + * Creates a new list out of the two supplied by applying the function to each + * equally-positioned pair in the lists. The returned list is truncated to the + * length of the shorter of the two input lists. + * + * @function + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> c) -> [a] -> [b] -> [c] + * @param {Function} fn The function used to combine the two elements into one value. + * @param {Array} list1 The first array to consider. + * @param {Array} list2 The second array to consider. + * @return {Array} The list made by combining same-indexed elements of `list1` and `list2` + * using `fn`. + * @example + * + * const f = (x, y) => { + * // ... + * }; + * R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); + * //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + * @symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)] + */ + +var zipWith = +/*#__PURE__*/ +_curry3(function zipWith(fn, a, b) { + var rv = []; + var idx = 0; + var len = Math.min(a.length, b.length); + + while (idx < len) { + rv[idx] = fn(a[idx], b[idx]); + idx += 1; + } + + return rv; +}); + +export default zipWith; \ No newline at end of file diff --git a/node_modules/ramda/package.json b/node_modules/ramda/package.json new file mode 100644 index 0000000..2b2e455 --- /dev/null +++ b/node_modules/ramda/package.json @@ -0,0 +1,137 @@ +{ + "_from": "ramda@0.27.0", + "_id": "ramda@0.27.0", + "_inBundle": false, + "_integrity": "sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA==", + "_location": "/ramda", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ramda@0.27.0", + "name": "ramda", + "escapedName": "ramda", + "rawSpec": "0.27.0", + "saveSpec": null, + "fetchSpec": "0.27.0" + }, + "_requiredBy": [ + "/docker-hub-utils" + ], + "_resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.0.tgz", + "_shasum": "915dc29865c0800bf3f69b8fd6c279898b59de43", + "_spec": "ramda@0.27.0", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/docker-hub-utils", + "author": { + "name": "Scott Sauyet", + "email": "scott@sauyet.com", + "url": "scott.sauyet.com" + }, + "bugs": { + "url": "https://github.com/ramda/ramda/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Michael Hurley", + "email": "mh@buzzdecafe.com", + "url": "http://buzzdecafe.com" + }, + { + "name": "Scott Sauyet", + "email": "scott@sauyet.com", + "url": "http://fr.umio.us" + }, + { + "name": "David Chambers", + "email": "dc@davidchambers.me", + "url": "http://davidchambers.me" + }, + { + "name": "Graeme Yeates", + "email": "yeatesgraeme@gmail.com", + "url": "https://github.com/megawac" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "A practical functional library for JavaScript programmers.", + "devDependencies": { + "@babel/cli": "^7.4.4", + "@babel/core": "^7.4.5", + "@babel/register": "^7.4.4", + "@babel/types": "^7.4.4", + "babel-plugin-annotate-pure-calls": "^0.4.0", + "babel-plugin-import-export-rename": "^1.0.1", + "babelify": "^10.0.0", + "benchmark": "~1.0.0", + "browserify": "https://api.github.com/repos/browserify/browserify/tarball/9ff7c55cc67a7ddbc64f8e7270bcd75fcc72ce2f", + "cli-table": "0.3.x", + "cross-env": "^5.2.0", + "dox": "latest", + "envvar": "^2.0.0", + "eslint": "^5.16.0", + "handlebars": ">=4.1.2", + "istanbul": "^0.4.x", + "js-yaml": "^3.13.1", + "jsverify": "^0.8.4", + "mocha": "^6.1.4", + "ramda": "0.17.x", + "rimraf": "^2.6.3", + "rollup": "^0.68.2", + "rollup-plugin-uglify": "^6.0.2", + "sanctuary": "0.7.x", + "sinon": "^7.3.2", + "testem": "^2.16.0", + "xyz": "^3.0.0" + }, + "files": [ + "es", + "src", + "dist" + ], + "homepage": "https://ramdajs.com/", + "jsdelivr": "dist/ramda.min.js", + "keywords": [ + "ramda", + "functional", + "utils", + "utilities", + "toolkit", + "fp", + "tacit", + "point-free", + "curried", + "pure", + "fantasy-land" + ], + "license": "MIT", + "main": "src/index", + "module": "es/index.js", + "name": "ramda", + "repository": { + "type": "git", + "url": "git://github.com/ramda/ramda.git" + }, + "scripts": { + "bench": "node scripts/benchRunner", + "bookmarklet": "node scripts/bookmarklet", + "browser_test": "testem ci", + "build": "npm run build:es && npm run build:cjs && npm run build:umd && npm run build:umd:min && npm run build:mjs", + "build:cjs": "cross-env BABEL_ENV=cjs babel source --out-dir src", + "build:es": "cross-env BABEL_ENV=es babel source --out-dir es", + "build:mjs": "cross-env BABEL_ENV=es babel source/index.js --out-file src/index.mjs", + "build:umd": "cross-env NODE_ENV=development rollup -c -o dist/ramda.js", + "build:umd:min": "cross-env NODE_ENV=production rollup -c -o dist/ramda.min.js", + "clean": "rimraf es/* src/* dist/* coverage/*", + "coverage": "istanbul cover node_modules/.bin/_mocha -- --reporter spec", + "lint": "eslint scripts/bookmarklet scripts/*.js source/*.js source/internal/*.js test/*.js test/**/*.js lib/sauce/*.js lib/bench/*.js", + "partial-build": "node ./scripts/partialBuild", + "prebench": "npm run --silent build:cjs", + "prepare": "npm run clean && npm run build", + "test": "cross-env BABEL_ENV=cjs mocha --require @babel/register --reporter spec" + }, + "sideEffects": false, + "unpkg": "dist/ramda.min.js", + "version": "0.27.0" +} diff --git a/node_modules/ramda/src/F.js b/node_modules/ramda/src/F.js new file mode 100644 index 0000000..25aa99e --- /dev/null +++ b/node_modules/ramda/src/F.js @@ -0,0 +1,20 @@ +/** + * A function that always returns `false`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.T + * @example + * + * R.F(); //=> false + */ +var F = function () { + return false; +}; + +module.exports = F; \ No newline at end of file diff --git a/node_modules/ramda/src/T.js b/node_modules/ramda/src/T.js new file mode 100644 index 0000000..74df5e7 --- /dev/null +++ b/node_modules/ramda/src/T.js @@ -0,0 +1,20 @@ +/** + * A function that always returns `true`. Any passed in parameters are ignored. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig * -> Boolean + * @param {*} + * @return {Boolean} + * @see R.F + * @example + * + * R.T(); //=> true + */ +var T = function () { + return true; +}; + +module.exports = T; \ No newline at end of file diff --git a/node_modules/ramda/src/__.js b/node_modules/ramda/src/__.js new file mode 100644 index 0000000..539415e --- /dev/null +++ b/node_modules/ramda/src/__.js @@ -0,0 +1,30 @@ +/** + * A special placeholder value used to specify "gaps" within curried functions, + * allowing partial application of any combination of arguments, regardless of + * their positions. + * + * If `g` is a curried ternary function and `_` is `R.__`, the following are + * equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2, _)(1, 3)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @name __ + * @constant + * @memberOf R + * @since v0.6.0 + * @category Function + * @example + * + * const greet = R.replace('{name}', R.__, 'Hello, {name}!'); + * greet('Alice'); //=> 'Hello, Alice!' + */ +module.exports = { + '@@functional/placeholder': true +}; \ No newline at end of file diff --git a/node_modules/ramda/src/add.js b/node_modules/ramda/src/add.js new file mode 100644 index 0000000..30bb37c --- /dev/null +++ b/node_modules/ramda/src/add.js @@ -0,0 +1,29 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Adds two values. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a + * @param {Number} b + * @return {Number} + * @see R.subtract + * @example + * + * R.add(2, 3); //=> 5 + * R.add(7)(10); //=> 17 + */ + + +var add = +/*#__PURE__*/ +_curry2(function add(a, b) { + return Number(a) + Number(b); +}); + +module.exports = add; \ No newline at end of file diff --git a/node_modules/ramda/src/addIndex.js b/node_modules/ramda/src/addIndex.js new file mode 100644 index 0000000..2df4dfd --- /dev/null +++ b/node_modules/ramda/src/addIndex.js @@ -0,0 +1,57 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Creates a new list iteration function from an existing one by adding two new + * parameters to its callback function: the current index, and the entire list. + * + * This would turn, for instance, [`R.map`](#map) function into one that + * more closely resembles `Array.prototype.map`. Note that this will only work + * for functions in which the iteration callback function is the first + * parameter, and where the list is the last parameter. (This latter might be + * unimportant if the list parameter is not used.) + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Function + * @category List + * @sig ((a ... -> b) ... -> [a] -> *) -> ((a ..., Int, [a] -> b) ... -> [a] -> *) + * @param {Function} fn A list iteration function that does not pass index or list to its callback + * @return {Function} An altered list iteration function that passes (item, index, list) to its callback + * @example + * + * const mapIndexed = R.addIndex(R.map); + * mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']); + * //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r'] + */ + + +var addIndex = +/*#__PURE__*/ +_curry1(function addIndex(fn) { + return curryN(fn.length, function () { + var idx = 0; + var origFn = arguments[0]; + var list = arguments[arguments.length - 1]; + var args = Array.prototype.slice.call(arguments, 0); + + args[0] = function () { + var result = origFn.apply(this, _concat(arguments, [idx, list])); + idx += 1; + return result; + }; + + return fn.apply(this, args); + }); +}); + +module.exports = addIndex; \ No newline at end of file diff --git a/node_modules/ramda/src/adjust.js b/node_modules/ramda/src/adjust.js new file mode 100644 index 0000000..0034da7 --- /dev/null +++ b/node_modules/ramda/src/adjust.js @@ -0,0 +1,52 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Applies a function to the value at the given index of an array, returning a + * new copy of the array with the element at the given index replaced with the + * result of the function application. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig Number -> (a -> a) -> [a] -> [a] + * @param {Number} idx The index. + * @param {Function} fn The function to apply. + * @param {Array|Arguments} list An array-like object whose value + * at the supplied index will be replaced. + * @return {Array} A copy of the supplied array-like object with + * the element at index `idx` replaced with the value + * returned by applying `fn` to the existing element. + * @see R.update + * @example + * + * R.adjust(1, R.toUpper, ['a', 'b', 'c', 'd']); //=> ['a', 'B', 'c', 'd'] + * R.adjust(-1, R.toUpper, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c', 'D'] + * @symb R.adjust(-1, f, [a, b]) = [a, f(b)] + * @symb R.adjust(0, f, [a, b]) = [f(a), b] + */ + + +var adjust = +/*#__PURE__*/ +_curry3(function adjust(idx, fn, list) { + if (idx >= list.length || idx < -list.length) { + return list; + } + + var start = idx < 0 ? list.length : 0; + + var _idx = start + idx; + + var _list = _concat(list); + + _list[_idx] = fn(list[_idx]); + return _list; +}); + +module.exports = adjust; \ No newline at end of file diff --git a/node_modules/ramda/src/all.js b/node_modules/ramda/src/all.js new file mode 100644 index 0000000..00ec4b7 --- /dev/null +++ b/node_modules/ramda/src/all.js @@ -0,0 +1,56 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xall = +/*#__PURE__*/ +require("./internal/_xall"); +/** + * Returns `true` if all elements of the list match the predicate, `false` if + * there are any that don't. + * + * Dispatches to the `all` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is satisfied by every element, `false` + * otherwise. + * @see R.any, R.none, R.transduce + * @example + * + * const equals3 = R.equals(3); + * R.all(equals3)([3, 3, 3, 3]); //=> true + * R.all(equals3)([3, 3, 1, 3]); //=> false + */ + + +var all = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['all'], _xall, function all(fn, list) { + var idx = 0; + + while (idx < list.length) { + if (!fn(list[idx])) { + return false; + } + + idx += 1; + } + + return true; +})); + +module.exports = all; \ No newline at end of file diff --git a/node_modules/ramda/src/allPass.js b/node_modules/ramda/src/allPass.js new file mode 100644 index 0000000..6481d2b --- /dev/null +++ b/node_modules/ramda/src/allPass.js @@ -0,0 +1,66 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var max = +/*#__PURE__*/ +require("./max"); + +var pluck = +/*#__PURE__*/ +require("./pluck"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); +/** + * Takes a list of predicates and returns a predicate that returns true for a + * given list of arguments if every one of the provided predicates is satisfied + * by those arguments. + * + * The function returned is a curried function whose arity matches that of the + * highest-arity predicate. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Logic + * @sig [(*... -> Boolean)] -> (*... -> Boolean) + * @param {Array} predicates An array of predicates to check + * @return {Function} The combined predicate + * @see R.anyPass + * @example + * + * const isQueen = R.propEq('rank', 'Q'); + * const isSpade = R.propEq('suit', '♠︎'); + * const isQueenOfSpades = R.allPass([isQueen, isSpade]); + * + * isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false + * isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true + */ + + +var allPass = +/*#__PURE__*/ +_curry1(function allPass(preds) { + return curryN(reduce(max, 0, pluck('length', preds)), function () { + var idx = 0; + var len = preds.length; + + while (idx < len) { + if (!preds[idx].apply(this, arguments)) { + return false; + } + + idx += 1; + } + + return true; + }); +}); + +module.exports = allPass; \ No newline at end of file diff --git a/node_modules/ramda/src/always.js b/node_modules/ramda/src/always.js new file mode 100644 index 0000000..3971395 --- /dev/null +++ b/node_modules/ramda/src/always.js @@ -0,0 +1,33 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Returns a function that always returns the given value. Note that for + * non-primitives the value returned is a reference to the original value. + * + * This function is known as `const`, `constant`, or `K` (for K combinator) in + * other languages and libraries. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> (* -> a) + * @param {*} val The value to wrap in a function + * @return {Function} A Function :: * -> val. + * @example + * + * const t = R.always('Tee'); + * t(); //=> 'Tee' + */ + + +var always = +/*#__PURE__*/ +_curry1(function always(val) { + return function () { + return val; + }; +}); + +module.exports = always; \ No newline at end of file diff --git a/node_modules/ramda/src/and.js b/node_modules/ramda/src/and.js new file mode 100644 index 0000000..ecca064 --- /dev/null +++ b/node_modules/ramda/src/and.js @@ -0,0 +1,31 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if both arguments are `true`; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> b -> a | b + * @param {Any} a + * @param {Any} b + * @return {Any} the first argument if it is falsy, otherwise the second argument. + * @see R.both, R.xor + * @example + * + * R.and(true, true); //=> true + * R.and(true, false); //=> false + * R.and(false, true); //=> false + * R.and(false, false); //=> false + */ + + +var and = +/*#__PURE__*/ +_curry2(function and(a, b) { + return a && b; +}); + +module.exports = and; \ No newline at end of file diff --git a/node_modules/ramda/src/andThen.js b/node_modules/ramda/src/andThen.js new file mode 100644 index 0000000..d0d296a --- /dev/null +++ b/node_modules/ramda/src/andThen.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _assertPromise = +/*#__PURE__*/ +require("./internal/_assertPromise"); +/** + * Returns the result of applying the onSuccess function to the value inside + * a successfully resolved promise. This is useful for working with promises + * inside function compositions. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Function + * @sig (a -> b) -> (Promise e a) -> (Promise e b) + * @sig (a -> (Promise e b)) -> (Promise e a) -> (Promise e b) + * @param {Function} onSuccess The function to apply. Can return a value or a promise of a value. + * @param {Promise} p + * @return {Promise} The result of calling `p.then(onSuccess)` + * @see R.otherwise + * @example + * + * var makeQuery = (email) => ({ query: { email }}); + * + * //getMemberName :: String -> Promise ({firstName, lastName}) + * var getMemberName = R.pipe( + * makeQuery, + * fetchMember, + * R.andThen(R.pick(['firstName', 'lastName'])) + * ); + */ + + +var andThen = +/*#__PURE__*/ +_curry2(function andThen(f, p) { + _assertPromise('andThen', p); + + return p.then(f); +}); + +module.exports = andThen; \ No newline at end of file diff --git a/node_modules/ramda/src/any.js b/node_modules/ramda/src/any.js new file mode 100644 index 0000000..c3ae099 --- /dev/null +++ b/node_modules/ramda/src/any.js @@ -0,0 +1,57 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xany = +/*#__PURE__*/ +require("./internal/_xany"); +/** + * Returns `true` if at least one of the elements of the list match the predicate, + * `false` otherwise. + * + * Dispatches to the `any` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false` + * otherwise. + * @see R.all, R.none, R.transduce + * @example + * + * const lessThan0 = R.flip(R.lt)(0); + * const lessThan2 = R.flip(R.lt)(2); + * R.any(lessThan0)([1, 2]); //=> false + * R.any(lessThan2)([1, 2]); //=> true + */ + + +var any = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['any'], _xany, function any(fn, list) { + var idx = 0; + + while (idx < list.length) { + if (fn(list[idx])) { + return true; + } + + idx += 1; + } + + return false; +})); + +module.exports = any; \ No newline at end of file diff --git a/node_modules/ramda/src/anyPass.js b/node_modules/ramda/src/anyPass.js new file mode 100644 index 0000000..44951c3 --- /dev/null +++ b/node_modules/ramda/src/anyPass.js @@ -0,0 +1,67 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var max = +/*#__PURE__*/ +require("./max"); + +var pluck = +/*#__PURE__*/ +require("./pluck"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); +/** + * Takes a list of predicates and returns a predicate that returns true for a + * given list of arguments if at least one of the provided predicates is + * satisfied by those arguments. + * + * The function returned is a curried function whose arity matches that of the + * highest-arity predicate. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Logic + * @sig [(*... -> Boolean)] -> (*... -> Boolean) + * @param {Array} predicates An array of predicates to check + * @return {Function} The combined predicate + * @see R.allPass + * @example + * + * const isClub = R.propEq('suit', '♣'); + * const isSpade = R.propEq('suit', '♠'); + * const isBlackCard = R.anyPass([isClub, isSpade]); + * + * isBlackCard({rank: '10', suit: '♣'}); //=> true + * isBlackCard({rank: 'Q', suit: '♠'}); //=> true + * isBlackCard({rank: 'Q', suit: '♦'}); //=> false + */ + + +var anyPass = +/*#__PURE__*/ +_curry1(function anyPass(preds) { + return curryN(reduce(max, 0, pluck('length', preds)), function () { + var idx = 0; + var len = preds.length; + + while (idx < len) { + if (preds[idx].apply(this, arguments)) { + return true; + } + + idx += 1; + } + + return false; + }); +}); + +module.exports = anyPass; \ No newline at end of file diff --git a/node_modules/ramda/src/ap.js b/node_modules/ramda/src/ap.js new file mode 100644 index 0000000..7adc7ba --- /dev/null +++ b/node_modules/ramda/src/ap.js @@ -0,0 +1,54 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var map = +/*#__PURE__*/ +require("./map"); +/** + * ap applies a list of functions to a list of values. + * + * Dispatches to the `ap` method of the second argument, if present. Also + * treats curried functions as applicatives. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig [a -> b] -> [a] -> [b] + * @sig Apply f => f (a -> b) -> f a -> f b + * @sig (r -> a -> b) -> (r -> a) -> (r -> b) + * @param {*} applyF + * @param {*} applyX + * @return {*} + * @example + * + * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6] + * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"] + * + * // R.ap can also be used as S combinator + * // when only two functions are passed + * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA' + * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] + */ + + +var ap = +/*#__PURE__*/ +_curry2(function ap(applyF, applyX) { + return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) { + return applyF(x)(applyX(x)); + } : _reduce(function (acc, f) { + return _concat(acc, map(f, applyX)); + }, [], applyF); +}); + +module.exports = ap; \ No newline at end of file diff --git a/node_modules/ramda/src/aperture.js b/node_modules/ramda/src/aperture.js new file mode 100644 index 0000000..d94314e --- /dev/null +++ b/node_modules/ramda/src/aperture.js @@ -0,0 +1,45 @@ +var _aperture = +/*#__PURE__*/ +require("./internal/_aperture"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xaperture = +/*#__PURE__*/ +require("./internal/_xaperture"); +/** + * Returns a new list, composed of n-tuples of consecutive elements. If `n` is + * greater than the length of the list, an empty list is returned. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig Number -> [a] -> [[a]] + * @param {Number} n The size of the tuples to create + * @param {Array} list The list to split into `n`-length tuples + * @return {Array} The resulting list of `n`-length tuples + * @see R.transduce + * @example + * + * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] + * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] + * R.aperture(7, [1, 2, 3, 4, 5]); //=> [] + */ + + +var aperture = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xaperture, _aperture)); + +module.exports = aperture; \ No newline at end of file diff --git a/node_modules/ramda/src/append.js b/node_modules/ramda/src/append.js new file mode 100644 index 0000000..24f2fa1 --- /dev/null +++ b/node_modules/ramda/src/append.js @@ -0,0 +1,36 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a new list containing the contents of the given list, followed by + * the given element. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} el The element to add to the end of the new list. + * @param {Array} list The list of elements to add a new item to. + * list. + * @return {Array} A new list containing the elements of the old list followed by `el`. + * @see R.prepend + * @example + * + * R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] + * R.append('tests', []); //=> ['tests'] + * R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] + */ + + +var append = +/*#__PURE__*/ +_curry2(function append(el, list) { + return _concat(list, [el]); +}); + +module.exports = append; \ No newline at end of file diff --git a/node_modules/ramda/src/apply.js b/node_modules/ramda/src/apply.js new file mode 100644 index 0000000..7ca7961 --- /dev/null +++ b/node_modules/ramda/src/apply.js @@ -0,0 +1,32 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Applies function `fn` to the argument list `args`. This is useful for + * creating a fixed-arity function from a variadic function. `fn` should be a + * bound function if context is significant. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> a) -> [*] -> a + * @param {Function} fn The function which will be called with `args` + * @param {Array} args The arguments to call `fn` with + * @return {*} result The result, equivalent to `fn(...args)` + * @see R.call, R.unapply + * @example + * + * const nums = [1, 2, 3, -99, 42, 6, 7]; + * R.apply(Math.max, nums); //=> 42 + * @symb R.apply(f, [a, b, c]) = f(a, b, c) + */ + + +var apply = +/*#__PURE__*/ +_curry2(function apply(fn, args) { + return fn.apply(this, args); +}); + +module.exports = apply; \ No newline at end of file diff --git a/node_modules/ramda/src/applySpec.js b/node_modules/ramda/src/applySpec.js new file mode 100644 index 0000000..aea5a93 --- /dev/null +++ b/node_modules/ramda/src/applySpec.js @@ -0,0 +1,82 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var apply = +/*#__PURE__*/ +require("./apply"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var max = +/*#__PURE__*/ +require("./max"); + +var pluck = +/*#__PURE__*/ +require("./pluck"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); + +var keys = +/*#__PURE__*/ +require("./keys"); + +var values = +/*#__PURE__*/ +require("./values"); // Use custom mapValues function to avoid issues with specs that include a "map" key and R.map +// delegating calls to .map + + +function mapValues(fn, obj) { + return keys(obj).reduce(function (acc, key) { + acc[key] = fn(obj[key]); + return acc; + }, {}); +} +/** + * Given a spec object recursively mapping properties to functions, creates a + * function producing an object of the same structure, by mapping each property + * to the result of calling its associated function with the supplied arguments. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Function + * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v}) + * @param {Object} spec an object recursively mapping properties to functions for + * producing the values for these properties. + * @return {Function} A function that returns an object of the same structure + * as `spec', with each property set to the value returned by calling its + * associated function with the supplied arguments. + * @see R.converge, R.juxt + * @example + * + * const getMetrics = R.applySpec({ + * sum: R.add, + * nested: { mul: R.multiply } + * }); + * getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } } + * @symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } } + */ + + +var applySpec = +/*#__PURE__*/ +_curry1(function applySpec(spec) { + spec = mapValues(function (v) { + return typeof v == 'function' ? v : applySpec(v); + }, spec); + return curryN(reduce(max, 0, pluck('length', values(spec))), function () { + var args = arguments; + return mapValues(function (f) { + return apply(f, args); + }, spec); + }); +}); + +module.exports = applySpec; \ No newline at end of file diff --git a/node_modules/ramda/src/applyTo.js b/node_modules/ramda/src/applyTo.js new file mode 100644 index 0000000..05a3187 --- /dev/null +++ b/node_modules/ramda/src/applyTo.js @@ -0,0 +1,31 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Takes a value and applies a function to it. + * + * This function is also known as the `thrush` combinator. + * + * @func + * @memberOf R + * @since v0.25.0 + * @category Function + * @sig a -> (a -> b) -> b + * @param {*} x The value + * @param {Function} f The function to apply + * @return {*} The result of applying `f` to `x` + * @example + * + * const t42 = R.applyTo(42); + * t42(R.identity); //=> 42 + * t42(R.add(1)); //=> 43 + */ + + +var applyTo = +/*#__PURE__*/ +_curry2(function applyTo(x, f) { + return f(x); +}); + +module.exports = applyTo; \ No newline at end of file diff --git a/node_modules/ramda/src/ascend.js b/node_modules/ramda/src/ascend.js new file mode 100644 index 0000000..3f0f8f2 --- /dev/null +++ b/node_modules/ramda/src/ascend.js @@ -0,0 +1,39 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Makes an ascending comparator function out of a function that returns a value + * that can be compared with `<` and `>`. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Function + * @sig Ord b => (a -> b) -> a -> a -> Number + * @param {Function} fn A function of arity one that returns a value that can be compared + * @param {*} a The first item to be compared. + * @param {*} b The second item to be compared. + * @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0` + * @see R.descend + * @example + * + * const byAge = R.ascend(R.prop('age')); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByYoungestFirst = R.sort(byAge, people); + * //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }] + */ + + +var ascend = +/*#__PURE__*/ +_curry3(function ascend(fn, a, b) { + var aa = fn(a); + var bb = fn(b); + return aa < bb ? -1 : aa > bb ? 1 : 0; +}); + +module.exports = ascend; \ No newline at end of file diff --git a/node_modules/ramda/src/assoc.js b/node_modules/ramda/src/assoc.js new file mode 100644 index 0000000..1df01ef --- /dev/null +++ b/node_modules/ramda/src/assoc.js @@ -0,0 +1,39 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Makes a shallow clone of an object, setting or overriding the specified + * property with the given value. Note that this copies and flattens prototype + * properties onto the new object as well. All non-primitive properties are + * copied by reference. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @sig String -> a -> {k: v} -> {k: v} + * @param {String} prop The property name to set + * @param {*} val The new value + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original except for the changed property. + * @see R.dissoc, R.pick + * @example + * + * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} + */ + + +var assoc = +/*#__PURE__*/ +_curry3(function assoc(prop, val, obj) { + var result = {}; + + for (var p in obj) { + result[p] = obj[p]; + } + + result[prop] = val; + return result; +}); + +module.exports = assoc; \ No newline at end of file diff --git a/node_modules/ramda/src/assocPath.js b/node_modules/ramda/src/assocPath.js new file mode 100644 index 0000000..af82c33 --- /dev/null +++ b/node_modules/ramda/src/assocPath.js @@ -0,0 +1,73 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); + +var _isArray = +/*#__PURE__*/ +require("./internal/_isArray"); + +var _isInteger = +/*#__PURE__*/ +require("./internal/_isInteger"); + +var assoc = +/*#__PURE__*/ +require("./assoc"); + +var isNil = +/*#__PURE__*/ +require("./isNil"); +/** + * Makes a shallow clone of an object, setting or overriding the nodes required + * to create the given path, and placing the specific value at the tail end of + * that path. Note that this copies and flattens prototype properties onto the + * new object as well. All non-primitive properties are copied by reference. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> a -> {a} -> {a} + * @param {Array} path the path to set + * @param {*} val The new value + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original except along the specified path. + * @see R.dissocPath + * @example + * + * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} + * + * // Any missing or non-object keys in path will be overridden + * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}} + */ + + +var assocPath = +/*#__PURE__*/ +_curry3(function assocPath(path, val, obj) { + if (path.length === 0) { + return val; + } + + var idx = path[0]; + + if (path.length > 1) { + var nextObj = !isNil(obj) && _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {}; + val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj); + } + + if (_isInteger(idx) && _isArray(obj)) { + var arr = [].concat(obj); + arr[idx] = val; + return arr; + } else { + return assoc(idx, val, obj); + } +}); + +module.exports = assocPath; \ No newline at end of file diff --git a/node_modules/ramda/src/binary.js b/node_modules/ramda/src/binary.js new file mode 100644 index 0000000..2af9722 --- /dev/null +++ b/node_modules/ramda/src/binary.js @@ -0,0 +1,44 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var nAry = +/*#__PURE__*/ +require("./nAry"); +/** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly 2 parameters. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Function + * @sig (* -> c) -> (a, b -> c) + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity 2. + * @see R.nAry, R.unary + * @example + * + * const takesThreeArgs = function(a, b, c) { + * return [a, b, c]; + * }; + * takesThreeArgs.length; //=> 3 + * takesThreeArgs(1, 2, 3); //=> [1, 2, 3] + * + * const takesTwoArgs = R.binary(takesThreeArgs); + * takesTwoArgs.length; //=> 2 + * // Only 2 arguments are passed to the wrapped function + * takesTwoArgs(1, 2, 3); //=> [1, 2, undefined] + * @symb R.binary(f)(a, b, c) = f(a, b) + */ + + +var binary = +/*#__PURE__*/ +_curry1(function binary(fn) { + return nAry(2, fn); +}); + +module.exports = binary; \ No newline at end of file diff --git a/node_modules/ramda/src/bind.js b/node_modules/ramda/src/bind.js new file mode 100644 index 0000000..2195b8c --- /dev/null +++ b/node_modules/ramda/src/bind.js @@ -0,0 +1,40 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates a function that is bound to a context. + * Note: `R.bind` does not provide the additional argument-binding capabilities of + * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Function + * @category Object + * @sig (* -> *) -> {*} -> (* -> *) + * @param {Function} fn The function to bind to context + * @param {Object} thisObj The context to bind `fn` to + * @return {Function} A function that will execute in the context of `thisObj`. + * @see R.partial + * @example + * + * const log = R.bind(console.log, console); + * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} + * // logs {a: 2} + * @symb R.bind(f, o)(a, b) = f.call(o, a, b) + */ + + +var bind = +/*#__PURE__*/ +_curry2(function bind(fn, thisObj) { + return _arity(fn.length, function () { + return fn.apply(thisObj, arguments); + }); +}); + +module.exports = bind; \ No newline at end of file diff --git a/node_modules/ramda/src/both.js b/node_modules/ramda/src/both.js new file mode 100644 index 0000000..187eb4e --- /dev/null +++ b/node_modules/ramda/src/both.js @@ -0,0 +1,57 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isFunction = +/*#__PURE__*/ +require("./internal/_isFunction"); + +var and = +/*#__PURE__*/ +require("./and"); + +var lift = +/*#__PURE__*/ +require("./lift"); +/** + * A function which calls the two provided functions and returns the `&&` + * of the results. + * It returns the result of the first function if it is false-y and the result + * of the second function otherwise. Note that this is short-circuited, + * meaning that the second function will not be invoked if the first returns a + * false-y value. + * + * In addition to functions, `R.both` also accepts any fantasy-land compatible + * applicative functor. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) + * @param {Function} f A predicate + * @param {Function} g Another predicate + * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together. + * @see R.and + * @example + * + * const gt10 = R.gt(R.__, 10) + * const lt20 = R.lt(R.__, 20) + * const f = R.both(gt10, lt20); + * f(15); //=> true + * f(30); //=> false + * + * R.both(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(false) + * R.both([false, false, 'a'], [11]); //=> [false, false, 11] + */ + + +var both = +/*#__PURE__*/ +_curry2(function both(f, g) { + return _isFunction(f) ? function _both() { + return f.apply(this, arguments) && g.apply(this, arguments); + } : lift(and)(f, g); +}); + +module.exports = both; \ No newline at end of file diff --git a/node_modules/ramda/src/call.js b/node_modules/ramda/src/call.js new file mode 100644 index 0000000..b0f668f --- /dev/null +++ b/node_modules/ramda/src/call.js @@ -0,0 +1,43 @@ +var curry = +/*#__PURE__*/ +require("./curry"); +/** + * Returns the result of calling its first argument with the remaining + * arguments. This is occasionally useful as a converging function for + * [`R.converge`](#converge): the first branch can produce a function while the + * remaining branches produce values to be passed to that function as its + * arguments. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig (*... -> a),*... -> a + * @param {Function} fn The function to apply to the remaining arguments. + * @param {...*} args Any number of positional arguments. + * @return {*} + * @see R.apply + * @example + * + * R.call(R.add, 1, 2); //=> 3 + * + * const indentN = R.pipe(R.repeat(' '), + * R.join(''), + * R.replace(/^(?!$)/gm)); + * + * const format = R.converge(R.call, [ + * R.pipe(R.prop('indent'), indentN), + * R.prop('value') + * ]); + * + * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' + * @symb R.call(f, a, b) = f(a, b) + */ + + +var call = +/*#__PURE__*/ +curry(function call(fn) { + return fn.apply(this, Array.prototype.slice.call(arguments, 1)); +}); +module.exports = call; \ No newline at end of file diff --git a/node_modules/ramda/src/chain.js b/node_modules/ramda/src/chain.js new file mode 100644 index 0000000..9731489 --- /dev/null +++ b/node_modules/ramda/src/chain.js @@ -0,0 +1,62 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _makeFlat = +/*#__PURE__*/ +require("./internal/_makeFlat"); + +var _xchain = +/*#__PURE__*/ +require("./internal/_xchain"); + +var map = +/*#__PURE__*/ +require("./map"); +/** + * `chain` maps a function over a list and concatenates the results. `chain` + * is also known as `flatMap` in some libraries. + * + * Dispatches to the `chain` method of the second argument, if present, + * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). + * + * If second argument is a function, `chain(f, g)(x)` is equivalent to `f(g(x), x)`. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain m => (a -> m b) -> m a -> m b + * @param {Function} fn The function to map with + * @param {Array} list The list to map over + * @return {Array} The result of flat-mapping `list` with `fn` + * @example + * + * const duplicate = n => [n, n]; + * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + * + * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] + */ + + +var chain = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { + if (typeof monad === 'function') { + return function (x) { + return fn(monad(x))(x); + }; + } + + return _makeFlat(false)(map(fn, monad)); +})); + +module.exports = chain; \ No newline at end of file diff --git a/node_modules/ramda/src/clamp.js b/node_modules/ramda/src/clamp.js new file mode 100644 index 0000000..6b3f90c --- /dev/null +++ b/node_modules/ramda/src/clamp.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Restricts a number to be within a range. + * + * Also works for other ordered types such as Strings and Dates. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Relation + * @sig Ord a => a -> a -> a -> a + * @param {Number} minimum The lower limit of the clamp (inclusive) + * @param {Number} maximum The upper limit of the clamp (inclusive) + * @param {Number} value Value to be clamped + * @return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise + * @example + * + * R.clamp(1, 10, -5) // => 1 + * R.clamp(1, 10, 15) // => 10 + * R.clamp(1, 10, 4) // => 4 + */ + + +var clamp = +/*#__PURE__*/ +_curry3(function clamp(min, max, value) { + if (min > max) { + throw new Error('min must not be greater than max in clamp(min, max, value)'); + } + + return value < min ? min : value > max ? max : value; +}); + +module.exports = clamp; \ No newline at end of file diff --git a/node_modules/ramda/src/clone.js b/node_modules/ramda/src/clone.js new file mode 100644 index 0000000..660a899 --- /dev/null +++ b/node_modules/ramda/src/clone.js @@ -0,0 +1,37 @@ +var _clone = +/*#__PURE__*/ +require("./internal/_clone"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Creates a deep copy of the value which may contain (nested) `Array`s and + * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are + * assigned by reference rather than copied + * + * Dispatches to a `clone` method if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {*} -> {*} + * @param {*} value The object or array to clone + * @return {*} A deeply cloned copy of `val` + * @example + * + * const objects = [{}, {}, {}]; + * const objectsClone = R.clone(objects); + * objects === objectsClone; //=> false + * objects[0] === objectsClone[0]; //=> false + */ + + +var clone = +/*#__PURE__*/ +_curry1(function clone(value) { + return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true); +}); + +module.exports = clone; \ No newline at end of file diff --git a/node_modules/ramda/src/comparator.js b/node_modules/ramda/src/comparator.js new file mode 100644 index 0000000..7b78ce3 --- /dev/null +++ b/node_modules/ramda/src/comparator.js @@ -0,0 +1,37 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Makes a comparator function out of a function that reports whether the first + * element is less than the second. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b) -> Boolean) -> ((a, b) -> Number) + * @param {Function} pred A predicate function of arity two which will return `true` if the first argument + * is less than the second, `false` otherwise + * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0` + * @example + * + * const byAge = R.comparator((a, b) => a.age < b.age); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByIncreasingAge = R.sort(byAge, people); + * //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }] + */ + + +var comparator = +/*#__PURE__*/ +_curry1(function comparator(pred) { + return function (a, b) { + return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; + }; +}); + +module.exports = comparator; \ No newline at end of file diff --git a/node_modules/ramda/src/complement.js b/node_modules/ramda/src/complement.js new file mode 100644 index 0000000..1c15140 --- /dev/null +++ b/node_modules/ramda/src/complement.js @@ -0,0 +1,35 @@ +var lift = +/*#__PURE__*/ +require("./lift"); + +var not = +/*#__PURE__*/ +require("./not"); +/** + * Takes a function `f` and returns a function `g` such that if called with the same arguments + * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. + * + * `R.complement` may be applied to any functor + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> *) -> (*... -> Boolean) + * @param {Function} f + * @return {Function} + * @see R.not + * @example + * + * const isNotNil = R.complement(R.isNil); + * isNil(null); //=> true + * isNotNil(null); //=> false + * isNil(7); //=> false + * isNotNil(7); //=> true + */ + + +var complement = +/*#__PURE__*/ +lift(not); +module.exports = complement; \ No newline at end of file diff --git a/node_modules/ramda/src/compose.js b/node_modules/ramda/src/compose.js new file mode 100644 index 0000000..7932eb8 --- /dev/null +++ b/node_modules/ramda/src/compose.js @@ -0,0 +1,42 @@ +var pipe = +/*#__PURE__*/ +require("./pipe"); + +var reverse = +/*#__PURE__*/ +require("./reverse"); +/** + * Performs right-to-left function composition. The last argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of compose is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipe + * @example + * + * const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName + * const yellGreeting = R.compose(R.toUpper, classyGreeting); + * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 + * + * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) + */ + + +function compose() { + if (arguments.length === 0) { + throw new Error('compose requires at least one argument'); + } + + return pipe.apply(this, reverse(arguments)); +} + +module.exports = compose; \ No newline at end of file diff --git a/node_modules/ramda/src/composeK.js b/node_modules/ramda/src/composeK.js new file mode 100644 index 0000000..8aad0ac --- /dev/null +++ b/node_modules/ramda/src/composeK.js @@ -0,0 +1,55 @@ +var chain = +/*#__PURE__*/ +require("./chain"); + +var compose = +/*#__PURE__*/ +require("./compose"); + +var map = +/*#__PURE__*/ +require("./map"); +/** + * Returns the right-to-left Kleisli composition of the provided functions, + * each of which must return a value of a type supported by [`chain`](#chain). + * + * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), f)`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Function + * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.pipeK + * @deprecated since v0.26.0 + * @example + * + * // get :: String -> Object -> Maybe * + * const get = R.curry((propName, obj) => Maybe(obj[propName])) + * + * // getStateCode :: Maybe String -> Maybe String + * const getStateCode = R.composeK( + * R.compose(Maybe.of, R.toUpper), + * get('state'), + * get('address'), + * get('user'), + * ); + * getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY") + * getStateCode({}); //=> Maybe.Nothing() + * @symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a))) + */ + + +function composeK() { + if (arguments.length === 0) { + throw new Error('composeK requires at least one argument'); + } + + var init = Array.prototype.slice.call(arguments); + var last = init.pop(); + return compose(compose.apply(this, map(chain, init)), last); +} + +module.exports = composeK; \ No newline at end of file diff --git a/node_modules/ramda/src/composeP.js b/node_modules/ramda/src/composeP.js new file mode 100644 index 0000000..6774c80 --- /dev/null +++ b/node_modules/ramda/src/composeP.js @@ -0,0 +1,53 @@ +var pipeP = +/*#__PURE__*/ +require("./pipeP"); + +var reverse = +/*#__PURE__*/ +require("./reverse"); +/** + * Performs right-to-left composition of one or more Promise-returning + * functions. The last arguments may have any arity; the remaining + * arguments must be unary. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z) + * @param {...Function} functions The functions to compose + * @return {Function} + * @see R.pipeP + * @deprecated since v0.26.0 + * @example + * + * const db = { + * users: { + * JOE: { + * name: 'Joe', + * followers: ['STEVE', 'SUZY'] + * } + * } + * } + * + * // We'll pretend to do a db lookup which returns a promise + * const lookupUser = (userId) => Promise.resolve(db.users[userId]) + * const lookupFollowers = (user) => Promise.resolve(user.followers) + * lookupUser('JOE').then(lookupFollowers) + * + * // followersForUser :: String -> Promise [UserId] + * const followersForUser = R.composeP(lookupFollowers, lookupUser); + * followersForUser('JOE').then(followers => console.log('Followers:', followers)) + * // Followers: ["STEVE","SUZY"] + */ + + +function composeP() { + if (arguments.length === 0) { + throw new Error('composeP requires at least one argument'); + } + + return pipeP.apply(this, reverse(arguments)); +} + +module.exports = composeP; \ No newline at end of file diff --git a/node_modules/ramda/src/composeWith.js b/node_modules/ramda/src/composeWith.js new file mode 100644 index 0000000..4edf088 --- /dev/null +++ b/node_modules/ramda/src/composeWith.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var pipeWith = +/*#__PURE__*/ +require("./pipeWith"); + +var reverse = +/*#__PURE__*/ +require("./reverse"); +/** + * Performs right-to-left function composition using transforming function. The last argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of compose is not automatically curried. Transforming function is not used on the + * last argument. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((* -> *), [(y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)]) -> ((a, b, ..., n) -> z) + * @param {...Function} ...functions The functions to compose + * @return {Function} + * @see R.compose, R.pipeWith + * @example + * + * const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res)); + * + * composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2 + * composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined + * + * @symb R.composeWith(f)([g, h, i])(...args) = f(g, f(h, i(...args))) + */ + + +var composeWith = +/*#__PURE__*/ +_curry2(function composeWith(xf, list) { + return pipeWith.apply(this, [xf, reverse(list)]); +}); + +module.exports = composeWith; \ No newline at end of file diff --git a/node_modules/ramda/src/concat.js b/node_modules/ramda/src/concat.js new file mode 100644 index 0000000..4a290e9 --- /dev/null +++ b/node_modules/ramda/src/concat.js @@ -0,0 +1,80 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isArray = +/*#__PURE__*/ +require("./internal/_isArray"); + +var _isFunction = +/*#__PURE__*/ +require("./internal/_isFunction"); + +var _isString = +/*#__PURE__*/ +require("./internal/_isString"); + +var toString = +/*#__PURE__*/ +require("./toString"); +/** + * Returns the result of concatenating the given lists or strings. + * + * Note: `R.concat` expects both arguments to be of the same type, + * unlike the native `Array.prototype.concat` method. It will throw + * an error if you `concat` an Array with a non-Array value. + * + * Dispatches to the `concat` method of the first argument, if present. + * Can also concatenate two members of a [fantasy-land + * compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] -> [a] + * @sig String -> String -> String + * @param {Array|String} firstList The first list + * @param {Array|String} secondList The second list + * @return {Array|String} A list consisting of the elements of `firstList` followed by the elements of + * `secondList`. + * + * @example + * + * R.concat('ABC', 'DEF'); // 'ABCDEF' + * R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + * R.concat([], []); //=> [] + */ + + +var concat = +/*#__PURE__*/ +_curry2(function concat(a, b) { + if (_isArray(a)) { + if (_isArray(b)) { + return a.concat(b); + } + + throw new TypeError(toString(b) + ' is not an array'); + } + + if (_isString(a)) { + if (_isString(b)) { + return a + b; + } + + throw new TypeError(toString(b) + ' is not a string'); + } + + if (a != null && _isFunction(a['fantasy-land/concat'])) { + return a['fantasy-land/concat'](b); + } + + if (a != null && _isFunction(a.concat)) { + return a.concat(b); + } + + throw new TypeError(toString(a) + ' does not have a method named "concat" or "fantasy-land/concat"'); +}); + +module.exports = concat; \ No newline at end of file diff --git a/node_modules/ramda/src/cond.js b/node_modules/ramda/src/cond.js new file mode 100644 index 0000000..11acc96 --- /dev/null +++ b/node_modules/ramda/src/cond.js @@ -0,0 +1,68 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var map = +/*#__PURE__*/ +require("./map"); + +var max = +/*#__PURE__*/ +require("./max"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); +/** + * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic. + * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments + * to `fn` are applied to each of the predicates in turn until one returns a + * "truthy" value, at which point `fn` returns the result of applying its + * arguments to the corresponding transformer. If none of the predicates + * matches, `fn` returns undefined. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Logic + * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *) + * @param {Array} pairs A list of [predicate, transformer] + * @return {Function} + * @see R.ifElse, R.unless, R.when + * @example + * + * const fn = R.cond([ + * [R.equals(0), R.always('water freezes at 0°C')], + * [R.equals(100), R.always('water boils at 100°C')], + * [R.T, temp => 'nothing special happens at ' + temp + '°C'] + * ]); + * fn(0); //=> 'water freezes at 0°C' + * fn(50); //=> 'nothing special happens at 50°C' + * fn(100); //=> 'water boils at 100°C' + */ + + +var cond = +/*#__PURE__*/ +_curry1(function cond(pairs) { + var arity = reduce(max, 0, map(function (pair) { + return pair[0].length; + }, pairs)); + return _arity(arity, function () { + var idx = 0; + + while (idx < pairs.length) { + if (pairs[idx][0].apply(this, arguments)) { + return pairs[idx][1].apply(this, arguments); + } + + idx += 1; + } + }); +}); + +module.exports = cond; \ No newline at end of file diff --git a/node_modules/ramda/src/construct.js b/node_modules/ramda/src/construct.js new file mode 100644 index 0000000..72c0e78 --- /dev/null +++ b/node_modules/ramda/src/construct.js @@ -0,0 +1,48 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var constructN = +/*#__PURE__*/ +require("./constructN"); +/** + * Wraps a constructor function inside a curried function that can be called + * with the same arguments and returns the same type. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> {*}) -> (* -> {*}) + * @param {Function} fn The constructor function to wrap. + * @return {Function} A wrapped, curried constructor function. + * @see R.invoker + * @example + * + * // Constructor function + * function Animal(kind) { + * this.kind = kind; + * }; + * Animal.prototype.sighting = function() { + * return "It's a " + this.kind + "!"; + * } + * + * const AnimalConstructor = R.construct(Animal) + * + * // Notice we no longer need the 'new' keyword: + * AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}}; + * + * const animalTypes = ["Lion", "Tiger", "Bear"]; + * const animalSighting = R.invoker(0, 'sighting'); + * const sightNewAnimal = R.compose(animalSighting, AnimalConstructor); + * R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"] + */ + + +var construct = +/*#__PURE__*/ +_curry1(function construct(Fn) { + return constructN(Fn.length, Fn); +}); + +module.exports = construct; \ No newline at end of file diff --git a/node_modules/ramda/src/constructN.js b/node_modules/ramda/src/constructN.js new file mode 100644 index 0000000..c3ecbf0 --- /dev/null +++ b/node_modules/ramda/src/constructN.js @@ -0,0 +1,97 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var curry = +/*#__PURE__*/ +require("./curry"); + +var nAry = +/*#__PURE__*/ +require("./nAry"); +/** + * Wraps a constructor function inside a curried function that can be called + * with the same arguments and returns the same type. The arity of the function + * returned is specified to allow using variadic constructor functions. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Function + * @sig Number -> (* -> {*}) -> (* -> {*}) + * @param {Number} n The arity of the constructor function. + * @param {Function} Fn The constructor function to wrap. + * @return {Function} A wrapped, curried constructor function. + * @example + * + * // Variadic Constructor function + * function Salad() { + * this.ingredients = arguments; + * } + * + * Salad.prototype.recipe = function() { + * const instructions = R.map(ingredient => 'Add a dollop of ' + ingredient, this.ingredients); + * return R.join('\n', instructions); + * }; + * + * const ThreeLayerSalad = R.constructN(3, Salad); + * + * // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments. + * const salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup'); + * + * console.log(salad.recipe()); + * // Add a dollop of Mayonnaise + * // Add a dollop of Potato Chips + * // Add a dollop of Ketchup + */ + + +var constructN = +/*#__PURE__*/ +_curry2(function constructN(n, Fn) { + if (n > 10) { + throw new Error('Constructor with greater than ten arguments'); + } + + if (n === 0) { + return function () { + return new Fn(); + }; + } + + return curry(nAry(n, function ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) { + switch (arguments.length) { + case 1: + return new Fn($0); + + case 2: + return new Fn($0, $1); + + case 3: + return new Fn($0, $1, $2); + + case 4: + return new Fn($0, $1, $2, $3); + + case 5: + return new Fn($0, $1, $2, $3, $4); + + case 6: + return new Fn($0, $1, $2, $3, $4, $5); + + case 7: + return new Fn($0, $1, $2, $3, $4, $5, $6); + + case 8: + return new Fn($0, $1, $2, $3, $4, $5, $6, $7); + + case 9: + return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8); + + case 10: + return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9); + } + })); +}); + +module.exports = constructN; \ No newline at end of file diff --git a/node_modules/ramda/src/contains.js b/node_modules/ramda/src/contains.js new file mode 100644 index 0000000..018e94f --- /dev/null +++ b/node_modules/ramda/src/contains.js @@ -0,0 +1,37 @@ +var _includes = +/*#__PURE__*/ +require("./internal/_includes"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if the specified value is equal, in [`R.equals`](#equals) + * terms, to at least one element of the given list; `false` otherwise. + * Works also with strings. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Boolean + * @param {Object} a The item to compare against. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. + * @see R.includes + * @deprecated since v0.26.0 + * @example + * + * R.contains(3, [1, 2, 3]); //=> true + * R.contains(4, [1, 2, 3]); //=> false + * R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + * R.contains([42], [[42]]); //=> true + * R.contains('ba', 'banana'); //=>true + */ + + +var contains = +/*#__PURE__*/ +_curry2(_includes); + +module.exports = contains; \ No newline at end of file diff --git a/node_modules/ramda/src/converge.js b/node_modules/ramda/src/converge.js new file mode 100644 index 0000000..0173f99 --- /dev/null +++ b/node_modules/ramda/src/converge.js @@ -0,0 +1,66 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _map = +/*#__PURE__*/ +require("./internal/_map"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var max = +/*#__PURE__*/ +require("./max"); + +var pluck = +/*#__PURE__*/ +require("./pluck"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); +/** + * Accepts a converging function and a list of branching functions and returns + * a new function. The arity of the new function is the same as the arity of + * the longest branching function. When invoked, this new function is applied + * to some arguments, and each branching function is applied to those same + * arguments. The results of each branching function are passed as arguments + * to the converging function to produce the return value. + * + * @func + * @memberOf R + * @since v0.4.2 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} after A function. `after` will be invoked with the return values of + * `fn1` and `fn2` as its arguments. + * @param {Array} functions A list of functions. + * @return {Function} A new function. + * @see R.useWith + * @example + * + * const average = R.converge(R.divide, [R.sum, R.length]) + * average([1, 2, 3, 4, 5, 6, 7]) //=> 4 + * + * const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]) + * strangeConcat("Yodel") //=> "YODELyodel" + * + * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) + */ + + +var converge = +/*#__PURE__*/ +_curry2(function converge(after, fns) { + return curryN(reduce(max, 0, pluck('length', fns)), function () { + var args = arguments; + var context = this; + return after.apply(context, _map(function (fn) { + return fn.apply(context, args); + }, fns)); + }); +}); + +module.exports = converge; \ No newline at end of file diff --git a/node_modules/ramda/src/countBy.js b/node_modules/ramda/src/countBy.js new file mode 100644 index 0000000..88f51eb --- /dev/null +++ b/node_modules/ramda/src/countBy.js @@ -0,0 +1,35 @@ +var reduceBy = +/*#__PURE__*/ +require("./reduceBy"); +/** + * Counts the elements of a list according to how many match each value of a + * key generated by the supplied function. Returns an object mapping the keys + * produced by `fn` to the number of occurrences in the list. Note that all + * keys are coerced to strings because of how JavaScript objects work. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig (a -> String) -> [a] -> {*} + * @param {Function} fn The function used to map values to keys. + * @param {Array} list The list to count elements from. + * @return {Object} An object mapping keys to number of occurrences in the list. + * @example + * + * const numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; + * R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + * + * const letters = ['a', 'b', 'A', 'a', 'B', 'c']; + * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} + */ + + +var countBy = +/*#__PURE__*/ +reduceBy(function (acc, elem) { + return acc + 1; +}, 0); +module.exports = countBy; \ No newline at end of file diff --git a/node_modules/ramda/src/curry.js b/node_modules/ramda/src/curry.js new file mode 100644 index 0000000..a8a5c41 --- /dev/null +++ b/node_modules/ramda/src/curry.js @@ -0,0 +1,57 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Returns a curried equivalent of the provided function. The curried function + * has two unusual capabilities. First, its arguments needn't be provided one + * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (* -> a) -> (* -> a) + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curryN, R.partial + * @example + * + * const addFourNumbers = (a, b, c, d) => a + b + c + d; + * + * const curriedAddFourNumbers = R.curry(addFourNumbers); + * const f = curriedAddFourNumbers(1, 2); + * const g = f(3); + * g(4); //=> 10 + */ + + +var curry = +/*#__PURE__*/ +_curry1(function curry(fn) { + return curryN(fn.length, fn); +}); + +module.exports = curry; \ No newline at end of file diff --git a/node_modules/ramda/src/curryN.js b/node_modules/ramda/src/curryN.js new file mode 100644 index 0000000..d168f40 --- /dev/null +++ b/node_modules/ramda/src/curryN.js @@ -0,0 +1,70 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _curryN = +/*#__PURE__*/ +require("./internal/_curryN"); +/** + * Returns a curried equivalent of the provided function, with the specified + * arity. The curried function has two unusual capabilities. First, its + * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the + * following are equivalent: + * + * - `g(1)(2)(3)` + * - `g(1)(2, 3)` + * - `g(1, 2)(3)` + * - `g(1, 2, 3)` + * + * Secondly, the special placeholder value [`R.__`](#__) may be used to specify + * "gaps", allowing partial application of any combination of arguments, + * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), + * the following are equivalent: + * + * - `g(1, 2, 3)` + * - `g(_, 2, 3)(1)` + * - `g(_, _, 3)(1)(2)` + * - `g(_, _, 3)(1, 2)` + * - `g(_, 2)(1)(3)` + * - `g(_, 2)(1, 3)` + * - `g(_, 2)(_, 3)(1)` + * + * @func + * @memberOf R + * @since v0.5.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to curry. + * @return {Function} A new, curried function. + * @see R.curry + * @example + * + * const sumArgs = (...args) => R.sum(args); + * + * const curriedAddFourNumbers = R.curryN(4, sumArgs); + * const f = curriedAddFourNumbers(1, 2); + * const g = f(3); + * g(4); //=> 10 + */ + + +var curryN = +/*#__PURE__*/ +_curry2(function curryN(length, fn) { + if (length === 1) { + return _curry1(fn); + } + + return _arity(length, _curryN(length, [], fn)); +}); + +module.exports = curryN; \ No newline at end of file diff --git a/node_modules/ramda/src/dec.js b/node_modules/ramda/src/dec.js new file mode 100644 index 0000000..a48daae --- /dev/null +++ b/node_modules/ramda/src/dec.js @@ -0,0 +1,24 @@ +var add = +/*#__PURE__*/ +require("./add"); +/** + * Decrements its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n - 1 + * @see R.inc + * @example + * + * R.dec(42); //=> 41 + */ + + +var dec = +/*#__PURE__*/ +add(-1); +module.exports = dec; \ No newline at end of file diff --git a/node_modules/ramda/src/defaultTo.js b/node_modules/ramda/src/defaultTo.js new file mode 100644 index 0000000..5f46bf9 --- /dev/null +++ b/node_modules/ramda/src/defaultTo.js @@ -0,0 +1,35 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns the second argument if it is not `null`, `undefined` or `NaN`; + * otherwise the first argument is returned. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Logic + * @sig a -> b -> a | b + * @param {a} default The default value. + * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`. + * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value + * @example + * + * const defaultTo42 = R.defaultTo(42); + * + * defaultTo42(null); //=> 42 + * defaultTo42(undefined); //=> 42 + * defaultTo42(false); //=> false + * defaultTo42('Ramda'); //=> 'Ramda' + * // parseInt('string') results in NaN + * defaultTo42(parseInt('string')); //=> 42 + */ + + +var defaultTo = +/*#__PURE__*/ +_curry2(function defaultTo(d, v) { + return v == null || v !== v ? d : v; +}); + +module.exports = defaultTo; \ No newline at end of file diff --git a/node_modules/ramda/src/descend.js b/node_modules/ramda/src/descend.js new file mode 100644 index 0000000..4fac1ee --- /dev/null +++ b/node_modules/ramda/src/descend.js @@ -0,0 +1,39 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Makes a descending comparator function out of a function that returns a value + * that can be compared with `<` and `>`. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Function + * @sig Ord b => (a -> b) -> a -> a -> Number + * @param {Function} fn A function of arity one that returns a value that can be compared + * @param {*} a The first item to be compared. + * @param {*} b The second item to be compared. + * @return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0` + * @see R.ascend + * @example + * + * const byAge = R.descend(R.prop('age')); + * const people = [ + * { name: 'Emma', age: 70 }, + * { name: 'Peter', age: 78 }, + * { name: 'Mikhail', age: 62 }, + * ]; + * const peopleByOldestFirst = R.sort(byAge, people); + * //=> [{ name: 'Peter', age: 78 }, { name: 'Emma', age: 70 }, { name: 'Mikhail', age: 62 }] + */ + + +var descend = +/*#__PURE__*/ +_curry3(function descend(fn, a, b) { + var aa = fn(a); + var bb = fn(b); + return aa > bb ? -1 : aa < bb ? 1 : 0; +}); + +module.exports = descend; \ No newline at end of file diff --git a/node_modules/ramda/src/difference.js b/node_modules/ramda/src/difference.js new file mode 100644 index 0000000..675f1c6 --- /dev/null +++ b/node_modules/ramda/src/difference.js @@ -0,0 +1,54 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _Set = +/*#__PURE__*/ +require("./internal/_Set"); +/** + * Finds the set (i.e. no duplicates) of all elements in the first list not + * contained in the second list. Objects and Arrays are compared in terms of + * value equality, not reference equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` that are not in `list2`. + * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without + * @example + * + * R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2] + * R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5] + * R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}] + */ + + +var difference = +/*#__PURE__*/ +_curry2(function difference(first, second) { + var out = []; + var idx = 0; + var firstLen = first.length; + var secondLen = second.length; + var toFilterOut = new _Set(); + + for (var i = 0; i < secondLen; i += 1) { + toFilterOut.add(second[i]); + } + + while (idx < firstLen) { + if (toFilterOut.add(first[idx])) { + out[out.length] = first[idx]; + } + + idx += 1; + } + + return out; +}); + +module.exports = difference; \ No newline at end of file diff --git a/node_modules/ramda/src/differenceWith.js b/node_modules/ramda/src/differenceWith.js new file mode 100644 index 0000000..f8b6962 --- /dev/null +++ b/node_modules/ramda/src/differenceWith.js @@ -0,0 +1,50 @@ +var _includesWith = +/*#__PURE__*/ +require("./internal/_includesWith"); + +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Finds the set (i.e. no duplicates) of all elements in the first list not + * contained in the second list. Duplication is determined according to the + * value returned by applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` that are not in `list2`. + * @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith + * @example + * + * const cmp = (x, y) => x.a === y.a; + * const l1 = [{a: 1}, {a: 2}, {a: 3}]; + * const l2 = [{a: 3}, {a: 4}]; + * R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] + */ + + +var differenceWith = +/*#__PURE__*/ +_curry3(function differenceWith(pred, first, second) { + var out = []; + var idx = 0; + var firstLen = first.length; + + while (idx < firstLen) { + if (!_includesWith(pred, first[idx], second) && !_includesWith(pred, first[idx], out)) { + out.push(first[idx]); + } + + idx += 1; + } + + return out; +}); + +module.exports = differenceWith; \ No newline at end of file diff --git a/node_modules/ramda/src/dissoc.js b/node_modules/ramda/src/dissoc.js new file mode 100644 index 0000000..393e312 --- /dev/null +++ b/node_modules/ramda/src/dissoc.js @@ -0,0 +1,35 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a new object that does not contain a `prop` property. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Object + * @sig String -> {k: v} -> {k: v} + * @param {String} prop The name of the property to dissociate + * @param {Object} obj The object to clone + * @return {Object} A new object equivalent to the original but without the specified property + * @see R.assoc, R.omit + * @example + * + * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3} + */ + + +var dissoc = +/*#__PURE__*/ +_curry2(function dissoc(prop, obj) { + var result = {}; + + for (var p in obj) { + result[p] = obj[p]; + } + + delete result[prop]; + return result; +}); + +module.exports = dissoc; \ No newline at end of file diff --git a/node_modules/ramda/src/dissocPath.js b/node_modules/ramda/src/dissocPath.js new file mode 100644 index 0000000..ad5319e --- /dev/null +++ b/node_modules/ramda/src/dissocPath.js @@ -0,0 +1,74 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isInteger = +/*#__PURE__*/ +require("./internal/_isInteger"); + +var _isArray = +/*#__PURE__*/ +require("./internal/_isArray"); + +var assoc = +/*#__PURE__*/ +require("./assoc"); + +var dissoc = +/*#__PURE__*/ +require("./dissoc"); + +var remove = +/*#__PURE__*/ +require("./remove"); + +var update = +/*#__PURE__*/ +require("./update"); +/** + * Makes a shallow clone of an object, omitting the property at the given path. + * Note that this copies and flattens prototype properties onto the new object + * as well. All non-primitive properties are copied by reference. + * + * @func + * @memberOf R + * @since v0.11.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {k: v} -> {k: v} + * @param {Array} path The path to the value to omit + * @param {Object} obj The object to clone + * @return {Object} A new object without the property at path + * @see R.assocPath + * @example + * + * R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} + */ + + +var dissocPath = +/*#__PURE__*/ +_curry2(function dissocPath(path, obj) { + switch (path.length) { + case 0: + return obj; + + case 1: + return _isInteger(path[0]) && _isArray(obj) ? remove(path[0], 1, obj) : dissoc(path[0], obj); + + default: + var head = path[0]; + var tail = Array.prototype.slice.call(path, 1); + + if (obj[head] == null) { + return obj; + } else if (_isInteger(head) && _isArray(obj)) { + return update(head, dissocPath(tail, obj[head]), obj); + } else { + return assoc(head, dissocPath(tail, obj[head]), obj); + } + + } +}); + +module.exports = dissocPath; \ No newline at end of file diff --git a/node_modules/ramda/src/divide.js b/node_modules/ramda/src/divide.js new file mode 100644 index 0000000..ff2475f --- /dev/null +++ b/node_modules/ramda/src/divide.js @@ -0,0 +1,34 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Divides two numbers. Equivalent to `a / b`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a / b`. + * @see R.multiply + * @example + * + * R.divide(71, 100); //=> 0.71 + * + * const half = R.divide(R.__, 2); + * half(42); //=> 21 + * + * const reciprocal = R.divide(1); + * reciprocal(4); //=> 0.25 + */ + + +var divide = +/*#__PURE__*/ +_curry2(function divide(a, b) { + return a / b; +}); + +module.exports = divide; \ No newline at end of file diff --git a/node_modules/ramda/src/drop.js b/node_modules/ramda/src/drop.js new file mode 100644 index 0000000..786d112 --- /dev/null +++ b/node_modules/ramda/src/drop.js @@ -0,0 +1,50 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xdrop = +/*#__PURE__*/ +require("./internal/_xdrop"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns all but the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `drop` method). + * + * Dispatches to the `drop` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} A copy of list without the first `n` elements + * @see R.take, R.transduce, R.dropLast, R.dropWhile + * @example + * + * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz'] + * R.drop(3, ['foo', 'bar', 'baz']); //=> [] + * R.drop(4, ['foo', 'bar', 'baz']); //=> [] + * R.drop(3, 'ramda'); //=> 'da' + */ + + +var drop = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['drop'], _xdrop, function drop(n, xs) { + return slice(Math.max(0, n), Infinity, xs); +})); + +module.exports = drop; \ No newline at end of file diff --git a/node_modules/ramda/src/dropLast.js b/node_modules/ramda/src/dropLast.js new file mode 100644 index 0000000..37b878e --- /dev/null +++ b/node_modules/ramda/src/dropLast.js @@ -0,0 +1,47 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _dropLast = +/*#__PURE__*/ +require("./internal/_dropLast"); + +var _xdropLast = +/*#__PURE__*/ +require("./internal/_xdropLast"); +/** + * Returns a list containing all but the last `n` elements of the given `list`. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements of `list` to skip. + * @param {Array} list The list of elements to consider. + * @return {Array} A copy of the list with only the first `list.length - n` elements + * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile + * @example + * + * R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.dropLast(3, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(4, ['foo', 'bar', 'baz']); //=> [] + * R.dropLast(3, 'ramda'); //=> 'ra' + */ + + +var dropLast = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xdropLast, _dropLast)); + +module.exports = dropLast; \ No newline at end of file diff --git a/node_modules/ramda/src/dropLastWhile.js b/node_modules/ramda/src/dropLastWhile.js new file mode 100644 index 0000000..cfacd80 --- /dev/null +++ b/node_modules/ramda/src/dropLastWhile.js @@ -0,0 +1,51 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _dropLastWhile = +/*#__PURE__*/ +require("./internal/_dropLastWhile"); + +var _xdropLastWhile = +/*#__PURE__*/ +require("./internal/_xdropLastWhile"); +/** + * Returns a new list excluding all the tailing elements of a given list which + * satisfy the supplied predicate function. It passes each value from the right + * to the supplied predicate function, skipping elements until the predicate + * function returns a `falsy` value. The predicate function is applied to one argument: + * *(value)*. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} predicate The function to be called on each element + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`. + * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile + * @example + * + * const lteThree = x => x <= 3; + * + * R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4] + * + * R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd' + */ + + +var dropLastWhile = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xdropLastWhile, _dropLastWhile)); + +module.exports = dropLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/dropRepeats.js b/node_modules/ramda/src/dropRepeats.js new file mode 100644 index 0000000..f8fd651 --- /dev/null +++ b/node_modules/ramda/src/dropRepeats.js @@ -0,0 +1,50 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xdropRepeatsWith = +/*#__PURE__*/ +require("./internal/_xdropRepeatsWith"); + +var dropRepeatsWith = +/*#__PURE__*/ +require("./dropRepeatsWith"); + +var equals = +/*#__PURE__*/ +require("./equals"); +/** + * Returns a new list without any consecutively repeating elements. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] + */ + + +var dropRepeats = +/*#__PURE__*/ +_curry1( +/*#__PURE__*/ +_dispatchable([], +/*#__PURE__*/ +_xdropRepeatsWith(equals), +/*#__PURE__*/ +dropRepeatsWith(equals))); + +module.exports = dropRepeats; \ No newline at end of file diff --git a/node_modules/ramda/src/dropRepeatsWith.js b/node_modules/ramda/src/dropRepeatsWith.js new file mode 100644 index 0000000..c6b11dd --- /dev/null +++ b/node_modules/ramda/src/dropRepeatsWith.js @@ -0,0 +1,63 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xdropRepeatsWith = +/*#__PURE__*/ +require("./internal/_xdropRepeatsWith"); + +var last = +/*#__PURE__*/ +require("./last"); +/** + * Returns a new list without any consecutively repeating elements. Equality is + * determined by applying the supplied predicate to each pair of consecutive elements. The + * first element in a series of equal elements will be preserved. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} `list` without repeating elements. + * @see R.transduce + * @example + * + * const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] + */ + + +var dropRepeatsWith = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { + var result = []; + var idx = 1; + var len = list.length; + + if (len !== 0) { + result[0] = list[0]; + + while (idx < len) { + if (!pred(last(result), list[idx])) { + result[result.length] = list[idx]; + } + + idx += 1; + } + } + + return result; +})); + +module.exports = dropRepeatsWith; \ No newline at end of file diff --git a/node_modules/ramda/src/dropWhile.js b/node_modules/ramda/src/dropWhile.js new file mode 100644 index 0000000..61206c9 --- /dev/null +++ b/node_modules/ramda/src/dropWhile.js @@ -0,0 +1,61 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xdropWhile = +/*#__PURE__*/ +require("./internal/_xdropWhile"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns a new list excluding the leading elements of a given list which + * satisfy the supplied predicate function. It passes each value to the supplied + * predicate function, skipping elements while the predicate function returns + * `true`. The predicate function is applied to one argument: *(value)*. + * + * Dispatches to the `dropWhile` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.takeWhile, R.transduce, R.addIndex + * @example + * + * const lteTwo = x => x <= 2; + * + * R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1] + * + * R.dropWhile(x => x !== 'd' , 'Ramda'); //=> 'da' + */ + + +var dropWhile = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['dropWhile'], _xdropWhile, function dropWhile(pred, xs) { + var idx = 0; + var len = xs.length; + + while (idx < len && pred(xs[idx])) { + idx += 1; + } + + return slice(idx, Infinity, xs); +})); + +module.exports = dropWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/either.js b/node_modules/ramda/src/either.js new file mode 100644 index 0000000..b0fbcf8 --- /dev/null +++ b/node_modules/ramda/src/either.js @@ -0,0 +1,56 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isFunction = +/*#__PURE__*/ +require("./internal/_isFunction"); + +var lift = +/*#__PURE__*/ +require("./lift"); + +var or = +/*#__PURE__*/ +require("./or"); +/** + * A function wrapping calls to the two functions in an `||` operation, + * returning the result of the first function if it is truth-y and the result + * of the second function otherwise. Note that this is short-circuited, + * meaning that the second function will not be invoked if the first returns a + * truth-y value. + * + * In addition to functions, `R.either` also accepts any fantasy-land compatible + * applicative functor. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) + * @param {Function} f a predicate + * @param {Function} g another predicate + * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together. + * @see R.or + * @example + * + * const gt10 = x => x > 10; + * const even = x => x % 2 === 0; + * const f = R.either(gt10, even); + * f(101); //=> true + * f(8); //=> true + * + * R.either(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(55) + * R.either([false, false, 'a'], [11]) // => [11, 11, "a"] + */ + + +var either = +/*#__PURE__*/ +_curry2(function either(f, g) { + return _isFunction(f) ? function _either() { + return f.apply(this, arguments) || g.apply(this, arguments); + } : lift(or)(f, g); +}); + +module.exports = either; \ No newline at end of file diff --git a/node_modules/ramda/src/empty.js b/node_modules/ramda/src/empty.js new file mode 100644 index 0000000..70346e7 --- /dev/null +++ b/node_modules/ramda/src/empty.js @@ -0,0 +1,54 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _isArguments = +/*#__PURE__*/ +require("./internal/_isArguments"); + +var _isArray = +/*#__PURE__*/ +require("./internal/_isArray"); + +var _isObject = +/*#__PURE__*/ +require("./internal/_isObject"); + +var _isString = +/*#__PURE__*/ +require("./internal/_isString"); +/** + * Returns the empty value of its argument's type. Ramda defines the empty + * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other + * types are supported if they define `.empty`, + * `.prototype.empty` or implement the + * [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid). + * + * Dispatches to the `empty` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig a -> a + * @param {*} x + * @return {*} + * @example + * + * R.empty(Just(42)); //=> Nothing() + * R.empty([1, 2, 3]); //=> [] + * R.empty('unicorns'); //=> '' + * R.empty({x: 1, y: 2}); //=> {} + */ + + +var empty = +/*#__PURE__*/ +_curry1(function empty(x) { + return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () { + return arguments; + }() : void 0 // else + ; +}); + +module.exports = empty; \ No newline at end of file diff --git a/node_modules/ramda/src/endsWith.js b/node_modules/ramda/src/endsWith.js new file mode 100644 index 0000000..b8a5c1b --- /dev/null +++ b/node_modules/ramda/src/endsWith.js @@ -0,0 +1,42 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var equals = +/*#__PURE__*/ +require("./equals"); + +var takeLast = +/*#__PURE__*/ +require("./takeLast"); +/** + * Checks if a list ends with the provided sublist. + * + * Similarly, checks if a string ends with the provided substring. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category List + * @sig [a] -> [a] -> Boolean + * @sig String -> String -> Boolean + * @param {*} suffix + * @param {*} list + * @return {Boolean} + * @see R.startsWith + * @example + * + * R.endsWith('c', 'abc') //=> true + * R.endsWith('b', 'abc') //=> false + * R.endsWith(['c'], ['a', 'b', 'c']) //=> true + * R.endsWith(['b'], ['a', 'b', 'c']) //=> false + */ + + +var endsWith = +/*#__PURE__*/ +_curry2(function (suffix, list) { + return equals(takeLast(suffix.length, list), suffix); +}); + +module.exports = endsWith; \ No newline at end of file diff --git a/node_modules/ramda/src/eqBy.js b/node_modules/ramda/src/eqBy.js new file mode 100644 index 0000000..18f9956 --- /dev/null +++ b/node_modules/ramda/src/eqBy.js @@ -0,0 +1,33 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var equals = +/*#__PURE__*/ +require("./equals"); +/** + * Takes a function and two values in its domain and returns `true` if the + * values map to the same value in the codomain; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Relation + * @sig (a -> b) -> a -> a -> Boolean + * @param {Function} f + * @param {*} x + * @param {*} y + * @return {Boolean} + * @example + * + * R.eqBy(Math.abs, 5, -5); //=> true + */ + + +var eqBy = +/*#__PURE__*/ +_curry3(function eqBy(f, x, y) { + return equals(f(x), f(y)); +}); + +module.exports = eqBy; \ No newline at end of file diff --git a/node_modules/ramda/src/eqProps.js b/node_modules/ramda/src/eqProps.js new file mode 100644 index 0000000..7aec035 --- /dev/null +++ b/node_modules/ramda/src/eqProps.js @@ -0,0 +1,37 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var equals = +/*#__PURE__*/ +require("./equals"); +/** + * Reports whether two objects have the same value, in [`R.equals`](#equals) + * terms, for the specified property. Useful as a curried predicate. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig k -> {k: v} -> {k: v} -> Boolean + * @param {String} prop The name of the property to compare + * @param {Object} obj1 + * @param {Object} obj2 + * @return {Boolean} + * + * @example + * + * const o1 = { a: 1, b: 2, c: 3, d: 4 }; + * const o2 = { a: 10, b: 20, c: 3, d: 40 }; + * R.eqProps('a', o1, o2); //=> false + * R.eqProps('c', o1, o2); //=> true + */ + + +var eqProps = +/*#__PURE__*/ +_curry3(function eqProps(prop, obj1, obj2) { + return equals(obj1[prop], obj2[prop]); +}); + +module.exports = eqProps; \ No newline at end of file diff --git a/node_modules/ramda/src/equals.js b/node_modules/ramda/src/equals.js new file mode 100644 index 0000000..5b6aabc --- /dev/null +++ b/node_modules/ramda/src/equals.js @@ -0,0 +1,41 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _equals = +/*#__PURE__*/ +require("./internal/_equals"); +/** + * Returns `true` if its arguments are equivalent, `false` otherwise. Handles + * cyclical data structures. + * + * Dispatches symmetrically to the `equals` methods of both arguments, if + * present. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> b -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * R.equals(1, 1); //=> true + * R.equals(1, '1'); //=> false + * R.equals([1, 2, 3], [1, 2, 3]); //=> true + * + * const a = {}; a.v = a; + * const b = {}; b.v = b; + * R.equals(a, b); //=> true + */ + + +var equals = +/*#__PURE__*/ +_curry2(function equals(a, b) { + return _equals(a, b, [], []); +}); + +module.exports = equals; \ No newline at end of file diff --git a/node_modules/ramda/src/evolve.js b/node_modules/ramda/src/evolve.js new file mode 100644 index 0000000..dd2f5b8 --- /dev/null +++ b/node_modules/ramda/src/evolve.js @@ -0,0 +1,48 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates a new object by recursively evolving a shallow copy of `object`, + * according to the `transformation` functions. All non-primitive properties + * are copied by reference. + * + * A `transformation` function will not be invoked if its corresponding key + * does not exist in the evolved object. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {k: (v -> v)} -> {k: v} -> {k: v} + * @param {Object} transformations The object specifying transformation functions to apply + * to the object. + * @param {Object} object The object to be transformed. + * @return {Object} The transformed object. + * @example + * + * const tomato = {firstName: ' Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; + * const transformations = { + * firstName: R.trim, + * lastName: R.trim, // Will not get invoked. + * data: {elapsed: R.add(1), remaining: R.add(-1)} + * }; + * R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} + */ + + +var evolve = +/*#__PURE__*/ +_curry2(function evolve(transformations, object) { + var result = object instanceof Array ? [] : {}; + var transformation, key, type; + + for (key in object) { + transformation = transformations[key]; + type = typeof transformation; + result[key] = type === 'function' ? transformation(object[key]) : transformation && type === 'object' ? evolve(transformation, object[key]) : object[key]; + } + + return result; +}); + +module.exports = evolve; \ No newline at end of file diff --git a/node_modules/ramda/src/filter.js b/node_modules/ramda/src/filter.js new file mode 100644 index 0000000..b8537a8 --- /dev/null +++ b/node_modules/ramda/src/filter.js @@ -0,0 +1,72 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _filter = +/*#__PURE__*/ +require("./internal/_filter"); + +var _isObject = +/*#__PURE__*/ +require("./internal/_isObject"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var _xfilter = +/*#__PURE__*/ +require("./internal/_xfilter"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * Takes a predicate and a `Filterable`, and returns a new filterable of the + * same type containing the members of the given filterable which satisfy the + * given predicate. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * Dispatches to the `filter` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} Filterable + * @see R.reject, R.transduce, R.addIndex + * @example + * + * const isEven = n => n % 2 === 0; + * + * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + * + * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + + +var filter = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['filter'], _xfilter, function (pred, filterable) { + return _isObject(filterable) ? _reduce(function (acc, key) { + if (pred(filterable[key])) { + acc[key] = filterable[key]; + } + + return acc; + }, {}, keys(filterable)) : // else + _filter(pred, filterable); +})); + +module.exports = filter; \ No newline at end of file diff --git a/node_modules/ramda/src/find.js b/node_modules/ramda/src/find.js new file mode 100644 index 0000000..084b4ce --- /dev/null +++ b/node_modules/ramda/src/find.js @@ -0,0 +1,55 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xfind = +/*#__PURE__*/ +require("./internal/_xfind"); +/** + * Returns the first element of the list which matches the predicate, or + * `undefined` if no element matches. + * + * Dispatches to the `find` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> a | undefined + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Object} The element found, or `undefined`. + * @see R.transduce + * @example + * + * const xs = [{a: 1}, {a: 2}, {a: 3}]; + * R.find(R.propEq('a', 2))(xs); //=> {a: 2} + * R.find(R.propEq('a', 4))(xs); //=> undefined + */ + + +var find = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['find'], _xfind, function find(fn, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (fn(list[idx])) { + return list[idx]; + } + + idx += 1; + } +})); + +module.exports = find; \ No newline at end of file diff --git a/node_modules/ramda/src/findIndex.js b/node_modules/ramda/src/findIndex.js new file mode 100644 index 0000000..d9b9f38 --- /dev/null +++ b/node_modules/ramda/src/findIndex.js @@ -0,0 +1,55 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xfindIndex = +/*#__PURE__*/ +require("./internal/_xfindIndex"); +/** + * Returns the index of the first element of the list which matches the + * predicate, or `-1` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> Number + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Number} The index of the element found, or `-1`. + * @see R.transduce + * @example + * + * const xs = [{a: 1}, {a: 2}, {a: 3}]; + * R.findIndex(R.propEq('a', 2))(xs); //=> 1 + * R.findIndex(R.propEq('a', 4))(xs); //=> -1 + */ + + +var findIndex = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xfindIndex, function findIndex(fn, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (fn(list[idx])) { + return idx; + } + + idx += 1; + } + + return -1; +})); + +module.exports = findIndex; \ No newline at end of file diff --git a/node_modules/ramda/src/findLast.js b/node_modules/ramda/src/findLast.js new file mode 100644 index 0000000..eafc964 --- /dev/null +++ b/node_modules/ramda/src/findLast.js @@ -0,0 +1,52 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xfindLast = +/*#__PURE__*/ +require("./internal/_xfindLast"); +/** + * Returns the last element of the list which matches the predicate, or + * `undefined` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> a | undefined + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Object} The element found, or `undefined`. + * @see R.transduce + * @example + * + * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; + * R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} + * R.findLast(R.propEq('a', 4))(xs); //=> undefined + */ + + +var findLast = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xfindLast, function findLast(fn, list) { + var idx = list.length - 1; + + while (idx >= 0) { + if (fn(list[idx])) { + return list[idx]; + } + + idx -= 1; + } +})); + +module.exports = findLast; \ No newline at end of file diff --git a/node_modules/ramda/src/findLastIndex.js b/node_modules/ramda/src/findLastIndex.js new file mode 100644 index 0000000..084b85f --- /dev/null +++ b/node_modules/ramda/src/findLastIndex.js @@ -0,0 +1,54 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xfindLastIndex = +/*#__PURE__*/ +require("./internal/_xfindLastIndex"); +/** + * Returns the index of the last element of the list which matches the + * predicate, or `-1` if no element matches. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> Boolean) -> [a] -> Number + * @param {Function} fn The predicate function used to determine if the element is the + * desired one. + * @param {Array} list The array to consider. + * @return {Number} The index of the element found, or `-1`. + * @see R.transduce + * @example + * + * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; + * R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 + * R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 + */ + + +var findLastIndex = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xfindLastIndex, function findLastIndex(fn, list) { + var idx = list.length - 1; + + while (idx >= 0) { + if (fn(list[idx])) { + return idx; + } + + idx -= 1; + } + + return -1; +})); + +module.exports = findLastIndex; \ No newline at end of file diff --git a/node_modules/ramda/src/flatten.js b/node_modules/ramda/src/flatten.js new file mode 100644 index 0000000..620f487 --- /dev/null +++ b/node_modules/ramda/src/flatten.js @@ -0,0 +1,33 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _makeFlat = +/*#__PURE__*/ +require("./internal/_makeFlat"); +/** + * Returns a new list by pulling every item out of it (and all its sub-arrays) + * and putting them in a new array, depth-first. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] + * @param {Array} list The array to consider. + * @return {Array} The flattened list. + * @see R.unnest + * @example + * + * R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]); + * //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + */ + + +var flatten = +/*#__PURE__*/ +_curry1( +/*#__PURE__*/ +_makeFlat(true)); + +module.exports = flatten; \ No newline at end of file diff --git a/node_modules/ramda/src/flip.js b/node_modules/ramda/src/flip.js new file mode 100644 index 0000000..600d703 --- /dev/null +++ b/node_modules/ramda/src/flip.js @@ -0,0 +1,41 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Returns a new function much like the supplied one, except that the first two + * arguments' order is reversed. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((a, b, c, ...) -> z) -> (b -> a -> c -> ... -> z) + * @param {Function} fn The function to invoke with its first two parameters reversed. + * @return {*} The result of invoking `fn` with its first two parameters' order reversed. + * @example + * + * const mergeThree = (a, b, c) => [].concat(a, b, c); + * + * mergeThree(1, 2, 3); //=> [1, 2, 3] + * + * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] + * @symb R.flip(f)(a, b, c) = f(b, a, c) + */ + + +var flip = +/*#__PURE__*/ +_curry1(function flip(fn) { + return curryN(fn.length, function (a, b) { + var args = Array.prototype.slice.call(arguments, 0); + args[0] = b; + args[1] = a; + return fn.apply(this, args); + }); +}); + +module.exports = flip; \ No newline at end of file diff --git a/node_modules/ramda/src/forEach.js b/node_modules/ramda/src/forEach.js new file mode 100644 index 0000000..8997268 --- /dev/null +++ b/node_modules/ramda/src/forEach.js @@ -0,0 +1,60 @@ +var _checkForMethod = +/*#__PURE__*/ +require("./internal/_checkForMethod"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Iterate over an input `list`, calling a provided function `fn` for each + * element in the list. + * + * `fn` receives one argument: *(value)*. + * + * Note: `R.forEach` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.forEach` method. For more + * details on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description + * + * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns + * the original array. In some libraries this function is named `each`. + * + * Dispatches to the `forEach` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig (a -> *) -> [a] -> [a] + * @param {Function} fn The function to invoke. Receives one argument, `value`. + * @param {Array} list The list to iterate over. + * @return {Array} The original list. + * @see R.addIndex + * @example + * + * const printXPlusFive = x => console.log(x + 5); + * R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3] + * // logs 6 + * // logs 7 + * // logs 8 + * @symb R.forEach(f, [a, b, c]) = [a, b, c] + */ + + +var forEach = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_checkForMethod('forEach', function forEach(fn, list) { + var len = list.length; + var idx = 0; + + while (idx < len) { + fn(list[idx]); + idx += 1; + } + + return list; +})); + +module.exports = forEach; \ No newline at end of file diff --git a/node_modules/ramda/src/forEachObjIndexed.js b/node_modules/ramda/src/forEachObjIndexed.js new file mode 100644 index 0000000..14e270c --- /dev/null +++ b/node_modules/ramda/src/forEachObjIndexed.js @@ -0,0 +1,47 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * Iterate over an input `object`, calling a provided function `fn` for each + * key and value in the object. + * + * `fn` receives three argument: *(value, key, obj)*. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Object + * @sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a + * @param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`. + * @param {Object} obj The object to iterate over. + * @return {Object} The original object. + * @example + * + * const printKeyConcatValue = (value, key) => console.log(key + ':' + value); + * R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2} + * // logs x:1 + * // logs y:2 + * @symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b} + */ + + +var forEachObjIndexed = +/*#__PURE__*/ +_curry2(function forEachObjIndexed(fn, obj) { + var keyList = keys(obj); + var idx = 0; + + while (idx < keyList.length) { + var key = keyList[idx]; + fn(obj[key], key, obj); + idx += 1; + } + + return obj; +}); + +module.exports = forEachObjIndexed; \ No newline at end of file diff --git a/node_modules/ramda/src/fromPairs.js b/node_modules/ramda/src/fromPairs.js new file mode 100644 index 0000000..504d612 --- /dev/null +++ b/node_modules/ramda/src/fromPairs.js @@ -0,0 +1,36 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Creates a new object from a list key-value pairs. If a key appears in + * multiple pairs, the rightmost pair is included in the object. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [[k,v]] -> {k: v} + * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object. + * @return {Object} The object made by pairing up `keys` and `values`. + * @see R.toPairs, R.pair + * @example + * + * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} + */ + + +var fromPairs = +/*#__PURE__*/ +_curry1(function fromPairs(pairs) { + var result = {}; + var idx = 0; + + while (idx < pairs.length) { + result[pairs[idx][0]] = pairs[idx][1]; + idx += 1; + } + + return result; +}); + +module.exports = fromPairs; \ No newline at end of file diff --git a/node_modules/ramda/src/groupBy.js b/node_modules/ramda/src/groupBy.js new file mode 100644 index 0000000..8fcd0e5 --- /dev/null +++ b/node_modules/ramda/src/groupBy.js @@ -0,0 +1,69 @@ +var _checkForMethod = +/*#__PURE__*/ +require("./internal/_checkForMethod"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var reduceBy = +/*#__PURE__*/ +require("./reduceBy"); +/** + * Splits a list into sub-lists stored in an object, based on the result of + * calling a String-returning function on each element, and grouping the + * results according to values returned. + * + * Dispatches to the `groupBy` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> String) -> [a] -> {String: [a]} + * @param {Function} fn Function :: a -> String + * @param {Array} list The array to group + * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements + * that produced that key when passed to `fn`. + * @see R.reduceBy, R.transduce + * @example + * + * const byGrade = R.groupBy(function(student) { + * const score = student.score; + * return score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A'; + * }); + * const students = [{name: 'Abby', score: 84}, + * {name: 'Eddy', score: 58}, + * // ... + * {name: 'Jack', score: 69}]; + * byGrade(students); + * // { + * // 'A': [{name: 'Dianne', score: 99}], + * // 'B': [{name: 'Abby', score: 84}] + * // // ..., + * // 'F': [{name: 'Eddy', score: 58}] + * // } + */ + + +var groupBy = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_checkForMethod('groupBy', +/*#__PURE__*/ +reduceBy(function (acc, item) { + if (acc == null) { + acc = []; + } + + acc.push(item); + return acc; +}, null))); + +module.exports = groupBy; \ No newline at end of file diff --git a/node_modules/ramda/src/groupWith.js b/node_modules/ramda/src/groupWith.js new file mode 100644 index 0000000..1e0786c --- /dev/null +++ b/node_modules/ramda/src/groupWith.js @@ -0,0 +1,57 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Takes a list and returns a list of lists where each sublist's elements are + * all satisfied pairwise comparison according to the provided function. + * Only adjacent elements are passed to the comparison function. + * + * @func + * @memberOf R + * @since v0.21.0 + * @category List + * @sig ((a, a) → Boolean) → [a] → [[a]] + * @param {Function} fn Function for determining whether two given (adjacent) + * elements should be in the same group + * @param {Array} list The array to group. Also accepts a string, which will be + * treated as a list of characters. + * @return {List} A list that contains sublists of elements, + * whose concatenations are equal to the original list. + * @example + * + * R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]] + * + * R.groupWith((a, b) => a + 1 === b, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0, 1], [1, 2, 3], [5], [8], [13], [21]] + * + * R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21]) + * //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]] + * + * R.groupWith(R.eqBy(isVowel), 'aestiou') + * //=> ['ae', 'st', 'iou'] + */ + + +var groupWith = +/*#__PURE__*/ +_curry2(function (fn, list) { + var res = []; + var idx = 0; + var len = list.length; + + while (idx < len) { + var nextidx = idx + 1; + + while (nextidx < len && fn(list[nextidx - 1], list[nextidx])) { + nextidx += 1; + } + + res.push(list.slice(idx, nextidx)); + idx = nextidx; + } + + return res; +}); + +module.exports = groupWith; \ No newline at end of file diff --git a/node_modules/ramda/src/gt.js b/node_modules/ramda/src/gt.js new file mode 100644 index 0000000..e757ae5 --- /dev/null +++ b/node_modules/ramda/src/gt.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if the first argument is greater than the second; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @see R.lt + * @example + * + * R.gt(2, 1); //=> true + * R.gt(2, 2); //=> false + * R.gt(2, 3); //=> false + * R.gt('a', 'z'); //=> false + * R.gt('z', 'a'); //=> true + */ + + +var gt = +/*#__PURE__*/ +_curry2(function gt(a, b) { + return a > b; +}); + +module.exports = gt; \ No newline at end of file diff --git a/node_modules/ramda/src/gte.js b/node_modules/ramda/src/gte.js new file mode 100644 index 0000000..0ce3bef --- /dev/null +++ b/node_modules/ramda/src/gte.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if the first argument is greater than or equal to the second; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {Number} a + * @param {Number} b + * @return {Boolean} + * @see R.lte + * @example + * + * R.gte(2, 1); //=> true + * R.gte(2, 2); //=> true + * R.gte(2, 3); //=> false + * R.gte('a', 'z'); //=> false + * R.gte('z', 'a'); //=> true + */ + + +var gte = +/*#__PURE__*/ +_curry2(function gte(a, b) { + return a >= b; +}); + +module.exports = gte; \ No newline at end of file diff --git a/node_modules/ramda/src/has.js b/node_modules/ramda/src/has.js new file mode 100644 index 0000000..76acb13 --- /dev/null +++ b/node_modules/ramda/src/has.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var hasPath = +/*#__PURE__*/ +require("./hasPath"); +/** + * Returns whether or not an object has an own property with the specified name + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Object + * @sig s -> {s: x} -> Boolean + * @param {String} prop The name of the property to check for. + * @param {Object} obj The object to query. + * @return {Boolean} Whether the property exists. + * @example + * + * const hasName = R.has('name'); + * hasName({name: 'alice'}); //=> true + * hasName({name: 'bob'}); //=> true + * hasName({}); //=> false + * + * const point = {x: 0, y: 0}; + * const pointHas = R.has(R.__, point); + * pointHas('x'); //=> true + * pointHas('y'); //=> true + * pointHas('z'); //=> false + */ + + +var has = +/*#__PURE__*/ +_curry2(function has(prop, obj) { + return hasPath([prop], obj); +}); + +module.exports = has; \ No newline at end of file diff --git a/node_modules/ramda/src/hasIn.js b/node_modules/ramda/src/hasIn.js new file mode 100644 index 0000000..efbe133 --- /dev/null +++ b/node_modules/ramda/src/hasIn.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns whether or not an object or its prototype chain has a property with + * the specified name + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Object + * @sig s -> {s: x} -> Boolean + * @param {String} prop The name of the property to check for. + * @param {Object} obj The object to query. + * @return {Boolean} Whether the property exists. + * @example + * + * function Rectangle(width, height) { + * this.width = width; + * this.height = height; + * } + * Rectangle.prototype.area = function() { + * return this.width * this.height; + * }; + * + * const square = new Rectangle(2, 2); + * R.hasIn('width', square); //=> true + * R.hasIn('area', square); //=> true + */ + + +var hasIn = +/*#__PURE__*/ +_curry2(function hasIn(prop, obj) { + return prop in obj; +}); + +module.exports = hasIn; \ No newline at end of file diff --git a/node_modules/ramda/src/hasPath.js b/node_modules/ramda/src/hasPath.js new file mode 100644 index 0000000..d820200 --- /dev/null +++ b/node_modules/ramda/src/hasPath.js @@ -0,0 +1,57 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); + +var isNil = +/*#__PURE__*/ +require("./isNil"); +/** + * Returns whether or not a path exists in an object. Only the object's + * own properties are checked. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> Boolean + * @param {Array} path The path to use. + * @param {Object} obj The object to check the path in. + * @return {Boolean} Whether the path exists. + * @see R.has + * @example + * + * R.hasPath(['a', 'b'], {a: {b: 2}}); // => true + * R.hasPath(['a', 'b'], {a: {b: undefined}}); // => true + * R.hasPath(['a', 'b'], {a: {c: 2}}); // => false + * R.hasPath(['a', 'b'], {}); // => false + */ + + +var hasPath = +/*#__PURE__*/ +_curry2(function hasPath(_path, obj) { + if (_path.length === 0 || isNil(obj)) { + return false; + } + + var val = obj; + var idx = 0; + + while (idx < _path.length) { + if (!isNil(val) && _has(_path[idx], val)) { + val = val[_path[idx]]; + idx += 1; + } else { + return false; + } + } + + return true; +}); + +module.exports = hasPath; \ No newline at end of file diff --git a/node_modules/ramda/src/head.js b/node_modules/ramda/src/head.js new file mode 100644 index 0000000..390ba9b --- /dev/null +++ b/node_modules/ramda/src/head.js @@ -0,0 +1,30 @@ +var nth = +/*#__PURE__*/ +require("./nth"); +/** + * Returns the first element of the given list or string. In some libraries + * this function is named `first`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {Array|String} list + * @return {*} + * @see R.tail, R.init, R.last + * @example + * + * R.head(['fi', 'fo', 'fum']); //=> 'fi' + * R.head([]); //=> undefined + * + * R.head('abc'); //=> 'a' + * R.head(''); //=> '' + */ + + +var head = +/*#__PURE__*/ +nth(0); +module.exports = head; \ No newline at end of file diff --git a/node_modules/ramda/src/identical.js b/node_modules/ramda/src/identical.js new file mode 100644 index 0000000..dddafcd --- /dev/null +++ b/node_modules/ramda/src/identical.js @@ -0,0 +1,39 @@ +var _objectIs = +/*#__PURE__*/ +require("./internal/_objectIs"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns true if its arguments are identical, false otherwise. Values are + * identical if they reference the same memory. `NaN` is identical to `NaN`; + * `0` and `-0` are not identical. + * + * Note this is merely a curried version of ES6 `Object.is`. + * + * @func + * @memberOf R + * @since v0.15.0 + * @category Relation + * @sig a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @example + * + * const o = {}; + * R.identical(o, o); //=> true + * R.identical(1, 1); //=> true + * R.identical(1, '1'); //=> false + * R.identical([], []); //=> false + * R.identical(0, -0); //=> false + * R.identical(NaN, NaN); //=> true + */ + + +var identical = +/*#__PURE__*/ +_curry2(_objectIs); + +module.exports = identical; \ No newline at end of file diff --git a/node_modules/ramda/src/identity.js b/node_modules/ramda/src/identity.js new file mode 100644 index 0000000..5a1be71 --- /dev/null +++ b/node_modules/ramda/src/identity.js @@ -0,0 +1,33 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _identity = +/*#__PURE__*/ +require("./internal/_identity"); +/** + * A function that does nothing but return the parameter supplied to it. Good + * as a default or placeholder function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig a -> a + * @param {*} x The value to return. + * @return {*} The input value, `x`. + * @example + * + * R.identity(1); //=> 1 + * + * const obj = {}; + * R.identity(obj) === obj; //=> true + * @symb R.identity(a) = a + */ + + +var identity = +/*#__PURE__*/ +_curry1(_identity); + +module.exports = identity; \ No newline at end of file diff --git a/node_modules/ramda/src/ifElse.js b/node_modules/ramda/src/ifElse.js new file mode 100644 index 0000000..1971eb3 --- /dev/null +++ b/node_modules/ramda/src/ifElse.js @@ -0,0 +1,43 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Creates a function that will process either the `onTrue` or the `onFalse` + * function depending upon the result of the `condition` predicate. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Logic + * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *) + * @param {Function} condition A predicate function + * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value. + * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value. + * @return {Function} A new function that will process either the `onTrue` or the `onFalse` + * function depending upon the result of the `condition` predicate. + * @see R.unless, R.when, R.cond + * @example + * + * const incCount = R.ifElse( + * R.has('count'), + * R.over(R.lensProp('count'), R.inc), + * R.assoc('count', 1) + * ); + * incCount({}); //=> { count: 1 } + * incCount({ count: 1 }); //=> { count: 2 } + */ + + +var ifElse = +/*#__PURE__*/ +_curry3(function ifElse(condition, onTrue, onFalse) { + return curryN(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() { + return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments); + }); +}); + +module.exports = ifElse; \ No newline at end of file diff --git a/node_modules/ramda/src/inc.js b/node_modules/ramda/src/inc.js new file mode 100644 index 0000000..c4b9112 --- /dev/null +++ b/node_modules/ramda/src/inc.js @@ -0,0 +1,24 @@ +var add = +/*#__PURE__*/ +require("./add"); +/** + * Increments its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} n + 1 + * @see R.dec + * @example + * + * R.inc(42); //=> 43 + */ + + +var inc = +/*#__PURE__*/ +add(1); +module.exports = inc; \ No newline at end of file diff --git a/node_modules/ramda/src/includes.js b/node_modules/ramda/src/includes.js new file mode 100644 index 0000000..39c5610 --- /dev/null +++ b/node_modules/ramda/src/includes.js @@ -0,0 +1,36 @@ +var _includes = +/*#__PURE__*/ +require("./internal/_includes"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if the specified value is equal, in [`R.equals`](#equals) + * terms, to at least one element of the given list; `false` otherwise. + * Works also with strings. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category List + * @sig a -> [a] -> Boolean + * @param {Object} a The item to compare against. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. + * @see R.any + * @example + * + * R.includes(3, [1, 2, 3]); //=> true + * R.includes(4, [1, 2, 3]); //=> false + * R.includes({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + * R.includes([42], [[42]]); //=> true + * R.includes('ba', 'banana'); //=>true + */ + + +var includes = +/*#__PURE__*/ +_curry2(_includes); + +module.exports = includes; \ No newline at end of file diff --git a/node_modules/ramda/src/index.js b/node_modules/ramda/src/index.js new file mode 100644 index 0000000..3213efb --- /dev/null +++ b/node_modules/ramda/src/index.js @@ -0,0 +1,772 @@ +module.exports = {}; +module.exports.F = +/*#__PURE__*/ +require("./F"); +module.exports.T = +/*#__PURE__*/ +require("./T"); +module.exports.__ = +/*#__PURE__*/ +require("./__"); +module.exports.add = +/*#__PURE__*/ +require("./add"); +module.exports.addIndex = +/*#__PURE__*/ +require("./addIndex"); +module.exports.adjust = +/*#__PURE__*/ +require("./adjust"); +module.exports.all = +/*#__PURE__*/ +require("./all"); +module.exports.allPass = +/*#__PURE__*/ +require("./allPass"); +module.exports.always = +/*#__PURE__*/ +require("./always"); +module.exports.and = +/*#__PURE__*/ +require("./and"); +module.exports.any = +/*#__PURE__*/ +require("./any"); +module.exports.anyPass = +/*#__PURE__*/ +require("./anyPass"); +module.exports.ap = +/*#__PURE__*/ +require("./ap"); +module.exports.aperture = +/*#__PURE__*/ +require("./aperture"); +module.exports.append = +/*#__PURE__*/ +require("./append"); +module.exports.apply = +/*#__PURE__*/ +require("./apply"); +module.exports.applySpec = +/*#__PURE__*/ +require("./applySpec"); +module.exports.applyTo = +/*#__PURE__*/ +require("./applyTo"); +module.exports.ascend = +/*#__PURE__*/ +require("./ascend"); +module.exports.assoc = +/*#__PURE__*/ +require("./assoc"); +module.exports.assocPath = +/*#__PURE__*/ +require("./assocPath"); +module.exports.binary = +/*#__PURE__*/ +require("./binary"); +module.exports.bind = +/*#__PURE__*/ +require("./bind"); +module.exports.both = +/*#__PURE__*/ +require("./both"); +module.exports.call = +/*#__PURE__*/ +require("./call"); +module.exports.chain = +/*#__PURE__*/ +require("./chain"); +module.exports.clamp = +/*#__PURE__*/ +require("./clamp"); +module.exports.clone = +/*#__PURE__*/ +require("./clone"); +module.exports.comparator = +/*#__PURE__*/ +require("./comparator"); +module.exports.complement = +/*#__PURE__*/ +require("./complement"); +module.exports.compose = +/*#__PURE__*/ +require("./compose"); +module.exports.composeK = +/*#__PURE__*/ +require("./composeK"); +module.exports.composeP = +/*#__PURE__*/ +require("./composeP"); +module.exports.composeWith = +/*#__PURE__*/ +require("./composeWith"); +module.exports.concat = +/*#__PURE__*/ +require("./concat"); +module.exports.cond = +/*#__PURE__*/ +require("./cond"); +module.exports.construct = +/*#__PURE__*/ +require("./construct"); +module.exports.constructN = +/*#__PURE__*/ +require("./constructN"); +module.exports.contains = +/*#__PURE__*/ +require("./contains"); +module.exports.converge = +/*#__PURE__*/ +require("./converge"); +module.exports.countBy = +/*#__PURE__*/ +require("./countBy"); +module.exports.curry = +/*#__PURE__*/ +require("./curry"); +module.exports.curryN = +/*#__PURE__*/ +require("./curryN"); +module.exports.dec = +/*#__PURE__*/ +require("./dec"); +module.exports.defaultTo = +/*#__PURE__*/ +require("./defaultTo"); +module.exports.descend = +/*#__PURE__*/ +require("./descend"); +module.exports.difference = +/*#__PURE__*/ +require("./difference"); +module.exports.differenceWith = +/*#__PURE__*/ +require("./differenceWith"); +module.exports.dissoc = +/*#__PURE__*/ +require("./dissoc"); +module.exports.dissocPath = +/*#__PURE__*/ +require("./dissocPath"); +module.exports.divide = +/*#__PURE__*/ +require("./divide"); +module.exports.drop = +/*#__PURE__*/ +require("./drop"); +module.exports.dropLast = +/*#__PURE__*/ +require("./dropLast"); +module.exports.dropLastWhile = +/*#__PURE__*/ +require("./dropLastWhile"); +module.exports.dropRepeats = +/*#__PURE__*/ +require("./dropRepeats"); +module.exports.dropRepeatsWith = +/*#__PURE__*/ +require("./dropRepeatsWith"); +module.exports.dropWhile = +/*#__PURE__*/ +require("./dropWhile"); +module.exports.either = +/*#__PURE__*/ +require("./either"); +module.exports.empty = +/*#__PURE__*/ +require("./empty"); +module.exports.endsWith = +/*#__PURE__*/ +require("./endsWith"); +module.exports.eqBy = +/*#__PURE__*/ +require("./eqBy"); +module.exports.eqProps = +/*#__PURE__*/ +require("./eqProps"); +module.exports.equals = +/*#__PURE__*/ +require("./equals"); +module.exports.evolve = +/*#__PURE__*/ +require("./evolve"); +module.exports.filter = +/*#__PURE__*/ +require("./filter"); +module.exports.find = +/*#__PURE__*/ +require("./find"); +module.exports.findIndex = +/*#__PURE__*/ +require("./findIndex"); +module.exports.findLast = +/*#__PURE__*/ +require("./findLast"); +module.exports.findLastIndex = +/*#__PURE__*/ +require("./findLastIndex"); +module.exports.flatten = +/*#__PURE__*/ +require("./flatten"); +module.exports.flip = +/*#__PURE__*/ +require("./flip"); +module.exports.forEach = +/*#__PURE__*/ +require("./forEach"); +module.exports.forEachObjIndexed = +/*#__PURE__*/ +require("./forEachObjIndexed"); +module.exports.fromPairs = +/*#__PURE__*/ +require("./fromPairs"); +module.exports.groupBy = +/*#__PURE__*/ +require("./groupBy"); +module.exports.groupWith = +/*#__PURE__*/ +require("./groupWith"); +module.exports.gt = +/*#__PURE__*/ +require("./gt"); +module.exports.gte = +/*#__PURE__*/ +require("./gte"); +module.exports.has = +/*#__PURE__*/ +require("./has"); +module.exports.hasIn = +/*#__PURE__*/ +require("./hasIn"); +module.exports.hasPath = +/*#__PURE__*/ +require("./hasPath"); +module.exports.head = +/*#__PURE__*/ +require("./head"); +module.exports.identical = +/*#__PURE__*/ +require("./identical"); +module.exports.identity = +/*#__PURE__*/ +require("./identity"); +module.exports.ifElse = +/*#__PURE__*/ +require("./ifElse"); +module.exports.inc = +/*#__PURE__*/ +require("./inc"); +module.exports.includes = +/*#__PURE__*/ +require("./includes"); +module.exports.indexBy = +/*#__PURE__*/ +require("./indexBy"); +module.exports.indexOf = +/*#__PURE__*/ +require("./indexOf"); +module.exports.init = +/*#__PURE__*/ +require("./init"); +module.exports.innerJoin = +/*#__PURE__*/ +require("./innerJoin"); +module.exports.insert = +/*#__PURE__*/ +require("./insert"); +module.exports.insertAll = +/*#__PURE__*/ +require("./insertAll"); +module.exports.intersection = +/*#__PURE__*/ +require("./intersection"); +module.exports.intersperse = +/*#__PURE__*/ +require("./intersperse"); +module.exports.into = +/*#__PURE__*/ +require("./into"); +module.exports.invert = +/*#__PURE__*/ +require("./invert"); +module.exports.invertObj = +/*#__PURE__*/ +require("./invertObj"); +module.exports.invoker = +/*#__PURE__*/ +require("./invoker"); +module.exports.is = +/*#__PURE__*/ +require("./is"); +module.exports.isEmpty = +/*#__PURE__*/ +require("./isEmpty"); +module.exports.isNil = +/*#__PURE__*/ +require("./isNil"); +module.exports.join = +/*#__PURE__*/ +require("./join"); +module.exports.juxt = +/*#__PURE__*/ +require("./juxt"); +module.exports.keys = +/*#__PURE__*/ +require("./keys"); +module.exports.keysIn = +/*#__PURE__*/ +require("./keysIn"); +module.exports.last = +/*#__PURE__*/ +require("./last"); +module.exports.lastIndexOf = +/*#__PURE__*/ +require("./lastIndexOf"); +module.exports.length = +/*#__PURE__*/ +require("./length"); +module.exports.lens = +/*#__PURE__*/ +require("./lens"); +module.exports.lensIndex = +/*#__PURE__*/ +require("./lensIndex"); +module.exports.lensPath = +/*#__PURE__*/ +require("./lensPath"); +module.exports.lensProp = +/*#__PURE__*/ +require("./lensProp"); +module.exports.lift = +/*#__PURE__*/ +require("./lift"); +module.exports.liftN = +/*#__PURE__*/ +require("./liftN"); +module.exports.lt = +/*#__PURE__*/ +require("./lt"); +module.exports.lte = +/*#__PURE__*/ +require("./lte"); +module.exports.map = +/*#__PURE__*/ +require("./map"); +module.exports.mapAccum = +/*#__PURE__*/ +require("./mapAccum"); +module.exports.mapAccumRight = +/*#__PURE__*/ +require("./mapAccumRight"); +module.exports.mapObjIndexed = +/*#__PURE__*/ +require("./mapObjIndexed"); +module.exports.match = +/*#__PURE__*/ +require("./match"); +module.exports.mathMod = +/*#__PURE__*/ +require("./mathMod"); +module.exports.max = +/*#__PURE__*/ +require("./max"); +module.exports.maxBy = +/*#__PURE__*/ +require("./maxBy"); +module.exports.mean = +/*#__PURE__*/ +require("./mean"); +module.exports.median = +/*#__PURE__*/ +require("./median"); +module.exports.memoizeWith = +/*#__PURE__*/ +require("./memoizeWith"); +module.exports.merge = +/*#__PURE__*/ +require("./merge"); +module.exports.mergeAll = +/*#__PURE__*/ +require("./mergeAll"); +module.exports.mergeDeepLeft = +/*#__PURE__*/ +require("./mergeDeepLeft"); +module.exports.mergeDeepRight = +/*#__PURE__*/ +require("./mergeDeepRight"); +module.exports.mergeDeepWith = +/*#__PURE__*/ +require("./mergeDeepWith"); +module.exports.mergeDeepWithKey = +/*#__PURE__*/ +require("./mergeDeepWithKey"); +module.exports.mergeLeft = +/*#__PURE__*/ +require("./mergeLeft"); +module.exports.mergeRight = +/*#__PURE__*/ +require("./mergeRight"); +module.exports.mergeWith = +/*#__PURE__*/ +require("./mergeWith"); +module.exports.mergeWithKey = +/*#__PURE__*/ +require("./mergeWithKey"); +module.exports.min = +/*#__PURE__*/ +require("./min"); +module.exports.minBy = +/*#__PURE__*/ +require("./minBy"); +module.exports.modulo = +/*#__PURE__*/ +require("./modulo"); +module.exports.move = +/*#__PURE__*/ +require("./move"); +module.exports.multiply = +/*#__PURE__*/ +require("./multiply"); +module.exports.nAry = +/*#__PURE__*/ +require("./nAry"); +module.exports.negate = +/*#__PURE__*/ +require("./negate"); +module.exports.none = +/*#__PURE__*/ +require("./none"); +module.exports.not = +/*#__PURE__*/ +require("./not"); +module.exports.nth = +/*#__PURE__*/ +require("./nth"); +module.exports.nthArg = +/*#__PURE__*/ +require("./nthArg"); +module.exports.o = +/*#__PURE__*/ +require("./o"); +module.exports.objOf = +/*#__PURE__*/ +require("./objOf"); +module.exports.of = +/*#__PURE__*/ +require("./of"); +module.exports.omit = +/*#__PURE__*/ +require("./omit"); +module.exports.once = +/*#__PURE__*/ +require("./once"); +module.exports.or = +/*#__PURE__*/ +require("./or"); +module.exports.otherwise = +/*#__PURE__*/ +require("./otherwise"); +module.exports.over = +/*#__PURE__*/ +require("./over"); +module.exports.pair = +/*#__PURE__*/ +require("./pair"); +module.exports.partial = +/*#__PURE__*/ +require("./partial"); +module.exports.partialRight = +/*#__PURE__*/ +require("./partialRight"); +module.exports.partition = +/*#__PURE__*/ +require("./partition"); +module.exports.path = +/*#__PURE__*/ +require("./path"); +module.exports.paths = +/*#__PURE__*/ +require("./paths"); +module.exports.pathEq = +/*#__PURE__*/ +require("./pathEq"); +module.exports.pathOr = +/*#__PURE__*/ +require("./pathOr"); +module.exports.pathSatisfies = +/*#__PURE__*/ +require("./pathSatisfies"); +module.exports.pick = +/*#__PURE__*/ +require("./pick"); +module.exports.pickAll = +/*#__PURE__*/ +require("./pickAll"); +module.exports.pickBy = +/*#__PURE__*/ +require("./pickBy"); +module.exports.pipe = +/*#__PURE__*/ +require("./pipe"); +module.exports.pipeK = +/*#__PURE__*/ +require("./pipeK"); +module.exports.pipeP = +/*#__PURE__*/ +require("./pipeP"); +module.exports.pipeWith = +/*#__PURE__*/ +require("./pipeWith"); +module.exports.pluck = +/*#__PURE__*/ +require("./pluck"); +module.exports.prepend = +/*#__PURE__*/ +require("./prepend"); +module.exports.product = +/*#__PURE__*/ +require("./product"); +module.exports.project = +/*#__PURE__*/ +require("./project"); +module.exports.prop = +/*#__PURE__*/ +require("./prop"); +module.exports.propEq = +/*#__PURE__*/ +require("./propEq"); +module.exports.propIs = +/*#__PURE__*/ +require("./propIs"); +module.exports.propOr = +/*#__PURE__*/ +require("./propOr"); +module.exports.propSatisfies = +/*#__PURE__*/ +require("./propSatisfies"); +module.exports.props = +/*#__PURE__*/ +require("./props"); +module.exports.range = +/*#__PURE__*/ +require("./range"); +module.exports.reduce = +/*#__PURE__*/ +require("./reduce"); +module.exports.reduceBy = +/*#__PURE__*/ +require("./reduceBy"); +module.exports.reduceRight = +/*#__PURE__*/ +require("./reduceRight"); +module.exports.reduceWhile = +/*#__PURE__*/ +require("./reduceWhile"); +module.exports.reduced = +/*#__PURE__*/ +require("./reduced"); +module.exports.reject = +/*#__PURE__*/ +require("./reject"); +module.exports.remove = +/*#__PURE__*/ +require("./remove"); +module.exports.repeat = +/*#__PURE__*/ +require("./repeat"); +module.exports.replace = +/*#__PURE__*/ +require("./replace"); +module.exports.reverse = +/*#__PURE__*/ +require("./reverse"); +module.exports.scan = +/*#__PURE__*/ +require("./scan"); +module.exports.sequence = +/*#__PURE__*/ +require("./sequence"); +module.exports.set = +/*#__PURE__*/ +require("./set"); +module.exports.slice = +/*#__PURE__*/ +require("./slice"); +module.exports.sort = +/*#__PURE__*/ +require("./sort"); +module.exports.sortBy = +/*#__PURE__*/ +require("./sortBy"); +module.exports.sortWith = +/*#__PURE__*/ +require("./sortWith"); +module.exports.split = +/*#__PURE__*/ +require("./split"); +module.exports.splitAt = +/*#__PURE__*/ +require("./splitAt"); +module.exports.splitEvery = +/*#__PURE__*/ +require("./splitEvery"); +module.exports.splitWhen = +/*#__PURE__*/ +require("./splitWhen"); +module.exports.startsWith = +/*#__PURE__*/ +require("./startsWith"); +module.exports.subtract = +/*#__PURE__*/ +require("./subtract"); +module.exports.sum = +/*#__PURE__*/ +require("./sum"); +module.exports.symmetricDifference = +/*#__PURE__*/ +require("./symmetricDifference"); +module.exports.symmetricDifferenceWith = +/*#__PURE__*/ +require("./symmetricDifferenceWith"); +module.exports.tail = +/*#__PURE__*/ +require("./tail"); +module.exports.take = +/*#__PURE__*/ +require("./take"); +module.exports.takeLast = +/*#__PURE__*/ +require("./takeLast"); +module.exports.takeLastWhile = +/*#__PURE__*/ +require("./takeLastWhile"); +module.exports.takeWhile = +/*#__PURE__*/ +require("./takeWhile"); +module.exports.tap = +/*#__PURE__*/ +require("./tap"); +module.exports.test = +/*#__PURE__*/ +require("./test"); +module.exports.andThen = +/*#__PURE__*/ +require("./andThen"); +module.exports.times = +/*#__PURE__*/ +require("./times"); +module.exports.toLower = +/*#__PURE__*/ +require("./toLower"); +module.exports.toPairs = +/*#__PURE__*/ +require("./toPairs"); +module.exports.toPairsIn = +/*#__PURE__*/ +require("./toPairsIn"); +module.exports.toString = +/*#__PURE__*/ +require("./toString"); +module.exports.toUpper = +/*#__PURE__*/ +require("./toUpper"); +module.exports.transduce = +/*#__PURE__*/ +require("./transduce"); +module.exports.transpose = +/*#__PURE__*/ +require("./transpose"); +module.exports.traverse = +/*#__PURE__*/ +require("./traverse"); +module.exports.trim = +/*#__PURE__*/ +require("./trim"); +module.exports.tryCatch = +/*#__PURE__*/ +require("./tryCatch"); +module.exports.type = +/*#__PURE__*/ +require("./type"); +module.exports.unapply = +/*#__PURE__*/ +require("./unapply"); +module.exports.unary = +/*#__PURE__*/ +require("./unary"); +module.exports.uncurryN = +/*#__PURE__*/ +require("./uncurryN"); +module.exports.unfold = +/*#__PURE__*/ +require("./unfold"); +module.exports.union = +/*#__PURE__*/ +require("./union"); +module.exports.unionWith = +/*#__PURE__*/ +require("./unionWith"); +module.exports.uniq = +/*#__PURE__*/ +require("./uniq"); +module.exports.uniqBy = +/*#__PURE__*/ +require("./uniqBy"); +module.exports.uniqWith = +/*#__PURE__*/ +require("./uniqWith"); +module.exports.unless = +/*#__PURE__*/ +require("./unless"); +module.exports.unnest = +/*#__PURE__*/ +require("./unnest"); +module.exports.until = +/*#__PURE__*/ +require("./until"); +module.exports.update = +/*#__PURE__*/ +require("./update"); +module.exports.useWith = +/*#__PURE__*/ +require("./useWith"); +module.exports.values = +/*#__PURE__*/ +require("./values"); +module.exports.valuesIn = +/*#__PURE__*/ +require("./valuesIn"); +module.exports.view = +/*#__PURE__*/ +require("./view"); +module.exports.when = +/*#__PURE__*/ +require("./when"); +module.exports.where = +/*#__PURE__*/ +require("./where"); +module.exports.whereEq = +/*#__PURE__*/ +require("./whereEq"); +module.exports.without = +/*#__PURE__*/ +require("./without"); +module.exports.xor = +/*#__PURE__*/ +require("./xor"); +module.exports.xprod = +/*#__PURE__*/ +require("./xprod"); +module.exports.zip = +/*#__PURE__*/ +require("./zip"); +module.exports.zipObj = +/*#__PURE__*/ +require("./zipObj"); +module.exports.zipWith = +/*#__PURE__*/ +require("./zipWith"); +module.exports.thunkify = +/*#__PURE__*/ +require("./thunkify"); \ No newline at end of file diff --git a/node_modules/ramda/src/index.mjs b/node_modules/ramda/src/index.mjs new file mode 100644 index 0000000..0f80dd8 --- /dev/null +++ b/node_modules/ramda/src/index.mjs @@ -0,0 +1,257 @@ +export { default as F } from "./F.js"; +export { default as T } from "./T.js"; +export { default as __ } from "./__.js"; +export { default as add } from "./add.js"; +export { default as addIndex } from "./addIndex.js"; +export { default as adjust } from "./adjust.js"; +export { default as all } from "./all.js"; +export { default as allPass } from "./allPass.js"; +export { default as always } from "./always.js"; +export { default as and } from "./and.js"; +export { default as any } from "./any.js"; +export { default as anyPass } from "./anyPass.js"; +export { default as ap } from "./ap.js"; +export { default as aperture } from "./aperture.js"; +export { default as append } from "./append.js"; +export { default as apply } from "./apply.js"; +export { default as applySpec } from "./applySpec.js"; +export { default as applyTo } from "./applyTo.js"; +export { default as ascend } from "./ascend.js"; +export { default as assoc } from "./assoc.js"; +export { default as assocPath } from "./assocPath.js"; +export { default as binary } from "./binary.js"; +export { default as bind } from "./bind.js"; +export { default as both } from "./both.js"; +export { default as call } from "./call.js"; +export { default as chain } from "./chain.js"; +export { default as clamp } from "./clamp.js"; +export { default as clone } from "./clone.js"; +export { default as comparator } from "./comparator.js"; +export { default as complement } from "./complement.js"; +export { default as compose } from "./compose.js"; +export { default as composeK } from "./composeK.js"; +export { default as composeP } from "./composeP.js"; +export { default as composeWith } from "./composeWith.js"; +export { default as concat } from "./concat.js"; +export { default as cond } from "./cond.js"; +export { default as construct } from "./construct.js"; +export { default as constructN } from "./constructN.js"; +export { default as contains } from "./contains.js"; +export { default as converge } from "./converge.js"; +export { default as countBy } from "./countBy.js"; +export { default as curry } from "./curry.js"; +export { default as curryN } from "./curryN.js"; +export { default as dec } from "./dec.js"; +export { default as defaultTo } from "./defaultTo.js"; +export { default as descend } from "./descend.js"; +export { default as difference } from "./difference.js"; +export { default as differenceWith } from "./differenceWith.js"; +export { default as dissoc } from "./dissoc.js"; +export { default as dissocPath } from "./dissocPath.js"; +export { default as divide } from "./divide.js"; +export { default as drop } from "./drop.js"; +export { default as dropLast } from "./dropLast.js"; +export { default as dropLastWhile } from "./dropLastWhile.js"; +export { default as dropRepeats } from "./dropRepeats.js"; +export { default as dropRepeatsWith } from "./dropRepeatsWith.js"; +export { default as dropWhile } from "./dropWhile.js"; +export { default as either } from "./either.js"; +export { default as empty } from "./empty.js"; +export { default as endsWith } from "./endsWith.js"; +export { default as eqBy } from "./eqBy.js"; +export { default as eqProps } from "./eqProps.js"; +export { default as equals } from "./equals.js"; +export { default as evolve } from "./evolve.js"; +export { default as filter } from "./filter.js"; +export { default as find } from "./find.js"; +export { default as findIndex } from "./findIndex.js"; +export { default as findLast } from "./findLast.js"; +export { default as findLastIndex } from "./findLastIndex.js"; +export { default as flatten } from "./flatten.js"; +export { default as flip } from "./flip.js"; +export { default as forEach } from "./forEach.js"; +export { default as forEachObjIndexed } from "./forEachObjIndexed.js"; +export { default as fromPairs } from "./fromPairs.js"; +export { default as groupBy } from "./groupBy.js"; +export { default as groupWith } from "./groupWith.js"; +export { default as gt } from "./gt.js"; +export { default as gte } from "./gte.js"; +export { default as has } from "./has.js"; +export { default as hasIn } from "./hasIn.js"; +export { default as hasPath } from "./hasPath.js"; +export { default as head } from "./head.js"; +export { default as identical } from "./identical.js"; +export { default as identity } from "./identity.js"; +export { default as ifElse } from "./ifElse.js"; +export { default as inc } from "./inc.js"; +export { default as includes } from "./includes.js"; +export { default as indexBy } from "./indexBy.js"; +export { default as indexOf } from "./indexOf.js"; +export { default as init } from "./init.js"; +export { default as innerJoin } from "./innerJoin.js"; +export { default as insert } from "./insert.js"; +export { default as insertAll } from "./insertAll.js"; +export { default as intersection } from "./intersection.js"; +export { default as intersperse } from "./intersperse.js"; +export { default as into } from "./into.js"; +export { default as invert } from "./invert.js"; +export { default as invertObj } from "./invertObj.js"; +export { default as invoker } from "./invoker.js"; +export { default as is } from "./is.js"; +export { default as isEmpty } from "./isEmpty.js"; +export { default as isNil } from "./isNil.js"; +export { default as join } from "./join.js"; +export { default as juxt } from "./juxt.js"; +export { default as keys } from "./keys.js"; +export { default as keysIn } from "./keysIn.js"; +export { default as last } from "./last.js"; +export { default as lastIndexOf } from "./lastIndexOf.js"; +export { default as length } from "./length.js"; +export { default as lens } from "./lens.js"; +export { default as lensIndex } from "./lensIndex.js"; +export { default as lensPath } from "./lensPath.js"; +export { default as lensProp } from "./lensProp.js"; +export { default as lift } from "./lift.js"; +export { default as liftN } from "./liftN.js"; +export { default as lt } from "./lt.js"; +export { default as lte } from "./lte.js"; +export { default as map } from "./map.js"; +export { default as mapAccum } from "./mapAccum.js"; +export { default as mapAccumRight } from "./mapAccumRight.js"; +export { default as mapObjIndexed } from "./mapObjIndexed.js"; +export { default as match } from "./match.js"; +export { default as mathMod } from "./mathMod.js"; +export { default as max } from "./max.js"; +export { default as maxBy } from "./maxBy.js"; +export { default as mean } from "./mean.js"; +export { default as median } from "./median.js"; +export { default as memoizeWith } from "./memoizeWith.js"; +export { default as merge } from "./merge.js"; +export { default as mergeAll } from "./mergeAll.js"; +export { default as mergeDeepLeft } from "./mergeDeepLeft.js"; +export { default as mergeDeepRight } from "./mergeDeepRight.js"; +export { default as mergeDeepWith } from "./mergeDeepWith.js"; +export { default as mergeDeepWithKey } from "./mergeDeepWithKey.js"; +export { default as mergeLeft } from "./mergeLeft.js"; +export { default as mergeRight } from "./mergeRight.js"; +export { default as mergeWith } from "./mergeWith.js"; +export { default as mergeWithKey } from "./mergeWithKey.js"; +export { default as min } from "./min.js"; +export { default as minBy } from "./minBy.js"; +export { default as modulo } from "./modulo.js"; +export { default as move } from "./move.js"; +export { default as multiply } from "./multiply.js"; +export { default as nAry } from "./nAry.js"; +export { default as negate } from "./negate.js"; +export { default as none } from "./none.js"; +export { default as not } from "./not.js"; +export { default as nth } from "./nth.js"; +export { default as nthArg } from "./nthArg.js"; +export { default as o } from "./o.js"; +export { default as objOf } from "./objOf.js"; +export { default as of } from "./of.js"; +export { default as omit } from "./omit.js"; +export { default as once } from "./once.js"; +export { default as or } from "./or.js"; +export { default as otherwise } from "./otherwise.js"; +export { default as over } from "./over.js"; +export { default as pair } from "./pair.js"; +export { default as partial } from "./partial.js"; +export { default as partialRight } from "./partialRight.js"; +export { default as partition } from "./partition.js"; +export { default as path } from "./path.js"; +export { default as paths } from "./paths.js"; +export { default as pathEq } from "./pathEq.js"; +export { default as pathOr } from "./pathOr.js"; +export { default as pathSatisfies } from "./pathSatisfies.js"; +export { default as pick } from "./pick.js"; +export { default as pickAll } from "./pickAll.js"; +export { default as pickBy } from "./pickBy.js"; +export { default as pipe } from "./pipe.js"; +export { default as pipeK } from "./pipeK.js"; +export { default as pipeP } from "./pipeP.js"; +export { default as pipeWith } from "./pipeWith.js"; +export { default as pluck } from "./pluck.js"; +export { default as prepend } from "./prepend.js"; +export { default as product } from "./product.js"; +export { default as project } from "./project.js"; +export { default as prop } from "./prop.js"; +export { default as propEq } from "./propEq.js"; +export { default as propIs } from "./propIs.js"; +export { default as propOr } from "./propOr.js"; +export { default as propSatisfies } from "./propSatisfies.js"; +export { default as props } from "./props.js"; +export { default as range } from "./range.js"; +export { default as reduce } from "./reduce.js"; +export { default as reduceBy } from "./reduceBy.js"; +export { default as reduceRight } from "./reduceRight.js"; +export { default as reduceWhile } from "./reduceWhile.js"; +export { default as reduced } from "./reduced.js"; +export { default as reject } from "./reject.js"; +export { default as remove } from "./remove.js"; +export { default as repeat } from "./repeat.js"; +export { default as replace } from "./replace.js"; +export { default as reverse } from "./reverse.js"; +export { default as scan } from "./scan.js"; +export { default as sequence } from "./sequence.js"; +export { default as set } from "./set.js"; +export { default as slice } from "./slice.js"; +export { default as sort } from "./sort.js"; +export { default as sortBy } from "./sortBy.js"; +export { default as sortWith } from "./sortWith.js"; +export { default as split } from "./split.js"; +export { default as splitAt } from "./splitAt.js"; +export { default as splitEvery } from "./splitEvery.js"; +export { default as splitWhen } from "./splitWhen.js"; +export { default as startsWith } from "./startsWith.js"; +export { default as subtract } from "./subtract.js"; +export { default as sum } from "./sum.js"; +export { default as symmetricDifference } from "./symmetricDifference.js"; +export { default as symmetricDifferenceWith } from "./symmetricDifferenceWith.js"; +export { default as tail } from "./tail.js"; +export { default as take } from "./take.js"; +export { default as takeLast } from "./takeLast.js"; +export { default as takeLastWhile } from "./takeLastWhile.js"; +export { default as takeWhile } from "./takeWhile.js"; +export { default as tap } from "./tap.js"; +export { default as test } from "./test.js"; +export { default as andThen } from "./andThen.js"; +export { default as times } from "./times.js"; +export { default as toLower } from "./toLower.js"; +export { default as toPairs } from "./toPairs.js"; +export { default as toPairsIn } from "./toPairsIn.js"; +export { default as toString } from "./toString.js"; +export { default as toUpper } from "./toUpper.js"; +export { default as transduce } from "./transduce.js"; +export { default as transpose } from "./transpose.js"; +export { default as traverse } from "./traverse.js"; +export { default as trim } from "./trim.js"; +export { default as tryCatch } from "./tryCatch.js"; +export { default as type } from "./type.js"; +export { default as unapply } from "./unapply.js"; +export { default as unary } from "./unary.js"; +export { default as uncurryN } from "./uncurryN.js"; +export { default as unfold } from "./unfold.js"; +export { default as union } from "./union.js"; +export { default as unionWith } from "./unionWith.js"; +export { default as uniq } from "./uniq.js"; +export { default as uniqBy } from "./uniqBy.js"; +export { default as uniqWith } from "./uniqWith.js"; +export { default as unless } from "./unless.js"; +export { default as unnest } from "./unnest.js"; +export { default as until } from "./until.js"; +export { default as update } from "./update.js"; +export { default as useWith } from "./useWith.js"; +export { default as values } from "./values.js"; +export { default as valuesIn } from "./valuesIn.js"; +export { default as view } from "./view.js"; +export { default as when } from "./when.js"; +export { default as where } from "./where.js"; +export { default as whereEq } from "./whereEq.js"; +export { default as without } from "./without.js"; +export { default as xor } from "./xor.js"; +export { default as xprod } from "./xprod.js"; +export { default as zip } from "./zip.js"; +export { default as zipObj } from "./zipObj.js"; +export { default as zipWith } from "./zipWith.js"; +export { default as thunkify } from "./thunkify.js"; diff --git a/node_modules/ramda/src/indexBy.js b/node_modules/ramda/src/indexBy.js new file mode 100644 index 0000000..0f6c76a --- /dev/null +++ b/node_modules/ramda/src/indexBy.js @@ -0,0 +1,33 @@ +var reduceBy = +/*#__PURE__*/ +require("./reduceBy"); +/** + * Given a function that generates a key, turns a list of objects into an + * object indexing the objects by the given key. Note that if multiple + * objects generate the same value for the indexing key only the last value + * will be included in the generated object. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> String) -> [{k: v}] -> {k: {k: v}} + * @param {Function} fn Function :: a -> String + * @param {Array} array The array of objects to index + * @return {Object} An object indexing each array element by the given property. + * @example + * + * const list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; + * R.indexBy(R.prop('id'), list); + * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} + */ + + +var indexBy = +/*#__PURE__*/ +reduceBy(function (acc, elem) { + return elem; +}, null); +module.exports = indexBy; \ No newline at end of file diff --git a/node_modules/ramda/src/indexOf.js b/node_modules/ramda/src/indexOf.js new file mode 100644 index 0000000..1ef5c36 --- /dev/null +++ b/node_modules/ramda/src/indexOf.js @@ -0,0 +1,39 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _indexOf = +/*#__PURE__*/ +require("./internal/_indexOf"); + +var _isArray = +/*#__PURE__*/ +require("./internal/_isArray"); +/** + * Returns the position of the first occurrence of an item in an array, or -1 + * if the item is not included in the array. [`R.equals`](#equals) is used to + * determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Number + * @param {*} target The item to find. + * @param {Array} xs The array to search in. + * @return {Number} the index of the target, or -1 if the target is not found. + * @see R.lastIndexOf + * @example + * + * R.indexOf(3, [1,2,3,4]); //=> 2 + * R.indexOf(10, [1,2,3,4]); //=> -1 + */ + + +var indexOf = +/*#__PURE__*/ +_curry2(function indexOf(target, xs) { + return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0); +}); + +module.exports = indexOf; \ No newline at end of file diff --git a/node_modules/ramda/src/init.js b/node_modules/ramda/src/init.js new file mode 100644 index 0000000..9f1b416 --- /dev/null +++ b/node_modules/ramda/src/init.js @@ -0,0 +1,33 @@ +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns all but the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.last, R.head, R.tail + * @example + * + * R.init([1, 2, 3]); //=> [1, 2] + * R.init([1, 2]); //=> [1] + * R.init([1]); //=> [] + * R.init([]); //=> [] + * + * R.init('abc'); //=> 'ab' + * R.init('ab'); //=> 'a' + * R.init('a'); //=> '' + * R.init(''); //=> '' + */ + + +var init = +/*#__PURE__*/ +slice(0, -1); +module.exports = init; \ No newline at end of file diff --git a/node_modules/ramda/src/innerJoin.js b/node_modules/ramda/src/innerJoin.js new file mode 100644 index 0000000..029d800 --- /dev/null +++ b/node_modules/ramda/src/innerJoin.js @@ -0,0 +1,57 @@ +var _includesWith = +/*#__PURE__*/ +require("./internal/_includesWith"); + +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var _filter = +/*#__PURE__*/ +require("./internal/_filter"); +/** + * Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list + * `xs'` comprising each of the elements of `xs` which is equal to one or more + * elements of `ys` according to `pred`. + * + * `pred` must be a binary function expecting an element from each list. + * + * `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should + * not be significant, but since `xs'` is ordered the implementation guarantees + * that its values are in the same order as they appear in `xs`. Duplicates are + * not removed, so `xs'` may contain duplicates if `xs` contains duplicates. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Relation + * @sig ((a, b) -> Boolean) -> [a] -> [b] -> [a] + * @param {Function} pred + * @param {Array} xs + * @param {Array} ys + * @return {Array} + * @see R.intersection + * @example + * + * R.innerJoin( + * (record, id) => record.id === id, + * [{id: 824, name: 'Richie Furay'}, + * {id: 956, name: 'Dewey Martin'}, + * {id: 313, name: 'Bruce Palmer'}, + * {id: 456, name: 'Stephen Stills'}, + * {id: 177, name: 'Neil Young'}], + * [177, 456, 999] + * ); + * //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] + */ + + +var innerJoin = +/*#__PURE__*/ +_curry3(function innerJoin(pred, xs, ys) { + return _filter(function (x) { + return _includesWith(pred, x, ys); + }, xs); +}); + +module.exports = innerJoin; \ No newline at end of file diff --git a/node_modules/ramda/src/insert.js b/node_modules/ramda/src/insert.js new file mode 100644 index 0000000..2ecbcc6 --- /dev/null +++ b/node_modules/ramda/src/insert.js @@ -0,0 +1,34 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Inserts the supplied element into the list, at the specified `index`. _Note that + + * this is not destructive_: it returns a copy of the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.2.2 + * @category List + * @sig Number -> a -> [a] -> [a] + * @param {Number} index The position to insert the element + * @param {*} elt The element to insert into the Array + * @param {Array} list The list to insert into + * @return {Array} A new Array with `elt` inserted at `index`. + * @example + * + * R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4] + */ + + +var insert = +/*#__PURE__*/ +_curry3(function insert(idx, elt, list) { + idx = idx < list.length && idx >= 0 ? idx : list.length; + var result = Array.prototype.slice.call(list, 0); + result.splice(idx, 0, elt); + return result; +}); + +module.exports = insert; \ No newline at end of file diff --git a/node_modules/ramda/src/insertAll.js b/node_modules/ramda/src/insertAll.js new file mode 100644 index 0000000..40707fb --- /dev/null +++ b/node_modules/ramda/src/insertAll.js @@ -0,0 +1,31 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Inserts the sub-list into the list, at the specified `index`. _Note that this is not + * destructive_: it returns a copy of the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category List + * @sig Number -> [a] -> [a] -> [a] + * @param {Number} index The position to insert the sub-list + * @param {Array} elts The sub-list to insert into the Array + * @param {Array} list The list to insert the sub-list into + * @return {Array} A new Array with `elts` inserted starting at `index`. + * @example + * + * R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4] + */ + + +var insertAll = +/*#__PURE__*/ +_curry3(function insertAll(idx, elts, list) { + idx = idx < list.length && idx >= 0 ? idx : list.length; + return [].concat(Array.prototype.slice.call(list, 0, idx), elts, Array.prototype.slice.call(list, idx)); +}); + +module.exports = insertAll; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_Set.js b/node_modules/ramda/src/internal/_Set.js new file mode 100644 index 0000000..4460178 --- /dev/null +++ b/node_modules/ramda/src/internal/_Set.js @@ -0,0 +1,203 @@ +var _includes = +/*#__PURE__*/ +require("./_includes"); + +var _Set = +/*#__PURE__*/ +function () { + function _Set() { + /* globals Set */ + this._nativeSet = typeof Set === 'function' ? new Set() : null; + this._items = {}; + } + + // until we figure out why jsdoc chokes on this + // @param item The item to add to the Set + // @returns {boolean} true if the item did not exist prior, otherwise false + // + _Set.prototype.add = function (item) { + return !hasOrAdd(item, true, this); + }; // + // @param item The item to check for existence in the Set + // @returns {boolean} true if the item exists in the Set, otherwise false + // + + + _Set.prototype.has = function (item) { + return hasOrAdd(item, false, this); + }; // + // Combines the logic for checking whether an item is a member of the set and + // for adding a new item to the set. + // + // @param item The item to check or add to the Set instance. + // @param shouldAdd If true, the item will be added to the set if it doesn't + // already exist. + // @param set The set instance to check or add to. + // @return {boolean} true if the item already existed, otherwise false. + // + + + return _Set; +}(); + +function hasOrAdd(item, shouldAdd, set) { + var type = typeof item; + var prevSize, newSize; + + switch (type) { + case 'string': + case 'number': + // distinguish between +0 and -0 + if (item === 0 && 1 / item === -Infinity) { + if (set._items['-0']) { + return true; + } else { + if (shouldAdd) { + set._items['-0'] = true; + } + + return false; + } + } // these types can all utilise the native Set + + + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + + set._nativeSet.add(item); + + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = {}; + set._items[type][item] = true; + } + + return false; + } else if (item in set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type][item] = true; + } + + return false; + } + } + + case 'boolean': + // set._items['boolean'] holds a two element array + // representing [ falseExists, trueExists ] + if (type in set._items) { + var bIdx = item ? 1 : 0; + + if (set._items[type][bIdx]) { + return true; + } else { + if (shouldAdd) { + set._items[type][bIdx] = true; + } + + return false; + } + } else { + if (shouldAdd) { + set._items[type] = item ? [false, true] : [true, false]; + } + + return false; + } + + case 'function': + // compare functions for reference equality + if (set._nativeSet !== null) { + if (shouldAdd) { + prevSize = set._nativeSet.size; + + set._nativeSet.add(item); + + newSize = set._nativeSet.size; + return newSize === prevSize; + } else { + return set._nativeSet.has(item); + } + } else { + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + + return false; + } + + if (!_includes(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + + return false; + } + + return true; + } + + case 'undefined': + if (set._items[type]) { + return true; + } else { + if (shouldAdd) { + set._items[type] = true; + } + + return false; + } + + case 'object': + if (item === null) { + if (!set._items['null']) { + if (shouldAdd) { + set._items['null'] = true; + } + + return false; + } + + return true; + } + + /* falls through */ + + default: + // reduce the search size of heterogeneous sets by creating buckets + // for each type. + type = Object.prototype.toString.call(item); + + if (!(type in set._items)) { + if (shouldAdd) { + set._items[type] = [item]; + } + + return false; + } // scan through all previously applied items + + + if (!_includes(item, set._items[type])) { + if (shouldAdd) { + set._items[type].push(item); + } + + return false; + } + + return true; + } +} // A simple Set type that honours R.equals semantics + + +module.exports = _Set; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_aperture.js b/node_modules/ramda/src/internal/_aperture.js new file mode 100644 index 0000000..a0d5df0 --- /dev/null +++ b/node_modules/ramda/src/internal/_aperture.js @@ -0,0 +1,14 @@ +function _aperture(n, list) { + var idx = 0; + var limit = list.length - (n - 1); + var acc = new Array(limit >= 0 ? limit : 0); + + while (idx < limit) { + acc[idx] = Array.prototype.slice.call(list, idx, idx + n); + idx += 1; + } + + return acc; +} + +module.exports = _aperture; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_arity.js b/node_modules/ramda/src/internal/_arity.js new file mode 100644 index 0000000..09ba49d --- /dev/null +++ b/node_modules/ramda/src/internal/_arity.js @@ -0,0 +1,64 @@ +function _arity(n, fn) { + /* eslint-disable no-unused-vars */ + switch (n) { + case 0: + return function () { + return fn.apply(this, arguments); + }; + + case 1: + return function (a0) { + return fn.apply(this, arguments); + }; + + case 2: + return function (a0, a1) { + return fn.apply(this, arguments); + }; + + case 3: + return function (a0, a1, a2) { + return fn.apply(this, arguments); + }; + + case 4: + return function (a0, a1, a2, a3) { + return fn.apply(this, arguments); + }; + + case 5: + return function (a0, a1, a2, a3, a4) { + return fn.apply(this, arguments); + }; + + case 6: + return function (a0, a1, a2, a3, a4, a5) { + return fn.apply(this, arguments); + }; + + case 7: + return function (a0, a1, a2, a3, a4, a5, a6) { + return fn.apply(this, arguments); + }; + + case 8: + return function (a0, a1, a2, a3, a4, a5, a6, a7) { + return fn.apply(this, arguments); + }; + + case 9: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { + return fn.apply(this, arguments); + }; + + case 10: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return fn.apply(this, arguments); + }; + + default: + throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); + } +} + +module.exports = _arity; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_arrayFromIterator.js b/node_modules/ramda/src/internal/_arrayFromIterator.js new file mode 100644 index 0000000..8e2027e --- /dev/null +++ b/node_modules/ramda/src/internal/_arrayFromIterator.js @@ -0,0 +1,12 @@ +function _arrayFromIterator(iter) { + var list = []; + var next; + + while (!(next = iter.next()).done) { + list.push(next.value); + } + + return list; +} + +module.exports = _arrayFromIterator; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_assertPromise.js b/node_modules/ramda/src/internal/_assertPromise.js new file mode 100644 index 0000000..b939333 --- /dev/null +++ b/node_modules/ramda/src/internal/_assertPromise.js @@ -0,0 +1,15 @@ +var _isFunction = +/*#__PURE__*/ +require("./_isFunction"); + +var _toString = +/*#__PURE__*/ +require("./_toString"); + +function _assertPromise(name, p) { + if (p == null || !_isFunction(p.then)) { + throw new TypeError('`' + name + '` expected a Promise, received ' + _toString(p, [])); + } +} + +module.exports = _assertPromise; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_checkForMethod.js b/node_modules/ramda/src/internal/_checkForMethod.js new file mode 100644 index 0000000..8830b3f --- /dev/null +++ b/node_modules/ramda/src/internal/_checkForMethod.js @@ -0,0 +1,29 @@ +var _isArray = +/*#__PURE__*/ +require("./_isArray"); +/** + * This checks whether a function has a [methodname] function. If it isn't an + * array it will execute that function otherwise it will default to the ramda + * implementation. + * + * @private + * @param {Function} fn ramda implemtation + * @param {String} methodname property to check for a custom implementation + * @return {Object} Whatever the return value of the method is. + */ + + +function _checkForMethod(methodname, fn) { + return function () { + var length = arguments.length; + + if (length === 0) { + return fn(); + } + + var obj = arguments[length - 1]; + return _isArray(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1)); + }; +} + +module.exports = _checkForMethod; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_clone.js b/node_modules/ramda/src/internal/_clone.js new file mode 100644 index 0000000..274839c --- /dev/null +++ b/node_modules/ramda/src/internal/_clone.js @@ -0,0 +1,61 @@ +var _cloneRegExp = +/*#__PURE__*/ +require("./_cloneRegExp"); + +var type = +/*#__PURE__*/ +require("../type"); +/** + * Copies an object. + * + * @private + * @param {*} value The value to be copied + * @param {Array} refFrom Array containing the source references + * @param {Array} refTo Array containing the copied source references + * @param {Boolean} deep Whether or not to perform deep cloning. + * @return {*} The copied value. + */ + + +function _clone(value, refFrom, refTo, deep) { + var copy = function copy(copiedValue) { + var len = refFrom.length; + var idx = 0; + + while (idx < len) { + if (value === refFrom[idx]) { + return refTo[idx]; + } + + idx += 1; + } + + refFrom[idx + 1] = value; + refTo[idx + 1] = copiedValue; + + for (var key in value) { + copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key]; + } + + return copiedValue; + }; + + switch (type(value)) { + case 'Object': + return copy({}); + + case 'Array': + return copy([]); + + case 'Date': + return new Date(value.valueOf()); + + case 'RegExp': + return _cloneRegExp(value); + + default: + return value; + } +} + +module.exports = _clone; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_cloneRegExp.js b/node_modules/ramda/src/internal/_cloneRegExp.js new file mode 100644 index 0000000..ea26283 --- /dev/null +++ b/node_modules/ramda/src/internal/_cloneRegExp.js @@ -0,0 +1,5 @@ +function _cloneRegExp(pattern) { + return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : '')); +} + +module.exports = _cloneRegExp; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_complement.js b/node_modules/ramda/src/internal/_complement.js new file mode 100644 index 0000000..4bb77e3 --- /dev/null +++ b/node_modules/ramda/src/internal/_complement.js @@ -0,0 +1,7 @@ +function _complement(f) { + return function () { + return !f.apply(this, arguments); + }; +} + +module.exports = _complement; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_concat.js b/node_modules/ramda/src/internal/_concat.js new file mode 100644 index 0000000..6b00ed8 --- /dev/null +++ b/node_modules/ramda/src/internal/_concat.js @@ -0,0 +1,36 @@ +/** + * Private `concat` function to merge two array-like objects. + * + * @private + * @param {Array|Arguments} [set1=[]] An array-like object. + * @param {Array|Arguments} [set2=[]] An array-like object. + * @return {Array} A new, merged array. + * @example + * + * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + */ +function _concat(set1, set2) { + set1 = set1 || []; + set2 = set2 || []; + var idx; + var len1 = set1.length; + var len2 = set2.length; + var result = []; + idx = 0; + + while (idx < len1) { + result[result.length] = set1[idx]; + idx += 1; + } + + idx = 0; + + while (idx < len2) { + result[result.length] = set2[idx]; + idx += 1; + } + + return result; +} + +module.exports = _concat; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_createPartialApplicator.js b/node_modules/ramda/src/internal/_createPartialApplicator.js new file mode 100644 index 0000000..05f301b --- /dev/null +++ b/node_modules/ramda/src/internal/_createPartialApplicator.js @@ -0,0 +1,17 @@ +var _arity = +/*#__PURE__*/ +require("./_arity"); + +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +function _createPartialApplicator(concat) { + return _curry2(function (fn, args) { + return _arity(Math.max(0, fn.length - args.length), function () { + return fn.apply(this, concat(args, arguments)); + }); + }); +} + +module.exports = _createPartialApplicator; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_curry1.js b/node_modules/ramda/src/internal/_curry1.js new file mode 100644 index 0000000..a3bd4b9 --- /dev/null +++ b/node_modules/ramda/src/internal/_curry1.js @@ -0,0 +1,24 @@ +var _isPlaceholder = +/*#__PURE__*/ +require("./_isPlaceholder"); +/** + * Optimized internal one-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + +function _curry1(fn) { + return function f1(a) { + if (arguments.length === 0 || _isPlaceholder(a)) { + return f1; + } else { + return fn.apply(this, arguments); + } + }; +} + +module.exports = _curry1; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_curry2.js b/node_modules/ramda/src/internal/_curry2.js new file mode 100644 index 0000000..a5f8a47 --- /dev/null +++ b/node_modules/ramda/src/internal/_curry2.js @@ -0,0 +1,39 @@ +var _curry1 = +/*#__PURE__*/ +require("./_curry1"); + +var _isPlaceholder = +/*#__PURE__*/ +require("./_isPlaceholder"); +/** + * Optimized internal two-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + +function _curry2(fn) { + return function f2(a, b) { + switch (arguments.length) { + case 0: + return f2; + + case 1: + return _isPlaceholder(a) ? f2 : _curry1(function (_b) { + return fn(a, _b); + }); + + default: + return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) { + return fn(_a, b); + }) : _isPlaceholder(b) ? _curry1(function (_b) { + return fn(a, _b); + }) : fn(a, b); + } + }; +} + +module.exports = _curry2; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_curry3.js b/node_modules/ramda/src/internal/_curry3.js new file mode 100644 index 0000000..da2cbe5 --- /dev/null +++ b/node_modules/ramda/src/internal/_curry3.js @@ -0,0 +1,60 @@ +var _curry1 = +/*#__PURE__*/ +require("./_curry1"); + +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _isPlaceholder = +/*#__PURE__*/ +require("./_isPlaceholder"); +/** + * Optimized internal three-arity curry function. + * + * @private + * @category Function + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + +function _curry3(fn) { + return function f3(a, b, c) { + switch (arguments.length) { + case 0: + return f3; + + case 1: + return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) { + return fn(a, _b, _c); + }); + + case 2: + return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) { + return fn(_a, b, _c); + }) : _isPlaceholder(b) ? _curry2(function (_b, _c) { + return fn(a, _b, _c); + }) : _curry1(function (_c) { + return fn(a, b, _c); + }); + + default: + return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) { + return fn(_a, _b, c); + }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) { + return fn(_a, b, _c); + }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) { + return fn(a, _b, _c); + }) : _isPlaceholder(a) ? _curry1(function (_a) { + return fn(_a, b, c); + }) : _isPlaceholder(b) ? _curry1(function (_b) { + return fn(a, _b, c); + }) : _isPlaceholder(c) ? _curry1(function (_c) { + return fn(a, b, _c); + }) : fn(a, b, c); + } + }; +} + +module.exports = _curry3; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_curryN.js b/node_modules/ramda/src/internal/_curryN.js new file mode 100644 index 0000000..3e62862 --- /dev/null +++ b/node_modules/ramda/src/internal/_curryN.js @@ -0,0 +1,50 @@ +var _arity = +/*#__PURE__*/ +require("./_arity"); + +var _isPlaceholder = +/*#__PURE__*/ +require("./_isPlaceholder"); +/** + * Internal curryN function. + * + * @private + * @category Function + * @param {Number} length The arity of the curried function. + * @param {Array} received An array of arguments received thus far. + * @param {Function} fn The function to curry. + * @return {Function} The curried function. + */ + + +function _curryN(length, received, fn) { + return function () { + var combined = []; + var argsIdx = 0; + var left = length; + var combinedIdx = 0; + + while (combinedIdx < received.length || argsIdx < arguments.length) { + var result; + + if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) { + result = received[combinedIdx]; + } else { + result = arguments[argsIdx]; + argsIdx += 1; + } + + combined[combinedIdx] = result; + + if (!_isPlaceholder(result)) { + left -= 1; + } + + combinedIdx += 1; + } + + return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn)); + }; +} + +module.exports = _curryN; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_dispatchable.js b/node_modules/ramda/src/internal/_dispatchable.js new file mode 100644 index 0000000..44b4228 --- /dev/null +++ b/node_modules/ramda/src/internal/_dispatchable.js @@ -0,0 +1,54 @@ +var _isArray = +/*#__PURE__*/ +require("./_isArray"); + +var _isTransformer = +/*#__PURE__*/ +require("./_isTransformer"); +/** + * Returns a function that dispatches with different strategies based on the + * object in list position (last argument). If it is an array, executes [fn]. + * Otherwise, if it has a function with one of the given method names, it will + * execute that function (functor case). Otherwise, if it is a transformer, + * uses transducer [xf] to return a new transformer (transducer case). + * Otherwise, it will default to executing [fn]. + * + * @private + * @param {Array} methodNames properties to check for a custom implementation + * @param {Function} xf transducer to initialize if object is transformer + * @param {Function} fn default ramda implementation + * @return {Function} A function that dispatches on object in list position + */ + + +function _dispatchable(methodNames, xf, fn) { + return function () { + if (arguments.length === 0) { + return fn(); + } + + var args = Array.prototype.slice.call(arguments, 0); + var obj = args.pop(); + + if (!_isArray(obj)) { + var idx = 0; + + while (idx < methodNames.length) { + if (typeof obj[methodNames[idx]] === 'function') { + return obj[methodNames[idx]].apply(obj, args); + } + + idx += 1; + } + + if (_isTransformer(obj)) { + var transducer = xf.apply(null, args); + return transducer(obj); + } + } + + return fn.apply(this, arguments); + }; +} + +module.exports = _dispatchable; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_dropLast.js b/node_modules/ramda/src/internal/_dropLast.js new file mode 100644 index 0000000..9f717a9 --- /dev/null +++ b/node_modules/ramda/src/internal/_dropLast.js @@ -0,0 +1,9 @@ +var take = +/*#__PURE__*/ +require("../take"); + +function dropLast(n, xs) { + return take(n < xs.length ? xs.length - n : 0, xs); +} + +module.exports = dropLast; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_dropLastWhile.js b/node_modules/ramda/src/internal/_dropLastWhile.js new file mode 100644 index 0000000..3f7d1e9 --- /dev/null +++ b/node_modules/ramda/src/internal/_dropLastWhile.js @@ -0,0 +1,15 @@ +var slice = +/*#__PURE__*/ +require("../slice"); + +function dropLastWhile(pred, xs) { + var idx = xs.length - 1; + + while (idx >= 0 && pred(xs[idx])) { + idx -= 1; + } + + return slice(0, idx + 1, xs); +} + +module.exports = dropLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_equals.js b/node_modules/ramda/src/internal/_equals.js new file mode 100644 index 0000000..f8519e2 --- /dev/null +++ b/node_modules/ramda/src/internal/_equals.js @@ -0,0 +1,189 @@ +var _arrayFromIterator = +/*#__PURE__*/ +require("./_arrayFromIterator"); + +var _includesWith = +/*#__PURE__*/ +require("./_includesWith"); + +var _functionName = +/*#__PURE__*/ +require("./_functionName"); + +var _has = +/*#__PURE__*/ +require("./_has"); + +var _objectIs = +/*#__PURE__*/ +require("./_objectIs"); + +var keys = +/*#__PURE__*/ +require("../keys"); + +var type = +/*#__PURE__*/ +require("../type"); +/** + * private _uniqContentEquals function. + * That function is checking equality of 2 iterator contents with 2 assumptions + * - iterators lengths are the same + * - iterators values are unique + * + * false-positive result will be returned for comparision of, e.g. + * - [1,2,3] and [1,2,3,4] + * - [1,1,1] and [1,2,3] + * */ + + +function _uniqContentEquals(aIterator, bIterator, stackA, stackB) { + var a = _arrayFromIterator(aIterator); + + var b = _arrayFromIterator(bIterator); + + function eq(_a, _b) { + return _equals(_a, _b, stackA.slice(), stackB.slice()); + } // if *a* array contains any element that is not included in *b* + + + return !_includesWith(function (b, aItem) { + return !_includesWith(eq, aItem, b); + }, b, a); +} + +function _equals(a, b, stackA, stackB) { + if (_objectIs(a, b)) { + return true; + } + + var typeA = type(a); + + if (typeA !== type(b)) { + return false; + } + + if (a == null || b == null) { + return false; + } + + if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') { + return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a); + } + + if (typeof a.equals === 'function' || typeof b.equals === 'function') { + return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a); + } + + switch (typeA) { + case 'Arguments': + case 'Array': + case 'Object': + if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') { + return a === b; + } + + break; + + case 'Boolean': + case 'Number': + case 'String': + if (!(typeof a === typeof b && _objectIs(a.valueOf(), b.valueOf()))) { + return false; + } + + break; + + case 'Date': + if (!_objectIs(a.valueOf(), b.valueOf())) { + return false; + } + + break; + + case 'Error': + return a.name === b.name && a.message === b.message; + + case 'RegExp': + if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) { + return false; + } + + break; + } + + var idx = stackA.length - 1; + + while (idx >= 0) { + if (stackA[idx] === a) { + return stackB[idx] === b; + } + + idx -= 1; + } + + switch (typeA) { + case 'Map': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b])); + + case 'Set': + if (a.size !== b.size) { + return false; + } + + return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b])); + + case 'Arguments': + case 'Array': + case 'Object': + case 'Boolean': + case 'Number': + case 'String': + case 'Date': + case 'Error': + case 'RegExp': + case 'Int8Array': + case 'Uint8Array': + case 'Uint8ClampedArray': + case 'Int16Array': + case 'Uint16Array': + case 'Int32Array': + case 'Uint32Array': + case 'Float32Array': + case 'Float64Array': + case 'ArrayBuffer': + break; + + default: + // Values of other types are only equal if identical. + return false; + } + + var keysA = keys(a); + + if (keysA.length !== keys(b).length) { + return false; + } + + var extendedStackA = stackA.concat([a]); + var extendedStackB = stackB.concat([b]); + idx = keysA.length - 1; + + while (idx >= 0) { + var key = keysA[idx]; + + if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { + return false; + } + + idx -= 1; + } + + return true; +} + +module.exports = _equals; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_filter.js b/node_modules/ramda/src/internal/_filter.js new file mode 100644 index 0000000..4283703 --- /dev/null +++ b/node_modules/ramda/src/internal/_filter.js @@ -0,0 +1,17 @@ +function _filter(fn, list) { + var idx = 0; + var len = list.length; + var result = []; + + while (idx < len) { + if (fn(list[idx])) { + result[result.length] = list[idx]; + } + + idx += 1; + } + + return result; +} + +module.exports = _filter; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_flatCat.js b/node_modules/ramda/src/internal/_flatCat.js new file mode 100644 index 0000000..04c68e5 --- /dev/null +++ b/node_modules/ramda/src/internal/_flatCat.js @@ -0,0 +1,43 @@ +var _forceReduced = +/*#__PURE__*/ +require("./_forceReduced"); + +var _isArrayLike = +/*#__PURE__*/ +require("./_isArrayLike"); + +var _reduce = +/*#__PURE__*/ +require("./_reduce"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var preservingReduced = function (xf) { + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function (result) { + return xf['@@transducer/result'](result); + }, + '@@transducer/step': function (result, input) { + var ret = xf['@@transducer/step'](result, input); + return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret; + } + }; +}; + +var _flatCat = function _xcat(xf) { + var rxf = preservingReduced(xf); + return { + '@@transducer/init': _xfBase.init, + '@@transducer/result': function (result) { + return rxf['@@transducer/result'](result); + }, + '@@transducer/step': function (result, input) { + return !_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input); + } + }; +}; + +module.exports = _flatCat; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_forceReduced.js b/node_modules/ramda/src/internal/_forceReduced.js new file mode 100644 index 0000000..d989c4d --- /dev/null +++ b/node_modules/ramda/src/internal/_forceReduced.js @@ -0,0 +1,8 @@ +function _forceReduced(x) { + return { + '@@transducer/value': x, + '@@transducer/reduced': true + }; +} + +module.exports = _forceReduced; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_functionName.js b/node_modules/ramda/src/internal/_functionName.js new file mode 100644 index 0000000..25e9afb --- /dev/null +++ b/node_modules/ramda/src/internal/_functionName.js @@ -0,0 +1,7 @@ +function _functionName(f) { + // String(x => x) evaluates to "x => x", so the pattern may not match. + var match = String(f).match(/^function (\w*)/); + return match == null ? '' : match[1]; +} + +module.exports = _functionName; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_functionsWith.js b/node_modules/ramda/src/internal/_functionsWith.js new file mode 100644 index 0000000..8a1fe01 --- /dev/null +++ b/node_modules/ramda/src/internal/_functionsWith.js @@ -0,0 +1,19 @@ +var _filter = +/*#__PURE__*/ +require("./_filter"); +/** + * @private + * @param {Function} fn The strategy for extracting function names from an object + * @return {Function} A function that takes an object and returns an array of function names. + */ + + +function _functionsWith(fn) { + return function (obj) { + return _filter(function (key) { + return typeof obj[key] === 'function'; + }, fn(obj)); + }; +} + +module.exports = _functionsWith; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_has.js b/node_modules/ramda/src/internal/_has.js new file mode 100644 index 0000000..ec54484 --- /dev/null +++ b/node_modules/ramda/src/internal/_has.js @@ -0,0 +1,5 @@ +function _has(prop, obj) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = _has; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_identity.js b/node_modules/ramda/src/internal/_identity.js new file mode 100644 index 0000000..43b5558 --- /dev/null +++ b/node_modules/ramda/src/internal/_identity.js @@ -0,0 +1,5 @@ +function _identity(x) { + return x; +} + +module.exports = _identity; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_includes.js b/node_modules/ramda/src/internal/_includes.js new file mode 100644 index 0000000..8368eab --- /dev/null +++ b/node_modules/ramda/src/internal/_includes.js @@ -0,0 +1,9 @@ +var _indexOf = +/*#__PURE__*/ +require("./_indexOf"); + +function _includes(a, list) { + return _indexOf(list, a, 0) >= 0; +} + +module.exports = _includes; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_includesWith.js b/node_modules/ramda/src/internal/_includesWith.js new file mode 100644 index 0000000..19d3072 --- /dev/null +++ b/node_modules/ramda/src/internal/_includesWith.js @@ -0,0 +1,16 @@ +function _includesWith(pred, x, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + if (pred(x, list[idx])) { + return true; + } + + idx += 1; + } + + return false; +} + +module.exports = _includesWith; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_indexOf.js b/node_modules/ramda/src/internal/_indexOf.js new file mode 100644 index 0000000..6a8db89 --- /dev/null +++ b/node_modules/ramda/src/internal/_indexOf.js @@ -0,0 +1,72 @@ +var equals = +/*#__PURE__*/ +require("../equals"); + +function _indexOf(list, a, idx) { + var inf, item; // Array.prototype.indexOf doesn't exist below IE9 + + if (typeof list.indexOf === 'function') { + switch (typeof a) { + case 'number': + if (a === 0) { + // manually crawl the list to distinguish between +0 and -0 + inf = 1 / a; + + while (idx < list.length) { + item = list[idx]; + + if (item === 0 && 1 / item === inf) { + return idx; + } + + idx += 1; + } + + return -1; + } else if (a !== a) { + // NaN + while (idx < list.length) { + item = list[idx]; + + if (typeof item === 'number' && item !== item) { + return idx; + } + + idx += 1; + } + + return -1; + } // non-zero numbers can utilise Set + + + return list.indexOf(a, idx); + // all these types can utilise Set + + case 'string': + case 'boolean': + case 'function': + case 'undefined': + return list.indexOf(a, idx); + + case 'object': + if (a === null) { + // null can utilise Set + return list.indexOf(a, idx); + } + + } + } // anything else not covered above, defer to R.equals + + + while (idx < list.length) { + if (equals(list[idx], a)) { + return idx; + } + + idx += 1; + } + + return -1; +} + +module.exports = _indexOf; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isArguments.js b/node_modules/ramda/src/internal/_isArguments.js new file mode 100644 index 0000000..bb86b25 --- /dev/null +++ b/node_modules/ramda/src/internal/_isArguments.js @@ -0,0 +1,17 @@ +var _has = +/*#__PURE__*/ +require("./_has"); + +var toString = Object.prototype.toString; + +var _isArguments = +/*#__PURE__*/ +function () { + return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) { + return toString.call(x) === '[object Arguments]'; + } : function _isArguments(x) { + return _has('callee', x); + }; +}(); + +module.exports = _isArguments; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isArray.js b/node_modules/ramda/src/internal/_isArray.js new file mode 100644 index 0000000..fc8bcc3 --- /dev/null +++ b/node_modules/ramda/src/internal/_isArray.js @@ -0,0 +1,15 @@ +/** + * Tests whether or not an object is an array. + * + * @private + * @param {*} val The object to test. + * @return {Boolean} `true` if `val` is an array, `false` otherwise. + * @example + * + * _isArray([]); //=> true + * _isArray(null); //=> false + * _isArray({}); //=> false + */ +module.exports = Array.isArray || function _isArray(val) { + return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]'; +}; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isArrayLike.js b/node_modules/ramda/src/internal/_isArrayLike.js new file mode 100644 index 0000000..14c41ac --- /dev/null +++ b/node_modules/ramda/src/internal/_isArrayLike.js @@ -0,0 +1,65 @@ +var _curry1 = +/*#__PURE__*/ +require("./_curry1"); + +var _isArray = +/*#__PURE__*/ +require("./_isArray"); + +var _isString = +/*#__PURE__*/ +require("./_isString"); +/** + * Tests whether or not an object is similar to an array. + * + * @private + * @category Type + * @category List + * @sig * -> Boolean + * @param {*} x The object to test. + * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. + * @example + * + * _isArrayLike([]); //=> true + * _isArrayLike(true); //=> false + * _isArrayLike({}); //=> false + * _isArrayLike({length: 10}); //=> false + * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true + */ + + +var _isArrayLike = +/*#__PURE__*/ +_curry1(function isArrayLike(x) { + if (_isArray(x)) { + return true; + } + + if (!x) { + return false; + } + + if (typeof x !== 'object') { + return false; + } + + if (_isString(x)) { + return false; + } + + if (x.nodeType === 1) { + return !!x.length; + } + + if (x.length === 0) { + return true; + } + + if (x.length > 0) { + return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1); + } + + return false; +}); + +module.exports = _isArrayLike; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isFunction.js b/node_modules/ramda/src/internal/_isFunction.js new file mode 100644 index 0000000..ea5dfb8 --- /dev/null +++ b/node_modules/ramda/src/internal/_isFunction.js @@ -0,0 +1,6 @@ +function _isFunction(x) { + var type = Object.prototype.toString.call(x); + return type === '[object Function]' || type === '[object AsyncFunction]' || type === '[object GeneratorFunction]' || type === '[object AsyncGeneratorFunction]'; +} + +module.exports = _isFunction; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isInteger.js b/node_modules/ramda/src/internal/_isInteger.js new file mode 100644 index 0000000..458977f --- /dev/null +++ b/node_modules/ramda/src/internal/_isInteger.js @@ -0,0 +1,11 @@ +/** + * Determine if the passed argument is an integer. + * + * @private + * @param {*} n + * @category Type + * @return {Boolean} + */ +module.exports = Number.isInteger || function _isInteger(n) { + return n << 0 === n; +}; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isNumber.js b/node_modules/ramda/src/internal/_isNumber.js new file mode 100644 index 0000000..bb59d63 --- /dev/null +++ b/node_modules/ramda/src/internal/_isNumber.js @@ -0,0 +1,5 @@ +function _isNumber(x) { + return Object.prototype.toString.call(x) === '[object Number]'; +} + +module.exports = _isNumber; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isObject.js b/node_modules/ramda/src/internal/_isObject.js new file mode 100644 index 0000000..8be1386 --- /dev/null +++ b/node_modules/ramda/src/internal/_isObject.js @@ -0,0 +1,5 @@ +function _isObject(x) { + return Object.prototype.toString.call(x) === '[object Object]'; +} + +module.exports = _isObject; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isPlaceholder.js b/node_modules/ramda/src/internal/_isPlaceholder.js new file mode 100644 index 0000000..720b073 --- /dev/null +++ b/node_modules/ramda/src/internal/_isPlaceholder.js @@ -0,0 +1,5 @@ +function _isPlaceholder(a) { + return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true; +} + +module.exports = _isPlaceholder; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isRegExp.js b/node_modules/ramda/src/internal/_isRegExp.js new file mode 100644 index 0000000..bec7e02 --- /dev/null +++ b/node_modules/ramda/src/internal/_isRegExp.js @@ -0,0 +1,5 @@ +function _isRegExp(x) { + return Object.prototype.toString.call(x) === '[object RegExp]'; +} + +module.exports = _isRegExp; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isString.js b/node_modules/ramda/src/internal/_isString.js new file mode 100644 index 0000000..8a18aad --- /dev/null +++ b/node_modules/ramda/src/internal/_isString.js @@ -0,0 +1,5 @@ +function _isString(x) { + return Object.prototype.toString.call(x) === '[object String]'; +} + +module.exports = _isString; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_isTransformer.js b/node_modules/ramda/src/internal/_isTransformer.js new file mode 100644 index 0000000..015386f --- /dev/null +++ b/node_modules/ramda/src/internal/_isTransformer.js @@ -0,0 +1,5 @@ +function _isTransformer(obj) { + return obj != null && typeof obj['@@transducer/step'] === 'function'; +} + +module.exports = _isTransformer; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_makeFlat.js b/node_modules/ramda/src/internal/_makeFlat.js new file mode 100644 index 0000000..530312b --- /dev/null +++ b/node_modules/ramda/src/internal/_makeFlat.js @@ -0,0 +1,40 @@ +var _isArrayLike = +/*#__PURE__*/ +require("./_isArrayLike"); +/** + * `_makeFlat` is a helper function that returns a one-level or fully recursive + * function based on the flag passed in. + * + * @private + */ + + +function _makeFlat(recursive) { + return function flatt(list) { + var value, jlen, j; + var result = []; + var idx = 0; + var ilen = list.length; + + while (idx < ilen) { + if (_isArrayLike(list[idx])) { + value = recursive ? flatt(list[idx]) : list[idx]; + j = 0; + jlen = value.length; + + while (j < jlen) { + result[result.length] = value[j]; + j += 1; + } + } else { + result[result.length] = list[idx]; + } + + idx += 1; + } + + return result; + }; +} + +module.exports = _makeFlat; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_map.js b/node_modules/ramda/src/internal/_map.js new file mode 100644 index 0000000..ab95735 --- /dev/null +++ b/node_modules/ramda/src/internal/_map.js @@ -0,0 +1,14 @@ +function _map(fn, functor) { + var idx = 0; + var len = functor.length; + var result = Array(len); + + while (idx < len) { + result[idx] = fn(functor[idx]); + idx += 1; + } + + return result; +} + +module.exports = _map; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_objectAssign.js b/node_modules/ramda/src/internal/_objectAssign.js new file mode 100644 index 0000000..6f8d516 --- /dev/null +++ b/node_modules/ramda/src/internal/_objectAssign.js @@ -0,0 +1,32 @@ +var _has = +/*#__PURE__*/ +require("./_has"); // Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + + +function _objectAssign(target) { + if (target == null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + var idx = 1; + var length = arguments.length; + + while (idx < length) { + var source = arguments[idx]; + + if (source != null) { + for (var nextKey in source) { + if (_has(nextKey, source)) { + output[nextKey] = source[nextKey]; + } + } + } + + idx += 1; + } + + return output; +} + +module.exports = typeof Object.assign === 'function' ? Object.assign : _objectAssign; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_objectIs.js b/node_modules/ramda/src/internal/_objectIs.js new file mode 100644 index 0000000..0f8b07e --- /dev/null +++ b/node_modules/ramda/src/internal/_objectIs.js @@ -0,0 +1,14 @@ +// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is +function _objectIs(a, b) { + // SameValue algorithm + if (a === b) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return a !== 0 || 1 / a === 1 / b; + } else { + // Step 6.a: NaN == NaN + return a !== a && b !== b; + } +} + +module.exports = typeof Object.is === 'function' ? Object.is : _objectIs; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_of.js b/node_modules/ramda/src/internal/_of.js new file mode 100644 index 0000000..e408fcc --- /dev/null +++ b/node_modules/ramda/src/internal/_of.js @@ -0,0 +1,5 @@ +function _of(x) { + return [x]; +} + +module.exports = _of; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_pipe.js b/node_modules/ramda/src/internal/_pipe.js new file mode 100644 index 0000000..7d72cc4 --- /dev/null +++ b/node_modules/ramda/src/internal/_pipe.js @@ -0,0 +1,7 @@ +function _pipe(f, g) { + return function () { + return g.call(this, f.apply(this, arguments)); + }; +} + +module.exports = _pipe; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_pipeP.js b/node_modules/ramda/src/internal/_pipeP.js new file mode 100644 index 0000000..3b79a05 --- /dev/null +++ b/node_modules/ramda/src/internal/_pipeP.js @@ -0,0 +1,10 @@ +function _pipeP(f, g) { + return function () { + var ctx = this; + return f.apply(ctx, arguments).then(function (x) { + return g.call(ctx, x); + }); + }; +} + +module.exports = _pipeP; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_quote.js b/node_modules/ramda/src/internal/_quote.js new file mode 100644 index 0000000..1067e8a --- /dev/null +++ b/node_modules/ramda/src/internal/_quote.js @@ -0,0 +1,7 @@ +function _quote(s) { + var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace + .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0'); + return '"' + escaped.replace(/"/g, '\\"') + '"'; +} + +module.exports = _quote; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_reduce.js b/node_modules/ramda/src/internal/_reduce.js new file mode 100644 index 0000000..2f96aca --- /dev/null +++ b/node_modules/ramda/src/internal/_reduce.js @@ -0,0 +1,82 @@ +var _isArrayLike = +/*#__PURE__*/ +require("./_isArrayLike"); + +var _xwrap = +/*#__PURE__*/ +require("./_xwrap"); + +var bind = +/*#__PURE__*/ +require("../bind"); + +function _arrayReduce(xf, acc, list) { + var idx = 0; + var len = list.length; + + while (idx < len) { + acc = xf['@@transducer/step'](acc, list[idx]); + + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + + idx += 1; + } + + return xf['@@transducer/result'](acc); +} + +function _iterableReduce(xf, acc, iter) { + var step = iter.next(); + + while (!step.done) { + acc = xf['@@transducer/step'](acc, step.value); + + if (acc && acc['@@transducer/reduced']) { + acc = acc['@@transducer/value']; + break; + } + + step = iter.next(); + } + + return xf['@@transducer/result'](acc); +} + +function _methodReduce(xf, acc, obj, methodName) { + return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc)); +} + +var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator'; + +function _reduce(fn, acc, list) { + if (typeof fn === 'function') { + fn = _xwrap(fn); + } + + if (_isArrayLike(list)) { + return _arrayReduce(fn, acc, list); + } + + if (typeof list['fantasy-land/reduce'] === 'function') { + return _methodReduce(fn, acc, list, 'fantasy-land/reduce'); + } + + if (list[symIterator] != null) { + return _iterableReduce(fn, acc, list[symIterator]()); + } + + if (typeof list.next === 'function') { + return _iterableReduce(fn, acc, list); + } + + if (typeof list.reduce === 'function') { + return _methodReduce(fn, acc, list, 'reduce'); + } + + throw new TypeError('reduce: list must be array or iterable'); +} + +module.exports = _reduce; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_reduced.js b/node_modules/ramda/src/internal/_reduced.js new file mode 100644 index 0000000..f514bc5 --- /dev/null +++ b/node_modules/ramda/src/internal/_reduced.js @@ -0,0 +1,8 @@ +function _reduced(x) { + return x && x['@@transducer/reduced'] ? x : { + '@@transducer/value': x, + '@@transducer/reduced': true + }; +} + +module.exports = _reduced; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_stepCat.js b/node_modules/ramda/src/internal/_stepCat.js new file mode 100644 index 0000000..fc52dd6 --- /dev/null +++ b/node_modules/ramda/src/internal/_stepCat.js @@ -0,0 +1,64 @@ +var _objectAssign = +/*#__PURE__*/ +require("./_objectAssign"); + +var _identity = +/*#__PURE__*/ +require("./_identity"); + +var _isArrayLike = +/*#__PURE__*/ +require("./_isArrayLike"); + +var _isTransformer = +/*#__PURE__*/ +require("./_isTransformer"); + +var objOf = +/*#__PURE__*/ +require("../objOf"); + +var _stepCatArray = { + '@@transducer/init': Array, + '@@transducer/step': function (xs, x) { + xs.push(x); + return xs; + }, + '@@transducer/result': _identity +}; +var _stepCatString = { + '@@transducer/init': String, + '@@transducer/step': function (a, b) { + return a + b; + }, + '@@transducer/result': _identity +}; +var _stepCatObject = { + '@@transducer/init': Object, + '@@transducer/step': function (result, input) { + return _objectAssign(result, _isArrayLike(input) ? objOf(input[0], input[1]) : input); + }, + '@@transducer/result': _identity +}; + +function _stepCat(obj) { + if (_isTransformer(obj)) { + return obj; + } + + if (_isArrayLike(obj)) { + return _stepCatArray; + } + + if (typeof obj === 'string') { + return _stepCatString; + } + + if (typeof obj === 'object') { + return _stepCatObject; + } + + throw new Error('Cannot create transformer for ' + obj); +} + +module.exports = _stepCat; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_toISOString.js b/node_modules/ramda/src/internal/_toISOString.js new file mode 100644 index 0000000..3c1da8a --- /dev/null +++ b/node_modules/ramda/src/internal/_toISOString.js @@ -0,0 +1,14 @@ +/** + * Polyfill from . + */ +var pad = function pad(n) { + return (n < 10 ? '0' : '') + n; +}; + +var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) { + return d.toISOString(); +} : function _toISOString(d) { + return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; +}; + +module.exports = _toISOString; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_toString.js b/node_modules/ramda/src/internal/_toString.js new file mode 100644 index 0000000..09cabf5 --- /dev/null +++ b/node_modules/ramda/src/internal/_toString.js @@ -0,0 +1,78 @@ +var _includes = +/*#__PURE__*/ +require("./_includes"); + +var _map = +/*#__PURE__*/ +require("./_map"); + +var _quote = +/*#__PURE__*/ +require("./_quote"); + +var _toISOString = +/*#__PURE__*/ +require("./_toISOString"); + +var keys = +/*#__PURE__*/ +require("../keys"); + +var reject = +/*#__PURE__*/ +require("../reject"); + +function _toString(x, seen) { + var recur = function recur(y) { + var xs = seen.concat([x]); + return _includes(y, xs) ? '' : _toString(y, xs); + }; // mapPairs :: (Object, [String]) -> [String] + + + var mapPairs = function (obj, keys) { + return _map(function (k) { + return _quote(k) + ': ' + recur(obj[k]); + }, keys.slice().sort()); + }; + + switch (Object.prototype.toString.call(x)) { + case '[object Arguments]': + return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))'; + + case '[object Array]': + return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) { + return /^\d+$/.test(k); + }, keys(x)))).join(', ') + ']'; + + case '[object Boolean]': + return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString(); + + case '[object Date]': + return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')'; + + case '[object Null]': + return 'null'; + + case '[object Number]': + return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10); + + case '[object String]': + return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x); + + case '[object Undefined]': + return 'undefined'; + + default: + if (typeof x.toString === 'function') { + var repr = x.toString(); + + if (repr !== '[object Object]') { + return repr; + } + } + + return '{' + mapPairs(x, keys(x)).join(', ') + '}'; + } +} + +module.exports = _toString; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xall.js b/node_modules/ramda/src/internal/_xall.js new file mode 100644 index 0000000..3248cc5 --- /dev/null +++ b/node_modules/ramda/src/internal/_xall.js @@ -0,0 +1,50 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduced = +/*#__PURE__*/ +require("./_reduced"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XAll = +/*#__PURE__*/ +function () { + function XAll(f, xf) { + this.xf = xf; + this.f = f; + this.all = true; + } + + XAll.prototype['@@transducer/init'] = _xfBase.init; + + XAll.prototype['@@transducer/result'] = function (result) { + if (this.all) { + result = this.xf['@@transducer/step'](result, true); + } + + return this.xf['@@transducer/result'](result); + }; + + XAll.prototype['@@transducer/step'] = function (result, input) { + if (!this.f(input)) { + this.all = false; + result = _reduced(this.xf['@@transducer/step'](result, false)); + } + + return result; + }; + + return XAll; +}(); + +var _xall = +/*#__PURE__*/ +_curry2(function _xall(f, xf) { + return new XAll(f, xf); +}); + +module.exports = _xall; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xany.js b/node_modules/ramda/src/internal/_xany.js new file mode 100644 index 0000000..d21bb02 --- /dev/null +++ b/node_modules/ramda/src/internal/_xany.js @@ -0,0 +1,50 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduced = +/*#__PURE__*/ +require("./_reduced"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XAny = +/*#__PURE__*/ +function () { + function XAny(f, xf) { + this.xf = xf; + this.f = f; + this.any = false; + } + + XAny.prototype['@@transducer/init'] = _xfBase.init; + + XAny.prototype['@@transducer/result'] = function (result) { + if (!this.any) { + result = this.xf['@@transducer/step'](result, false); + } + + return this.xf['@@transducer/result'](result); + }; + + XAny.prototype['@@transducer/step'] = function (result, input) { + if (this.f(input)) { + this.any = true; + result = _reduced(this.xf['@@transducer/step'](result, true)); + } + + return result; + }; + + return XAny; +}(); + +var _xany = +/*#__PURE__*/ +_curry2(function _xany(f, xf) { + return new XAny(f, xf); +}); + +module.exports = _xany; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xaperture.js b/node_modules/ramda/src/internal/_xaperture.js new file mode 100644 index 0000000..7715fe4 --- /dev/null +++ b/node_modules/ramda/src/internal/_xaperture.js @@ -0,0 +1,58 @@ +var _concat = +/*#__PURE__*/ +require("./_concat"); + +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XAperture = +/*#__PURE__*/ +function () { + function XAperture(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + + XAperture.prototype['@@transducer/init'] = _xfBase.init; + + XAperture.prototype['@@transducer/result'] = function (result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + + XAperture.prototype['@@transducer/step'] = function (result, input) { + this.store(input); + return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result; + }; + + XAperture.prototype.store = function (input) { + this.acc[this.pos] = input; + this.pos += 1; + + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + + XAperture.prototype.getCopy = function () { + return _concat(Array.prototype.slice.call(this.acc, this.pos), Array.prototype.slice.call(this.acc, 0, this.pos)); + }; + + return XAperture; +}(); + +var _xaperture = +/*#__PURE__*/ +_curry2(function _xaperture(n, xf) { + return new XAperture(n, xf); +}); + +module.exports = _xaperture; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xchain.js b/node_modules/ramda/src/internal/_xchain.js new file mode 100644 index 0000000..64106d1 --- /dev/null +++ b/node_modules/ramda/src/internal/_xchain.js @@ -0,0 +1,19 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _flatCat = +/*#__PURE__*/ +require("./_flatCat"); + +var map = +/*#__PURE__*/ +require("../map"); + +var _xchain = +/*#__PURE__*/ +_curry2(function _xchain(f, xf) { + return map(f, _flatCat(xf)); +}); + +module.exports = _xchain; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xdrop.js b/node_modules/ramda/src/internal/_xdrop.js new file mode 100644 index 0000000..97efb8a --- /dev/null +++ b/node_modules/ramda/src/internal/_xdrop.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XDrop = +/*#__PURE__*/ +function () { + function XDrop(n, xf) { + this.xf = xf; + this.n = n; + } + + XDrop.prototype['@@transducer/init'] = _xfBase.init; + XDrop.prototype['@@transducer/result'] = _xfBase.result; + + XDrop.prototype['@@transducer/step'] = function (result, input) { + if (this.n > 0) { + this.n -= 1; + return result; + } + + return this.xf['@@transducer/step'](result, input); + }; + + return XDrop; +}(); + +var _xdrop = +/*#__PURE__*/ +_curry2(function _xdrop(n, xf) { + return new XDrop(n, xf); +}); + +module.exports = _xdrop; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xdropLast.js b/node_modules/ramda/src/internal/_xdropLast.js new file mode 100644 index 0000000..85fa91e --- /dev/null +++ b/node_modules/ramda/src/internal/_xdropLast.js @@ -0,0 +1,54 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XDropLast = +/*#__PURE__*/ +function () { + function XDropLast(n, xf) { + this.xf = xf; + this.pos = 0; + this.full = false; + this.acc = new Array(n); + } + + XDropLast.prototype['@@transducer/init'] = _xfBase.init; + + XDropLast.prototype['@@transducer/result'] = function (result) { + this.acc = null; + return this.xf['@@transducer/result'](result); + }; + + XDropLast.prototype['@@transducer/step'] = function (result, input) { + if (this.full) { + result = this.xf['@@transducer/step'](result, this.acc[this.pos]); + } + + this.store(input); + return result; + }; + + XDropLast.prototype.store = function (input) { + this.acc[this.pos] = input; + this.pos += 1; + + if (this.pos === this.acc.length) { + this.pos = 0; + this.full = true; + } + }; + + return XDropLast; +}(); + +var _xdropLast = +/*#__PURE__*/ +_curry2(function _xdropLast(n, xf) { + return new XDropLast(n, xf); +}); + +module.exports = _xdropLast; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xdropLastWhile.js b/node_modules/ramda/src/internal/_xdropLastWhile.js new file mode 100644 index 0000000..674a4c6 --- /dev/null +++ b/node_modules/ramda/src/internal/_xdropLastWhile.js @@ -0,0 +1,53 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduce = +/*#__PURE__*/ +require("./_reduce"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XDropLastWhile = +/*#__PURE__*/ +function () { + function XDropLastWhile(fn, xf) { + this.f = fn; + this.retained = []; + this.xf = xf; + } + + XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init; + + XDropLastWhile.prototype['@@transducer/result'] = function (result) { + this.retained = null; + return this.xf['@@transducer/result'](result); + }; + + XDropLastWhile.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.retain(result, input) : this.flush(result, input); + }; + + XDropLastWhile.prototype.flush = function (result, input) { + result = _reduce(this.xf['@@transducer/step'], result, this.retained); + this.retained = []; + return this.xf['@@transducer/step'](result, input); + }; + + XDropLastWhile.prototype.retain = function (result, input) { + this.retained.push(input); + return result; + }; + + return XDropLastWhile; +}(); + +var _xdropLastWhile = +/*#__PURE__*/ +_curry2(function _xdropLastWhile(fn, xf) { + return new XDropLastWhile(fn, xf); +}); + +module.exports = _xdropLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xdropRepeatsWith.js b/node_modules/ramda/src/internal/_xdropRepeatsWith.js new file mode 100644 index 0000000..d9e12dc --- /dev/null +++ b/node_modules/ramda/src/internal/_xdropRepeatsWith.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XDropRepeatsWith = +/*#__PURE__*/ +function () { + function XDropRepeatsWith(pred, xf) { + this.xf = xf; + this.pred = pred; + this.lastValue = undefined; + this.seenFirstValue = false; + } + + XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; + XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; + + XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) { + var sameAsLast = false; + + if (!this.seenFirstValue) { + this.seenFirstValue = true; + } else if (this.pred(this.lastValue, input)) { + sameAsLast = true; + } + + this.lastValue = input; + return sameAsLast ? result : this.xf['@@transducer/step'](result, input); + }; + + return XDropRepeatsWith; +}(); + +var _xdropRepeatsWith = +/*#__PURE__*/ +_curry2(function _xdropRepeatsWith(pred, xf) { + return new XDropRepeatsWith(pred, xf); +}); + +module.exports = _xdropRepeatsWith; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xdropWhile.js b/node_modules/ramda/src/internal/_xdropWhile.js new file mode 100644 index 0000000..e33febf --- /dev/null +++ b/node_modules/ramda/src/internal/_xdropWhile.js @@ -0,0 +1,41 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XDropWhile = +/*#__PURE__*/ +function () { + function XDropWhile(f, xf) { + this.xf = xf; + this.f = f; + } + + XDropWhile.prototype['@@transducer/init'] = _xfBase.init; + XDropWhile.prototype['@@transducer/result'] = _xfBase.result; + + XDropWhile.prototype['@@transducer/step'] = function (result, input) { + if (this.f) { + if (this.f(input)) { + return result; + } + + this.f = null; + } + + return this.xf['@@transducer/step'](result, input); + }; + + return XDropWhile; +}(); + +var _xdropWhile = +/*#__PURE__*/ +_curry2(function _xdropWhile(f, xf) { + return new XDropWhile(f, xf); +}); + +module.exports = _xdropWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xfBase.js b/node_modules/ramda/src/internal/_xfBase.js new file mode 100644 index 0000000..cb1dfee --- /dev/null +++ b/node_modules/ramda/src/internal/_xfBase.js @@ -0,0 +1,8 @@ +module.exports = { + init: function () { + return this.xf['@@transducer/init'](); + }, + result: function (result) { + return this.xf['@@transducer/result'](result); + } +}; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xfilter.js b/node_modules/ramda/src/internal/_xfilter.js new file mode 100644 index 0000000..4bc4dbf --- /dev/null +++ b/node_modules/ramda/src/internal/_xfilter.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XFilter = +/*#__PURE__*/ +function () { + function XFilter(f, xf) { + this.xf = xf; + this.f = f; + } + + XFilter.prototype['@@transducer/init'] = _xfBase.init; + XFilter.prototype['@@transducer/result'] = _xfBase.result; + + XFilter.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; + }; + + return XFilter; +}(); + +var _xfilter = +/*#__PURE__*/ +_curry2(function _xfilter(f, xf) { + return new XFilter(f, xf); +}); + +module.exports = _xfilter; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xfind.js b/node_modules/ramda/src/internal/_xfind.js new file mode 100644 index 0000000..ef413c5 --- /dev/null +++ b/node_modules/ramda/src/internal/_xfind.js @@ -0,0 +1,50 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduced = +/*#__PURE__*/ +require("./_reduced"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XFind = +/*#__PURE__*/ +function () { + function XFind(f, xf) { + this.xf = xf; + this.f = f; + this.found = false; + } + + XFind.prototype['@@transducer/init'] = _xfBase.init; + + XFind.prototype['@@transducer/result'] = function (result) { + if (!this.found) { + result = this.xf['@@transducer/step'](result, void 0); + } + + return this.xf['@@transducer/result'](result); + }; + + XFind.prototype['@@transducer/step'] = function (result, input) { + if (this.f(input)) { + this.found = true; + result = _reduced(this.xf['@@transducer/step'](result, input)); + } + + return result; + }; + + return XFind; +}(); + +var _xfind = +/*#__PURE__*/ +_curry2(function _xfind(f, xf) { + return new XFind(f, xf); +}); + +module.exports = _xfind; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xfindIndex.js b/node_modules/ramda/src/internal/_xfindIndex.js new file mode 100644 index 0000000..0db4dd0 --- /dev/null +++ b/node_modules/ramda/src/internal/_xfindIndex.js @@ -0,0 +1,53 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduced = +/*#__PURE__*/ +require("./_reduced"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XFindIndex = +/*#__PURE__*/ +function () { + function XFindIndex(f, xf) { + this.xf = xf; + this.f = f; + this.idx = -1; + this.found = false; + } + + XFindIndex.prototype['@@transducer/init'] = _xfBase.init; + + XFindIndex.prototype['@@transducer/result'] = function (result) { + if (!this.found) { + result = this.xf['@@transducer/step'](result, -1); + } + + return this.xf['@@transducer/result'](result); + }; + + XFindIndex.prototype['@@transducer/step'] = function (result, input) { + this.idx += 1; + + if (this.f(input)) { + this.found = true; + result = _reduced(this.xf['@@transducer/step'](result, this.idx)); + } + + return result; + }; + + return XFindIndex; +}(); + +var _xfindIndex = +/*#__PURE__*/ +_curry2(function _xfindIndex(f, xf) { + return new XFindIndex(f, xf); +}); + +module.exports = _xfindIndex; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xfindLast.js b/node_modules/ramda/src/internal/_xfindLast.js new file mode 100644 index 0000000..315feb7 --- /dev/null +++ b/node_modules/ramda/src/internal/_xfindLast.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XFindLast = +/*#__PURE__*/ +function () { + function XFindLast(f, xf) { + this.xf = xf; + this.f = f; + } + + XFindLast.prototype['@@transducer/init'] = _xfBase.init; + + XFindLast.prototype['@@transducer/result'] = function (result) { + return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last)); + }; + + XFindLast.prototype['@@transducer/step'] = function (result, input) { + if (this.f(input)) { + this.last = input; + } + + return result; + }; + + return XFindLast; +}(); + +var _xfindLast = +/*#__PURE__*/ +_curry2(function _xfindLast(f, xf) { + return new XFindLast(f, xf); +}); + +module.exports = _xfindLast; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xfindLastIndex.js b/node_modules/ramda/src/internal/_xfindLastIndex.js new file mode 100644 index 0000000..0a0f564 --- /dev/null +++ b/node_modules/ramda/src/internal/_xfindLastIndex.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XFindLastIndex = +/*#__PURE__*/ +function () { + function XFindLastIndex(f, xf) { + this.xf = xf; + this.f = f; + this.idx = -1; + this.lastIdx = -1; + } + + XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init; + + XFindLastIndex.prototype['@@transducer/result'] = function (result) { + return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx)); + }; + + XFindLastIndex.prototype['@@transducer/step'] = function (result, input) { + this.idx += 1; + + if (this.f(input)) { + this.lastIdx = this.idx; + } + + return result; + }; + + return XFindLastIndex; +}(); + +var _xfindLastIndex = +/*#__PURE__*/ +_curry2(function _xfindLastIndex(f, xf) { + return new XFindLastIndex(f, xf); +}); + +module.exports = _xfindLastIndex; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xmap.js b/node_modules/ramda/src/internal/_xmap.js new file mode 100644 index 0000000..fff35da --- /dev/null +++ b/node_modules/ramda/src/internal/_xmap.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XMap = +/*#__PURE__*/ +function () { + function XMap(f, xf) { + this.xf = xf; + this.f = f; + } + + XMap.prototype['@@transducer/init'] = _xfBase.init; + XMap.prototype['@@transducer/result'] = _xfBase.result; + + XMap.prototype['@@transducer/step'] = function (result, input) { + return this.xf['@@transducer/step'](result, this.f(input)); + }; + + return XMap; +}(); + +var _xmap = +/*#__PURE__*/ +_curry2(function _xmap(f, xf) { + return new XMap(f, xf); +}); + +module.exports = _xmap; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xreduceBy.js b/node_modules/ramda/src/internal/_xreduceBy.js new file mode 100644 index 0000000..7adee15 --- /dev/null +++ b/node_modules/ramda/src/internal/_xreduceBy.js @@ -0,0 +1,60 @@ +var _curryN = +/*#__PURE__*/ +require("./_curryN"); + +var _has = +/*#__PURE__*/ +require("./_has"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XReduceBy = +/*#__PURE__*/ +function () { + function XReduceBy(valueFn, valueAcc, keyFn, xf) { + this.valueFn = valueFn; + this.valueAcc = valueAcc; + this.keyFn = keyFn; + this.xf = xf; + this.inputs = {}; + } + + XReduceBy.prototype['@@transducer/init'] = _xfBase.init; + + XReduceBy.prototype['@@transducer/result'] = function (result) { + var key; + + for (key in this.inputs) { + if (_has(key, this.inputs)) { + result = this.xf['@@transducer/step'](result, this.inputs[key]); + + if (result['@@transducer/reduced']) { + result = result['@@transducer/value']; + break; + } + } + } + + this.inputs = null; + return this.xf['@@transducer/result'](result); + }; + + XReduceBy.prototype['@@transducer/step'] = function (result, input) { + var key = this.keyFn(input); + this.inputs[key] = this.inputs[key] || [key, this.valueAcc]; + this.inputs[key][1] = this.valueFn(this.inputs[key][1], input); + return result; + }; + + return XReduceBy; +}(); + +var _xreduceBy = +/*#__PURE__*/ +_curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) { + return new XReduceBy(valueFn, valueAcc, keyFn, xf); +}); + +module.exports = _xreduceBy; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xtake.js b/node_modules/ramda/src/internal/_xtake.js new file mode 100644 index 0000000..0f777f0 --- /dev/null +++ b/node_modules/ramda/src/internal/_xtake.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduced = +/*#__PURE__*/ +require("./_reduced"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XTake = +/*#__PURE__*/ +function () { + function XTake(n, xf) { + this.xf = xf; + this.n = n; + this.i = 0; + } + + XTake.prototype['@@transducer/init'] = _xfBase.init; + XTake.prototype['@@transducer/result'] = _xfBase.result; + + XTake.prototype['@@transducer/step'] = function (result, input) { + this.i += 1; + var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input); + return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret; + }; + + return XTake; +}(); + +var _xtake = +/*#__PURE__*/ +_curry2(function _xtake(n, xf) { + return new XTake(n, xf); +}); + +module.exports = _xtake; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xtakeWhile.js b/node_modules/ramda/src/internal/_xtakeWhile.js new file mode 100644 index 0000000..ecf93e6 --- /dev/null +++ b/node_modules/ramda/src/internal/_xtakeWhile.js @@ -0,0 +1,37 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _reduced = +/*#__PURE__*/ +require("./_reduced"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XTakeWhile = +/*#__PURE__*/ +function () { + function XTakeWhile(f, xf) { + this.xf = xf; + this.f = f; + } + + XTakeWhile.prototype['@@transducer/init'] = _xfBase.init; + XTakeWhile.prototype['@@transducer/result'] = _xfBase.result; + + XTakeWhile.prototype['@@transducer/step'] = function (result, input) { + return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result); + }; + + return XTakeWhile; +}(); + +var _xtakeWhile = +/*#__PURE__*/ +_curry2(function _xtakeWhile(f, xf) { + return new XTakeWhile(f, xf); +}); + +module.exports = _xtakeWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xtap.js b/node_modules/ramda/src/internal/_xtap.js new file mode 100644 index 0000000..41e4da0 --- /dev/null +++ b/node_modules/ramda/src/internal/_xtap.js @@ -0,0 +1,34 @@ +var _curry2 = +/*#__PURE__*/ +require("./_curry2"); + +var _xfBase = +/*#__PURE__*/ +require("./_xfBase"); + +var XTap = +/*#__PURE__*/ +function () { + function XTap(f, xf) { + this.xf = xf; + this.f = f; + } + + XTap.prototype['@@transducer/init'] = _xfBase.init; + XTap.prototype['@@transducer/result'] = _xfBase.result; + + XTap.prototype['@@transducer/step'] = function (result, input) { + this.f(input); + return this.xf['@@transducer/step'](result, input); + }; + + return XTap; +}(); + +var _xtap = +/*#__PURE__*/ +_curry2(function _xtap(f, xf) { + return new XTap(f, xf); +}); + +module.exports = _xtap; \ No newline at end of file diff --git a/node_modules/ramda/src/internal/_xwrap.js b/node_modules/ramda/src/internal/_xwrap.js new file mode 100644 index 0000000..ea7b410 --- /dev/null +++ b/node_modules/ramda/src/internal/_xwrap.js @@ -0,0 +1,27 @@ +var XWrap = +/*#__PURE__*/ +function () { + function XWrap(fn) { + this.f = fn; + } + + XWrap.prototype['@@transducer/init'] = function () { + throw new Error('init not implemented on XWrap'); + }; + + XWrap.prototype['@@transducer/result'] = function (acc) { + return acc; + }; + + XWrap.prototype['@@transducer/step'] = function (acc, x) { + return this.f(acc, x); + }; + + return XWrap; +}(); + +function _xwrap(fn) { + return new XWrap(fn); +} + +module.exports = _xwrap; \ No newline at end of file diff --git a/node_modules/ramda/src/intersection.js b/node_modules/ramda/src/intersection.js new file mode 100644 index 0000000..8ead1a3 --- /dev/null +++ b/node_modules/ramda/src/intersection.js @@ -0,0 +1,55 @@ +var _includes = +/*#__PURE__*/ +require("./internal/_includes"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _filter = +/*#__PURE__*/ +require("./internal/_filter"); + +var flip = +/*#__PURE__*/ +require("./flip"); + +var uniq = +/*#__PURE__*/ +require("./uniq"); +/** + * Combines two lists into a set (i.e. no duplicates) composed of those + * elements common to both lists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The list of elements found in both `list1` and `list2`. + * @see R.innerJoin + * @example + * + * R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3] + */ + + +var intersection = +/*#__PURE__*/ +_curry2(function intersection(list1, list2) { + var lookupList, filteredList; + + if (list1.length > list2.length) { + lookupList = list1; + filteredList = list2; + } else { + lookupList = list2; + filteredList = list1; + } + + return uniq(_filter(flip(_includes)(lookupList), filteredList)); +}); + +module.exports = intersection; \ No newline at end of file diff --git a/node_modules/ramda/src/intersperse.js b/node_modules/ramda/src/intersperse.js new file mode 100644 index 0000000..37aeaf7 --- /dev/null +++ b/node_modules/ramda/src/intersperse.js @@ -0,0 +1,49 @@ +var _checkForMethod = +/*#__PURE__*/ +require("./internal/_checkForMethod"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates a new list with the separator interposed between elements. + * + * Dispatches to the `intersperse` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} separator The element to add to the list. + * @param {Array} list The list to be interposed. + * @return {Array} The new list. + * @example + * + * R.intersperse('a', ['b', 'n', 'n', 's']); //=> ['b', 'a', 'n', 'a', 'n', 'a', 's'] + */ + + +var intersperse = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_checkForMethod('intersperse', function intersperse(separator, list) { + var out = []; + var idx = 0; + var length = list.length; + + while (idx < length) { + if (idx === length - 1) { + out.push(list[idx]); + } else { + out.push(list[idx], separator); + } + + idx += 1; + } + + return out; +})); + +module.exports = intersperse; \ No newline at end of file diff --git a/node_modules/ramda/src/into.js b/node_modules/ramda/src/into.js new file mode 100644 index 0000000..184a853 --- /dev/null +++ b/node_modules/ramda/src/into.js @@ -0,0 +1,67 @@ +var _clone = +/*#__PURE__*/ +require("./internal/_clone"); + +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var _isTransformer = +/*#__PURE__*/ +require("./internal/_isTransformer"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var _stepCat = +/*#__PURE__*/ +require("./internal/_stepCat"); +/** + * Transforms the items of the list with the transducer and appends the + * transformed items to the accumulator using an appropriate iterator function + * based on the accumulator type. + * + * The accumulator can be an array, string, object or a transformer. Iterated + * items will be appended to arrays and concatenated to strings. Objects will + * be merged directly or 2-item arrays will be merged as key, value pairs. + * + * The accumulator can also be a transformer object that provides a 2-arity + * reducing iterator function, step, 0-arity initial value function, init, and + * 1-arity result extraction function result. The step function is used as the + * iterator function in reduce. The result function is used to convert the + * final accumulator into the return type and in most cases is R.identity. The + * init function is used to provide the initial accumulator. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the + * transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig a -> (b -> b) -> [c] -> a + * @param {*} acc The initial accumulator value. + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.transduce + * @example + * + * const numbers = [1, 2, 3, 4]; + * const transducer = R.compose(R.map(R.add(1)), R.take(2)); + * + * R.into([], transducer, numbers); //=> [2, 3] + * + * const intoArray = R.into([]); + * intoArray(transducer, numbers); //=> [2, 3] + */ + + +var into = +/*#__PURE__*/ +_curry3(function into(acc, xf, list) { + return _isTransformer(acc) ? _reduce(xf(acc), acc['@@transducer/init'](), list) : _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list); +}); + +module.exports = into; \ No newline at end of file diff --git a/node_modules/ramda/src/invert.js b/node_modules/ramda/src/invert.js new file mode 100644 index 0000000..d80627d --- /dev/null +++ b/node_modules/ramda/src/invert.js @@ -0,0 +1,55 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * Same as [`R.invertObj`](#invertObj), however this accounts for objects with + * duplicate values by putting the values into an array. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {s: x} -> {x: [ s, ... ]} + * @param {Object} obj The object or array to invert + * @return {Object} out A new object with keys in an array. + * @see R.invertObj + * @example + * + * const raceResultsByFirstName = { + * first: 'alice', + * second: 'jake', + * third: 'alice', + * }; + * R.invert(raceResultsByFirstName); + * //=> { 'alice': ['first', 'third'], 'jake':['second'] } + */ + + +var invert = +/*#__PURE__*/ +_curry1(function invert(obj) { + var props = keys(obj); + var len = props.length; + var idx = 0; + var out = {}; + + while (idx < len) { + var key = props[idx]; + var val = obj[key]; + var list = _has(val, out) ? out[val] : out[val] = []; + list[list.length] = key; + idx += 1; + } + + return out; +}); + +module.exports = invert; \ No newline at end of file diff --git a/node_modules/ramda/src/invertObj.js b/node_modules/ramda/src/invertObj.js new file mode 100644 index 0000000..012b591 --- /dev/null +++ b/node_modules/ramda/src/invertObj.js @@ -0,0 +1,54 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * Returns a new object with the keys of the given object as values, and the + * values of the given object, which are coerced to strings, as keys. Note + * that the last key found is preferred when handling the same value. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig {s: x} -> {x: s} + * @param {Object} obj The object or array to invert + * @return {Object} out A new object + * @see R.invert + * @example + * + * const raceResults = { + * first: 'alice', + * second: 'jake' + * }; + * R.invertObj(raceResults); + * //=> { 'alice': 'first', 'jake':'second' } + * + * // Alternatively: + * const raceResults = ['alice', 'jake']; + * R.invertObj(raceResults); + * //=> { 'alice': '0', 'jake':'1' } + */ + + +var invertObj = +/*#__PURE__*/ +_curry1(function invertObj(obj) { + var props = keys(obj); + var len = props.length; + var idx = 0; + var out = {}; + + while (idx < len) { + var key = props[idx]; + out[obj[key]] = key; + idx += 1; + } + + return out; +}); + +module.exports = invertObj; \ No newline at end of file diff --git a/node_modules/ramda/src/invoker.js b/node_modules/ramda/src/invoker.js new file mode 100644 index 0000000..44783a2 --- /dev/null +++ b/node_modules/ramda/src/invoker.js @@ -0,0 +1,66 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isFunction = +/*#__PURE__*/ +require("./internal/_isFunction"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var toString = +/*#__PURE__*/ +require("./toString"); +/** + * Turns a named method with a specified arity into a function that can be + * called directly supplied with arguments and a target object. + * + * The returned function is curried and accepts `arity + 1` parameters where + * the final parameter is the target object. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *) + * @param {Number} arity Number of arguments the returned function should take + * before the target object. + * @param {String} method Name of any of the target object's methods to call. + * @return {Function} A new curried function. + * @see R.construct + * @example + * + * const sliceFrom = R.invoker(1, 'slice'); + * sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm' + * const sliceFrom6 = R.invoker(2, 'slice')(6); + * sliceFrom6(8, 'abcdefghijklm'); //=> 'gh' + * + * const dog = { + * speak: async () => 'Woof!' + * }; + * const speak = R.invoker(0, 'speak'); + * speak(dog).then(console.log) //~> 'Woof!' + * + * @symb R.invoker(0, 'method')(o) = o['method']() + * @symb R.invoker(1, 'method')(a, o) = o['method'](a) + * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) + */ + + +var invoker = +/*#__PURE__*/ +_curry2(function invoker(arity, method) { + return curryN(arity + 1, function () { + var target = arguments[arity]; + + if (target != null && _isFunction(target[method])) { + return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity)); + } + + throw new TypeError(toString(target) + ' does not have a method named "' + method + '"'); + }); +}); + +module.exports = invoker; \ No newline at end of file diff --git a/node_modules/ramda/src/is.js b/node_modules/ramda/src/is.js new file mode 100644 index 0000000..3a1945e --- /dev/null +++ b/node_modules/ramda/src/is.js @@ -0,0 +1,35 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * See if an object (`val`) is an instance of the supplied constructor. This + * function will check up the inheritance chain, if any. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Type + * @sig (* -> {*}) -> a -> Boolean + * @param {Object} ctor A constructor + * @param {*} val The value to test + * @return {Boolean} + * @example + * + * R.is(Object, {}); //=> true + * R.is(Number, 1); //=> true + * R.is(Object, 1); //=> false + * R.is(String, 's'); //=> true + * R.is(String, new String('')); //=> true + * R.is(Object, new String('')); //=> true + * R.is(Object, 's'); //=> false + * R.is(Number, {}); //=> false + */ + + +var is = +/*#__PURE__*/ +_curry2(function is(Ctor, val) { + return val != null && val.constructor === Ctor || val instanceof Ctor; +}); + +module.exports = is; \ No newline at end of file diff --git a/node_modules/ramda/src/isEmpty.js b/node_modules/ramda/src/isEmpty.js new file mode 100644 index 0000000..48c80a5 --- /dev/null +++ b/node_modules/ramda/src/isEmpty.js @@ -0,0 +1,41 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var empty = +/*#__PURE__*/ +require("./empty"); + +var equals = +/*#__PURE__*/ +require("./equals"); +/** + * Returns `true` if the given value is its type's empty value; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> Boolean + * @param {*} x + * @return {Boolean} + * @see R.empty + * @example + * + * R.isEmpty([1, 2, 3]); //=> false + * R.isEmpty([]); //=> true + * R.isEmpty(''); //=> true + * R.isEmpty(null); //=> false + * R.isEmpty({}); //=> true + * R.isEmpty({length: 0}); //=> false + */ + + +var isEmpty = +/*#__PURE__*/ +_curry1(function isEmpty(x) { + return x != null && equals(x, empty(x)); +}); + +module.exports = isEmpty; \ No newline at end of file diff --git a/node_modules/ramda/src/isNil.js b/node_modules/ramda/src/isNil.js new file mode 100644 index 0000000..f29f44f --- /dev/null +++ b/node_modules/ramda/src/isNil.js @@ -0,0 +1,29 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Checks if the input value is `null` or `undefined`. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Type + * @sig * -> Boolean + * @param {*} x The value to test. + * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`. + * @example + * + * R.isNil(null); //=> true + * R.isNil(undefined); //=> true + * R.isNil(0); //=> false + * R.isNil([]); //=> false + */ + + +var isNil = +/*#__PURE__*/ +_curry1(function isNil(x) { + return x == null; +}); + +module.exports = isNil; \ No newline at end of file diff --git a/node_modules/ramda/src/join.js b/node_modules/ramda/src/join.js new file mode 100644 index 0000000..c18635e --- /dev/null +++ b/node_modules/ramda/src/join.js @@ -0,0 +1,28 @@ +var invoker = +/*#__PURE__*/ +require("./invoker"); +/** + * Returns a string made by inserting the `separator` between each element and + * concatenating all the elements into a single string. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig String -> [a] -> String + * @param {Number|String} separator The string used to separate the elements. + * @param {Array} xs The elements to join into a string. + * @return {String} str The string made by concatenating `xs` with `separator`. + * @see R.split + * @example + * + * const spacer = R.join(' '); + * spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + * R.join('|', [1, 2, 3]); //=> '1|2|3' + */ + + +var join = +/*#__PURE__*/ +invoker(1, 'join'); +module.exports = join; \ No newline at end of file diff --git a/node_modules/ramda/src/juxt.js b/node_modules/ramda/src/juxt.js new file mode 100644 index 0000000..6ed49b3 --- /dev/null +++ b/node_modules/ramda/src/juxt.js @@ -0,0 +1,35 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var converge = +/*#__PURE__*/ +require("./converge"); +/** + * juxt applies a list of functions to a list of values. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Function + * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n]) + * @param {Array} fns An array of functions + * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters. + * @see R.applySpec + * @example + * + * const getRange = R.juxt([Math.min, Math.max]); + * getRange(3, 4, 9, -3); //=> [-3, 9] + * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] + */ + + +var juxt = +/*#__PURE__*/ +_curry1(function juxt(fns) { + return converge(function () { + return Array.prototype.slice.call(arguments, 0); + }, fns); +}); + +module.exports = juxt; \ No newline at end of file diff --git a/node_modules/ramda/src/keys.js b/node_modules/ramda/src/keys.js new file mode 100644 index 0000000..8688954 --- /dev/null +++ b/node_modules/ramda/src/keys.js @@ -0,0 +1,100 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); + +var _isArguments = +/*#__PURE__*/ +require("./internal/_isArguments"); // cover IE < 9 keys issues + + +var hasEnumBug = ! +/*#__PURE__*/ +{ + toString: null +}.propertyIsEnumerable('toString'); +var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug + +var hasArgsEnumBug = +/*#__PURE__*/ +function () { + 'use strict'; + + return arguments.propertyIsEnumerable('length'); +}(); + +var contains = function contains(list, item) { + var idx = 0; + + while (idx < list.length) { + if (list[idx] === item) { + return true; + } + + idx += 1; + } + + return false; +}; +/** + * Returns a list containing the names of all the enumerable own properties of + * the supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own properties. + * @see R.keysIn, R.values + * @example + * + * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] + */ + + +var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ? +/*#__PURE__*/ +_curry1(function keys(obj) { + return Object(obj) !== obj ? [] : Object.keys(obj); +}) : +/*#__PURE__*/ +_curry1(function keys(obj) { + if (Object(obj) !== obj) { + return []; + } + + var prop, nIdx; + var ks = []; + + var checkArgsLength = hasArgsEnumBug && _isArguments(obj); + + for (prop in obj) { + if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) { + ks[ks.length] = prop; + } + } + + if (hasEnumBug) { + nIdx = nonEnumerableProps.length - 1; + + while (nIdx >= 0) { + prop = nonEnumerableProps[nIdx]; + + if (_has(prop, obj) && !contains(ks, prop)) { + ks[ks.length] = prop; + } + + nIdx -= 1; + } + } + + return ks; +}); +module.exports = keys; \ No newline at end of file diff --git a/node_modules/ramda/src/keysIn.js b/node_modules/ramda/src/keysIn.js new file mode 100644 index 0000000..0b71e53 --- /dev/null +++ b/node_modules/ramda/src/keysIn.js @@ -0,0 +1,40 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Returns a list containing the names of all the properties of the supplied + * object, including prototype properties. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @sig {k: v} -> [k] + * @param {Object} obj The object to extract properties from + * @return {Array} An array of the object's own and prototype properties. + * @see R.keys, R.valuesIn + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.keysIn(f); //=> ['x', 'y'] + */ + + +var keysIn = +/*#__PURE__*/ +_curry1(function keysIn(obj) { + var prop; + var ks = []; + + for (prop in obj) { + ks[ks.length] = prop; + } + + return ks; +}); + +module.exports = keysIn; \ No newline at end of file diff --git a/node_modules/ramda/src/last.js b/node_modules/ramda/src/last.js new file mode 100644 index 0000000..4f86a5f --- /dev/null +++ b/node_modules/ramda/src/last.js @@ -0,0 +1,29 @@ +var nth = +/*#__PURE__*/ +require("./nth"); +/** + * Returns the last element of the given list or string. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig [a] -> a | Undefined + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.init, R.head, R.tail + * @example + * + * R.last(['fi', 'fo', 'fum']); //=> 'fum' + * R.last([]); //=> undefined + * + * R.last('abc'); //=> 'c' + * R.last(''); //=> '' + */ + + +var last = +/*#__PURE__*/ +nth(-1); +module.exports = last; \ No newline at end of file diff --git a/node_modules/ramda/src/lastIndexOf.js b/node_modules/ramda/src/lastIndexOf.js new file mode 100644 index 0000000..8f6bd82 --- /dev/null +++ b/node_modules/ramda/src/lastIndexOf.js @@ -0,0 +1,53 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isArray = +/*#__PURE__*/ +require("./internal/_isArray"); + +var equals = +/*#__PURE__*/ +require("./equals"); +/** + * Returns the position of the last occurrence of an item in an array, or -1 if + * the item is not included in the array. [`R.equals`](#equals) is used to + * determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> Number + * @param {*} target The item to find. + * @param {Array} xs The array to search in. + * @return {Number} the index of the target, or -1 if the target is not found. + * @see R.indexOf + * @example + * + * R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6 + * R.lastIndexOf(10, [1,2,3,4]); //=> -1 + */ + + +var lastIndexOf = +/*#__PURE__*/ +_curry2(function lastIndexOf(target, xs) { + if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) { + return xs.lastIndexOf(target); + } else { + var idx = xs.length - 1; + + while (idx >= 0) { + if (equals(xs[idx], target)) { + return idx; + } + + idx -= 1; + } + + return -1; + } +}); + +module.exports = lastIndexOf; \ No newline at end of file diff --git a/node_modules/ramda/src/length.js b/node_modules/ramda/src/length.js new file mode 100644 index 0000000..ad6ec1d --- /dev/null +++ b/node_modules/ramda/src/length.js @@ -0,0 +1,31 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _isNumber = +/*#__PURE__*/ +require("./internal/_isNumber"); +/** + * Returns the number of elements in the array by returning `list.length`. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [a] -> Number + * @param {Array} list The array to inspect. + * @return {Number} The length of the array. + * @example + * + * R.length([]); //=> 0 + * R.length([1, 2, 3]); //=> 3 + */ + + +var length = +/*#__PURE__*/ +_curry1(function length(list) { + return list != null && _isNumber(list.length) ? list.length : NaN; +}); + +module.exports = length; \ No newline at end of file diff --git a/node_modules/ramda/src/lens.js b/node_modules/ramda/src/lens.js new file mode 100644 index 0000000..1e6ee20 --- /dev/null +++ b/node_modules/ramda/src/lens.js @@ -0,0 +1,45 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var map = +/*#__PURE__*/ +require("./map"); +/** + * Returns a lens for the given getter and setter functions. The getter "gets" + * the value of the focus; the setter "sets" the value of the focus. The setter + * should not mutate the data structure. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig (s -> a) -> ((a, s) -> s) -> Lens s a + * @param {Function} getter + * @param {Function} setter + * @return {Lens} + * @see R.view, R.set, R.over, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lens(R.prop('x'), R.assoc('x')); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} + */ + + +var lens = +/*#__PURE__*/ +_curry2(function lens(getter, setter) { + return function (toFunctorFn) { + return function (target) { + return map(function (focus) { + return setter(focus, target); + }, toFunctorFn(getter(target))); + }; + }; +}); + +module.exports = lens; \ No newline at end of file diff --git a/node_modules/ramda/src/lensIndex.js b/node_modules/ramda/src/lensIndex.js new file mode 100644 index 0000000..f3d9410 --- /dev/null +++ b/node_modules/ramda/src/lensIndex.js @@ -0,0 +1,44 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var lens = +/*#__PURE__*/ +require("./lens"); + +var nth = +/*#__PURE__*/ +require("./nth"); + +var update = +/*#__PURE__*/ +require("./update"); +/** + * Returns a lens whose focus is the specified index. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Number -> Lens s a + * @param {Number} n + * @return {Lens} + * @see R.view, R.set, R.over, R.nth + * @example + * + * const headLens = R.lensIndex(0); + * + * R.view(headLens, ['a', 'b', 'c']); //=> 'a' + * R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] + * R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] + */ + + +var lensIndex = +/*#__PURE__*/ +_curry1(function lensIndex(n) { + return lens(nth(n), update(n)); +}); + +module.exports = lensIndex; \ No newline at end of file diff --git a/node_modules/ramda/src/lensPath.js b/node_modules/ramda/src/lensPath.js new file mode 100644 index 0000000..fd25e44 --- /dev/null +++ b/node_modules/ramda/src/lensPath.js @@ -0,0 +1,48 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var assocPath = +/*#__PURE__*/ +require("./assocPath"); + +var lens = +/*#__PURE__*/ +require("./lens"); + +var path = +/*#__PURE__*/ +require("./path"); +/** + * Returns a lens whose focus is the specified path. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @typedefn Idx = String | Int + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig [Idx] -> Lens s a + * @param {Array} path The path to use. + * @return {Lens} + * @see R.view, R.set, R.over + * @example + * + * const xHeadYLens = R.lensPath(['x', 0, 'y']); + * + * R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> 2 + * R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]} + * R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + * //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]} + */ + + +var lensPath = +/*#__PURE__*/ +_curry1(function lensPath(p) { + return lens(path(p), assocPath(p)); +}); + +module.exports = lensPath; \ No newline at end of file diff --git a/node_modules/ramda/src/lensProp.js b/node_modules/ramda/src/lensProp.js new file mode 100644 index 0000000..b455429 --- /dev/null +++ b/node_modules/ramda/src/lensProp.js @@ -0,0 +1,44 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var assoc = +/*#__PURE__*/ +require("./assoc"); + +var lens = +/*#__PURE__*/ +require("./lens"); + +var prop = +/*#__PURE__*/ +require("./prop"); +/** + * Returns a lens whose focus is the specified property. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig String -> Lens s a + * @param {String} k + * @return {Lens} + * @see R.view, R.set, R.over + * @example + * + * const xLens = R.lensProp('x'); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} + */ + + +var lensProp = +/*#__PURE__*/ +_curry1(function lensProp(k) { + return lens(prop(k), assoc(k)); +}); + +module.exports = lensProp; \ No newline at end of file diff --git a/node_modules/ramda/src/lift.js b/node_modules/ramda/src/lift.js new file mode 100644 index 0000000..1628e48 --- /dev/null +++ b/node_modules/ramda/src/lift.js @@ -0,0 +1,38 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var liftN = +/*#__PURE__*/ +require("./liftN"); +/** + * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other + * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.liftN + * @example + * + * const madd3 = R.lift((a, b, c) => a + b + c); + * + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + * + * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e); + * + * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] + */ + + +var lift = +/*#__PURE__*/ +_curry1(function lift(fn) { + return liftN(fn.length, fn); +}); + +module.exports = lift; \ No newline at end of file diff --git a/node_modules/ramda/src/liftN.js b/node_modules/ramda/src/liftN.js new file mode 100644 index 0000000..997fb5c --- /dev/null +++ b/node_modules/ramda/src/liftN.js @@ -0,0 +1,48 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var ap = +/*#__PURE__*/ +require("./ap"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var map = +/*#__PURE__*/ +require("./map"); +/** + * "lifts" a function to be the specified arity, so that it may "map over" that + * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Function + * @sig Number -> (*... -> *) -> ([*]... -> [*]) + * @param {Function} fn The function to lift into higher context + * @return {Function} The lifted function. + * @see R.lift, R.ap + * @example + * + * const madd3 = R.liftN(3, (...args) => R.sum(args)); + * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + */ + + +var liftN = +/*#__PURE__*/ +_curry2(function liftN(arity, fn) { + var lifted = curryN(arity, fn); + return curryN(arity, function () { + return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); + }); +}); + +module.exports = liftN; \ No newline at end of file diff --git a/node_modules/ramda/src/lt.js b/node_modules/ramda/src/lt.js new file mode 100644 index 0000000..5014e8c --- /dev/null +++ b/node_modules/ramda/src/lt.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if the first argument is less than the second; `false` + * otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {*} a + * @param {*} b + * @return {Boolean} + * @see R.gt + * @example + * + * R.lt(2, 1); //=> false + * R.lt(2, 2); //=> false + * R.lt(2, 3); //=> true + * R.lt('a', 'z'); //=> true + * R.lt('z', 'a'); //=> false + */ + + +var lt = +/*#__PURE__*/ +_curry2(function lt(a, b) { + return a < b; +}); + +module.exports = lt; \ No newline at end of file diff --git a/node_modules/ramda/src/lte.js b/node_modules/ramda/src/lte.js new file mode 100644 index 0000000..da8641e --- /dev/null +++ b/node_modules/ramda/src/lte.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if the first argument is less than or equal to the second; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> Boolean + * @param {Number} a + * @param {Number} b + * @return {Boolean} + * @see R.gte + * @example + * + * R.lte(2, 1); //=> false + * R.lte(2, 2); //=> true + * R.lte(2, 3); //=> true + * R.lte('a', 'z'); //=> true + * R.lte('z', 'a'); //=> false + */ + + +var lte = +/*#__PURE__*/ +_curry2(function lte(a, b) { + return a <= b; +}); + +module.exports = lte; \ No newline at end of file diff --git a/node_modules/ramda/src/map.js b/node_modules/ramda/src/map.js new file mode 100644 index 0000000..9684261 --- /dev/null +++ b/node_modules/ramda/src/map.js @@ -0,0 +1,87 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _map = +/*#__PURE__*/ +require("./internal/_map"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var _xmap = +/*#__PURE__*/ +require("./internal/_xmap"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * Takes a function and + * a [functor](https://github.com/fantasyland/fantasy-land#functor), + * applies the function to each of the functor's values, and returns + * a functor of the same shape. + * + * Ramda provides suitable `map` implementations for `Array` and `Object`, + * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. + * + * Dispatches to the `map` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * Also treats functions as functors and will compose them together. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => (a -> b) -> f a -> f b + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {Array} list The list to be iterated over. + * @return {Array} The new list. + * @see R.transduce, R.addIndex + * @example + * + * const double = x => x * 2; + * + * R.map(double, [1, 2, 3]); //=> [2, 4, 6] + * + * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} + * @symb R.map(f, [a, b]) = [f(a), f(b)] + * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } + * @symb R.map(f, functor_o) = functor_o.map(f) + */ + + +var map = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) { + switch (Object.prototype.toString.call(functor)) { + case '[object Function]': + return curryN(functor.length, function () { + return fn.call(this, functor.apply(this, arguments)); + }); + + case '[object Object]': + return _reduce(function (acc, key) { + acc[key] = fn(functor[key]); + return acc; + }, {}, keys(functor)); + + default: + return _map(fn, functor); + } +})); + +module.exports = map; \ No newline at end of file diff --git a/node_modules/ramda/src/mapAccum.js b/node_modules/ramda/src/mapAccum.js new file mode 100644 index 0000000..17e17ed --- /dev/null +++ b/node_modules/ramda/src/mapAccum.js @@ -0,0 +1,57 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * The `mapAccum` function behaves like a combination of map and reduce; it + * applies a function to each element of a list, passing an accumulating + * parameter from left to right, and returning a final value of this + * accumulator together with the new list. + * + * The iterator function receives two arguments, *acc* and *value*, and should + * return a tuple *[acc, value]*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y]) + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.scan, R.addIndex, R.mapAccumRight + * @example + * + * const digits = ['1', '2', '3', '4']; + * const appender = (a, b) => [a + b, a + b]; + * + * R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']] + * @symb R.mapAccum(f, a, [b, c, d]) = [ + * f(f(f(a, b)[0], c)[0], d)[0], + * [ + * f(a, b)[1], + * f(f(a, b)[0], c)[1], + * f(f(f(a, b)[0], c)[0], d)[1] + * ] + * ] + */ + + +var mapAccum = +/*#__PURE__*/ +_curry3(function mapAccum(fn, acc, list) { + var idx = 0; + var len = list.length; + var result = []; + var tuple = [acc]; + + while (idx < len) { + tuple = fn(tuple[0], list[idx]); + result[idx] = tuple[1]; + idx += 1; + } + + return [tuple[0], result]; +}); + +module.exports = mapAccum; \ No newline at end of file diff --git a/node_modules/ramda/src/mapAccumRight.js b/node_modules/ramda/src/mapAccumRight.js new file mode 100644 index 0000000..dfe7532 --- /dev/null +++ b/node_modules/ramda/src/mapAccumRight.js @@ -0,0 +1,59 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * The `mapAccumRight` function behaves like a combination of map and reduce; it + * applies a function to each element of a list, passing an accumulating + * parameter from right to left, and returning a final value of this + * accumulator together with the new list. + * + * Similar to [`mapAccum`](#mapAccum), except moves through the input list from + * the right to the left. + * + * The iterator function receives two arguments, *acc* and *value*, and should + * return a tuple *[acc, value]*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y]) + * @param {Function} fn The function to be called on every element of the input `list`. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.addIndex, R.mapAccum + * @example + * + * const digits = ['1', '2', '3', '4']; + * const appender = (a, b) => [b + a, b + a]; + * + * R.mapAccumRight(appender, 5, digits); //=> ['12345', ['12345', '2345', '345', '45']] + * @symb R.mapAccumRight(f, a, [b, c, d]) = [ + * f(f(f(a, d)[0], c)[0], b)[0], + * [ + * f(a, d)[1], + * f(f(a, d)[0], c)[1], + * f(f(f(a, d)[0], c)[0], b)[1] + * ] + * ] + */ + + +var mapAccumRight = +/*#__PURE__*/ +_curry3(function mapAccumRight(fn, acc, list) { + var idx = list.length - 1; + var result = []; + var tuple = [acc]; + + while (idx >= 0) { + tuple = fn(tuple[0], list[idx]); + result[idx] = tuple[1]; + idx -= 1; + } + + return [tuple[0], result]; +}); + +module.exports = mapAccumRight; \ No newline at end of file diff --git a/node_modules/ramda/src/mapObjIndexed.js b/node_modules/ramda/src/mapObjIndexed.js new file mode 100644 index 0000000..f4d43d7 --- /dev/null +++ b/node_modules/ramda/src/mapObjIndexed.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * An Object-specific version of [`map`](#map). The function is applied to three + * arguments: *(value, key, obj)*. If only the value is significant, use + * [`map`](#map) instead. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Object + * @sig ((*, String, Object) -> *) -> Object -> Object + * @param {Function} fn + * @param {Object} obj + * @return {Object} + * @see R.map + * @example + * + * const xyz = { x: 1, y: 2, z: 3 }; + * const prependKeyAndDouble = (num, key, obj) => key + (num * 2); + * + * R.mapObjIndexed(prependKeyAndDouble, xyz); //=> { x: 'x2', y: 'y4', z: 'z6' } + */ + + +var mapObjIndexed = +/*#__PURE__*/ +_curry2(function mapObjIndexed(fn, obj) { + return _reduce(function (acc, key) { + acc[key] = fn(obj[key], key, obj); + return acc; + }, {}, keys(obj)); +}); + +module.exports = mapObjIndexed; \ No newline at end of file diff --git a/node_modules/ramda/src/match.js b/node_modules/ramda/src/match.js new file mode 100644 index 0000000..178b586 --- /dev/null +++ b/node_modules/ramda/src/match.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Tests a regular expression against a String. Note that this function will + * return an empty array when there are no matches. This differs from + * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) + * which returns `null` when there are no matches. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig RegExp -> String -> [String | Undefined] + * @param {RegExp} rx A regular expression. + * @param {String} str The string to match against + * @return {Array} The list of matches or empty array. + * @see R.test + * @example + * + * R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] + * R.match(/a/, 'b'); //=> [] + * R.match(/a/, null); //=> TypeError: null does not have a method named "match" + */ + + +var match = +/*#__PURE__*/ +_curry2(function match(rx, str) { + return str.match(rx) || []; +}); + +module.exports = match; \ No newline at end of file diff --git a/node_modules/ramda/src/mathMod.js b/node_modules/ramda/src/mathMod.js new file mode 100644 index 0000000..a9be103 --- /dev/null +++ b/node_modules/ramda/src/mathMod.js @@ -0,0 +1,57 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isInteger = +/*#__PURE__*/ +require("./internal/_isInteger"); +/** + * `mathMod` behaves like the modulo operator should mathematically, unlike the + * `%` operator (and by extension, [`R.modulo`](#modulo)). So while + * `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. `mathMod` requires Integer + * arguments, and returns NaN when the modulus is zero or negative. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} m The dividend. + * @param {Number} p the modulus. + * @return {Number} The result of `b mod a`. + * @see R.modulo + * @example + * + * R.mathMod(-17, 5); //=> 3 + * R.mathMod(17, 5); //=> 2 + * R.mathMod(17, -5); //=> NaN + * R.mathMod(17, 0); //=> NaN + * R.mathMod(17.2, 5); //=> NaN + * R.mathMod(17, 5.3); //=> NaN + * + * const clock = R.mathMod(R.__, 12); + * clock(15); //=> 3 + * clock(24); //=> 0 + * + * const seventeenMod = R.mathMod(17); + * seventeenMod(3); //=> 2 + * seventeenMod(4); //=> 1 + * seventeenMod(10); //=> 7 + */ + + +var mathMod = +/*#__PURE__*/ +_curry2(function mathMod(m, p) { + if (!_isInteger(m)) { + return NaN; + } + + if (!_isInteger(p) || p < 1) { + return NaN; + } + + return (m % p + p) % p; +}); + +module.exports = mathMod; \ No newline at end of file diff --git a/node_modules/ramda/src/max.js b/node_modules/ramda/src/max.js new file mode 100644 index 0000000..64d16dd --- /dev/null +++ b/node_modules/ramda/src/max.js @@ -0,0 +1,29 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns the larger of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.maxBy, R.min + * @example + * + * R.max(789, 123); //=> 789 + * R.max('a', 'b'); //=> 'b' + */ + + +var max = +/*#__PURE__*/ +_curry2(function max(a, b) { + return b > a ? b : a; +}); + +module.exports = max; \ No newline at end of file diff --git a/node_modules/ramda/src/maxBy.js b/node_modules/ramda/src/maxBy.js new file mode 100644 index 0000000..77c34c8 --- /dev/null +++ b/node_modules/ramda/src/maxBy.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Takes a function and two values, and returns whichever value produces the + * larger result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.max, R.minBy + * @example + * + * // square :: Number -> Number + * const square = n => n * n; + * + * R.maxBy(square, -3, 2); //=> -3 + * + * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5 + * R.reduce(R.maxBy(square), 0, []); //=> 0 + */ + + +var maxBy = +/*#__PURE__*/ +_curry3(function maxBy(f, a, b) { + return f(b) > f(a) ? b : a; +}); + +module.exports = maxBy; \ No newline at end of file diff --git a/node_modules/ramda/src/mean.js b/node_modules/ramda/src/mean.js new file mode 100644 index 0000000..ba8a70c --- /dev/null +++ b/node_modules/ramda/src/mean.js @@ -0,0 +1,32 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var sum = +/*#__PURE__*/ +require("./sum"); +/** + * Returns the mean of the given list of numbers. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list + * @return {Number} + * @see R.median + * @example + * + * R.mean([2, 7, 9]); //=> 6 + * R.mean([]); //=> NaN + */ + + +var mean = +/*#__PURE__*/ +_curry1(function mean(list) { + return sum(list) / list.length; +}); + +module.exports = mean; \ No newline at end of file diff --git a/node_modules/ramda/src/median.js b/node_modules/ramda/src/median.js new file mode 100644 index 0000000..7a63990 --- /dev/null +++ b/node_modules/ramda/src/median.js @@ -0,0 +1,43 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var mean = +/*#__PURE__*/ +require("./mean"); +/** + * Returns the median of the given list of numbers. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list + * @return {Number} + * @see R.mean + * @example + * + * R.median([2, 9, 7]); //=> 7 + * R.median([7, 2, 10, 9]); //=> 8 + * R.median([]); //=> NaN + */ + + +var median = +/*#__PURE__*/ +_curry1(function median(list) { + var len = list.length; + + if (len === 0) { + return NaN; + } + + var width = 2 - len % 2; + var idx = (len - width) / 2; + return mean(Array.prototype.slice.call(list, 0).sort(function (a, b) { + return a < b ? -1 : a > b ? 1 : 0; + }).slice(idx, idx + width)); +}); + +module.exports = median; \ No newline at end of file diff --git a/node_modules/ramda/src/memoizeWith.js b/node_modules/ramda/src/memoizeWith.js new file mode 100644 index 0000000..2d722e7 --- /dev/null +++ b/node_modules/ramda/src/memoizeWith.js @@ -0,0 +1,57 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); +/** + * Creates a new function that, when invoked, caches the result of calling `fn` + * for a given argument set and returns the result. Subsequent calls to the + * memoized `fn` with the same argument set will not result in an additional + * call to `fn`; instead, the cached result for that set of arguments will be + * returned. + * + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (*... -> String) -> (*... -> a) -> (*... -> a) + * @param {Function} fn The function to generate the cache key. + * @param {Function} fn The function to memoize. + * @return {Function} Memoized version of `fn`. + * @example + * + * let count = 0; + * const factorial = R.memoizeWith(R.identity, n => { + * count += 1; + * return R.product(R.range(1, n + 1)); + * }); + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * factorial(5); //=> 120 + * count; //=> 1 + */ + + +var memoizeWith = +/*#__PURE__*/ +_curry2(function memoizeWith(mFn, fn) { + var cache = {}; + return _arity(fn.length, function () { + var key = mFn.apply(this, arguments); + + if (!_has(key, cache)) { + cache[key] = fn.apply(this, arguments); + } + + return cache[key]; + }); +}); + +module.exports = memoizeWith; \ No newline at end of file diff --git a/node_modules/ramda/src/merge.js b/node_modules/ramda/src/merge.js new file mode 100644 index 0000000..2d17e46 --- /dev/null +++ b/node_modules/ramda/src/merge.js @@ -0,0 +1,40 @@ +var _objectAssign = +/*#__PURE__*/ +require("./internal/_objectAssign"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeRight, R.mergeDeepRight, R.mergeWith, R.mergeWithKey + * @deprecated since v0.26.0 + * @example + * + * R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const withDefaults = R.merge({x: 0, y: 0}); + * withDefaults({y: 2}); //=> {x: 0, y: 2} + * @symb R.merge(a, b) = {...a, ...b} + */ + + +var merge = +/*#__PURE__*/ +_curry2(function merge(l, r) { + return _objectAssign({}, l, r); +}); + +module.exports = merge; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeAll.js b/node_modules/ramda/src/mergeAll.js new file mode 100644 index 0000000..c1d44b3 --- /dev/null +++ b/node_modules/ramda/src/mergeAll.js @@ -0,0 +1,33 @@ +var _objectAssign = +/*#__PURE__*/ +require("./internal/_objectAssign"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Merges a list of objects together into one object. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig [{k: v}] -> {k: v} + * @param {Array} list An array of objects + * @return {Object} A merged object. + * @see R.reduce + * @example + * + * R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3} + * R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2} + * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 } + */ + + +var mergeAll = +/*#__PURE__*/ +_curry1(function mergeAll(list) { + return _objectAssign.apply(null, [{}].concat(list)); +}); + +module.exports = mergeAll; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeDeepLeft.js b/node_modules/ramda/src/mergeDeepLeft.js new file mode 100644 index 0000000..778b165 --- /dev/null +++ b/node_modules/ramda/src/mergeDeepLeft.js @@ -0,0 +1,39 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var mergeDeepWithKey = +/*#__PURE__*/ +require("./mergeDeepWithKey"); +/** + * Creates a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects: + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the first object will be used. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig {a} -> {a} -> {a} + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.merge, R.mergeDeepRight, R.mergeDeepWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepLeft({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + * { age: 40, contact: { email: 'baa@example.com' }}); + * //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }} + */ + + +var mergeDeepLeft = +/*#__PURE__*/ +_curry2(function mergeDeepLeft(lObj, rObj) { + return mergeDeepWithKey(function (k, lVal, rVal) { + return lVal; + }, lObj, rObj); +}); + +module.exports = mergeDeepLeft; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeDeepRight.js b/node_modules/ramda/src/mergeDeepRight.js new file mode 100644 index 0000000..5a865cb --- /dev/null +++ b/node_modules/ramda/src/mergeDeepRight.js @@ -0,0 +1,39 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var mergeDeepWithKey = +/*#__PURE__*/ +require("./mergeDeepWithKey"); +/** + * Creates a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects: + * - and both values are objects, the two values will be recursively merged + * - otherwise the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig {a} -> {a} -> {a} + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + * { age: 40, contact: { email: 'baa@example.com' }}); + * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }} + */ + + +var mergeDeepRight = +/*#__PURE__*/ +_curry2(function mergeDeepRight(lObj, rObj) { + return mergeDeepWithKey(function (k, lVal, rVal) { + return rVal; + }, lObj, rObj); +}); + +module.exports = mergeDeepRight; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeDeepWith.js b/node_modules/ramda/src/mergeDeepWith.js new file mode 100644 index 0000000..cd1e7c0 --- /dev/null +++ b/node_modules/ramda/src/mergeDeepWith.js @@ -0,0 +1,45 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var mergeDeepWithKey = +/*#__PURE__*/ +require("./mergeDeepWithKey"); +/** + * Creates a new object with the own properties of the two provided objects. + * If a key exists in both objects: + * - and both associated values are also objects then the values will be + * recursively merged. + * - otherwise the provided function is applied to associated values using the + * resulting value as the new value associated with the key. + * If a key only exists in one object, the value will be associated with the key + * of the resulting object. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig ((a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.mergeWith, R.mergeDeepWithKey + * @example + * + * R.mergeDeepWith(R.concat, + * { a: true, c: { values: [10, 20] }}, + * { b: true, c: { values: [15, 35] }}); + * //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }} + */ + + +var mergeDeepWith = +/*#__PURE__*/ +_curry3(function mergeDeepWith(fn, lObj, rObj) { + return mergeDeepWithKey(function (k, lVal, rVal) { + return fn(lVal, rVal); + }, lObj, rObj); +}); + +module.exports = mergeDeepWith; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeDeepWithKey.js b/node_modules/ramda/src/mergeDeepWithKey.js new file mode 100644 index 0000000..36117e3 --- /dev/null +++ b/node_modules/ramda/src/mergeDeepWithKey.js @@ -0,0 +1,54 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var _isObject = +/*#__PURE__*/ +require("./internal/_isObject"); + +var mergeWithKey = +/*#__PURE__*/ +require("./mergeWithKey"); +/** + * Creates a new object with the own properties of the two provided objects. + * If a key exists in both objects: + * - and both associated values are also objects then the values will be + * recursively merged. + * - otherwise the provided function is applied to the key and associated values + * using the resulting value as the new value associated with the key. + * If a key only exists in one object, the value will be associated with the key + * of the resulting object. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Object + * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} lObj + * @param {Object} rObj + * @return {Object} + * @see R.mergeWithKey, R.mergeDeepWith + * @example + * + * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + * R.mergeDeepWithKey(concatValues, + * { a: true, c: { thing: 'foo', values: [10, 20] }}, + * { b: true, c: { thing: 'bar', values: [15, 35] }}); + * //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }} + */ + + +var mergeDeepWithKey = +/*#__PURE__*/ +_curry3(function mergeDeepWithKey(fn, lObj, rObj) { + return mergeWithKey(function (k, lVal, rVal) { + if (_isObject(lVal) && _isObject(rVal)) { + return mergeDeepWithKey(fn, lVal, rVal); + } else { + return fn(k, lVal, rVal); + } + }, lObj, rObj); +}); + +module.exports = mergeDeepWithKey; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeLeft.js b/node_modules/ramda/src/mergeLeft.js new file mode 100644 index 0000000..9e7d10b --- /dev/null +++ b/node_modules/ramda/src/mergeLeft.js @@ -0,0 +1,39 @@ +var _objectAssign = +/*#__PURE__*/ +require("./internal/_objectAssign"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the first object will be used. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeRight, R.mergeDeepLeft, R.mergeWith, R.mergeWithKey + * @example + * + * R.mergeLeft({ 'age': 40 }, { 'name': 'fred', 'age': 10 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const resetToDefault = R.mergeLeft({x: 0}); + * resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2} + * @symb R.mergeLeft(a, b) = {...b, ...a} + */ + + +var mergeLeft = +/*#__PURE__*/ +_curry2(function mergeLeft(l, r) { + return _objectAssign({}, r, l); +}); + +module.exports = mergeLeft; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeRight.js b/node_modules/ramda/src/mergeRight.js new file mode 100644 index 0000000..fbbe4c1 --- /dev/null +++ b/node_modules/ramda/src/mergeRight.js @@ -0,0 +1,39 @@ +var _objectAssign = +/*#__PURE__*/ +require("./internal/_objectAssign"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Create a new object with the own properties of the first object merged with + * the own properties of the second object. If a key exists in both objects, + * the value from the second object will be used. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Object + * @sig {k: v} -> {k: v} -> {k: v} + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeLeft, R.mergeDeepRight, R.mergeWith, R.mergeWithKey + * @example + * + * R.mergeRight({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + * //=> { 'name': 'fred', 'age': 40 } + * + * const withDefaults = R.mergeRight({x: 0, y: 0}); + * withDefaults({y: 2}); //=> {x: 0, y: 2} + * @symb R.mergeRight(a, b) = {...a, ...b} + */ + + +var mergeRight = +/*#__PURE__*/ +_curry2(function mergeRight(l, r) { + return _objectAssign({}, l, r); +}); + +module.exports = mergeRight; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeWith.js b/node_modules/ramda/src/mergeWith.js new file mode 100644 index 0000000..790a1aa --- /dev/null +++ b/node_modules/ramda/src/mergeWith.js @@ -0,0 +1,41 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var mergeWithKey = +/*#__PURE__*/ +require("./mergeWithKey"); +/** + * Creates a new object with the own properties of the two provided objects. If + * a key exists in both objects, the provided function is applied to the values + * associated with the key in each object, with the result being used as the + * value associated with the key in the returned object. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @sig ((a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeDeepWith, R.merge, R.mergeWithKey + * @example + * + * R.mergeWith(R.concat, + * { a: true, values: [10, 20] }, + * { b: true, values: [15, 35] }); + * //=> { a: true, b: true, values: [10, 20, 15, 35] } + */ + + +var mergeWith = +/*#__PURE__*/ +_curry3(function mergeWith(fn, l, r) { + return mergeWithKey(function (_, _l, _r) { + return fn(_l, _r); + }, l, r); +}); + +module.exports = mergeWith; \ No newline at end of file diff --git a/node_modules/ramda/src/mergeWithKey.js b/node_modules/ramda/src/mergeWithKey.js new file mode 100644 index 0000000..763c002 --- /dev/null +++ b/node_modules/ramda/src/mergeWithKey.js @@ -0,0 +1,56 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); +/** + * Creates a new object with the own properties of the two provided objects. If + * a key exists in both objects, the provided function is applied to the key + * and the values associated with the key in each object, with the result being + * used as the value associated with the key in the returned object. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Object + * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} + * @param {Function} fn + * @param {Object} l + * @param {Object} r + * @return {Object} + * @see R.mergeDeepWithKey, R.merge, R.mergeWith + * @example + * + * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + * R.mergeWithKey(concatValues, + * { a: true, thing: 'foo', values: [10, 20] }, + * { b: true, thing: 'bar', values: [15, 35] }); + * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] } + * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 } + */ + + +var mergeWithKey = +/*#__PURE__*/ +_curry3(function mergeWithKey(fn, l, r) { + var result = {}; + var k; + + for (k in l) { + if (_has(k, l)) { + result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k]; + } + } + + for (k in r) { + if (_has(k, r) && !_has(k, result)) { + result[k] = r[k]; + } + } + + return result; +}); + +module.exports = mergeWithKey; \ No newline at end of file diff --git a/node_modules/ramda/src/min.js b/node_modules/ramda/src/min.js new file mode 100644 index 0000000..b535543 --- /dev/null +++ b/node_modules/ramda/src/min.js @@ -0,0 +1,29 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns the smaller of its two arguments. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord a => a -> a -> a + * @param {*} a + * @param {*} b + * @return {*} + * @see R.minBy, R.max + * @example + * + * R.min(789, 123); //=> 123 + * R.min('a', 'b'); //=> 'a' + */ + + +var min = +/*#__PURE__*/ +_curry2(function min(a, b) { + return b < a ? b : a; +}); + +module.exports = min; \ No newline at end of file diff --git a/node_modules/ramda/src/minBy.js b/node_modules/ramda/src/minBy.js new file mode 100644 index 0000000..283b0d8 --- /dev/null +++ b/node_modules/ramda/src/minBy.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Takes a function and two values, and returns whichever value produces the + * smaller result when passed to the provided function. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Relation + * @sig Ord b => (a -> b) -> a -> a -> a + * @param {Function} f + * @param {*} a + * @param {*} b + * @return {*} + * @see R.min, R.maxBy + * @example + * + * // square :: Number -> Number + * const square = n => n * n; + * + * R.minBy(square, -3, 2); //=> 2 + * + * R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1 + * R.reduce(R.minBy(square), Infinity, []); //=> Infinity + */ + + +var minBy = +/*#__PURE__*/ +_curry3(function minBy(f, a, b) { + return f(b) < f(a) ? b : a; +}); + +module.exports = minBy; \ No newline at end of file diff --git a/node_modules/ramda/src/modulo.js b/node_modules/ramda/src/modulo.js new file mode 100644 index 0000000..b26f80e --- /dev/null +++ b/node_modules/ramda/src/modulo.js @@ -0,0 +1,37 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Divides the first parameter by the second and returns the remainder. Note + * that this function preserves the JavaScript-style behavior for modulo. For + * mathematical modulo see [`mathMod`](#mathMod). + * + * @func + * @memberOf R + * @since v0.1.1 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The value to the divide. + * @param {Number} b The pseudo-modulus + * @return {Number} The result of `b % a`. + * @see R.mathMod + * @example + * + * R.modulo(17, 3); //=> 2 + * // JS behavior: + * R.modulo(-17, 3); //=> -2 + * R.modulo(17, -3); //=> 2 + * + * const isOdd = R.modulo(R.__, 2); + * isOdd(42); //=> 0 + * isOdd(21); //=> 1 + */ + + +var modulo = +/*#__PURE__*/ +_curry2(function modulo(a, b) { + return a % b; +}); + +module.exports = modulo; \ No newline at end of file diff --git a/node_modules/ramda/src/move.js b/node_modules/ramda/src/move.js new file mode 100644 index 0000000..621c664 --- /dev/null +++ b/node_modules/ramda/src/move.js @@ -0,0 +1,35 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Move an item, at index `from`, to index `to`, in a list of elements. + * A new list will be created containing the new elements order. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @param {Number} from The source index + * @param {Number} to The destination index + * @param {Array} list The list which will serve to realise the move + * @return {Array} The new list reordered + * @example + * + * R.move(0, 2, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['b', 'c', 'a', 'd', 'e', 'f'] + * R.move(-1, 0, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['f', 'a', 'b', 'c', 'd', 'e'] list rotation + */ + + +var move = +/*#__PURE__*/ +_curry3(function (from, to, list) { + var length = list.length; + var result = list.slice(); + var positiveFrom = from < 0 ? length + from : from; + var positiveTo = to < 0 ? length + to : to; + var item = result.splice(positiveFrom, 1); + return positiveFrom < 0 || positiveFrom >= list.length || positiveTo < 0 || positiveTo >= list.length ? list : [].concat(result.slice(0, positiveTo)).concat(item).concat(result.slice(positiveTo, list.length)); +}); + +module.exports = move; \ No newline at end of file diff --git a/node_modules/ramda/src/multiply.js b/node_modules/ramda/src/multiply.js new file mode 100644 index 0000000..774c208 --- /dev/null +++ b/node_modules/ramda/src/multiply.js @@ -0,0 +1,32 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Multiplies two numbers. Equivalent to `a * b` but curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a * b`. + * @see R.divide + * @example + * + * const double = R.multiply(2); + * const triple = R.multiply(3); + * double(3); //=> 6 + * triple(4); //=> 12 + * R.multiply(2, 5); //=> 10 + */ + + +var multiply = +/*#__PURE__*/ +_curry2(function multiply(a, b) { + return a * b; +}); + +module.exports = multiply; \ No newline at end of file diff --git a/node_modules/ramda/src/nAry.js b/node_modules/ramda/src/nAry.js new file mode 100644 index 0000000..6beae80 --- /dev/null +++ b/node_modules/ramda/src/nAry.js @@ -0,0 +1,100 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly `n` parameters. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig Number -> (* -> a) -> (* -> a) + * @param {Number} n The desired arity of the new function. + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity `n`. + * @see R.binary, R.unary + * @example + * + * const takesTwoArgs = (a, b) => [a, b]; + * + * takesTwoArgs.length; //=> 2 + * takesTwoArgs(1, 2); //=> [1, 2] + * + * const takesOneArg = R.nAry(1, takesTwoArgs); + * takesOneArg.length; //=> 1 + * // Only `n` arguments are passed to the wrapped function + * takesOneArg(1, 2); //=> [1, undefined] + * @symb R.nAry(0, f)(a, b) = f() + * @symb R.nAry(1, f)(a, b) = f(a) + * @symb R.nAry(2, f)(a, b) = f(a, b) + */ + + +var nAry = +/*#__PURE__*/ +_curry2(function nAry(n, fn) { + switch (n) { + case 0: + return function () { + return fn.call(this); + }; + + case 1: + return function (a0) { + return fn.call(this, a0); + }; + + case 2: + return function (a0, a1) { + return fn.call(this, a0, a1); + }; + + case 3: + return function (a0, a1, a2) { + return fn.call(this, a0, a1, a2); + }; + + case 4: + return function (a0, a1, a2, a3) { + return fn.call(this, a0, a1, a2, a3); + }; + + case 5: + return function (a0, a1, a2, a3, a4) { + return fn.call(this, a0, a1, a2, a3, a4); + }; + + case 6: + return function (a0, a1, a2, a3, a4, a5) { + return fn.call(this, a0, a1, a2, a3, a4, a5); + }; + + case 7: + return function (a0, a1, a2, a3, a4, a5, a6) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6); + }; + + case 8: + return function (a0, a1, a2, a3, a4, a5, a6, a7) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7); + }; + + case 9: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8); + }; + + case 10: + return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); + }; + + default: + throw new Error('First argument to nAry must be a non-negative integer no greater than ten'); + } +}); + +module.exports = nAry; \ No newline at end of file diff --git a/node_modules/ramda/src/negate.js b/node_modules/ramda/src/negate.js new file mode 100644 index 0000000..f6f7d8e --- /dev/null +++ b/node_modules/ramda/src/negate.js @@ -0,0 +1,26 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Negates its argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Math + * @sig Number -> Number + * @param {Number} n + * @return {Number} + * @example + * + * R.negate(42); //=> -42 + */ + + +var negate = +/*#__PURE__*/ +_curry1(function negate(n) { + return -n; +}); + +module.exports = negate; \ No newline at end of file diff --git a/node_modules/ramda/src/none.js b/node_modules/ramda/src/none.js new file mode 100644 index 0000000..f9851e8 --- /dev/null +++ b/node_modules/ramda/src/none.js @@ -0,0 +1,45 @@ +var _complement = +/*#__PURE__*/ +require("./internal/_complement"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var all = +/*#__PURE__*/ +require("./all"); +/** + * Returns `true` if no elements of the list match the predicate, `false` + * otherwise. + * + * Dispatches to the `all` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (a -> Boolean) -> [a] -> Boolean + * @param {Function} fn The predicate function. + * @param {Array} list The array to consider. + * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise. + * @see R.all, R.any + * @example + * + * const isEven = n => n % 2 === 0; + * const isOdd = n => n % 2 === 1; + * + * R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true + * R.none(isOdd, [1, 3, 5, 7, 8, 11]); //=> false + */ + + +var none = +/*#__PURE__*/ +_curry2(function none(fn, input) { + return all(_complement(fn), input); +}); + +module.exports = none; \ No newline at end of file diff --git a/node_modules/ramda/src/not.js b/node_modules/ramda/src/not.js new file mode 100644 index 0000000..e38e630 --- /dev/null +++ b/node_modules/ramda/src/not.js @@ -0,0 +1,31 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * A function that returns the `!` of its argument. It will return `true` when + * passed false-y value, and `false` when passed a truth-y one. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig * -> Boolean + * @param {*} a any value + * @return {Boolean} the logical inverse of passed argument. + * @see R.complement + * @example + * + * R.not(true); //=> false + * R.not(false); //=> true + * R.not(0); //=> true + * R.not(1); //=> false + */ + + +var not = +/*#__PURE__*/ +_curry1(function not(a) { + return !a; +}); + +module.exports = not; \ No newline at end of file diff --git a/node_modules/ramda/src/nth.js b/node_modules/ramda/src/nth.js new file mode 100644 index 0000000..24ff8eb --- /dev/null +++ b/node_modules/ramda/src/nth.js @@ -0,0 +1,43 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isString = +/*#__PURE__*/ +require("./internal/_isString"); +/** + * Returns the nth element of the given list or string. If n is negative the + * element at index length + n is returned. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> a | Undefined + * @sig Number -> String -> String + * @param {Number} offset + * @param {*} list + * @return {*} + * @example + * + * const list = ['foo', 'bar', 'baz', 'quux']; + * R.nth(1, list); //=> 'bar' + * R.nth(-1, list); //=> 'quux' + * R.nth(-99, list); //=> undefined + * + * R.nth(2, 'abc'); //=> 'c' + * R.nth(3, 'abc'); //=> '' + * @symb R.nth(-1, [a, b, c]) = c + * @symb R.nth(0, [a, b, c]) = a + * @symb R.nth(1, [a, b, c]) = b + */ + + +var nth = +/*#__PURE__*/ +_curry2(function nth(offset, list) { + var idx = offset < 0 ? list.length + offset : offset; + return _isString(list) ? list.charAt(idx) : list[idx]; +}); + +module.exports = nth; \ No newline at end of file diff --git a/node_modules/ramda/src/nthArg.js b/node_modules/ramda/src/nthArg.js new file mode 100644 index 0000000..b9727e4 --- /dev/null +++ b/node_modules/ramda/src/nthArg.js @@ -0,0 +1,41 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var nth = +/*#__PURE__*/ +require("./nth"); +/** + * Returns a function which returns its nth argument. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category Function + * @sig Number -> *... -> * + * @param {Number} n + * @return {Function} + * @example + * + * R.nthArg(1)('a', 'b', 'c'); //=> 'b' + * R.nthArg(-1)('a', 'b', 'c'); //=> 'c' + * @symb R.nthArg(-1)(a, b, c) = c + * @symb R.nthArg(0)(a, b, c) = a + * @symb R.nthArg(1)(a, b, c) = b + */ + + +var nthArg = +/*#__PURE__*/ +_curry1(function nthArg(n) { + var arity = n < 0 ? 1 : n + 1; + return curryN(arity, function () { + return nth(n, arguments); + }); +}); + +module.exports = nthArg; \ No newline at end of file diff --git a/node_modules/ramda/src/o.js b/node_modules/ramda/src/o.js new file mode 100644 index 0000000..3d284bb --- /dev/null +++ b/node_modules/ramda/src/o.js @@ -0,0 +1,39 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * `o` is a curried composition function that returns a unary function. + * Like [`compose`](#compose), `o` performs right-to-left function composition. + * Unlike [`compose`](#compose), the rightmost function passed to `o` will be + * invoked with only one argument. Also, unlike [`compose`](#compose), `o` is + * limited to accepting only 2 unary functions. The name o was chosen because + * of its similarity to the mathematical composition operator ∘. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category Function + * @sig (b -> c) -> (a -> b) -> a -> c + * @param {Function} f + * @param {Function} g + * @return {Function} + * @see R.compose, R.pipe + * @example + * + * const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last + * const yellGreeting = R.o(R.toUpper, classyGreeting); + * yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND" + * + * R.o(R.multiply(10), R.add(10))(-4) //=> 60 + * + * @symb R.o(f, g, x) = f(g(x)) + */ + + +var o = +/*#__PURE__*/ +_curry3(function o(f, g, x) { + return f(g(x)); +}); + +module.exports = o; \ No newline at end of file diff --git a/node_modules/ramda/src/objOf.js b/node_modules/ramda/src/objOf.js new file mode 100644 index 0000000..351c03e --- /dev/null +++ b/node_modules/ramda/src/objOf.js @@ -0,0 +1,34 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates an object containing a single key:value pair. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Object + * @sig String -> a -> {String:a} + * @param {String} key + * @param {*} val + * @return {Object} + * @see R.pair + * @example + * + * const matchPhrases = R.compose( + * R.objOf('must'), + * R.map(R.objOf('match_phrase')) + * ); + * matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]} + */ + + +var objOf = +/*#__PURE__*/ +_curry2(function objOf(key, val) { + var obj = {}; + obj[key] = val; + return obj; +}); + +module.exports = objOf; \ No newline at end of file diff --git a/node_modules/ramda/src/of.js b/node_modules/ramda/src/of.js new file mode 100644 index 0000000..1133a43 --- /dev/null +++ b/node_modules/ramda/src/of.js @@ -0,0 +1,32 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _of = +/*#__PURE__*/ +require("./internal/_of"); +/** + * Returns a singleton array containing the value provided. + * + * Note this `of` is different from the ES6 `of`; See + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of + * + * @func + * @memberOf R + * @since v0.3.0 + * @category Function + * @sig a -> [a] + * @param {*} x any value + * @return {Array} An array wrapping `x`. + * @example + * + * R.of(null); //=> [null] + * R.of([42]); //=> [[42]] + */ + + +var of = +/*#__PURE__*/ +_curry1(_of); + +module.exports = of; \ No newline at end of file diff --git a/node_modules/ramda/src/omit.js b/node_modules/ramda/src/omit.js new file mode 100644 index 0000000..467b68c --- /dev/null +++ b/node_modules/ramda/src/omit.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a partial copy of an object omitting the keys specified. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [String] -> {String: *} -> {String: *} + * @param {Array} names an array of String property names to omit from the new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with properties from `names` not on it. + * @see R.pick + * @example + * + * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3} + */ + + +var omit = +/*#__PURE__*/ +_curry2(function omit(names, obj) { + var result = {}; + var index = {}; + var idx = 0; + var len = names.length; + + while (idx < len) { + index[names[idx]] = 1; + idx += 1; + } + + for (var prop in obj) { + if (!index.hasOwnProperty(prop)) { + result[prop] = obj[prop]; + } + } + + return result; +}); + +module.exports = omit; \ No newline at end of file diff --git a/node_modules/ramda/src/once.js b/node_modules/ramda/src/once.js new file mode 100644 index 0000000..8ecd291 --- /dev/null +++ b/node_modules/ramda/src/once.js @@ -0,0 +1,45 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Accepts a function `fn` and returns a function that guards invocation of + * `fn` such that `fn` can only ever be called once, no matter how many times + * the returned function is invoked. The first value calculated is returned in + * subsequent invocations. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (a... -> b) -> (a... -> b) + * @param {Function} fn The function to wrap in a call-only-once wrapper. + * @return {Function} The wrapped function. + * @example + * + * const addOneOnce = R.once(x => x + 1); + * addOneOnce(10); //=> 11 + * addOneOnce(addOneOnce(50)); //=> 11 + */ + + +var once = +/*#__PURE__*/ +_curry1(function once(fn) { + var called = false; + var result; + return _arity(fn.length, function () { + if (called) { + return result; + } + + called = true; + result = fn.apply(this, arguments); + return result; + }); +}); + +module.exports = once; \ No newline at end of file diff --git a/node_modules/ramda/src/or.js b/node_modules/ramda/src/or.js new file mode 100644 index 0000000..4358b18 --- /dev/null +++ b/node_modules/ramda/src/or.js @@ -0,0 +1,32 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns `true` if one or both of its arguments are `true`. Returns `false` + * if both arguments are `false`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Logic + * @sig a -> b -> a | b + * @param {Any} a + * @param {Any} b + * @return {Any} the first argument if truthy, otherwise the second argument. + * @see R.either, R.xor + * @example + * + * R.or(true, true); //=> true + * R.or(true, false); //=> true + * R.or(false, true); //=> true + * R.or(false, false); //=> false + */ + + +var or = +/*#__PURE__*/ +_curry2(function or(a, b) { + return a || b; +}); + +module.exports = or; \ No newline at end of file diff --git a/node_modules/ramda/src/otherwise.js b/node_modules/ramda/src/otherwise.js new file mode 100644 index 0000000..6101886 --- /dev/null +++ b/node_modules/ramda/src/otherwise.js @@ -0,0 +1,46 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _assertPromise = +/*#__PURE__*/ +require("./internal/_assertPromise"); +/** + * Returns the result of applying the onFailure function to the value inside + * a failed promise. This is useful for handling rejected promises + * inside function compositions. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig (e -> b) -> (Promise e a) -> (Promise e b) + * @sig (e -> (Promise f b)) -> (Promise e a) -> (Promise f b) + * @param {Function} onFailure The function to apply. Can return a value or a promise of a value. + * @param {Promise} p + * @return {Promise} The result of calling `p.then(null, onFailure)` + * @see R.then + * @example + * + * var failedFetch = (id) => Promise.reject('bad ID'); + * var useDefault = () => ({ firstName: 'Bob', lastName: 'Loblaw' }) + * + * //recoverFromFailure :: String -> Promise ({firstName, lastName}) + * var recoverFromFailure = R.pipe( + * failedFetch, + * R.otherwise(useDefault), + * R.then(R.pick(['firstName', 'lastName'])), + * ); + * recoverFromFailure(12345).then(console.log) + */ + + +var otherwise = +/*#__PURE__*/ +_curry2(function otherwise(f, p) { + _assertPromise('otherwise', p); + + return p.then(null, f); +}); + +module.exports = otherwise; \ No newline at end of file diff --git a/node_modules/ramda/src/over.js b/node_modules/ramda/src/over.js new file mode 100644 index 0000000..c8c46c0 --- /dev/null +++ b/node_modules/ramda/src/over.js @@ -0,0 +1,50 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); // `Identity` is a functor that holds a single value, where `map` simply +// transforms the held value with the provided function. + + +var Identity = function (x) { + return { + value: x, + map: function (f) { + return Identity(f(x)); + } + }; +}; +/** + * Returns the result of "setting" the portion of the given data structure + * focused by the given lens to the result of applying the given function to + * the focused value. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> (a -> a) -> s -> s + * @param {Lens} lens + * @param {*} v + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const headLens = R.lensIndex(0); + * + * R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz'] + */ + + +var over = +/*#__PURE__*/ +_curry3(function over(lens, f, x) { + // The value returned by the getter function is first transformed with `f`, + // then set as the value of an `Identity`. This is then mapped over with the + // setter function of the lens. + return lens(function (y) { + return Identity(f(y)); + })(x).value; +}); + +module.exports = over; \ No newline at end of file diff --git a/node_modules/ramda/src/pair.js b/node_modules/ramda/src/pair.js new file mode 100644 index 0000000..09b683e --- /dev/null +++ b/node_modules/ramda/src/pair.js @@ -0,0 +1,28 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category List + * @sig a -> b -> (a,b) + * @param {*} fst + * @param {*} snd + * @return {Array} + * @see R.objOf, R.of + * @example + * + * R.pair('foo', 'bar'); //=> ['foo', 'bar'] + */ + + +var pair = +/*#__PURE__*/ +_curry2(function pair(fst, snd) { + return [fst, snd]; +}); + +module.exports = pair; \ No newline at end of file diff --git a/node_modules/ramda/src/partial.js b/node_modules/ramda/src/partial.js new file mode 100644 index 0000000..46141fe --- /dev/null +++ b/node_modules/ramda/src/partial.js @@ -0,0 +1,42 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _createPartialApplicator = +/*#__PURE__*/ +require("./internal/_createPartialApplicator"); +/** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided initially followed by the arguments provided to `g`. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partialRight, R.curry + * @example + * + * const multiply2 = (a, b) => a * b; + * const double = R.partial(multiply2, [2]); + * double(2); //=> 4 + * + * const greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * const sayHello = R.partial(greet, ['Hello']); + * const sayHelloToMs = R.partial(sayHello, ['Ms.']); + * sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d) + */ + + +var partial = +/*#__PURE__*/ +_createPartialApplicator(_concat); + +module.exports = partial; \ No newline at end of file diff --git a/node_modules/ramda/src/partialRight.js b/node_modules/ramda/src/partialRight.js new file mode 100644 index 0000000..0d88e17 --- /dev/null +++ b/node_modules/ramda/src/partialRight.js @@ -0,0 +1,44 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _createPartialApplicator = +/*#__PURE__*/ +require("./internal/_createPartialApplicator"); + +var flip = +/*#__PURE__*/ +require("./flip"); +/** + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided to `g` followed by the arguments provided initially. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x) + * @param {Function} f + * @param {Array} args + * @return {Function} + * @see R.partial + * @example + * + * const greet = (salutation, title, firstName, lastName) => + * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + * + * const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + * + * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' + * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) + */ + + +var partialRight = +/*#__PURE__*/ +_createPartialApplicator( +/*#__PURE__*/ +flip(_concat)); + +module.exports = partialRight; \ No newline at end of file diff --git a/node_modules/ramda/src/partition.js b/node_modules/ramda/src/partition.js new file mode 100644 index 0000000..23a8526 --- /dev/null +++ b/node_modules/ramda/src/partition.js @@ -0,0 +1,41 @@ +var filter = +/*#__PURE__*/ +require("./filter"); + +var juxt = +/*#__PURE__*/ +require("./juxt"); + +var reject = +/*#__PURE__*/ +require("./reject"); +/** + * Takes a predicate and a list or other `Filterable` object and returns the + * pair of filterable objects of the same type of elements which do and do not + * satisfy, the predicate, respectively. Filterable objects include plain objects or any object + * that has a filter method such as `Array`. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a] + * @param {Function} pred A predicate to determine which side the element belongs to. + * @param {Array} filterable the list (or other filterable) to partition. + * @return {Array} An array, containing first the subset of elements that satisfy the + * predicate, and second the subset of elements that do not satisfy. + * @see R.filter, R.reject + * @example + * + * R.partition(R.includes('s'), ['sss', 'ttt', 'foo', 'bars']); + * // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ] + * + * R.partition(R.includes('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); + * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] + */ + + +var partition = +/*#__PURE__*/ +juxt([filter, reject]); +module.exports = partition; \ No newline at end of file diff --git a/node_modules/ramda/src/path.js b/node_modules/ramda/src/path.js new file mode 100644 index 0000000..9f0e474 --- /dev/null +++ b/node_modules/ramda/src/path.js @@ -0,0 +1,36 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var paths = +/*#__PURE__*/ +require("./paths"); +/** + * Retrieve the value at a given path. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @typedefn Idx = String | Int + * @sig [Idx] -> {a} -> a | Undefined + * @param {Array} path The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path`. + * @see R.prop, R.nth + * @example + * + * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 + * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined + * R.path(['a', 'b', 0], {a: {b: [1, 2, 3]}}); //=> 1 + * R.path(['a', 'b', -2], {a: {b: [1, 2, 3]}}); //=> 2 + */ + + +var path = +/*#__PURE__*/ +_curry2(function path(pathAr, obj) { + return paths([pathAr], obj)[0]; +}); + +module.exports = path; \ No newline at end of file diff --git a/node_modules/ramda/src/pathEq.js b/node_modules/ramda/src/pathEq.js new file mode 100644 index 0000000..5fc848f --- /dev/null +++ b/node_modules/ramda/src/pathEq.js @@ -0,0 +1,44 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var equals = +/*#__PURE__*/ +require("./equals"); + +var path = +/*#__PURE__*/ +require("./path"); +/** + * Determines whether a nested path on an object has a specific value, in + * [`R.equals`](#equals) terms. Most likely used to filter a list. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category Relation + * @typedefn Idx = String | Int + * @sig [Idx] -> a -> {a} -> Boolean + * @param {Array} path The path of the nested property to use + * @param {*} val The value to compare the nested property with + * @param {Object} obj The object to check the nested property in + * @return {Boolean} `true` if the value equals the nested object property, + * `false` otherwise. + * @example + * + * const user1 = { address: { zipCode: 90210 } }; + * const user2 = { address: { zipCode: 55555 } }; + * const user3 = { name: 'Bob' }; + * const users = [ user1, user2, user3 ]; + * const isFamous = R.pathEq(['address', 'zipCode'], 90210); + * R.filter(isFamous, users); //=> [ user1 ] + */ + + +var pathEq = +/*#__PURE__*/ +_curry3(function pathEq(_path, val, obj) { + return equals(path(_path, obj), val); +}); + +module.exports = pathEq; \ No newline at end of file diff --git a/node_modules/ramda/src/pathOr.js b/node_modules/ramda/src/pathOr.js new file mode 100644 index 0000000..565d723 --- /dev/null +++ b/node_modules/ramda/src/pathOr.js @@ -0,0 +1,39 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var defaultTo = +/*#__PURE__*/ +require("./defaultTo"); + +var path = +/*#__PURE__*/ +require("./path"); +/** + * If the given, non-null object has a value at the given path, returns the + * value at that path. Otherwise returns the provided default value. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Object + * @typedefn Idx = String | Int + * @sig a -> [Idx] -> {a} -> a + * @param {*} d The default value. + * @param {Array} p The path to use. + * @param {Object} obj The object to retrieve the nested property from. + * @return {*} The data at `path` of the supplied object or the default value. + * @example + * + * R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2 + * R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A" + */ + + +var pathOr = +/*#__PURE__*/ +_curry3(function pathOr(d, p, obj) { + return defaultTo(d, path(p, obj)); +}); + +module.exports = pathOr; \ No newline at end of file diff --git a/node_modules/ramda/src/pathSatisfies.js b/node_modules/ramda/src/pathSatisfies.js new file mode 100644 index 0000000..3d9be8a --- /dev/null +++ b/node_modules/ramda/src/pathSatisfies.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var path = +/*#__PURE__*/ +require("./path"); +/** + * Returns `true` if the specified object property at given path satisfies the + * given predicate; `false` otherwise. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Logic + * @typedefn Idx = String | Int + * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean + * @param {Function} pred + * @param {Array} propPath + * @param {*} obj + * @return {Boolean} + * @see R.propSatisfies, R.path + * @example + * + * R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true + * R.pathSatisfies(R.is(Object), [], {x: {y: 2}}); //=> true + */ + + +var pathSatisfies = +/*#__PURE__*/ +_curry3(function pathSatisfies(pred, propPath, obj) { + return pred(path(propPath, obj)); +}); + +module.exports = pathSatisfies; \ No newline at end of file diff --git a/node_modules/ramda/src/paths.js b/node_modules/ramda/src/paths.js new file mode 100644 index 0000000..1b0ce7c --- /dev/null +++ b/node_modules/ramda/src/paths.js @@ -0,0 +1,54 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isInteger = +/*#__PURE__*/ +require("./internal/_isInteger"); + +var nth = +/*#__PURE__*/ +require("./nth"); +/** + * Retrieves the values at given paths of an object. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Object + * @typedefn Idx = [String | Int] + * @sig [Idx] -> {a} -> [a | Undefined] + * @param {Array} pathsArray The array of paths to be fetched. + * @param {Object} obj The object to retrieve the nested properties from. + * @return {Array} A list consisting of values at paths specified by "pathsArray". + * @see R.path + * @example + * + * R.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, 3] + * R.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, undefined] + */ + + +var paths = +/*#__PURE__*/ +_curry2(function paths(pathsArray, obj) { + return pathsArray.map(function (paths) { + var val = obj; + var idx = 0; + var p; + + while (idx < paths.length) { + if (val == null) { + return; + } + + p = paths[idx]; + val = _isInteger(p) ? nth(p, val) : val[p]; + idx += 1; + } + + return val; + }); +}); + +module.exports = paths; \ No newline at end of file diff --git a/node_modules/ramda/src/pick.js b/node_modules/ramda/src/pick.js new file mode 100644 index 0000000..5bb7c67 --- /dev/null +++ b/node_modules/ramda/src/pick.js @@ -0,0 +1,41 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a partial copy of an object containing only the keys specified. If + * the key does not exist, the property is ignored. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.omit, R.props + * @example + * + * R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1} + */ + + +var pick = +/*#__PURE__*/ +_curry2(function pick(names, obj) { + var result = {}; + var idx = 0; + + while (idx < names.length) { + if (names[idx] in obj) { + result[names[idx]] = obj[names[idx]]; + } + + idx += 1; + } + + return result; +}); + +module.exports = pick; \ No newline at end of file diff --git a/node_modules/ramda/src/pickAll.js b/node_modules/ramda/src/pickAll.js new file mode 100644 index 0000000..7556e36 --- /dev/null +++ b/node_modules/ramda/src/pickAll.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Similar to `pick` except that this one includes a `key: undefined` pair for + * properties that don't exist. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> {k: v} + * @param {Array} names an array of String property names to copy onto a new object + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties from `names` on it. + * @see R.pick + * @example + * + * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} + */ + + +var pickAll = +/*#__PURE__*/ +_curry2(function pickAll(names, obj) { + var result = {}; + var idx = 0; + var len = names.length; + + while (idx < len) { + var name = names[idx]; + result[name] = obj[name]; + idx += 1; + } + + return result; +}); + +module.exports = pickAll; \ No newline at end of file diff --git a/node_modules/ramda/src/pickBy.js b/node_modules/ramda/src/pickBy.js new file mode 100644 index 0000000..889a086 --- /dev/null +++ b/node_modules/ramda/src/pickBy.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a partial copy of an object containing only the keys that satisfy + * the supplied predicate. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Object + * @sig ((v, k) -> Boolean) -> {k: v} -> {k: v} + * @param {Function} pred A predicate to determine whether or not a key + * should be included on the output object. + * @param {Object} obj The object to copy from + * @return {Object} A new object with only properties that satisfy `pred` + * on it. + * @see R.pick, R.filter + * @example + * + * const isUpperCase = (val, key) => key.toUpperCase() === key; + * R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4} + */ + + +var pickBy = +/*#__PURE__*/ +_curry2(function pickBy(test, obj) { + var result = {}; + + for (var prop in obj) { + if (test(obj[prop], prop, obj)) { + result[prop] = obj[prop]; + } + } + + return result; +}); + +module.exports = pickBy; \ No newline at end of file diff --git a/node_modules/ramda/src/pipe.js b/node_modules/ramda/src/pipe.js new file mode 100644 index 0000000..9524b69 --- /dev/null +++ b/node_modules/ramda/src/pipe.js @@ -0,0 +1,49 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _pipe = +/*#__PURE__*/ +require("./internal/_pipe"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); + +var tail = +/*#__PURE__*/ +require("./tail"); +/** + * Performs left-to-right function composition. The first argument may have + * any arity; the remaining arguments must be unary. + * + * In some libraries this function is named `sequence`. + * + * **Note:** The result of pipe is not automatically curried. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.compose + * @example + * + * const f = R.pipe(Math.pow, R.negate, R.inc); + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) + */ + + +function pipe() { + if (arguments.length === 0) { + throw new Error('pipe requires at least one argument'); + } + + return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments))); +} + +module.exports = pipe; \ No newline at end of file diff --git a/node_modules/ramda/src/pipeK.js b/node_modules/ramda/src/pipeK.js new file mode 100644 index 0000000..db48d1d --- /dev/null +++ b/node_modules/ramda/src/pipeK.js @@ -0,0 +1,53 @@ +var composeK = +/*#__PURE__*/ +require("./composeK"); + +var reverse = +/*#__PURE__*/ +require("./reverse"); +/** + * Returns the left-to-right Kleisli composition of the provided functions, + * each of which must return a value of a type supported by [`chain`](#chain). + * + * `R.pipeK(f, g, h)` is equivalent to `R.pipe(f, R.chain(g), R.chain(h))`. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Function + * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z) + * @param {...Function} + * @return {Function} + * @see R.composeK + * @deprecated since v0.26.0 + * @example + * + * // parseJson :: String -> Maybe * + * // get :: String -> Object -> Maybe * + * + * // getStateCode :: Maybe String -> Maybe String + * const getStateCode = R.pipeK( + * parseJson, + * get('user'), + * get('address'), + * get('state'), + * R.compose(Maybe.of, R.toUpper) + * ); + * + * getStateCode('{"user":{"address":{"state":"ny"}}}'); + * //=> Just('NY') + * getStateCode('[Invalid JSON]'); + * //=> Nothing() + * @symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a))) + */ + + +function pipeK() { + if (arguments.length === 0) { + throw new Error('pipeK requires at least one argument'); + } + + return composeK.apply(this, reverse(arguments)); +} + +module.exports = pipeK; \ No newline at end of file diff --git a/node_modules/ramda/src/pipeP.js b/node_modules/ramda/src/pipeP.js new file mode 100644 index 0000000..a931d7e --- /dev/null +++ b/node_modules/ramda/src/pipeP.js @@ -0,0 +1,45 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _pipeP = +/*#__PURE__*/ +require("./internal/_pipeP"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); + +var tail = +/*#__PURE__*/ +require("./tail"); +/** + * Performs left-to-right composition of one or more Promise-returning + * functions. The first argument may have any arity; the remaining arguments + * must be unary. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category Function + * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z) + * @param {...Function} functions + * @return {Function} + * @see R.composeP + * @deprecated since v0.26.0 + * @example + * + * // followersForUser :: String -> Promise [User] + * const followersForUser = R.pipeP(db.getUserById, db.getFollowers); + */ + + +function pipeP() { + if (arguments.length === 0) { + throw new Error('pipeP requires at least one argument'); + } + + return _arity(arguments[0].length, reduce(_pipeP, arguments[0], tail(arguments))); +} + +module.exports = pipeP; \ No newline at end of file diff --git a/node_modules/ramda/src/pipeWith.js b/node_modules/ramda/src/pipeWith.js new file mode 100644 index 0000000..51adaac --- /dev/null +++ b/node_modules/ramda/src/pipeWith.js @@ -0,0 +1,65 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var head = +/*#__PURE__*/ +require("./head"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var tail = +/*#__PURE__*/ +require("./tail"); + +var identity = +/*#__PURE__*/ +require("./identity"); +/** + * Performs left-to-right function composition using transforming function. The first argument may have + * any arity; the remaining arguments must be unary. + * + * **Note:** The result of pipeWith is not automatically curried. Transforming function is not used on the + * first argument. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((* -> *), [((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)]) -> ((a, b, ..., n) -> z) + * @param {...Function} functions + * @return {Function} + * @see R.composeWith, R.pipe + * @example + * + * const pipeWhileNotNil = R.pipeWith((f, res) => R.isNil(res) ? res : f(res)); + * const f = pipeWhileNotNil([Math.pow, R.negate, R.inc]) + * + * f(3, 4); // -(3^4) + 1 + * @symb R.pipeWith(f)([g, h, i])(...args) = f(i, f(h, g(...args))) + */ + + +var pipeWith = +/*#__PURE__*/ +_curry2(function pipeWith(xf, list) { + if (list.length <= 0) { + return identity; + } + + var headList = head(list); + var tailList = tail(list); + return _arity(headList.length, function () { + return _reduce(function (result, f) { + return xf.call(this, f, result); + }, headList.apply(this, arguments), tailList); + }); +}); + +module.exports = pipeWith; \ No newline at end of file diff --git a/node_modules/ramda/src/pluck.js b/node_modules/ramda/src/pluck.js new file mode 100644 index 0000000..15174a3 --- /dev/null +++ b/node_modules/ramda/src/pluck.js @@ -0,0 +1,47 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var map = +/*#__PURE__*/ +require("./map"); + +var prop = +/*#__PURE__*/ +require("./prop"); +/** + * Returns a new list by plucking the same named property off all objects in + * the list supplied. + * + * `pluck` will work on + * any [functor](https://github.com/fantasyland/fantasy-land#functor) in + * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Functor f => k -> f {k: v} -> f v + * @param {Number|String} key The key name to pluck off of each object. + * @param {Array} f The array or functor to consider. + * @return {Array} The list of values for the given key. + * @see R.props + * @example + * + * var getAges = R.pluck('age'); + * getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27] + * + * R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3] + * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5} + * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] + * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] + */ + + +var pluck = +/*#__PURE__*/ +_curry2(function pluck(p, list) { + return map(prop(p), list); +}); + +module.exports = pluck; \ No newline at end of file diff --git a/node_modules/ramda/src/prepend.js b/node_modules/ramda/src/prepend.js new file mode 100644 index 0000000..3483e1f --- /dev/null +++ b/node_modules/ramda/src/prepend.js @@ -0,0 +1,33 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a new list with the given element at the front, followed by the + * contents of the list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig a -> [a] -> [a] + * @param {*} el The item to add to the head of the output list. + * @param {Array} list The array to add to the tail of the output list. + * @return {Array} A new array. + * @see R.append + * @example + * + * R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] + */ + + +var prepend = +/*#__PURE__*/ +_curry2(function prepend(el, list) { + return _concat([el], list); +}); + +module.exports = prepend; \ No newline at end of file diff --git a/node_modules/ramda/src/product.js b/node_modules/ramda/src/product.js new file mode 100644 index 0000000..6af481a --- /dev/null +++ b/node_modules/ramda/src/product.js @@ -0,0 +1,28 @@ +var multiply = +/*#__PURE__*/ +require("./multiply"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); +/** + * Multiplies together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The product of all the numbers in the list. + * @see R.reduce + * @example + * + * R.product([2,4,6,8,100,1]); //=> 38400 + */ + + +var product = +/*#__PURE__*/ +reduce(multiply, 1); +module.exports = product; \ No newline at end of file diff --git a/node_modules/ramda/src/project.js b/node_modules/ramda/src/project.js new file mode 100644 index 0000000..56d11a1 --- /dev/null +++ b/node_modules/ramda/src/project.js @@ -0,0 +1,41 @@ +var _map = +/*#__PURE__*/ +require("./internal/_map"); + +var identity = +/*#__PURE__*/ +require("./identity"); + +var pickAll = +/*#__PURE__*/ +require("./pickAll"); + +var useWith = +/*#__PURE__*/ +require("./useWith"); +/** + * Reasonable analog to SQL `select` statement. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @category Relation + * @sig [k] -> [{k: v}] -> [{k: v}] + * @param {Array} props The property names to project + * @param {Array} objs The objects to query + * @return {Array} An array of objects with just the `props` properties. + * @example + * + * const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; + * const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; + * const kids = [abby, fred]; + * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] + */ + + +var project = +/*#__PURE__*/ +useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity + +module.exports = project; \ No newline at end of file diff --git a/node_modules/ramda/src/prop.js b/node_modules/ramda/src/prop.js new file mode 100644 index 0000000..e05aacc --- /dev/null +++ b/node_modules/ramda/src/prop.js @@ -0,0 +1,37 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var path = +/*#__PURE__*/ +require("./path"); +/** + * Returns a function that when supplied an object returns the indicated + * property of that object, if it exists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @typedefn Idx = String | Int + * @sig Idx -> {s: a} -> a | Undefined + * @param {String|Number} p The property name or array index + * @param {Object} obj The object to query + * @return {*} The value at `obj.p`. + * @see R.path, R.nth + * @example + * + * R.prop('x', {x: 100}); //=> 100 + * R.prop('x', {}); //=> undefined + * R.prop(0, [100]); //=> 100 + * R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4 + */ + + +var prop = +/*#__PURE__*/ +_curry2(function prop(p, obj) { + return path([p], obj); +}); + +module.exports = prop; \ No newline at end of file diff --git a/node_modules/ramda/src/propEq.js b/node_modules/ramda/src/propEq.js new file mode 100644 index 0000000..10c33ed --- /dev/null +++ b/node_modules/ramda/src/propEq.js @@ -0,0 +1,41 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var equals = +/*#__PURE__*/ +require("./equals"); +/** + * Returns `true` if the specified object property is equal, in + * [`R.equals`](#equals) terms, to the given value; `false` otherwise. + * You can test multiple properties with [`R.whereEq`](#whereEq). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig String -> a -> Object -> Boolean + * @param {String} name + * @param {*} val + * @param {*} obj + * @return {Boolean} + * @see R.whereEq, R.propSatisfies, R.equals + * @example + * + * const abby = {name: 'Abby', age: 7, hair: 'blond'}; + * const fred = {name: 'Fred', age: 12, hair: 'brown'}; + * const rusty = {name: 'Rusty', age: 10, hair: 'brown'}; + * const alois = {name: 'Alois', age: 15, disposition: 'surly'}; + * const kids = [abby, fred, rusty, alois]; + * const hasBrownHair = R.propEq('hair', 'brown'); + * R.filter(hasBrownHair, kids); //=> [fred, rusty] + */ + + +var propEq = +/*#__PURE__*/ +_curry3(function propEq(name, val, obj) { + return equals(val, obj[name]); +}); + +module.exports = propEq; \ No newline at end of file diff --git a/node_modules/ramda/src/propIs.js b/node_modules/ramda/src/propIs.js new file mode 100644 index 0000000..5631dca --- /dev/null +++ b/node_modules/ramda/src/propIs.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var is = +/*#__PURE__*/ +require("./is"); +/** + * Returns `true` if the specified object property is of the given type; + * `false` otherwise. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Type + * @sig Type -> String -> Object -> Boolean + * @param {Function} type + * @param {String} name + * @param {*} obj + * @return {Boolean} + * @see R.is, R.propSatisfies + * @example + * + * R.propIs(Number, 'x', {x: 1, y: 2}); //=> true + * R.propIs(Number, 'x', {x: 'foo'}); //=> false + * R.propIs(Number, 'x', {}); //=> false + */ + + +var propIs = +/*#__PURE__*/ +_curry3(function propIs(type, name, obj) { + return is(type, obj[name]); +}); + +module.exports = propIs; \ No newline at end of file diff --git a/node_modules/ramda/src/propOr.js b/node_modules/ramda/src/propOr.js new file mode 100644 index 0000000..259d468 --- /dev/null +++ b/node_modules/ramda/src/propOr.js @@ -0,0 +1,42 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var pathOr = +/*#__PURE__*/ +require("./pathOr"); +/** + * If the given, non-null object has an own property with the specified name, + * returns the value of that property. Otherwise returns the provided default + * value. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category Object + * @sig a -> String -> Object -> a + * @param {*} val The default value. + * @param {String} p The name of the property to return. + * @param {Object} obj The object to query. + * @return {*} The value of given property of the supplied object or the default value. + * @example + * + * const alice = { + * name: 'ALICE', + * age: 101 + * }; + * const favorite = R.prop('favoriteLibrary'); + * const favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary'); + * + * favorite(alice); //=> undefined + * favoriteWithDefault(alice); //=> 'Ramda' + */ + + +var propOr = +/*#__PURE__*/ +_curry3(function propOr(val, p, obj) { + return pathOr(val, [p], obj); +}); + +module.exports = propOr; \ No newline at end of file diff --git a/node_modules/ramda/src/propSatisfies.js b/node_modules/ramda/src/propSatisfies.js new file mode 100644 index 0000000..9bb4edf --- /dev/null +++ b/node_modules/ramda/src/propSatisfies.js @@ -0,0 +1,31 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Returns `true` if the specified object property satisfies the given + * predicate; `false` otherwise. You can test multiple properties with + * [`R.where`](#where). + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Logic + * @sig (a -> Boolean) -> String -> {String: a} -> Boolean + * @param {Function} pred + * @param {String} name + * @param {*} obj + * @return {Boolean} + * @see R.where, R.propEq, R.propIs + * @example + * + * R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true + */ + + +var propSatisfies = +/*#__PURE__*/ +_curry3(function propSatisfies(pred, name, obj) { + return pred(obj[name]); +}); + +module.exports = propSatisfies; \ No newline at end of file diff --git a/node_modules/ramda/src/props.js b/node_modules/ramda/src/props.js new file mode 100644 index 0000000..f682b30 --- /dev/null +++ b/node_modules/ramda/src/props.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var path = +/*#__PURE__*/ +require("./path"); +/** + * Acts as multiple `prop`: array of keys in, array of values out. Preserves + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig [k] -> {k: v} -> [v] + * @param {Array} ps The property names to fetch + * @param {Object} obj The object to query + * @return {Array} The corresponding values or partially applied function. + * @example + * + * R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2] + * R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2] + * + * const fullName = R.compose(R.join(' '), R.props(['first', 'last'])); + * fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth' + */ + + +var props = +/*#__PURE__*/ +_curry2(function props(ps, obj) { + return ps.map(function (p) { + return path([p], obj); + }); +}); + +module.exports = props; \ No newline at end of file diff --git a/node_modules/ramda/src/range.js b/node_modules/ramda/src/range.js new file mode 100644 index 0000000..749a71c --- /dev/null +++ b/node_modules/ramda/src/range.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isNumber = +/*#__PURE__*/ +require("./internal/_isNumber"); +/** + * Returns a list of numbers from `from` (inclusive) to `to` (exclusive). + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> Number -> [Number] + * @param {Number} from The first number in the list. + * @param {Number} to One more than the last number in the list. + * @return {Array} The list of numbers in the set `[a, b)`. + * @example + * + * R.range(1, 5); //=> [1, 2, 3, 4] + * R.range(50, 53); //=> [50, 51, 52] + */ + + +var range = +/*#__PURE__*/ +_curry2(function range(from, to) { + if (!(_isNumber(from) && _isNumber(to))) { + throw new TypeError('Both arguments to range must be numbers'); + } + + var result = []; + var n = from; + + while (n < to) { + result.push(n); + n += 1; + } + + return result; +}); + +module.exports = range; \ No newline at end of file diff --git a/node_modules/ramda/src/reduce.js b/node_modules/ramda/src/reduce.js new file mode 100644 index 0000000..3176e01 --- /dev/null +++ b/node_modules/ramda/src/reduce.js @@ -0,0 +1,60 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); +/** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It may use + * [`R.reduced`](#reduced) to shortcut the iteration. + * + * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function + * is *(value, acc)*. + * + * Note: `R.reduce` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduce` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description + * + * Dispatches to the `reduce` method of the third argument, if present. When + * doing so, it is up to the user to handle the [`R.reduced`](#reduced) + * shortcuting, as this is not implemented by `reduce`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> a + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduced, R.addIndex, R.reduceRight + * @example + * + * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 + * // - -10 + * // / \ / \ + * // - 4 -6 4 + * // / \ / \ + * // - 3 ==> -3 3 + * // / \ / \ + * // - 2 -1 2 + * // / \ / \ + * // 0 1 0 1 + * + * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) + */ + + +var reduce = +/*#__PURE__*/ +_curry3(_reduce); + +module.exports = reduce; \ No newline at end of file diff --git a/node_modules/ramda/src/reduceBy.js b/node_modules/ramda/src/reduceBy.js new file mode 100644 index 0000000..380532f --- /dev/null +++ b/node_modules/ramda/src/reduceBy.js @@ -0,0 +1,79 @@ +var _clone = +/*#__PURE__*/ +require("./internal/_clone"); + +var _curryN = +/*#__PURE__*/ +require("./internal/_curryN"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var _xreduceBy = +/*#__PURE__*/ +require("./internal/_xreduceBy"); +/** + * Groups the elements of the list according to the result of calling + * the String-returning function `keyFn` on each element and reduces the elements + * of each group to a single value via the reducer function `valueFn`. + * + * This function is basically a more general [`groupBy`](#groupBy) function. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category List + * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} + * @param {Function} valueFn The function that reduces the elements of each group to a single + * value. Receives two values, accumulator for a particular group and the current element. + * @param {*} acc The (initial) accumulator value for each group. + * @param {Function} keyFn The function that maps the list's element into a key. + * @param {Array} list The array to group. + * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of + * `valueFn` for elements which produced that key when passed to `keyFn`. + * @see R.groupBy, R.reduce + * @example + * + * const groupNames = (acc, {name}) => acc.concat(name) + * const toGrade = ({score}) => + * score < 65 ? 'F' : + * score < 70 ? 'D' : + * score < 80 ? 'C' : + * score < 90 ? 'B' : 'A' + * + * var students = [ + * {name: 'Abby', score: 83}, + * {name: 'Bart', score: 62}, + * {name: 'Curt', score: 88}, + * {name: 'Dora', score: 92}, + * ] + * + * reduceBy(groupNames, [], toGrade, students) + * //=> {"A": ["Dora"], "B": ["Abby", "Curt"], "F": ["Bart"]} + */ + + +var reduceBy = +/*#__PURE__*/ +_curryN(4, [], +/*#__PURE__*/ +_dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) { + return _reduce(function (acc, elt) { + var key = keyFn(elt); + acc[key] = valueFn(_has(key, acc) ? acc[key] : _clone(valueAcc, [], [], false), elt); + return acc; + }, {}, list); +})); + +module.exports = reduceBy; \ No newline at end of file diff --git a/node_modules/ramda/src/reduceRight.js b/node_modules/ramda/src/reduceRight.js new file mode 100644 index 0000000..f5d0caa --- /dev/null +++ b/node_modules/ramda/src/reduceRight.js @@ -0,0 +1,61 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Returns a single item by iterating through the list, successively calling + * the iterator function and passing it an accumulator value and the current + * value from the array, and then passing the result to the next call. + * + * Similar to [`reduce`](#reduce), except moves through the input list from the + * right to the left. + * + * The iterator function receives two values: *(value, acc)*, while the arguments' + * order of `reduce`'s iterator function is *(acc, value)*. + * + * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse + * arrays), unlike the native `Array.prototype.reduceRight` method. For more details + * on this behavior, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> b) -> b -> [a] -> b + * @param {Function} fn The iterator function. Receives two values, the current element from the array + * and the accumulator. + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.addIndex + * @example + * + * R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2 + * // - -2 + * // / \ / \ + * // 1 - 1 3 + * // / \ / \ + * // 2 - ==> 2 -1 + * // / \ / \ + * // 3 - 3 4 + * // / \ / \ + * // 4 0 4 0 + * + * @symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a))) + */ + + +var reduceRight = +/*#__PURE__*/ +_curry3(function reduceRight(fn, acc, list) { + var idx = list.length - 1; + + while (idx >= 0) { + acc = fn(list[idx], acc); + idx -= 1; + } + + return acc; +}); + +module.exports = reduceRight; \ No newline at end of file diff --git a/node_modules/ramda/src/reduceWhile.js b/node_modules/ramda/src/reduceWhile.js new file mode 100644 index 0000000..c12c303 --- /dev/null +++ b/node_modules/ramda/src/reduceWhile.js @@ -0,0 +1,51 @@ +var _curryN = +/*#__PURE__*/ +require("./internal/_curryN"); + +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var _reduced = +/*#__PURE__*/ +require("./internal/_reduced"); +/** + * Like [`reduce`](#reduce), `reduceWhile` returns a single item by iterating + * through the list, successively calling the iterator function. `reduceWhile` + * also takes a predicate that is evaluated before each step. If the predicate + * returns `false`, it "short-circuits" the iteration and returns the current + * value of the accumulator. + * + * @func + * @memberOf R + * @since v0.22.0 + * @category List + * @sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} pred The predicate. It is passed the accumulator and the + * current element. + * @param {Function} fn The iterator function. Receives two values, the + * accumulator and the current element. + * @param {*} a The accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced + * @example + * + * const isOdd = (acc, x) => x % 2 === 1; + * const xs = [1, 3, 5, 60, 777, 800]; + * R.reduceWhile(isOdd, R.add, 0, xs); //=> 9 + * + * const ys = [2, 4, 6] + * R.reduceWhile(isOdd, R.add, 111, ys); //=> 111 + */ + + +var reduceWhile = +/*#__PURE__*/ +_curryN(4, [], function _reduceWhile(pred, fn, a, list) { + return _reduce(function (acc, x) { + return pred(acc, x) ? fn(acc, x) : _reduced(acc); + }, a, list); +}); + +module.exports = reduceWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/reduced.js b/node_modules/ramda/src/reduced.js new file mode 100644 index 0000000..38a70e2 --- /dev/null +++ b/node_modules/ramda/src/reduced.js @@ -0,0 +1,39 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _reduced = +/*#__PURE__*/ +require("./internal/_reduced"); +/** + * Returns a value wrapped to indicate that it is the final value of the reduce + * and transduce functions. The returned value should be considered a black + * box: the internal structure is not guaranteed to be stable. + * + * Note: this optimization is only available to the below functions: + * - [`reduce`](#reduce) + * - [`reduceWhile`](#reduceWhile) + * - [`transduce`](#transduce) + * + * @func + * @memberOf R + * @since v0.15.0 + * @category List + * @sig a -> * + * @param {*} x The final value of the reduce. + * @return {*} The wrapped value. + * @see R.reduce, R.reduceWhile, R.transduce + * @example + * + * R.reduce( + * (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item), + * [], + * [1, 2, 3, 4, 5]) // [1, 2, 3] + */ + + +var reduced = +/*#__PURE__*/ +_curry1(_reduced); + +module.exports = reduced; \ No newline at end of file diff --git a/node_modules/ramda/src/reject.js b/node_modules/ramda/src/reject.js new file mode 100644 index 0000000..7f3bd58 --- /dev/null +++ b/node_modules/ramda/src/reject.js @@ -0,0 +1,44 @@ +var _complement = +/*#__PURE__*/ +require("./internal/_complement"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var filter = +/*#__PURE__*/ +require("./filter"); +/** + * The complement of [`filter`](#filter). + * + * Acts as a transducer if a transformer is given in list position. Filterable + * objects include plain objects or any object that has a filter method such + * as `Array`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Filterable f => (a -> Boolean) -> f a -> f a + * @param {Function} pred + * @param {Array} filterable + * @return {Array} + * @see R.filter, R.transduce, R.addIndex + * @example + * + * const isOdd = (n) => n % 2 === 1; + * + * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + * + * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} + */ + + +var reject = +/*#__PURE__*/ +_curry2(function reject(pred, filterable) { + return filter(_complement(pred), filterable); +}); + +module.exports = reject; \ No newline at end of file diff --git a/node_modules/ramda/src/remove.js b/node_modules/ramda/src/remove.js new file mode 100644 index 0000000..225175c --- /dev/null +++ b/node_modules/ramda/src/remove.js @@ -0,0 +1,34 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Removes the sub-list of `list` starting at index `start` and containing + * `count` elements. _Note that this is not destructive_: it returns a copy of + * the list with the changes. + * No lists have been harmed in the application of this function. + * + * @func + * @memberOf R + * @since v0.2.2 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @param {Number} start The position to start removing elements + * @param {Number} count The number of elements to remove + * @param {Array} list The list to remove from + * @return {Array} A new Array with `count` elements from `start` removed. + * @see R.without + * @example + * + * R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8] + */ + + +var remove = +/*#__PURE__*/ +_curry3(function remove(start, count, list) { + var result = Array.prototype.slice.call(list, 0); + result.splice(start, count); + return result; +}); + +module.exports = remove; \ No newline at end of file diff --git a/node_modules/ramda/src/repeat.js b/node_modules/ramda/src/repeat.js new file mode 100644 index 0000000..2e49155 --- /dev/null +++ b/node_modules/ramda/src/repeat.js @@ -0,0 +1,43 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var always = +/*#__PURE__*/ +require("./always"); + +var times = +/*#__PURE__*/ +require("./times"); +/** + * Returns a fixed list of size `n` containing a specified identical value. + * + * @func + * @memberOf R + * @since v0.1.1 + * @category List + * @sig a -> n -> [a] + * @param {*} value The value to repeat. + * @param {Number} n The desired size of the output list. + * @return {Array} A new array containing `n` `value`s. + * @see R.times + * @example + * + * R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi'] + * + * const obj = {}; + * const repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}] + * repeatedObjs[0] === repeatedObjs[1]; //=> true + * @symb R.repeat(a, 0) = [] + * @symb R.repeat(a, 1) = [a] + * @symb R.repeat(a, 2) = [a, a] + */ + + +var repeat = +/*#__PURE__*/ +_curry2(function repeat(value, n) { + return times(always(value), n); +}); + +module.exports = repeat; \ No newline at end of file diff --git a/node_modules/ramda/src/replace.js b/node_modules/ramda/src/replace.js new file mode 100644 index 0000000..aa8fe04 --- /dev/null +++ b/node_modules/ramda/src/replace.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Replace a substring or regex match in a string with a replacement. + * + * The first two parameters correspond to the parameters of the + * `String.prototype.replace()` function, so the second parameter can also be a + * function. + * + * @func + * @memberOf R + * @since v0.7.0 + * @category String + * @sig RegExp|String -> String -> String -> String + * @param {RegExp|String} pattern A regular expression or a substring to match. + * @param {String} replacement The string to replace the matches with. + * @param {String} str The String to do the search and replacement in. + * @return {String} The result. + * @example + * + * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo' + * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo' + * + * // Use the "g" (global) flag to replace all occurrences: + * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar' + */ + + +var replace = +/*#__PURE__*/ +_curry3(function replace(regex, replacement, str) { + return str.replace(regex, replacement); +}); + +module.exports = replace; \ No newline at end of file diff --git a/node_modules/ramda/src/reverse.js b/node_modules/ramda/src/reverse.js new file mode 100644 index 0000000..cf3ab06 --- /dev/null +++ b/node_modules/ramda/src/reverse.js @@ -0,0 +1,40 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _isString = +/*#__PURE__*/ +require("./internal/_isString"); +/** + * Returns a new list or string with the elements or characters in reverse + * order. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {Array|String} list + * @return {Array|String} + * @example + * + * R.reverse([1, 2, 3]); //=> [3, 2, 1] + * R.reverse([1, 2]); //=> [2, 1] + * R.reverse([1]); //=> [1] + * R.reverse([]); //=> [] + * + * R.reverse('abc'); //=> 'cba' + * R.reverse('ab'); //=> 'ba' + * R.reverse('a'); //=> 'a' + * R.reverse(''); //=> '' + */ + + +var reverse = +/*#__PURE__*/ +_curry1(function reverse(list) { + return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse(); +}); + +module.exports = reverse; \ No newline at end of file diff --git a/node_modules/ramda/src/scan.js b/node_modules/ramda/src/scan.js new file mode 100644 index 0000000..9e6212d --- /dev/null +++ b/node_modules/ramda/src/scan.js @@ -0,0 +1,43 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Scan is similar to [`reduce`](#reduce), but returns a list of successively + * reduced values from the left + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig ((a, b) -> a) -> a -> [b] -> [a] + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array + * @param {*} acc The accumulator value. + * @param {Array} list The list to iterate over. + * @return {Array} A list of all intermediately reduced values. + * @see R.reduce, R.mapAccum + * @example + * + * const numbers = [1, 2, 3, 4]; + * const factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24] + * @symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)] + */ + + +var scan = +/*#__PURE__*/ +_curry3(function scan(fn, acc, list) { + var idx = 0; + var len = list.length; + var result = [acc]; + + while (idx < len) { + acc = fn(acc, list[idx]); + result[idx + 1] = acc; + idx += 1; + } + + return result; +}); + +module.exports = scan; \ No newline at end of file diff --git a/node_modules/ramda/src/sequence.js b/node_modules/ramda/src/sequence.js new file mode 100644 index 0000000..cc1fe8a --- /dev/null +++ b/node_modules/ramda/src/sequence.js @@ -0,0 +1,54 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var ap = +/*#__PURE__*/ +require("./ap"); + +var map = +/*#__PURE__*/ +require("./map"); + +var prepend = +/*#__PURE__*/ +require("./prepend"); + +var reduceRight = +/*#__PURE__*/ +require("./reduceRight"); +/** + * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) + * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an + * Applicative of Traversable. + * + * Dispatches to the `sequence` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a) + * @param {Function} of + * @param {*} traversable + * @return {*} + * @see R.traverse + * @example + * + * R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]); //=> Just([1, 2, 3]) + * R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing() + * + * R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)] + * R.sequence(R.of, Nothing()); //=> [Nothing()] + */ + + +var sequence = +/*#__PURE__*/ +_curry2(function sequence(of, traversable) { + return typeof traversable.sequence === 'function' ? traversable.sequence(of) : reduceRight(function (x, acc) { + return ap(map(prepend, x), acc); + }, of([]), traversable); +}); + +module.exports = sequence; \ No newline at end of file diff --git a/node_modules/ramda/src/set.js b/node_modules/ramda/src/set.js new file mode 100644 index 0000000..7a7b828 --- /dev/null +++ b/node_modules/ramda/src/set.js @@ -0,0 +1,42 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var always = +/*#__PURE__*/ +require("./always"); + +var over = +/*#__PURE__*/ +require("./over"); +/** + * Returns the result of "setting" the portion of the given data structure + * focused by the given lens to the given value. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> a -> s -> s + * @param {Lens} lens + * @param {*} v + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lensProp('x'); + * + * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + * R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2} + */ + + +var set = +/*#__PURE__*/ +_curry3(function set(lens, v, x) { + return over(lens, always(v), x); +}); + +module.exports = set; \ No newline at end of file diff --git a/node_modules/ramda/src/slice.js b/node_modules/ramda/src/slice.js new file mode 100644 index 0000000..4df43f8 --- /dev/null +++ b/node_modules/ramda/src/slice.js @@ -0,0 +1,42 @@ +var _checkForMethod = +/*#__PURE__*/ +require("./internal/_checkForMethod"); + +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Returns the elements of the given list or string (or object with a `slice` + * method) from `fromIndex` (inclusive) to `toIndex` (exclusive). + * + * Dispatches to the `slice` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.1.4 + * @category List + * @sig Number -> Number -> [a] -> [a] + * @sig Number -> Number -> String -> String + * @param {Number} fromIndex The start index (inclusive). + * @param {Number} toIndex The end index (exclusive). + * @param {*} list + * @return {*} + * @example + * + * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd'] + * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c'] + * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + * R.slice(0, 3, 'ramda'); //=> 'ram' + */ + + +var slice = +/*#__PURE__*/ +_curry3( +/*#__PURE__*/ +_checkForMethod('slice', function slice(fromIndex, toIndex, list) { + return Array.prototype.slice.call(list, fromIndex, toIndex); +})); + +module.exports = slice; \ No newline at end of file diff --git a/node_modules/ramda/src/sort.js b/node_modules/ramda/src/sort.js new file mode 100644 index 0000000..0d5c3b7 --- /dev/null +++ b/node_modules/ramda/src/sort.js @@ -0,0 +1,32 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a copy of the list, sorted according to the comparator function, + * which should accept two values at a time and return a negative number if the + * first value is smaller, a positive number if it's larger, and zero if they + * are equal. Please note that this is a **copy** of the list. It does not + * modify the original. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, a) -> Number) -> [a] -> [a] + * @param {Function} comparator A sorting function :: a -> b -> Int + * @param {Array} list The list to sort + * @return {Array} a new array with its elements sorted by the comparator function. + * @example + * + * const diff = function(a, b) { return a - b; }; + * R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7] + */ + + +var sort = +/*#__PURE__*/ +_curry2(function sort(comparator, list) { + return Array.prototype.slice.call(list, 0).sort(comparator); +}); + +module.exports = sort; \ No newline at end of file diff --git a/node_modules/ramda/src/sortBy.js b/node_modules/ramda/src/sortBy.js new file mode 100644 index 0000000..fb2f3ab --- /dev/null +++ b/node_modules/ramda/src/sortBy.js @@ -0,0 +1,49 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Sorts the list according to the supplied function. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig Ord b => (a -> b) -> [a] -> [a] + * @param {Function} fn + * @param {Array} list The list to sort. + * @return {Array} A new list sorted by the keys generated by `fn`. + * @example + * + * const sortByFirstItem = R.sortBy(R.prop(0)); + * const pairs = [[-1, 1], [-2, 2], [-3, 3]]; + * sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]] + * + * const sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name'))); + * const alice = { + * name: 'ALICE', + * age: 101 + * }; + * const bob = { + * name: 'Bob', + * age: -10 + * }; + * const clara = { + * name: 'clara', + * age: 314.159 + * }; + * const people = [clara, bob, alice]; + * sortByNameCaseInsensitive(people); //=> [alice, bob, clara] + */ + + +var sortBy = +/*#__PURE__*/ +_curry2(function sortBy(fn, list) { + return Array.prototype.slice.call(list, 0).sort(function (a, b) { + var aa = fn(a); + var bb = fn(b); + return aa < bb ? -1 : aa > bb ? 1 : 0; + }); +}); + +module.exports = sortBy; \ No newline at end of file diff --git a/node_modules/ramda/src/sortWith.js b/node_modules/ramda/src/sortWith.js new file mode 100644 index 0000000..fd89a13 --- /dev/null +++ b/node_modules/ramda/src/sortWith.js @@ -0,0 +1,54 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Sorts a list according to a list of comparators. + * + * @func + * @memberOf R + * @since v0.23.0 + * @category Relation + * @sig [(a, a) -> Number] -> [a] -> [a] + * @param {Array} functions A list of comparator functions. + * @param {Array} list The list to sort. + * @return {Array} A new list sorted according to the comarator functions. + * @example + * + * const alice = { + * name: 'alice', + * age: 40 + * }; + * const bob = { + * name: 'bob', + * age: 30 + * }; + * const clara = { + * name: 'clara', + * age: 40 + * }; + * const people = [clara, bob, alice]; + * const ageNameSort = R.sortWith([ + * R.descend(R.prop('age')), + * R.ascend(R.prop('name')) + * ]); + * ageNameSort(people); //=> [alice, clara, bob] + */ + + +var sortWith = +/*#__PURE__*/ +_curry2(function sortWith(fns, list) { + return Array.prototype.slice.call(list, 0).sort(function (a, b) { + var result = 0; + var i = 0; + + while (result === 0 && i < fns.length) { + result = fns[i](a, b); + i += 1; + } + + return result; + }); +}); + +module.exports = sortWith; \ No newline at end of file diff --git a/node_modules/ramda/src/split.js b/node_modules/ramda/src/split.js new file mode 100644 index 0000000..7adf8cd --- /dev/null +++ b/node_modules/ramda/src/split.js @@ -0,0 +1,29 @@ +var invoker = +/*#__PURE__*/ +require("./invoker"); +/** + * Splits a string into an array of strings based on the given + * separator. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category String + * @sig (String | RegExp) -> String -> [String] + * @param {String|RegExp} sep The pattern. + * @param {String} str The string to separate into an array. + * @return {Array} The array of strings from `str` separated by `sep`. + * @see R.join + * @example + * + * const pathComponents = R.split('/'); + * R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + * + * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] + */ + + +var split = +/*#__PURE__*/ +invoker(1, 'split'); +module.exports = split; \ No newline at end of file diff --git a/node_modules/ramda/src/splitAt.js b/node_modules/ramda/src/splitAt.js new file mode 100644 index 0000000..06de43c --- /dev/null +++ b/node_modules/ramda/src/splitAt.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var length = +/*#__PURE__*/ +require("./length"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Splits a given list or string at a given index. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig Number -> [a] -> [[a], [a]] + * @sig Number -> String -> [String, String] + * @param {Number} index The index where the array/string is split. + * @param {Array|String} array The array/string to be split. + * @return {Array} + * @example + * + * R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] + * R.splitAt(5, 'hello world'); //=> ['hello', ' world'] + * R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] + */ + + +var splitAt = +/*#__PURE__*/ +_curry2(function splitAt(index, array) { + return [slice(0, index, array), slice(index, length(array), array)]; +}); + +module.exports = splitAt; \ No newline at end of file diff --git a/node_modules/ramda/src/splitEvery.js b/node_modules/ramda/src/splitEvery.js new file mode 100644 index 0000000..db379e4 --- /dev/null +++ b/node_modules/ramda/src/splitEvery.js @@ -0,0 +1,44 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Splits a collection into slices of the specified length. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [[a]] + * @sig Number -> String -> [String] + * @param {Number} n + * @param {Array} list + * @return {Array} + * @example + * + * R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]] + * R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz'] + */ + + +var splitEvery = +/*#__PURE__*/ +_curry2(function splitEvery(n, list) { + if (n <= 0) { + throw new Error('First argument to splitEvery must be a positive integer'); + } + + var result = []; + var idx = 0; + + while (idx < list.length) { + result.push(slice(idx, idx += n, list)); + } + + return result; +}); + +module.exports = splitEvery; \ No newline at end of file diff --git a/node_modules/ramda/src/splitWhen.js b/node_modules/ramda/src/splitWhen.js new file mode 100644 index 0000000..034c44c --- /dev/null +++ b/node_modules/ramda/src/splitWhen.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Takes a list and a predicate and returns a pair of lists with the following properties: + * + * - the result of concatenating the two output lists is equivalent to the input list; + * - none of the elements of the first output list satisfies the predicate; and + * - if the second output list is non-empty, its first element satisfies the predicate. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [[a], [a]] + * @param {Function} pred The predicate that determines where the array is split. + * @param {Array} list The array to be split. + * @return {Array} + * @example + * + * R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] + */ + + +var splitWhen = +/*#__PURE__*/ +_curry2(function splitWhen(pred, list) { + var idx = 0; + var len = list.length; + var prefix = []; + + while (idx < len && !pred(list[idx])) { + prefix.push(list[idx]); + idx += 1; + } + + return [prefix, Array.prototype.slice.call(list, idx)]; +}); + +module.exports = splitWhen; \ No newline at end of file diff --git a/node_modules/ramda/src/startsWith.js b/node_modules/ramda/src/startsWith.js new file mode 100644 index 0000000..1c55396 --- /dev/null +++ b/node_modules/ramda/src/startsWith.js @@ -0,0 +1,42 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var equals = +/*#__PURE__*/ +require("./equals"); + +var take = +/*#__PURE__*/ +require("./take"); +/** + * Checks if a list starts with the provided sublist. + * + * Similarly, checks if a string starts with the provided substring. + * + * @func + * @memberOf R + * @since v0.24.0 + * @category List + * @sig [a] -> [a] -> Boolean + * @sig String -> String -> Boolean + * @param {*} prefix + * @param {*} list + * @return {Boolean} + * @see R.endsWith + * @example + * + * R.startsWith('a', 'abc') //=> true + * R.startsWith('b', 'abc') //=> false + * R.startsWith(['a'], ['a', 'b', 'c']) //=> true + * R.startsWith(['b'], ['a', 'b', 'c']) //=> false + */ + + +var startsWith = +/*#__PURE__*/ +_curry2(function (prefix, list) { + return equals(take(prefix.length, list), prefix); +}); + +module.exports = startsWith; \ No newline at end of file diff --git a/node_modules/ramda/src/subtract.js b/node_modules/ramda/src/subtract.js new file mode 100644 index 0000000..32f48ed --- /dev/null +++ b/node_modules/ramda/src/subtract.js @@ -0,0 +1,35 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Subtracts its second argument from its first argument. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig Number -> Number -> Number + * @param {Number} a The first value. + * @param {Number} b The second value. + * @return {Number} The result of `a - b`. + * @see R.add + * @example + * + * R.subtract(10, 8); //=> 2 + * + * const minus5 = R.subtract(R.__, 5); + * minus5(17); //=> 12 + * + * const complementaryAngle = R.subtract(90); + * complementaryAngle(30); //=> 60 + * complementaryAngle(72); //=> 18 + */ + + +var subtract = +/*#__PURE__*/ +_curry2(function subtract(a, b) { + return Number(a) - Number(b); +}); + +module.exports = subtract; \ No newline at end of file diff --git a/node_modules/ramda/src/sum.js b/node_modules/ramda/src/sum.js new file mode 100644 index 0000000..c2c3209 --- /dev/null +++ b/node_modules/ramda/src/sum.js @@ -0,0 +1,28 @@ +var add = +/*#__PURE__*/ +require("./add"); + +var reduce = +/*#__PURE__*/ +require("./reduce"); +/** + * Adds together all the elements of a list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Math + * @sig [Number] -> Number + * @param {Array} list An array of numbers + * @return {Number} The sum of all the numbers in the list. + * @see R.reduce + * @example + * + * R.sum([2,4,6,8,100,1]); //=> 121 + */ + + +var sum = +/*#__PURE__*/ +reduce(add, 0); +module.exports = sum; \ No newline at end of file diff --git a/node_modules/ramda/src/symmetricDifference.js b/node_modules/ramda/src/symmetricDifference.js new file mode 100644 index 0000000..a269374 --- /dev/null +++ b/node_modules/ramda/src/symmetricDifference.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var concat = +/*#__PURE__*/ +require("./concat"); + +var difference = +/*#__PURE__*/ +require("./difference"); +/** + * Finds the set (i.e. no duplicates) of all elements contained in the first or + * second list, but not both. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` or `list2`, but not both. + * @see R.symmetricDifferenceWith, R.difference, R.differenceWith + * @example + * + * R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5] + * R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2] + */ + + +var symmetricDifference = +/*#__PURE__*/ +_curry2(function symmetricDifference(list1, list2) { + return concat(difference(list1, list2), difference(list2, list1)); +}); + +module.exports = symmetricDifference; \ No newline at end of file diff --git a/node_modules/ramda/src/symmetricDifferenceWith.js b/node_modules/ramda/src/symmetricDifferenceWith.js new file mode 100644 index 0000000..653a46a --- /dev/null +++ b/node_modules/ramda/src/symmetricDifferenceWith.js @@ -0,0 +1,42 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var concat = +/*#__PURE__*/ +require("./concat"); + +var differenceWith = +/*#__PURE__*/ +require("./differenceWith"); +/** + * Finds the set (i.e. no duplicates) of all elements contained in the first or + * second list, but not both. Duplication is determined according to the value + * returned by applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The elements in `list1` or `list2`, but not both. + * @see R.symmetricDifference, R.difference, R.differenceWith + * @example + * + * const eqA = R.eqBy(R.prop('a')); + * const l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}]; + * const l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}]; + * R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + */ + + +var symmetricDifferenceWith = +/*#__PURE__*/ +_curry3(function symmetricDifferenceWith(pred, list1, list2) { + return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1)); +}); + +module.exports = symmetricDifferenceWith; \ No newline at end of file diff --git a/node_modules/ramda/src/tail.js b/node_modules/ramda/src/tail.js new file mode 100644 index 0000000..2831c63 --- /dev/null +++ b/node_modules/ramda/src/tail.js @@ -0,0 +1,49 @@ +var _checkForMethod = +/*#__PURE__*/ +require("./internal/_checkForMethod"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns all but the first element of the given list or string (or object + * with a `tail` method). + * + * Dispatches to the `slice` method of the first argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @sig String -> String + * @param {*} list + * @return {*} + * @see R.head, R.init, R.last + * @example + * + * R.tail([1, 2, 3]); //=> [2, 3] + * R.tail([1, 2]); //=> [2] + * R.tail([1]); //=> [] + * R.tail([]); //=> [] + * + * R.tail('abc'); //=> 'bc' + * R.tail('ab'); //=> 'b' + * R.tail('a'); //=> '' + * R.tail(''); //=> '' + */ + + +var tail = +/*#__PURE__*/ +_curry1( +/*#__PURE__*/ +_checkForMethod('tail', +/*#__PURE__*/ +slice(1, Infinity))); + +module.exports = tail; \ No newline at end of file diff --git a/node_modules/ramda/src/take.js b/node_modules/ramda/src/take.js new file mode 100644 index 0000000..d9363f1 --- /dev/null +++ b/node_modules/ramda/src/take.js @@ -0,0 +1,69 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xtake = +/*#__PURE__*/ +require("./internal/_xtake"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns the first `n` elements of the given list, string, or + * transducer/transformer (or object with a `take` method). + * + * Dispatches to the `take` method of the second argument, if present. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n + * @param {*} list + * @return {*} + * @see R.drop + * @example + * + * R.take(1, ['foo', 'bar', 'baz']); //=> ['foo'] + * R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + * R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.take(3, 'ramda'); //=> 'ram' + * + * const personnel = [ + * 'Dave Brubeck', + * 'Paul Desmond', + * 'Eugene Wright', + * 'Joe Morello', + * 'Gerry Mulligan', + * 'Bob Bates', + * 'Joe Dodge', + * 'Ron Crotty' + * ]; + * + * const takeFive = R.take(5); + * takeFive(personnel); + * //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan'] + * @symb R.take(-1, [a, b]) = [a, b] + * @symb R.take(0, [a, b]) = [] + * @symb R.take(1, [a, b]) = [a] + * @symb R.take(2, [a, b]) = [a, b] + */ + + +var take = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['take'], _xtake, function take(n, xs) { + return slice(0, n < 0 ? Infinity : n, xs); +})); + +module.exports = take; \ No newline at end of file diff --git a/node_modules/ramda/src/takeLast.js b/node_modules/ramda/src/takeLast.js new file mode 100644 index 0000000..a254cde --- /dev/null +++ b/node_modules/ramda/src/takeLast.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var drop = +/*#__PURE__*/ +require("./drop"); +/** + * Returns a new list containing the last `n` elements of the given list. + * If `n > list.length`, returns a list of `list.length` elements. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig Number -> [a] -> [a] + * @sig Number -> String -> String + * @param {Number} n The number of elements to return. + * @param {Array} xs The collection to consider. + * @return {Array} + * @see R.dropLast + * @example + * + * R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] + * R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + * R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + * R.takeLast(3, 'ramda'); //=> 'mda' + */ + + +var takeLast = +/*#__PURE__*/ +_curry2(function takeLast(n, xs) { + return drop(n >= 0 ? xs.length - n : 0, xs); +}); + +module.exports = takeLast; \ No newline at end of file diff --git a/node_modules/ramda/src/takeLastWhile.js b/node_modules/ramda/src/takeLastWhile.js new file mode 100644 index 0000000..98b82b6 --- /dev/null +++ b/node_modules/ramda/src/takeLastWhile.js @@ -0,0 +1,47 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns a new list containing the last `n` elements of a given list, passing + * each value to the supplied predicate function, and terminating when the + * predicate function returns `false`. Excludes the element that caused the + * predicate function to fail. The predicate function is passed one argument: + * *(value)*. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.dropLastWhile, R.addIndex + * @example + * + * const isNotOne = x => x !== 1; + * + * R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4] + * + * R.takeLastWhile(x => x !== 'R' , 'Ramda'); //=> 'amda' + */ + + +var takeLastWhile = +/*#__PURE__*/ +_curry2(function takeLastWhile(fn, xs) { + var idx = xs.length - 1; + + while (idx >= 0 && fn(xs[idx])) { + idx -= 1; + } + + return slice(idx + 1, Infinity, xs); +}); + +module.exports = takeLastWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/takeWhile.js b/node_modules/ramda/src/takeWhile.js new file mode 100644 index 0000000..02c47f4 --- /dev/null +++ b/node_modules/ramda/src/takeWhile.js @@ -0,0 +1,62 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xtakeWhile = +/*#__PURE__*/ +require("./internal/_xtakeWhile"); + +var slice = +/*#__PURE__*/ +require("./slice"); +/** + * Returns a new list containing the first `n` elements of a given list, + * passing each value to the supplied predicate function, and terminating when + * the predicate function returns `false`. Excludes the element that caused the + * predicate function to fail. The predicate function is passed one argument: + * *(value)*. + * + * Dispatches to the `takeWhile` method of the second argument, if present. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig (a -> Boolean) -> [a] -> [a] + * @sig (a -> Boolean) -> String -> String + * @param {Function} fn The function called per iteration. + * @param {Array} xs The collection to iterate over. + * @return {Array} A new array. + * @see R.dropWhile, R.transduce, R.addIndex + * @example + * + * const isNotFour = x => x !== 4; + * + * R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3] + * + * R.takeWhile(x => x !== 'd' , 'Ramda'); //=> 'Ram' + */ + + +var takeWhile = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable(['takeWhile'], _xtakeWhile, function takeWhile(fn, xs) { + var idx = 0; + var len = xs.length; + + while (idx < len && fn(xs[idx])) { + idx += 1; + } + + return slice(0, idx, xs); +})); + +module.exports = takeWhile; \ No newline at end of file diff --git a/node_modules/ramda/src/tap.js b/node_modules/ramda/src/tap.js new file mode 100644 index 0000000..cf4e593 --- /dev/null +++ b/node_modules/ramda/src/tap.js @@ -0,0 +1,43 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _dispatchable = +/*#__PURE__*/ +require("./internal/_dispatchable"); + +var _xtap = +/*#__PURE__*/ +require("./internal/_xtap"); +/** + * Runs the given function with the supplied object, then returns the object. + * + * Acts as a transducer if a transformer is given as second parameter. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig (a -> *) -> a -> a + * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away. + * @param {*} x + * @return {*} `x`. + * @example + * + * const sayX = x => console.log('x is ' + x); + * R.tap(sayX, 100); //=> 100 + * // logs 'x is 100' + * @symb R.tap(f, a) = a + */ + + +var tap = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +_dispatchable([], _xtap, function tap(fn, x) { + fn(x); + return x; +})); + +module.exports = tap; \ No newline at end of file diff --git a/node_modules/ramda/src/test.js b/node_modules/ramda/src/test.js new file mode 100644 index 0000000..0014957 --- /dev/null +++ b/node_modules/ramda/src/test.js @@ -0,0 +1,45 @@ +var _cloneRegExp = +/*#__PURE__*/ +require("./internal/_cloneRegExp"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _isRegExp = +/*#__PURE__*/ +require("./internal/_isRegExp"); + +var toString = +/*#__PURE__*/ +require("./toString"); +/** + * Determines whether a given string matches a given regular expression. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category String + * @sig RegExp -> String -> Boolean + * @param {RegExp} pattern + * @param {String} str + * @return {Boolean} + * @see R.match + * @example + * + * R.test(/^x/, 'xyz'); //=> true + * R.test(/^y/, 'xyz'); //=> false + */ + + +var test = +/*#__PURE__*/ +_curry2(function test(pattern, str) { + if (!_isRegExp(pattern)) { + throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received ' + toString(pattern)); + } + + return _cloneRegExp(pattern).test(str); +}); + +module.exports = test; \ No newline at end of file diff --git a/node_modules/ramda/src/thunkify.js b/node_modules/ramda/src/thunkify.js new file mode 100644 index 0000000..e4bbc22 --- /dev/null +++ b/node_modules/ramda/src/thunkify.js @@ -0,0 +1,39 @@ +var curryN = +/*#__PURE__*/ +require("./curryN"); + +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Creates a thunk out of a function. A thunk delays a calculation until + * its result is needed, providing lazy evaluation of arguments. + * + * @func + * @memberOf R + * @since v0.26.0 + * @category Function + * @sig ((a, b, ..., j) -> k) -> (a, b, ..., j) -> (() -> k) + * @param {Function} fn A function to wrap in a thunk + * @return {Function} Expects arguments for `fn` and returns a new function + * that, when called, applies those arguments to `fn`. + * @see R.partial, R.partialRight + * @example + * + * R.thunkify(R.identity)(42)(); //=> 42 + * R.thunkify((a, b) => a + b)(25, 17)(); //=> 42 + */ + + +var thunkify = +/*#__PURE__*/ +_curry1(function thunkify(fn) { + return curryN(fn.length, function createThunk() { + var fnArgs = arguments; + return function invokeThunk() { + return fn.apply(this, fnArgs); + }; + }); +}); + +module.exports = thunkify; \ No newline at end of file diff --git a/node_modules/ramda/src/times.js b/node_modules/ramda/src/times.js new file mode 100644 index 0000000..8e19c72 --- /dev/null +++ b/node_modules/ramda/src/times.js @@ -0,0 +1,50 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Calls an input function `n` times, returning an array containing the results + * of those function calls. + * + * `fn` is passed one argument: The current value of `n`, which begins at `0` + * and is gradually incremented to `n - 1`. + * + * @func + * @memberOf R + * @since v0.2.3 + * @category List + * @sig (Number -> a) -> Number -> [a] + * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`. + * @param {Number} n A value between `0` and `n - 1`. Increments after each function call. + * @return {Array} An array containing the return values of all calls to `fn`. + * @see R.repeat + * @example + * + * R.times(R.identity, 5); //=> [0, 1, 2, 3, 4] + * @symb R.times(f, 0) = [] + * @symb R.times(f, 1) = [f(0)] + * @symb R.times(f, 2) = [f(0), f(1)] + */ + + +var times = +/*#__PURE__*/ +_curry2(function times(fn, n) { + var len = Number(n); + var idx = 0; + var list; + + if (len < 0 || isNaN(len)) { + throw new RangeError('n must be a non-negative number'); + } + + list = new Array(len); + + while (idx < len) { + list[idx] = fn(idx); + idx += 1; + } + + return list; +}); + +module.exports = times; \ No newline at end of file diff --git a/node_modules/ramda/src/toLower.js b/node_modules/ramda/src/toLower.js new file mode 100644 index 0000000..b85c838 --- /dev/null +++ b/node_modules/ramda/src/toLower.js @@ -0,0 +1,24 @@ +var invoker = +/*#__PURE__*/ +require("./invoker"); +/** + * The lower case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to lower case. + * @return {String} The lower case version of `str`. + * @see R.toUpper + * @example + * + * R.toLower('XYZ'); //=> 'xyz' + */ + + +var toLower = +/*#__PURE__*/ +invoker(0, 'toLowerCase'); +module.exports = toLower; \ No newline at end of file diff --git a/node_modules/ramda/src/toPairs.js b/node_modules/ramda/src/toPairs.js new file mode 100644 index 0000000..ef9960b --- /dev/null +++ b/node_modules/ramda/src/toPairs.js @@ -0,0 +1,42 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); +/** + * Converts an object into an array of key, value arrays. Only the object's + * own properties are used. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own properties. + * @see R.fromPairs + * @example + * + * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] + */ + + +var toPairs = +/*#__PURE__*/ +_curry1(function toPairs(obj) { + var pairs = []; + + for (var prop in obj) { + if (_has(prop, obj)) { + pairs[pairs.length] = [prop, obj[prop]]; + } + } + + return pairs; +}); + +module.exports = toPairs; \ No newline at end of file diff --git a/node_modules/ramda/src/toPairsIn.js b/node_modules/ramda/src/toPairsIn.js new file mode 100644 index 0000000..a7c008e --- /dev/null +++ b/node_modules/ramda/src/toPairsIn.js @@ -0,0 +1,39 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Converts an object into an array of key, value arrays. The object's own + * properties and prototype properties are used. Note that the order of the + * output array is not guaranteed to be consistent across different JS + * platforms. + * + * @func + * @memberOf R + * @since v0.4.0 + * @category Object + * @sig {String: *} -> [[String,*]] + * @param {Object} obj The object to extract from + * @return {Array} An array of key, value arrays from the object's own + * and prototype properties. + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.toPairsIn(f); //=> [['x','X'], ['y','Y']] + */ + + +var toPairsIn = +/*#__PURE__*/ +_curry1(function toPairsIn(obj) { + var pairs = []; + + for (var prop in obj) { + pairs[pairs.length] = [prop, obj[prop]]; + } + + return pairs; +}); + +module.exports = toPairsIn; \ No newline at end of file diff --git a/node_modules/ramda/src/toString.js b/node_modules/ramda/src/toString.js new file mode 100644 index 0000000..638e9eb --- /dev/null +++ b/node_modules/ramda/src/toString.js @@ -0,0 +1,52 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var _toString = +/*#__PURE__*/ +require("./internal/_toString"); +/** + * Returns the string representation of the given value. `eval`'ing the output + * should result in a value equivalent to the input value. Many of the built-in + * `toString` methods do not satisfy this requirement. + * + * If the given value is an `[object Object]` with a `toString` method other + * than `Object.prototype.toString`, this method is invoked with no arguments + * to produce the return value. This means user-defined constructor functions + * can provide a suitable `toString` method. For example: + * + * function Point(x, y) { + * this.x = x; + * this.y = y; + * } + * + * Point.prototype.toString = function() { + * return 'new Point(' + this.x + ', ' + this.y + ')'; + * }; + * + * R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + * + * @func + * @memberOf R + * @since v0.14.0 + * @category String + * @sig * -> String + * @param {*} val + * @return {String} + * @example + * + * R.toString(42); //=> '42' + * R.toString('abc'); //=> '"abc"' + * R.toString([1, 2, 3]); //=> '[1, 2, 3]' + * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' + * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' + */ + + +var toString = +/*#__PURE__*/ +_curry1(function toString(val) { + return _toString(val, []); +}); + +module.exports = toString; \ No newline at end of file diff --git a/node_modules/ramda/src/toUpper.js b/node_modules/ramda/src/toUpper.js new file mode 100644 index 0000000..3d955ba --- /dev/null +++ b/node_modules/ramda/src/toUpper.js @@ -0,0 +1,24 @@ +var invoker = +/*#__PURE__*/ +require("./invoker"); +/** + * The upper case version of a string. + * + * @func + * @memberOf R + * @since v0.9.0 + * @category String + * @sig String -> String + * @param {String} str The string to upper case. + * @return {String} The upper case version of `str`. + * @see R.toLower + * @example + * + * R.toUpper('abc'); //=> 'ABC' + */ + + +var toUpper = +/*#__PURE__*/ +invoker(0, 'toUpperCase'); +module.exports = toUpper; \ No newline at end of file diff --git a/node_modules/ramda/src/transduce.js b/node_modules/ramda/src/transduce.js new file mode 100644 index 0000000..4d9444b --- /dev/null +++ b/node_modules/ramda/src/transduce.js @@ -0,0 +1,66 @@ +var _reduce = +/*#__PURE__*/ +require("./internal/_reduce"); + +var _xwrap = +/*#__PURE__*/ +require("./internal/_xwrap"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Initializes a transducer using supplied iterator function. Returns a single + * item by iterating through the list, successively calling the transformed + * iterator function and passing it an accumulator value and the current value + * from the array, and then passing the result to the next call. + * + * The iterator function receives two values: *(acc, value)*. It will be + * wrapped as a transformer to initialize the transducer. A transformer can be + * passed directly in place of an iterator function. In both cases, iteration + * may be stopped early with the [`R.reduced`](#reduced) function. + * + * A transducer is a function that accepts a transformer and returns a + * transformer and can be composed directly. + * + * A transformer is an an object that provides a 2-arity reducing iterator + * function, step, 0-arity initial value function, init, and 1-arity result + * extraction function, result. The step function is used as the iterator + * function in reduce. The result function is used to convert the final + * accumulator into the return type and in most cases is + * [`R.identity`](#identity). The init function can be used to provide an + * initial accumulator, but is ignored by transduce. + * + * The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer. + * + * @func + * @memberOf R + * @since v0.12.0 + * @category List + * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a + * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. + * @param {Function} fn The iterator function. Receives two values, the accumulator and the + * current element from the array. Wrapped as transformer, if necessary, and used to + * initialize the transducer + * @param {*} acc The initial accumulator value. + * @param {Array} list The list to iterate over. + * @return {*} The final, accumulated value. + * @see R.reduce, R.reduced, R.into + * @example + * + * const numbers = [1, 2, 3, 4]; + * const transducer = R.compose(R.map(R.add(1)), R.take(2)); + * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] + * + * const isOdd = (x) => x % 2 === 1; + * const firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); + * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] + */ + + +var transduce = +/*#__PURE__*/ +curryN(4, function transduce(xf, fn, acc, list) { + return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); +}); +module.exports = transduce; \ No newline at end of file diff --git a/node_modules/ramda/src/transpose.js b/node_modules/ramda/src/transpose.js new file mode 100644 index 0000000..ae32f3c --- /dev/null +++ b/node_modules/ramda/src/transpose.js @@ -0,0 +1,55 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Transposes the rows and columns of a 2D list. + * When passed a list of `n` lists of length `x`, + * returns a list of `x` lists of length `n`. + * + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig [[a]] -> [[a]] + * @param {Array} list A 2D list + * @return {Array} A 2D list + * @example + * + * R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']] + * R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']] + * + * // If some of the rows are shorter than the following rows, their elements are skipped: + * R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]] + * @symb R.transpose([[a], [b], [c]]) = [a, b, c] + * @symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]] + * @symb R.transpose([[a, b], [c]]) = [[a, c], [b]] + */ + + +var transpose = +/*#__PURE__*/ +_curry1(function transpose(outerlist) { + var i = 0; + var result = []; + + while (i < outerlist.length) { + var innerlist = outerlist[i]; + var j = 0; + + while (j < innerlist.length) { + if (typeof result[j] === 'undefined') { + result[j] = []; + } + + result[j].push(innerlist[j]); + j += 1; + } + + i += 1; + } + + return result; +}); + +module.exports = transpose; \ No newline at end of file diff --git a/node_modules/ramda/src/traverse.js b/node_modules/ramda/src/traverse.js new file mode 100644 index 0000000..e33b789 --- /dev/null +++ b/node_modules/ramda/src/traverse.js @@ -0,0 +1,46 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var map = +/*#__PURE__*/ +require("./map"); + +var sequence = +/*#__PURE__*/ +require("./sequence"); +/** + * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning + * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable), + * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative + * into an Applicative of Traversable. + * + * Dispatches to the `traverse` method of the third argument, if present. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b) + * @param {Function} of + * @param {Function} f + * @param {*} traversable + * @return {*} + * @see R.sequence + * @example + * + * // Returns `Maybe.Nothing` if the given divisor is `0` + * const safeDiv = n => d => d === 0 ? Maybe.Nothing() : Maybe.Just(n / d) + * + * R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Maybe.Just([5, 2.5, 2]) + * R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Maybe.Nothing + */ + + +var traverse = +/*#__PURE__*/ +_curry3(function traverse(of, f, traversable) { + return typeof traversable['fantasy-land/traverse'] === 'function' ? traversable['fantasy-land/traverse'](f, of) : sequence(of, map(f, traversable)); +}); + +module.exports = traverse; \ No newline at end of file diff --git a/node_modules/ramda/src/trim.js b/node_modules/ramda/src/trim.js new file mode 100644 index 0000000..9805811 --- /dev/null +++ b/node_modules/ramda/src/trim.js @@ -0,0 +1,39 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + '\u2029\uFEFF'; +var zeroWidth = '\u200b'; +var hasProtoTrim = typeof String.prototype.trim === 'function'; +/** + * Removes (strips) whitespace from both ends of the string. + * + * @func + * @memberOf R + * @since v0.6.0 + * @category String + * @sig String -> String + * @param {String} str The string to trim. + * @return {String} Trimmed version of `str`. + * @example + * + * R.trim(' xyz '); //=> 'xyz' + * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] + */ + +var trim = !hasProtoTrim || +/*#__PURE__*/ +ws.trim() || ! +/*#__PURE__*/ +zeroWidth.trim() ? +/*#__PURE__*/ +_curry1(function trim(str) { + var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); + var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); + return str.replace(beginRx, '').replace(endRx, ''); +}) : +/*#__PURE__*/ +_curry1(function trim(str) { + return str.trim(); +}); +module.exports = trim; \ No newline at end of file diff --git a/node_modules/ramda/src/tryCatch.js b/node_modules/ramda/src/tryCatch.js new file mode 100644 index 0000000..0583054 --- /dev/null +++ b/node_modules/ramda/src/tryCatch.js @@ -0,0 +1,49 @@ +var _arity = +/*#__PURE__*/ +require("./internal/_arity"); + +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned + * function evaluates the `tryer`; if it does not throw, it simply returns the + * result. If the `tryer` *does* throw, the returned function evaluates the + * `catcher` function and returns its result. Note that for effective + * composition with this function, both the `tryer` and `catcher` functions + * must return the same type of results. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Function + * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a) + * @param {Function} tryer The function that may throw. + * @param {Function} catcher The function that will be evaluated if `tryer` throws. + * @return {Function} A new function that will catch exceptions and send then to the catcher. + * @example + * + * R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true + * R.tryCatch(() => { throw 'foo'}, R.always('catched'))('bar') // => 'catched' + * R.tryCatch(R.times(R.identity), R.always([]))('s') // => [] + * R.tryCatch(() => { throw 'this is not a valid value'}, (err, value)=>({error : err, value }))('bar') // => {'error': 'this is not a valid value', 'value': 'bar'} + */ + + +var tryCatch = +/*#__PURE__*/ +_curry2(function _tryCatch(tryer, catcher) { + return _arity(tryer.length, function () { + try { + return tryer.apply(this, arguments); + } catch (e) { + return catcher.apply(this, _concat([e], arguments)); + } + }); +}); + +module.exports = tryCatch; \ No newline at end of file diff --git a/node_modules/ramda/src/type.js b/node_modules/ramda/src/type.js new file mode 100644 index 0000000..b953ba1 --- /dev/null +++ b/node_modules/ramda/src/type.js @@ -0,0 +1,37 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Gives a single-word string description of the (native) type of a value, + * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not + * attempt to distinguish user Object types any further, reporting them all as + * 'Object'. + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Type + * @sig (* -> {*}) -> String + * @param {*} val The value to test + * @return {String} + * @example + * + * R.type({}); //=> "Object" + * R.type(1); //=> "Number" + * R.type(false); //=> "Boolean" + * R.type('s'); //=> "String" + * R.type(null); //=> "Null" + * R.type([]); //=> "Array" + * R.type(/[A-z]/); //=> "RegExp" + * R.type(() => {}); //=> "Function" + * R.type(undefined); //=> "Undefined" + */ + + +var type = +/*#__PURE__*/ +_curry1(function type(val) { + return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1); +}); + +module.exports = type; \ No newline at end of file diff --git a/node_modules/ramda/src/unapply.js b/node_modules/ramda/src/unapply.js new file mode 100644 index 0000000..3fd173b --- /dev/null +++ b/node_modules/ramda/src/unapply.js @@ -0,0 +1,38 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Takes a function `fn`, which takes a single array argument, and returns a + * function which: + * + * - takes any number of positional arguments; + * - passes these arguments to `fn` as an array; and + * - returns the result. + * + * In other words, `R.unapply` derives a variadic function from a function which + * takes an array. `R.unapply` is the inverse of [`R.apply`](#apply). + * + * @func + * @memberOf R + * @since v0.8.0 + * @category Function + * @sig ([*...] -> a) -> (*... -> a) + * @param {Function} fn + * @return {Function} + * @see R.apply + * @example + * + * R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]' + * @symb R.unapply(f)(a, b) = f([a, b]) + */ + + +var unapply = +/*#__PURE__*/ +_curry1(function unapply(fn) { + return function () { + return fn(Array.prototype.slice.call(arguments, 0)); + }; +}); + +module.exports = unapply; \ No newline at end of file diff --git a/node_modules/ramda/src/unary.js b/node_modules/ramda/src/unary.js new file mode 100644 index 0000000..1ce6d42 --- /dev/null +++ b/node_modules/ramda/src/unary.js @@ -0,0 +1,44 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var nAry = +/*#__PURE__*/ +require("./nAry"); +/** + * Wraps a function of any arity (including nullary) in a function that accepts + * exactly 1 parameter. Any extraneous parameters will not be passed to the + * supplied function. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Function + * @sig (* -> b) -> (a -> b) + * @param {Function} fn The function to wrap. + * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + * arity 1. + * @see R.binary, R.nAry + * @example + * + * const takesTwoArgs = function(a, b) { + * return [a, b]; + * }; + * takesTwoArgs.length; //=> 2 + * takesTwoArgs(1, 2); //=> [1, 2] + * + * const takesOneArg = R.unary(takesTwoArgs); + * takesOneArg.length; //=> 1 + * // Only 1 argument is passed to the wrapped function + * takesOneArg(1, 2); //=> [1, undefined] + * @symb R.unary(f)(a, b, c) = f(a) + */ + + +var unary = +/*#__PURE__*/ +_curry1(function unary(fn) { + return nAry(1, fn); +}); + +module.exports = unary; \ No newline at end of file diff --git a/node_modules/ramda/src/uncurryN.js b/node_modules/ramda/src/uncurryN.js new file mode 100644 index 0000000..beb13dd --- /dev/null +++ b/node_modules/ramda/src/uncurryN.js @@ -0,0 +1,49 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Returns a function of arity `n` from a (manually) curried function. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Function + * @sig Number -> (a -> b) -> (a -> c) + * @param {Number} length The arity for the returned function. + * @param {Function} fn The function to uncurry. + * @return {Function} A new function. + * @see R.curry + * @example + * + * const addFour = a => b => c => d => a + b + c + d; + * + * const uncurriedAddFour = R.uncurryN(4, addFour); + * uncurriedAddFour(1, 2, 3, 4); //=> 10 + */ + + +var uncurryN = +/*#__PURE__*/ +_curry2(function uncurryN(depth, fn) { + return curryN(depth, function () { + var currentDepth = 1; + var value = fn; + var idx = 0; + var endIdx; + + while (currentDepth <= depth && typeof value === 'function') { + endIdx = currentDepth === depth ? arguments.length : idx + value.length; + value = value.apply(this, Array.prototype.slice.call(arguments, idx, endIdx)); + currentDepth += 1; + idx = endIdx; + } + + return value; + }); +}); + +module.exports = uncurryN; \ No newline at end of file diff --git a/node_modules/ramda/src/unfold.js b/node_modules/ramda/src/unfold.js new file mode 100644 index 0000000..4695c19 --- /dev/null +++ b/node_modules/ramda/src/unfold.js @@ -0,0 +1,45 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Builds a list from a seed value. Accepts an iterator function, which returns + * either false to stop iteration or an array of length 2 containing the value + * to add to the resulting list and the seed to be used in the next call to the + * iterator function. + * + * The iterator function receives one argument: *(seed)*. + * + * @func + * @memberOf R + * @since v0.10.0 + * @category List + * @sig (a -> [b]) -> * -> [b] + * @param {Function} fn The iterator function. receives one argument, `seed`, and returns + * either false to quit iteration or an array of length two to proceed. The element + * at index 0 of this array will be added to the resulting array, and the element + * at index 1 will be passed to the next call to `fn`. + * @param {*} seed The seed value. + * @return {Array} The final list. + * @example + * + * const f = n => n > 50 ? false : [-n, n + 10]; + * R.unfold(f, 10); //=> [-10, -20, -30, -40, -50] + * @symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...] + */ + + +var unfold = +/*#__PURE__*/ +_curry2(function unfold(fn, seed) { + var pair = fn(seed); + var result = []; + + while (pair && pair.length) { + result[result.length] = pair[0]; + pair = fn(pair[1]); + } + + return result; +}); + +module.exports = unfold; \ No newline at end of file diff --git a/node_modules/ramda/src/union.js b/node_modules/ramda/src/union.js new file mode 100644 index 0000000..d4b28c7 --- /dev/null +++ b/node_modules/ramda/src/union.js @@ -0,0 +1,41 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var compose = +/*#__PURE__*/ +require("./compose"); + +var uniq = +/*#__PURE__*/ +require("./uniq"); +/** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig [*] -> [*] -> [*] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @example + * + * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] + */ + + +var union = +/*#__PURE__*/ +_curry2( +/*#__PURE__*/ +compose(uniq, _concat)); + +module.exports = union; \ No newline at end of file diff --git a/node_modules/ramda/src/unionWith.js b/node_modules/ramda/src/unionWith.js new file mode 100644 index 0000000..7bb4941 --- /dev/null +++ b/node_modules/ramda/src/unionWith.js @@ -0,0 +1,42 @@ +var _concat = +/*#__PURE__*/ +require("./internal/_concat"); + +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var uniqWith = +/*#__PURE__*/ +require("./uniqWith"); +/** + * Combines two lists into a set (i.e. no duplicates) composed of the elements + * of each list. Duplication is determined according to the value returned by + * applying the supplied predicate to two list elements. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Relation + * @sig ((a, a) -> Boolean) -> [*] -> [*] -> [*] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list1 The first list. + * @param {Array} list2 The second list. + * @return {Array} The first and second lists concatenated, with + * duplicates removed. + * @see R.union + * @example + * + * const l1 = [{a: 1}, {a: 2}]; + * const l2 = [{a: 1}, {a: 4}]; + * R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}] + */ + + +var unionWith = +/*#__PURE__*/ +_curry3(function unionWith(pred, list1, list2) { + return uniqWith(pred, _concat(list1, list2)); +}); + +module.exports = unionWith; \ No newline at end of file diff --git a/node_modules/ramda/src/uniq.js b/node_modules/ramda/src/uniq.js new file mode 100644 index 0000000..9436184 --- /dev/null +++ b/node_modules/ramda/src/uniq.js @@ -0,0 +1,30 @@ +var identity = +/*#__PURE__*/ +require("./identity"); + +var uniqBy = +/*#__PURE__*/ +require("./uniqBy"); +/** + * Returns a new list containing only one copy of each element in the original + * list. [`R.equals`](#equals) is used to determine equality. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [a] + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniq([1, 1, 2, 1]); //=> [1, 2] + * R.uniq([1, '1']); //=> [1, '1'] + * R.uniq([[42], [42]]); //=> [[42]] + */ + + +var uniq = +/*#__PURE__*/ +uniqBy(identity); +module.exports = uniq; \ No newline at end of file diff --git a/node_modules/ramda/src/uniqBy.js b/node_modules/ramda/src/uniqBy.js new file mode 100644 index 0000000..6d7e00c --- /dev/null +++ b/node_modules/ramda/src/uniqBy.js @@ -0,0 +1,50 @@ +var _Set = +/*#__PURE__*/ +require("./internal/_Set"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied function to + * each list element. Prefers the first item if the supplied function produces + * the same value on two items. [`R.equals`](#equals) is used for comparison. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category List + * @sig (a -> b) -> [a] -> [a] + * @param {Function} fn A function used to produce a value to use during comparisons. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] + */ + + +var uniqBy = +/*#__PURE__*/ +_curry2(function uniqBy(fn, list) { + var set = new _Set(); + var result = []; + var idx = 0; + var appliedItem, item; + + while (idx < list.length) { + item = list[idx]; + appliedItem = fn(item); + + if (set.add(appliedItem)) { + result.push(item); + } + + idx += 1; + } + + return result; +}); + +module.exports = uniqBy; \ No newline at end of file diff --git a/node_modules/ramda/src/uniqWith.js b/node_modules/ramda/src/uniqWith.js new file mode 100644 index 0000000..1d8ed74 --- /dev/null +++ b/node_modules/ramda/src/uniqWith.js @@ -0,0 +1,53 @@ +var _includesWith = +/*#__PURE__*/ +require("./internal/_includesWith"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Returns a new list containing only one copy of each element in the original + * list, based upon the value returned by applying the supplied predicate to + * two list elements. Prefers the first item if two items compare equal based + * on the predicate. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category List + * @sig ((a, a) -> Boolean) -> [a] -> [a] + * @param {Function} pred A predicate used to test whether two items are equal. + * @param {Array} list The array to consider. + * @return {Array} The list of unique items. + * @example + * + * const strEq = R.eqBy(String); + * R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2] + * R.uniqWith(strEq)([{}, {}]); //=> [{}] + * R.uniqWith(strEq)([1, '1', 1]); //=> [1] + * R.uniqWith(strEq)(['1', 1, 1]); //=> ['1'] + */ + + +var uniqWith = +/*#__PURE__*/ +_curry2(function uniqWith(pred, list) { + var idx = 0; + var len = list.length; + var result = []; + var item; + + while (idx < len) { + item = list[idx]; + + if (!_includesWith(pred, item, result)) { + result[result.length] = item; + } + + idx += 1; + } + + return result; +}); + +module.exports = uniqWith; \ No newline at end of file diff --git a/node_modules/ramda/src/unless.js b/node_modules/ramda/src/unless.js new file mode 100644 index 0000000..79cd42a --- /dev/null +++ b/node_modules/ramda/src/unless.js @@ -0,0 +1,36 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Tests the final argument by passing it to the given predicate function. If + * the predicate is not satisfied, the function will return the result of + * calling the `whenFalseFn` function with the same argument. If the predicate + * is satisfied, the argument is returned as is. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates + * to a falsy value. + * @param {*} x An object to test with the `pred` function and + * pass to `whenFalseFn` if necessary. + * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`. + * @see R.ifElse, R.when, R.cond + * @example + * + * let safeInc = R.unless(R.isNil, R.inc); + * safeInc(null); //=> null + * safeInc(1); //=> 2 + */ + + +var unless = +/*#__PURE__*/ +_curry3(function unless(pred, whenFalseFn, x) { + return pred(x) ? x : whenFalseFn(x); +}); + +module.exports = unless; \ No newline at end of file diff --git a/node_modules/ramda/src/unnest.js b/node_modules/ramda/src/unnest.js new file mode 100644 index 0000000..2318994 --- /dev/null +++ b/node_modules/ramda/src/unnest.js @@ -0,0 +1,30 @@ +var _identity = +/*#__PURE__*/ +require("./internal/_identity"); + +var chain = +/*#__PURE__*/ +require("./chain"); +/** + * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from + * any [Chain](https://github.com/fantasyland/fantasy-land#chain). + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig Chain c => c (c a) -> c a + * @param {*} list + * @return {*} + * @see R.flatten, R.chain + * @example + * + * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] + * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] + */ + + +var unnest = +/*#__PURE__*/ +chain(_identity); +module.exports = unnest; \ No newline at end of file diff --git a/node_modules/ramda/src/until.js b/node_modules/ramda/src/until.js new file mode 100644 index 0000000..4891401 --- /dev/null +++ b/node_modules/ramda/src/until.js @@ -0,0 +1,37 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Takes a predicate, a transformation function, and an initial value, + * and returns a value of the same type as the initial value. + * It does so by applying the transformation until the predicate is satisfied, + * at which point it returns the satisfactory value. + * + * @func + * @memberOf R + * @since v0.20.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} fn The iterator function + * @param {*} init Initial value + * @return {*} Final value that satisfies predicate + * @example + * + * R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128 + */ + + +var until = +/*#__PURE__*/ +_curry3(function until(pred, fn, init) { + var val = init; + + while (!pred(val)) { + val = fn(val); + } + + return val; +}); + +module.exports = until; \ No newline at end of file diff --git a/node_modules/ramda/src/update.js b/node_modules/ramda/src/update.js new file mode 100644 index 0000000..bf9bb1d --- /dev/null +++ b/node_modules/ramda/src/update.js @@ -0,0 +1,42 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); + +var adjust = +/*#__PURE__*/ +require("./adjust"); + +var always = +/*#__PURE__*/ +require("./always"); +/** + * Returns a new copy of the array with the element at the provided index + * replaced with the given value. + * + * @func + * @memberOf R + * @since v0.14.0 + * @category List + * @sig Number -> a -> [a] -> [a] + * @param {Number} idx The index to update. + * @param {*} x The value to exist at the given index of the returned array. + * @param {Array|Arguments} list The source array-like object to be updated. + * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`. + * @see R.adjust + * @example + * + * R.update(1, '_', ['a', 'b', 'c']); //=> ['a', '_', 'c'] + * R.update(-1, '_', ['a', 'b', 'c']); //=> ['a', 'b', '_'] + * @symb R.update(-1, a, [b, c]) = [b, a] + * @symb R.update(0, a, [b, c]) = [a, c] + * @symb R.update(1, a, [b, c]) = [b, a] + */ + + +var update = +/*#__PURE__*/ +_curry3(function update(idx, x, list) { + return adjust(idx, always(x), list); +}); + +module.exports = update; \ No newline at end of file diff --git a/node_modules/ramda/src/useWith.js b/node_modules/ramda/src/useWith.js new file mode 100644 index 0000000..2b8a120 --- /dev/null +++ b/node_modules/ramda/src/useWith.js @@ -0,0 +1,55 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var curryN = +/*#__PURE__*/ +require("./curryN"); +/** + * Accepts a function `fn` and a list of transformer functions and returns a + * new curried function. When the new function is invoked, it calls the + * function `fn` with parameters consisting of the result of calling each + * supplied handler on successive arguments to the new function. + * + * If more arguments are passed to the returned function than transformer + * functions, those arguments are passed directly to `fn` as additional + * parameters. If you expect additional arguments that don't need to be + * transformed, although you can ignore them, it's best to pass an identity + * function so that the new function reports the correct arity. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Function + * @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z) + * @param {Function} fn The function to wrap. + * @param {Array} transformers A list of transformer functions + * @return {Function} The wrapped function. + * @see R.converge + * @example + * + * R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + * R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + * R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 + * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) + */ + + +var useWith = +/*#__PURE__*/ +_curry2(function useWith(fn, transformers) { + return curryN(transformers.length, function () { + var args = []; + var idx = 0; + + while (idx < transformers.length) { + args.push(transformers[idx].call(this, arguments[idx])); + idx += 1; + } + + return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length))); + }); +}); + +module.exports = useWith; \ No newline at end of file diff --git a/node_modules/ramda/src/values.js b/node_modules/ramda/src/values.js new file mode 100644 index 0000000..e1d6d9c --- /dev/null +++ b/node_modules/ramda/src/values.js @@ -0,0 +1,43 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); + +var keys = +/*#__PURE__*/ +require("./keys"); +/** + * Returns a list of all the enumerable own properties of the supplied object. + * Note that the order of the output array is not guaranteed across different + * JS platforms. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category Object + * @sig {k: v} -> [v] + * @param {Object} obj The object to extract values from + * @return {Array} An array of the values of the object's own properties. + * @see R.valuesIn, R.keys + * @example + * + * R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3] + */ + + +var values = +/*#__PURE__*/ +_curry1(function values(obj) { + var props = keys(obj); + var len = props.length; + var vals = []; + var idx = 0; + + while (idx < len) { + vals[idx] = obj[props[idx]]; + idx += 1; + } + + return vals; +}); + +module.exports = values; \ No newline at end of file diff --git a/node_modules/ramda/src/valuesIn.js b/node_modules/ramda/src/valuesIn.js new file mode 100644 index 0000000..589d9d0 --- /dev/null +++ b/node_modules/ramda/src/valuesIn.js @@ -0,0 +1,40 @@ +var _curry1 = +/*#__PURE__*/ +require("./internal/_curry1"); +/** + * Returns a list of all the properties, including prototype properties, of the + * supplied object. + * Note that the order of the output array is not guaranteed to be consistent + * across different JS platforms. + * + * @func + * @memberOf R + * @since v0.2.0 + * @category Object + * @sig {k: v} -> [v] + * @param {Object} obj The object to extract values from + * @return {Array} An array of the values of the object's own and prototype properties. + * @see R.values, R.keysIn + * @example + * + * const F = function() { this.x = 'X'; }; + * F.prototype.y = 'Y'; + * const f = new F(); + * R.valuesIn(f); //=> ['X', 'Y'] + */ + + +var valuesIn = +/*#__PURE__*/ +_curry1(function valuesIn(obj) { + var prop; + var vs = []; + + for (prop in obj) { + vs[vs.length] = obj[prop]; + } + + return vs; +}); + +module.exports = valuesIn; \ No newline at end of file diff --git a/node_modules/ramda/src/view.js b/node_modules/ramda/src/view.js new file mode 100644 index 0000000..0fddab6 --- /dev/null +++ b/node_modules/ramda/src/view.js @@ -0,0 +1,45 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); // `Const` is a functor that effectively ignores the function given to `map`. + + +var Const = function (x) { + return { + value: x, + 'fantasy-land/map': function () { + return this; + } + }; +}; +/** + * Returns a "view" of the given data structure, determined by the given lens. + * The lens's focus determines which portion of the data structure is visible. + * + * @func + * @memberOf R + * @since v0.16.0 + * @category Object + * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s + * @sig Lens s a -> s -> a + * @param {Lens} lens + * @param {*} x + * @return {*} + * @see R.prop, R.lensIndex, R.lensProp + * @example + * + * const xLens = R.lensProp('x'); + * + * R.view(xLens, {x: 1, y: 2}); //=> 1 + * R.view(xLens, {x: 4, y: 2}); //=> 4 + */ + + +var view = +/*#__PURE__*/ +_curry2(function view(lens, x) { + // Using `Const` effectively ignores the setter function of the `lens`, + // leaving the value returned by the getter function unmodified. + return lens(Const)(x).value; +}); + +module.exports = view; \ No newline at end of file diff --git a/node_modules/ramda/src/when.js b/node_modules/ramda/src/when.js new file mode 100644 index 0000000..982216f --- /dev/null +++ b/node_modules/ramda/src/when.js @@ -0,0 +1,40 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Tests the final argument by passing it to the given predicate function. If + * the predicate is satisfied, the function will return the result of calling + * the `whenTrueFn` function with the same argument. If the predicate is not + * satisfied, the argument is returned as is. + * + * @func + * @memberOf R + * @since v0.18.0 + * @category Logic + * @sig (a -> Boolean) -> (a -> a) -> a -> a + * @param {Function} pred A predicate function + * @param {Function} whenTrueFn A function to invoke when the `condition` + * evaluates to a truthy value. + * @param {*} x An object to test with the `pred` function and + * pass to `whenTrueFn` if necessary. + * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`. + * @see R.ifElse, R.unless, R.cond + * @example + * + * // truncate :: String -> String + * const truncate = R.when( + * R.propSatisfies(R.gt(R.__, 10), 'length'), + * R.pipe(R.take(10), R.append('…'), R.join('')) + * ); + * truncate('12345'); //=> '12345' + * truncate('0123456789ABC'); //=> '0123456789…' + */ + + +var when = +/*#__PURE__*/ +_curry3(function when(pred, whenTrueFn, x) { + return pred(x) ? whenTrueFn(x) : x; +}); + +module.exports = when; \ No newline at end of file diff --git a/node_modules/ramda/src/where.js b/node_modules/ramda/src/where.js new file mode 100644 index 0000000..55bc6b5 --- /dev/null +++ b/node_modules/ramda/src/where.js @@ -0,0 +1,57 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var _has = +/*#__PURE__*/ +require("./internal/_has"); +/** + * Takes a spec object and a test object; returns true if the test satisfies + * the spec. Each of the spec's own properties must be a predicate function. + * Each predicate is applied to the value of the corresponding property of the + * test object. `where` returns true if all the predicates return true, false + * otherwise. + * + * `where` is well suited to declaratively expressing constraints for other + * functions such as [`filter`](#filter) and [`find`](#find). + * + * @func + * @memberOf R + * @since v0.1.1 + * @category Object + * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean + * @param {Object} spec + * @param {Object} testObj + * @return {Boolean} + * @see R.propSatisfies, R.whereEq + * @example + * + * // pred :: Object -> Boolean + * const pred = R.where({ + * a: R.equals('foo'), + * b: R.complement(R.equals('bar')), + * x: R.gt(R.__, 10), + * y: R.lt(R.__, 20) + * }); + * + * pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true + * pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false + * pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false + * pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false + * pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false + */ + + +var where = +/*#__PURE__*/ +_curry2(function where(spec, testObj) { + for (var prop in spec) { + if (_has(prop, spec) && !spec[prop](testObj[prop])) { + return false; + } + } + + return true; +}); + +module.exports = where; \ No newline at end of file diff --git a/node_modules/ramda/src/whereEq.js b/node_modules/ramda/src/whereEq.js new file mode 100644 index 0000000..b37c5e4 --- /dev/null +++ b/node_modules/ramda/src/whereEq.js @@ -0,0 +1,52 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var equals = +/*#__PURE__*/ +require("./equals"); + +var map = +/*#__PURE__*/ +require("./map"); + +var where = +/*#__PURE__*/ +require("./where"); +/** + * Takes a spec object and a test object; returns true if the test satisfies + * the spec, false otherwise. An object satisfies the spec if, for each of the + * spec's own properties, accessing that property of the object gives the same + * value (in [`R.equals`](#equals) terms) as accessing that property of the + * spec. + * + * `whereEq` is a specialization of [`where`](#where). + * + * @func + * @memberOf R + * @since v0.14.0 + * @category Object + * @sig {String: *} -> {String: *} -> Boolean + * @param {Object} spec + * @param {Object} testObj + * @return {Boolean} + * @see R.propEq, R.where + * @example + * + * // pred :: Object -> Boolean + * const pred = R.whereEq({a: 1, b: 2}); + * + * pred({a: 1}); //=> false + * pred({a: 1, b: 2}); //=> true + * pred({a: 1, b: 2, c: 3}); //=> true + * pred({a: 1, b: 1}); //=> false + */ + + +var whereEq = +/*#__PURE__*/ +_curry2(function whereEq(spec, testObj) { + return where(map(equals, spec), testObj); +}); + +module.exports = whereEq; \ No newline at end of file diff --git a/node_modules/ramda/src/without.js b/node_modules/ramda/src/without.js new file mode 100644 index 0000000..fd3102b --- /dev/null +++ b/node_modules/ramda/src/without.js @@ -0,0 +1,43 @@ +var _includes = +/*#__PURE__*/ +require("./internal/_includes"); + +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); + +var flip = +/*#__PURE__*/ +require("./flip"); + +var reject = +/*#__PURE__*/ +require("./reject"); +/** + * Returns a new list without values in the first argument. + * [`R.equals`](#equals) is used to determine equality. + * + * Acts as a transducer if a transformer is given in list position. + * + * @func + * @memberOf R + * @since v0.19.0 + * @category List + * @sig [a] -> [a] -> [a] + * @param {Array} list1 The values to be removed from `list2`. + * @param {Array} list2 The array to remove values from. + * @return {Array} The new array without values in `list1`. + * @see R.transduce, R.difference, R.remove + * @example + * + * R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4] + */ + + +var without = +/*#__PURE__*/ +_curry2(function (xs, list) { + return reject(flip(_includes)(xs), list); +}); + +module.exports = without; \ No newline at end of file diff --git a/node_modules/ramda/src/xor.js b/node_modules/ramda/src/xor.js new file mode 100644 index 0000000..19de485 --- /dev/null +++ b/node_modules/ramda/src/xor.js @@ -0,0 +1,33 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Exclusive disjunction logical operation. + * Returns `true` if one of the arguments is truthy and the other is falsy. + * Otherwise, it returns `false`. + * + * @func + * @memberOf R + * @since v0.27.0 + * @category Logic + * @sig a -> b -> Boolean + * @param {Any} a + * @param {Any} b + * @return {Boolean} true if one of the arguments is truthy and the other is falsy + * @see R.or, R.and + * @example + * + * R.xor(true, true); //=> false + * R.xor(true, false); //=> true + * R.xor(false, true); //=> true + * R.xor(false, false); //=> false + */ + + +var xor = +/*#__PURE__*/ +_curry2(function xor(a, b) { + return Boolean(!a ^ !b); +}); + +module.exports = xor; \ No newline at end of file diff --git a/node_modules/ramda/src/xprod.js b/node_modules/ramda/src/xprod.js new file mode 100644 index 0000000..ad55d62 --- /dev/null +++ b/node_modules/ramda/src/xprod.js @@ -0,0 +1,48 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates a new list out of the two supplied by creating each possible pair + * from the lists. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] -> [[a,b]] + * @param {Array} as The first list. + * @param {Array} bs The second list. + * @return {Array} The list made by combining each possible pair from + * `as` and `bs` into pairs (`[a, b]`). + * @example + * + * R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]] + */ + + +var xprod = +/*#__PURE__*/ +_curry2(function xprod(a, b) { + // = xprodWith(prepend); (takes about 3 times as long...) + var idx = 0; + var ilen = a.length; + var j; + var jlen = b.length; + var result = []; + + while (idx < ilen) { + j = 0; + + while (j < jlen) { + result[result.length] = [a[idx], b[j]]; + j += 1; + } + + idx += 1; + } + + return result; +}); + +module.exports = xprod; \ No newline at end of file diff --git a/node_modules/ramda/src/zip.js b/node_modules/ramda/src/zip.js new file mode 100644 index 0000000..9da870c --- /dev/null +++ b/node_modules/ramda/src/zip.js @@ -0,0 +1,40 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates a new list out of the two supplied by pairing up equally-positioned + * items from both lists. The returned list is truncated to the length of the + * shorter of the two input lists. + * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`. + * + * @func + * @memberOf R + * @since v0.1.0 + * @category List + * @sig [a] -> [b] -> [[a,b]] + * @param {Array} list1 The first array to consider. + * @param {Array} list2 The second array to consider. + * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`. + * @example + * + * R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + * @symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]] + */ + + +var zip = +/*#__PURE__*/ +_curry2(function zip(a, b) { + var rv = []; + var idx = 0; + var len = Math.min(a.length, b.length); + + while (idx < len) { + rv[idx] = [a[idx], b[idx]]; + idx += 1; + } + + return rv; +}); + +module.exports = zip; \ No newline at end of file diff --git a/node_modules/ramda/src/zipObj.js b/node_modules/ramda/src/zipObj.js new file mode 100644 index 0000000..071f501 --- /dev/null +++ b/node_modules/ramda/src/zipObj.js @@ -0,0 +1,38 @@ +var _curry2 = +/*#__PURE__*/ +require("./internal/_curry2"); +/** + * Creates a new object out of a list of keys and a list of values. + * Key/value pairing is truncated to the length of the shorter of the two lists. + * Note: `zipObj` is equivalent to `pipe(zip, fromPairs)`. + * + * @func + * @memberOf R + * @since v0.3.0 + * @category List + * @sig [String] -> [*] -> {String: *} + * @param {Array} keys The array that will be properties on the output object. + * @param {Array} values The list of values on the output object. + * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`. + * @example + * + * R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} + */ + + +var zipObj = +/*#__PURE__*/ +_curry2(function zipObj(keys, values) { + var idx = 0; + var len = Math.min(keys.length, values.length); + var out = {}; + + while (idx < len) { + out[keys[idx]] = values[idx]; + idx += 1; + } + + return out; +}); + +module.exports = zipObj; \ No newline at end of file diff --git a/node_modules/ramda/src/zipWith.js b/node_modules/ramda/src/zipWith.js new file mode 100644 index 0000000..3385cca --- /dev/null +++ b/node_modules/ramda/src/zipWith.js @@ -0,0 +1,45 @@ +var _curry3 = +/*#__PURE__*/ +require("./internal/_curry3"); +/** + * Creates a new list out of the two supplied by applying the function to each + * equally-positioned pair in the lists. The returned list is truncated to the + * length of the shorter of the two input lists. + * + * @function + * @memberOf R + * @since v0.1.0 + * @category List + * @sig ((a, b) -> c) -> [a] -> [b] -> [c] + * @param {Function} fn The function used to combine the two elements into one value. + * @param {Array} list1 The first array to consider. + * @param {Array} list2 The second array to consider. + * @return {Array} The list made by combining same-indexed elements of `list1` and `list2` + * using `fn`. + * @example + * + * const f = (x, y) => { + * // ... + * }; + * R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); + * //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + * @symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)] + */ + + +var zipWith = +/*#__PURE__*/ +_curry3(function zipWith(fn, a, b) { + var rv = []; + var idx = 0; + var len = Math.min(a.length, b.length); + + while (idx < len) { + rv[idx] = fn(a[idx], b[idx]); + idx += 1; + } + + return rv; +}); + +module.exports = zipWith; \ No newline at end of file diff --git a/node_modules/sonic-boom/.travis.yml b/node_modules/sonic-boom/.travis.yml new file mode 100644 index 0000000..6054234 --- /dev/null +++ b/node_modules/sonic-boom/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +sudo: false +node_js: +- '6' +- '8' +- '10' +- '11' +- '12' +- '13' diff --git a/node_modules/sonic-boom/LICENSE b/node_modules/sonic-boom/LICENSE new file mode 100644 index 0000000..eea791d --- /dev/null +++ b/node_modules/sonic-boom/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Matteo Collina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/sonic-boom/README.md b/node_modules/sonic-boom/README.md new file mode 100644 index 0000000..d4cf0e5 --- /dev/null +++ b/node_modules/sonic-boom/README.md @@ -0,0 +1,100 @@ +# sonic-boom  [![Build Status](https://travis-ci.org/mcollina/sonic-boom.svg?branch=master)](https://travis-ci.org/mcollina/sonic-boom) + +Extremely fast utf8-only stream implementation to write to files and +file descriptors. + +This implementation is partial, but support backpressure and `.pipe()` in is here. +However, it is 2-3x faster than Node Core `fs.createWriteStream()`: + +``` +benchSonic*1000: 2215.220ms +benchSonicSync*1000: 8315.173ms +benchSonic4k*1000: 2184.558ms +benchSonicSync4k*1000: 1733.582ms +benchCore*1000: 6513.752ms +``` + +Note that sync mode without buffering is _slower_ than a Node Core WritableStream, however +this mode matches the expected behavior of `console.log()`. + +Note that if this is used to log to a windows terminal (`cmd.exe` or +powershell), it is needed to run `chcp 65001` in the terminal to +correctly display utf-8 characters, see +[chcp](https://ss64.com/nt/chcp.html) for more details. + +## Install + +``` +npm i sonic-boom +``` + +## Example + +```js +'use strict' + +const SonicBoom = require('sonic-boom') +const sonic = new SonicBoom(process.stdout.fd) // or '/path/to/destination' + +for (var i = 0; i < 10; i++) { + sonic.write('hello sonic\n') +} +``` + +## API + +### SonicBoom(String|Number, [minLength], [sync]) + +Creates a new instance of SonicBoom. + +The first argument can be: + +1. a string that is a path to a file to be written to (mode `'a'`) +2. a file descriptor, something that is returned by `fs.open` or + `fs.openSync`. + +The second argument is the minimum length of the internal buffer that is +required before flushing. + +The third argument is a flag that, when true, causes `SonicBoom` to perform synchronous writes. + +It will emit the `'ready'` event when a file descriptor is available. + +### SonicBoom#write(string) + +Writes the string to the file. +It will return false to signal the producer to slow down. + +### SonicBoom#flush() + +Writes the current buffer to the file if a write was not in progress. +Do nothing if `minLength` is zero or if it is already writing. + +### SonicBoom#reopen([file]) + +Reopen the file in place, useful for log rotation. + +Example: + +```js +const stream = new SonicBoom('./my.log') +process.on('SIGUSR2', function () { + stream.reopen() +}) +``` + +### SonicBoom#flushSync() + +Flushes the buffered data synchronously. This is a costly operation. + +### SonicBoom#end() + +Closes the stream, the data will be flushed down asynchronously + +### SonicBook#destroy() + +Closes the stream immediately, the data is not flushed. + +## License + +MIT diff --git a/node_modules/sonic-boom/bench.js b/node_modules/sonic-boom/bench.js new file mode 100644 index 0000000..9018466 --- /dev/null +++ b/node_modules/sonic-boom/bench.js @@ -0,0 +1,63 @@ +'use strict' + +var bench = require('fastbench') +var SonicBoom = require('./') +var fs = require('fs') + +var core = fs.createWriteStream('/dev/null') +var fd = fs.openSync('/dev/null', 'w') +var sonic = new SonicBoom(fd) +var sonic4k = new SonicBoom(fd, 4096) +var sonicSync = new SonicBoom(fd, 0, true) +var sonicSync4k = new SonicBoom(fd, 4096, true) + +var MAX = 10000 + +function str () { + var res = '' + + for (var i = 0; i < 10; i++) { + res += 'hello' + } + + return res +} + +setTimeout(doBench, 100) + +var run = bench([ + function benchSonic (cb) { + sonic.once('drain', cb) + for (var i = 0; i < MAX; i++) { + sonic.write(str()) + } + }, + function benchSonicSync (cb) { + sonicSync.once('drain', cb) + for (var i = 0; i < MAX; i++) { + sonicSync.write(str()) + } + }, + function benchSonic4k (cb) { + sonic4k.once('drain', cb) + for (var i = 0; i < MAX; i++) { + sonic4k.write(str()) + } + }, + function benchSonicSync4k (cb) { + sonicSync4k.once('drain', cb) + for (var i = 0; i < MAX; i++) { + sonicSync4k.write(str()) + } + }, + function benchCore (cb) { + core.once('drain', cb) + for (var i = 0; i < MAX; i++) { + core.write(str()) + } + } +], 1000) + +function doBench () { + run(run) +} diff --git a/node_modules/sonic-boom/check.js b/node_modules/sonic-boom/check.js new file mode 100644 index 0000000..2e554f0 --- /dev/null +++ b/node_modules/sonic-boom/check.js @@ -0,0 +1,18 @@ +'use strict' + +const SonicBoom = require('.') +const sonic = new SonicBoom(process.stdout.fd) + +let count = 0 +function scheduleWrites () { + for (var i = 0; i < 1000; i++) { + sonic.write('hello sonic\n') + console.log('hello console') + } + + if (++count < 10) { + setTimeout(scheduleWrites, 100) + } +} + +scheduleWrites() diff --git a/node_modules/sonic-boom/example.js b/node_modules/sonic-boom/example.js new file mode 100644 index 0000000..fac5cdb --- /dev/null +++ b/node_modules/sonic-boom/example.js @@ -0,0 +1,8 @@ +'use strict' + +const SonicBoom = require('.') +const sonic = new SonicBoom(process.stdout.fd) // or 'destination' + +for (var i = 0; i < 10; i++) { + sonic.write('hello sonic\n') +} diff --git a/node_modules/sonic-boom/fixtures/firehose.js b/node_modules/sonic-boom/fixtures/firehose.js new file mode 100644 index 0000000..ef698f0 --- /dev/null +++ b/node_modules/sonic-boom/fixtures/firehose.js @@ -0,0 +1,22 @@ +'use strict' + +const SonicBoom = require('..') + +const out = new SonicBoom(process.stdout.fd) +const str = Buffer.alloc(1000).fill('a').toString() + +let i = 0 + +function write () { + if (i++ === 10) { + return + } + + if (out.write(str)) { + write() + } else { + out.once('drain', write) + } +} + +write() diff --git a/node_modules/sonic-boom/index.js b/node_modules/sonic-boom/index.js new file mode 100644 index 0000000..ceff418 --- /dev/null +++ b/node_modules/sonic-boom/index.js @@ -0,0 +1,317 @@ +'use strict' + +const fs = require('fs') +const EventEmitter = require('events') +const flatstr = require('flatstr') +const inherits = require('util').inherits + +const BUSY_WRITE_TIMEOUT = 100 + +const sleep = require('atomic-sleep') + +// 16 MB - magic number +// This constant ensures that SonicBoom only needs +// 32 MB of free memory to run. In case of having 1GB+ +// of data to write, this prevents an out of memory +// condition. +const MAX_WRITE = 16 * 1024 * 1024 + +function openFile (file, sonic) { + sonic._opening = true + sonic._writing = true + sonic.file = file + fs.open(file, 'a', (err, fd) => { + if (err) { + sonic.emit('error', err) + return + } + + sonic.fd = fd + sonic._reopening = false + sonic._opening = false + sonic._writing = false + + sonic.emit('ready') + + if (sonic._reopening) { + return + } + + // start + var len = sonic._buf.length + if (len > 0 && len > sonic.minLength && !sonic.destroyed) { + actualWrite(sonic) + } + }) +} + +function SonicBoom (fd, minLength, sync) { + if (!(this instanceof SonicBoom)) { + return new SonicBoom(fd, minLength, sync) + } + + this._buf = '' + this.fd = -1 + this._writing = false + this._writingBuf = '' + this._ending = false + this._reopening = false + this._asyncDrainScheduled = false + this.file = null + this.destroyed = false + this.sync = sync || false + + this.minLength = minLength || 0 + + if (typeof fd === 'number') { + this.fd = fd + process.nextTick(() => this.emit('ready')) + } else if (typeof fd === 'string') { + openFile(fd, this) + } else { + throw new Error('SonicBoom supports only file descriptors and files') + } + + this.release = (err, n) => { + if (err) { + if (err.code === 'EAGAIN') { + if (this.sync) { + // This error code should not happen in sync mode, because it is + // not using the underlining operating system asynchronous functions. + // However it happens, and so we handle it. + // Ref: https://github.com/pinojs/pino/issues/783 + try { + sleep(BUSY_WRITE_TIMEOUT) + this.release(undefined, 0) + } catch (err) { + this.release(err) + } + } else { + // Let's give the destination some time to process the chunk. + setTimeout(() => { + fs.write(this.fd, this._writingBuf, 'utf8', this.release) + }, BUSY_WRITE_TIMEOUT) + } + } else { + this.emit('error', err) + } + return + } + + if (this._writingBuf.length !== n) { + this._writingBuf = this._writingBuf.slice(n) + if (this.sync) { + try { + do { + n = fs.writeSync(this.fd, this._writingBuf, 'utf8') + this._writingBuf = this._writingBuf.slice(n) + } while (this._writingBuf.length !== 0) + } catch (err) { + this.release(err) + return + } + } else { + fs.write(this.fd, this._writingBuf, 'utf8', this.release) + return + } + } + + this._writingBuf = '' + + if (this.destroyed) { + return + } + + var len = this._buf.length + if (this._reopening) { + this._writing = false + this._reopening = false + this.reopen() + } else if (len > 0 && len > this.minLength) { + actualWrite(this) + } else if (this._ending) { + if (len > 0) { + actualWrite(this) + } else { + this._writing = false + actualClose(this) + } + } else { + this._writing = false + if (this.sync) { + if (!this._asyncDrainScheduled) { + this._asyncDrainScheduled = true + process.nextTick(emitDrain, this) + } + } else { + this.emit('drain') + } + } + } +} + +function emitDrain (sonic) { + sonic._asyncDrainScheduled = false + sonic.emit('drain') +} + +inherits(SonicBoom, EventEmitter) + +SonicBoom.prototype.write = function (data) { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + + this._buf += data + var len = this._buf.length + if (!this._writing && len > this.minLength) { + actualWrite(this) + } + return len < 16384 +} + +SonicBoom.prototype.flush = function () { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + + if (this._writing || this.minLength <= 0) { + return + } + + actualWrite(this) +} + +SonicBoom.prototype.reopen = function (file) { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + + if (this._opening) { + this.once('ready', () => { + this.reopen(file) + }) + return + } + + if (this._ending) { + return + } + + if (!this.file) { + throw new Error('Unable to reopen a file descriptor, you must pass a file to SonicBoom') + } + + this._reopening = true + + if (this._writing) { + return + } + + fs.close(this.fd, (err) => { + if (err) { + return this.emit('error', err) + } + }) + + openFile(file || this.file, this) +} + +SonicBoom.prototype.end = function () { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + + if (this._opening) { + this.once('ready', () => { + this.end() + }) + return + } + + if (this._ending) { + return + } + + this._ending = true + + if (!this._writing && this._buf.length > 0 && this.fd >= 0) { + actualWrite(this) + return + } + + if (this._writing) { + return + } + + actualClose(this) +} + +SonicBoom.prototype.flushSync = function () { + if (this.destroyed) { + throw new Error('SonicBoom destroyed') + } + + if (this.fd < 0) { + throw new Error('sonic boom is not ready yet') + } + + if (this._buf.length > 0) { + fs.writeSync(this.fd, this._buf, 'utf8') + this._buf = '' + } +} + +SonicBoom.prototype.destroy = function () { + if (this.destroyed) { + return + } + actualClose(this) +} + +function actualWrite (sonic) { + sonic._writing = true + var buf = sonic._buf + var release = sonic.release + if (buf.length > MAX_WRITE) { + buf = buf.slice(0, MAX_WRITE) + sonic._buf = sonic._buf.slice(MAX_WRITE) + } else { + sonic._buf = '' + } + flatstr(buf) + sonic._writingBuf = buf + if (sonic.sync) { + try { + var written = fs.writeSync(sonic.fd, buf, 'utf8') + release(null, written) + } catch (err) { + release(err) + } + } else { + fs.write(sonic.fd, buf, 'utf8', release) + } +} + +function actualClose (sonic) { + if (sonic.fd === -1) { + sonic.once('ready', actualClose.bind(null, sonic)) + return + } + // TODO write a test to check if we are not leaking fds + fs.close(sonic.fd, (err) => { + if (err) { + sonic.emit('error', err) + return + } + + if (sonic._ending && !sonic._writing) { + sonic.emit('finish') + } + sonic.emit('close') + }) + sonic.destroyed = true + sonic._buf = '' +} + +module.exports = SonicBoom diff --git a/node_modules/sonic-boom/package.json b/node_modules/sonic-boom/package.json new file mode 100644 index 0000000..083ee69 --- /dev/null +++ b/node_modules/sonic-boom/package.json @@ -0,0 +1,67 @@ +{ + "_from": "sonic-boom@^0.7.5", + "_id": "sonic-boom@0.7.7", + "_inBundle": false, + "_integrity": "sha512-Ei5YOo5J64GKClHIL/5evJPgASXFVpfVYbJV9PILZQytTK6/LCwHvsZJW2Ig4p9FMC2OrBrMnXKgRN/OEoAWfg==", + "_location": "/sonic-boom", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "sonic-boom@^0.7.5", + "name": "sonic-boom", + "escapedName": "sonic-boom", + "rawSpec": "^0.7.5", + "saveSpec": null, + "fetchSpec": "^0.7.5" + }, + "_requiredBy": [ + "/pino" + ], + "_resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-0.7.7.tgz", + "_shasum": "d921de887428208bfa07b0ae32c278de043f350a", + "_spec": "sonic-boom@^0.7.5", + "_where": "/home/dawidd6/github/dawidd6/action-debian-package/node_modules/pino", + "author": { + "name": "Matteo Collina", + "email": "hello@matteocollina.com" + }, + "bugs": { + "url": "https://github.com/mcollina/sonic-boom/issues" + }, + "bundleDependencies": false, + "dependencies": { + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" + }, + "deprecated": false, + "description": "Extremely fast utf8 only stream implementation", + "devDependencies": { + "fastbench": "^1.0.1", + "pre-commit": "^1.2.2", + "proxyquire": "^2.1.0", + "standard": "^13.0.2", + "tap": "^12.1.0" + }, + "homepage": "https://github.com/mcollina/sonic-boom#readme", + "keywords": [ + "stream", + "fs", + "net", + "fd", + "file", + "descriptor", + "fast" + ], + "license": "MIT", + "main": "index.js", + "name": "sonic-boom", + "repository": { + "type": "git", + "url": "git+https://github.com/mcollina/sonic-boom.git" + }, + "scripts": { + "test": "standard && tap --no-esm -t 120 test.js" + }, + "version": "0.7.7" +} diff --git a/node_modules/sonic-boom/test.js b/node_modules/sonic-boom/test.js new file mode 100644 index 0000000..112ef57 --- /dev/null +++ b/node_modules/sonic-boom/test.js @@ -0,0 +1,762 @@ +'use strict' + +const { test, tearDown } = require('tap') +const { join } = require('path') +const { fork } = require('child_process') +const fs = require('fs') +const os = require('os') +const path = require('path') +const proxyquire = require('proxyquire') +const SonicBoom = require('.') + +const files = [] +var count = 0 + +function file () { + const file = path.join(os.tmpdir(), `sonic-boom-${process.pid}-${process.hrtime().toString()}-${count++}`) + files.push(file) + return file +} + +tearDown(() => { + files.forEach((file) => { + try { + fs.unlinkSync(file) + } catch (e) { + console.log(e) + } + }) +}) + +test('sync false', (t) => { + buildTests(t.test, false) + t.end() +}) + +test('sync true', (t) => { + buildTests(t.test, true) + t.end() +}) + +function buildTests (test, sync) { + test('write things to a file descriptor', (t) => { + t.plan(6) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, sync) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('write things in a streaming fashion', (t) => { + t.plan(8) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, sync) + + t.ok(stream.write('hello world\n')) + + stream.once('drain', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\n') + t.ok(stream.write('something else\n')) + }) + + stream.once('drain', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + stream.end() + }) + }) + }) + + stream.on('finish', () => { + t.pass('finish emitted') + }) + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('can be piped into', (t) => { + t.plan(4) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, sync) + const source = fs.createReadStream(__filename) + + source.pipe(stream) + + stream.on('finish', () => { + fs.readFile(__filename, 'utf8', (err, expected) => { + t.error(err) + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, expected) + }) + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('write things to a file', (t) => { + t.plan(6) + + const dest = file() + const stream = new SonicBoom(dest, 0, sync) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('flushSync', (t) => { + t.plan(4) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 4096, sync) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.flushSync() + + // let the file system settle down things + setImmediate(function () { + stream.end() + const data = fs.readFileSync(dest, 'utf8') + t.equal(data, 'hello world\nsomething else\n') + + stream.on('close', () => { + t.pass('close emitted') + }) + }) + }) + + test('destroy', (t) => { + t.plan(5) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, sync) + + t.ok(stream.write('hello world\n')) + stream.destroy() + t.throws(() => { stream.write('hello world\n') }) + + fs.readFile(dest, 'utf8', function (err, data) { + t.error(err) + t.equal(data, 'hello world\n') + }) + + stream.on('finish', () => { + t.fail('finish emitted') + }) + + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('destroy while opening', (t) => { + t.plan(1) + + const dest = file() + const stream = new SonicBoom(dest) + + stream.destroy() + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('minLength', (t) => { + t.plan(8) + + const dest = file() + const stream = new SonicBoom(dest, 4096, sync) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + var fail = t.fail + stream.on('drain', fail) + + // bad use of timer + // TODO refactor + setTimeout(function () { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, '') + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + }) + }, 100) + + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('flush', (t) => { + t.plan(5) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 4096, sync) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.flush() + + stream.on('drain', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + stream.end() + }) + }) + }) + + test('reopen', (t) => { + t.plan(9) + + const dest = file() + const stream = new SonicBoom(dest, 0, sync) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + const after = dest + '-moved' + + stream.once('drain', () => { + t.pass('drain emitted') + + fs.renameSync(dest, after) + stream.reopen() + + stream.once('ready', () => { + t.pass('ready emitted') + t.ok(stream.write('after reopen\n')) + + stream.on('drain', () => { + fs.readFile(after, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'after reopen\n') + stream.end() + }) + }) + }) + }) + }) + }) + + test('reopen with buffer', (t) => { + t.plan(9) + + const dest = file() + const stream = new SonicBoom(dest, 4096, sync) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + const after = dest + '-moved' + + stream.once('ready', () => { + t.pass('drain emitted') + + stream.flush() + fs.renameSync(dest, after) + stream.reopen() + + stream.once('ready', () => { + t.pass('ready emitted') + t.ok(stream.write('after reopen\n')) + stream.flush() + + stream.on('drain', () => { + fs.readFile(after, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'after reopen\n') + stream.end() + }) + }) + }) + }) + }) + }) + + test('reopen if not open', (t) => { + t.plan(3) + + const dest = file() + const stream = new SonicBoom(dest, 0, sync) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.reopen() + + stream.end() + stream.on('close', function () { + t.pass('ended') + }) + }) + + test('end after reopen', (t) => { + t.plan(4) + + const dest = file() + const stream = new SonicBoom(dest, 4096, sync) + + stream.once('ready', () => { + t.pass('ready emitted') + const after = dest + '-moved' + stream.reopen(after) + stream.write('after reopen\n') + stream.on('finish', () => { + t.pass('finish emitted') + fs.readFile(after, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'after reopen\n') + }) + }) + stream.end() + }) + }) + + test('end after 2x reopen', (t) => { + t.plan(4) + + const dest = file() + const stream = new SonicBoom(dest, 4096, sync) + + stream.once('ready', () => { + t.pass('ready emitted') + stream.reopen(dest + '-moved') + const after = dest + '-moved-moved' + stream.reopen(after) + stream.write('after reopen\n') + stream.on('finish', () => { + t.pass('finish emitted') + fs.readFile(after, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'after reopen\n') + }) + }) + stream.end() + }) + }) + + test('end if not ready', (t) => { + t.plan(3) + + const dest = file() + const stream = new SonicBoom(dest, 4096, sync) + const after = dest + '-moved' + stream.reopen(after) + stream.write('after reopen\n') + stream.on('finish', () => { + t.pass('finish emitted') + fs.readFile(after, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'after reopen\n') + }) + }) + stream.end() + }) + + test('reopen with file', (t) => { + t.plan(9) + + const dest = file() + const stream = new SonicBoom(dest, 0, sync) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + const after = dest + '-new' + + stream.once('drain', () => { + t.pass('drain emitted') + + stream.reopen(after) + + stream.once('ready', () => { + t.pass('ready emitted') + t.ok(stream.write('after reopen\n')) + + stream.on('drain', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + fs.readFile(after, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'after reopen\n') + stream.end() + }) + }) + }) + }) + }) + }) + + test('chunk data accordingly', (t) => { + t.plan(2) + + const child = fork(join(__dirname, 'fixtures', 'firehose.js'), { silent: true }) + const str = Buffer.alloc(10000).fill('a').toString() + + let data = '' + + child.stdout.on('data', function (chunk) { + data += chunk.toString() + }) + + child.stdout.on('end', function () { + t.is(data, str) + }) + + child.on('close', function (code) { + t.is(code, 0) + }) + }) +} + +test('retry on EAGAIN', (t) => { + t.plan(7) + + const fakeFs = Object.create(fs) + fakeFs.write = function (fd, buf, enc, cb) { + t.pass('fake fs.write called') + fakeFs.write = fs.write + const err = new Error('EAGAIN') + err.code = 'EAGAIN' + process.nextTick(cb, err) + } + const SonicBoom = proxyquire('.', { + fs: fakeFs + }) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, false) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) +}) + +test('retry on EAGAIN (sync)', (t) => { + t.plan(7) + + const fakeFs = Object.create(fs) + fakeFs.writeSync = function (fd, buf, enc, cb) { + t.pass('fake fs.writeSync called') + fakeFs.writeSync = fs.writeSync + const err = new Error('EAGAIN') + err.code = 'EAGAIN' + throw err + } + const SonicBoom = proxyquire('.', { + fs: fakeFs + }) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, true) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) +}) + +test('write buffers that are not totally written', (t) => { + t.plan(9) + + const fakeFs = Object.create(fs) + fakeFs.write = function (fd, buf, enc, cb) { + t.pass('fake fs.write called') + fakeFs.write = function (fd, buf, enc, cb) { + t.pass('calling real fs.write, ' + buf) + fs.write(fd, buf, enc, cb) + } + process.nextTick(cb, null, 0) + } + const SonicBoom = proxyquire('.', { + fs: fakeFs + }) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, false) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) +}) + +test('write buffers that are not totally written with sync mode', (t) => { + t.plan(9) + + const fakeFs = Object.create(fs) + fakeFs.writeSync = function (fd, buf, enc) { + t.pass('fake fs.write called') + fakeFs.writeSync = (fd, buf, enc) => { + t.pass('calling real fs.writeSync, ' + buf) + return fs.writeSync(fd, buf, enc) + } + return 0 + } + const SonicBoom = proxyquire('.', { + fs: fakeFs + }) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, true) + + stream.on('ready', () => { + t.pass('ready emitted') + }) + + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + stream.end() + + stream.on('finish', () => { + fs.readFile(dest, 'utf8', (err, data) => { + t.error(err) + t.equal(data, 'hello world\nsomething else\n') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) +}) + +test('sync writing is fully sync', (t) => { + t.plan(6) + + const fakeFs = Object.create(fs) + fakeFs.writeSync = function (fd, buf, enc, cb) { + t.pass('fake fs.write called') + return fs.writeSync(fd, buf, enc) + } + const SonicBoom = proxyquire('.', { + fs: fakeFs + }) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, true) + t.ok(stream.write('hello world\n')) + t.ok(stream.write('something else\n')) + + // 'drain' will be only emitted once, + // the number of assertions at the top check this. + stream.on('drain', () => { + t.pass('drain emitted') + }) + + const data = fs.readFileSync(dest, 'utf8') + t.equal(data, 'hello world\nsomething else\n') +}) + +// These they will fail on Node 6, as we cannot allocate a string this +// big. It's considered a won't fix on Node 6, as it's deprecated. +if (process.versions.node.indexOf('6.') !== 0) { + test('write enormously large buffers async', (t) => { + t.plan(3) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, false) + + const buf = Buffer.alloc(1024).fill('x').toString() // 1 MB + let length = 0 + + for (let i = 0; i < 1024 * 1024; i++) { + length += buf.length + stream.write(buf) + } + + stream.end() + + stream.on('finish', () => { + fs.stat(dest, (err, stat) => { + t.error(err) + t.equal(stat.size, length) + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) + }) + + test('write enormously large buffers sync', (t) => { + t.plan(3) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, true) + + const buf = Buffer.alloc(1024).fill('x').toString() // 1 MB + let length = 0 + + for (let i = 0; i < 1024 * 1024; i++) { + length += buf.length + stream.write(buf) + } + + stream.end() + + stream.on('finish', () => { + fs.stat(dest, (err, stat) => { + t.error(err) + t.equal(stat.size, length) + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) + }) +} + +test('write enormously large buffers sync with utf8 multi-byte split', (t) => { + t.plan(4) + + const dest = file() + const fd = fs.openSync(dest, 'w') + const stream = new SonicBoom(fd, 0, true) + + let buf = Buffer.alloc((1024 * 16) - 2).fill('x') // 16MB - 3B + const length = buf.length + 4 + buf = buf.toString() + '🌲' // 16 MB + 1B + + stream.write(buf) + + stream.end() + + stream.on('finish', () => { + fs.stat(dest, (err, stat) => { + t.error(err) + t.equal(stat.size, length) + const char = Buffer.alloc(4) + const fd = fs.openSync(dest, 'r') + fs.readSync(fd, char, 0, 4, length - 4) + t.equal(char.toString(), '🌲') + }) + }) + stream.on('close', () => { + t.pass('close emitted') + }) +}) diff --git a/package-lock.json b/package-lock.json index 9dedd72..79d7d1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,10 +21,138 @@ "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz", "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==" }, + "atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" + }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "camelcase-keys": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.1.tgz", + "integrity": "sha512-BPCNVH56RVIxQQIXskp5tLQXUNGQ6sXr7iCv1FHDt81xBOQ/1r6H8SPxf19InVP6DexWar4s87q9thfuk8X9HA==", + "requires": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "docker-hub-utils": { + "version": "1.10.29", + "resolved": "https://registry.npmjs.org/docker-hub-utils/-/docker-hub-utils-1.10.29.tgz", + "integrity": "sha512-wZ3BmcG3mq90rlXGfGcgqwgyTyO0kWQA5D+3J7T+nLgE1mzjggK1ZDB44krt5dj5lK/nXla3vGIw7nF7IE2kQQ==", + "requires": { + "axios": "0.19.2", + "camelcase-keys": "6.2.1", + "luxon": "1.22.2", + "pino": "5.17.0", + "ramda": "0.27.0" + } + }, + "fast-redact": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-2.0.0.tgz", + "integrity": "sha512-zxpkULI9W9MNTK2sJ3BpPQrTEXFNESd2X6O1tXMFpK/XM0G5c5Rll2EVYZH2TqI3xRGK/VaJ+eEOt7pnENJpeA==" + }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, "firstline": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/firstline/-/firstline-2.0.2.tgz", "integrity": "sha512-8KcmfI0jgSECnzdhucm0i7vrwef3BWwgjimW2YkRC5eSFwjb5DibVoA0YvgkYwwxuJi9c+7M7X3b3lX8o9B6wg==" + }, + "flatstr": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "luxon": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.22.2.tgz", + "integrity": "sha512-vq6eSaOOw1fKob+JXwfu0e3/UFUT4G4HTFRJab7dch8J1OdOGW/vXqCiJsY7rm2In+5gKNYx0EtnYT0Tc5V4Qw==" + }, + "map-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz", + "integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "pino": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-5.17.0.tgz", + "integrity": "sha512-LqrqmRcJz8etUjyV0ddqB6OTUutCgQULPFg2b4dtijRHUsucaAdBgSUW58vY6RFSX+NT8963F+q0tM6lNwGShA==", + "requires": { + "fast-redact": "^2.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^2.4.2", + "quick-format-unescaped": "^3.0.3", + "sonic-boom": "^0.7.5" + } + }, + "pino-std-serializers": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-2.4.2.tgz", + "integrity": "sha512-WaL504dO8eGs+vrK+j4BuQQq6GLKeCCcHaMB2ItygzVURcL1CycwNEUHTD/lHFHs/NL5qAz2UKrjYWXKSf4aMQ==" + }, + "quick-format-unescaped": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-3.0.3.tgz", + "integrity": "sha512-dy1yjycmn9blucmJLXOfZDx1ikZJUi6E8bBZLnhPG5gBrVhHXx2xVyqqgKBubVNEXmx51dBACMHpoMQK/N/AXQ==" + }, + "quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==" + }, + "ramda": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.0.tgz", + "integrity": "sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA==" + }, + "sonic-boom": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-0.7.7.tgz", + "integrity": "sha512-Ei5YOo5J64GKClHIL/5evJPgASXFVpfVYbJV9PILZQytTK6/LCwHvsZJW2Ig4p9FMC2OrBrMnXKgRN/OEoAWfg==", + "requires": { + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" + } } } } diff --git a/package.json b/package.json index 80a73df..4ab8163 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "dependencies": { "@actions/core": "^1.2.3", "@actions/exec": "^1.0.3", + "docker-hub-utils": "^1.10.29", "firstline": "^2.0.2" } }