X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/f753ef493338c40b6b2941d77e54510fa3c1691c..83f6aae0d1b8181dc2b0c6ccdba9f2fe2fdba3e6:/iri.js?ds=sidebyside diff --git a/iri.js b/iri.js index de23d5d..5dd9dd0 100644 --- a/iri.js +++ b/iri.js @@ -1,7 +1,7 @@ // ♓🌟 Piscēs ∷ iri.js // ==================================================================== // -// Copyright © 2020, 2022 Lady [@ Lady’s Computer]. +// Copyright © 2020, 2022–2023 Lady [@ Lady’s Computer]. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -20,6 +20,7 @@ import { stringStartsWith, substring, } from "./string.js"; +import { ITERATOR } from "./value.js"; const sub·delims = rawString`[!\$&'()*+,;=]`; const gen·delims = rawString`[:/?#\[\]@]`; @@ -168,7 +169,7 @@ export const { /** * Recomposes an (L·E·)I·R·I reference from its component parts. * - * See §5.3 of R·F·C 3986. + * See §5.3 of R·F·C 3986. */ composeReference, @@ -193,29 +194,28 @@ export const { * Removes all dot segments ("." or "..") from the provided * (L·E·)I·R·I. * - * See §5.2.4 of R·F·C 3986. + * See §5.2.4 of R·F·C 3986. */ removeDotSegments, } = (() => { const TE = TextEncoder; - const { iterator: iteratorSymbol } = Symbol; const { toString: numberToString } = Number.prototype; const { encode: teEncode } = TE.prototype; - const { [iteratorSymbol]: arrayIterator } = Array.prototype; + const { [ITERATOR]: arrayIterator } = Array.prototype; const { next: arrayIteratorNext, - } = Object.getPrototypeOf([][iteratorSymbol]()); + } = Object.getPrototypeOf([][ITERATOR]()); const { next: generatorIteratorNext, } = Object.getPrototypeOf(function* () {}.prototype); - const { [iteratorSymbol]: stringIterator } = String.prototype; + const { [ITERATOR]: stringIterator } = String.prototype; const { next: stringIteratorNext, - } = Object.getPrototypeOf(""[iteratorSymbol]()); + } = Object.getPrototypeOf(""[ITERATOR]()); const iriCharacterIterablePrototype = { - [iteratorSymbol]() { + [ITERATOR]() { return { next: bind( stringIteratorNext, @@ -226,14 +226,14 @@ export const { }, }; const iriGeneratorIterablePrototype = { - [iteratorSymbol]() { + [ITERATOR]() { return { next: bind(generatorIteratorNext, this.generator(), []), }; }, }; const iriSegmentIterablePrototype = { - [iteratorSymbol]() { + [ITERATOR]() { return { next: bind( arrayIteratorNext, @@ -535,7 +535,7 @@ export const { * Returns the result of merging the provided reference path with the * provided base path. * - * See §5.2.3 of R·F·C 3986. + * See §5.2.3 of R·F·C 3986. */ export const mergePaths = (base, reference) => { const baseStr = `${base}` || "/"; @@ -592,7 +592,7 @@ export const { * Resolves the provided reference relative to the provided base * (L·E·)I·R·I. * - * See §5.2 of R·F·C 3986. + * See §5.2 of R·F·C 3986. */ export const resolveReference = (R, Base = location ?? "") => { const {