X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/cbc7b43d863a143313425e0df475d6f4201ad690..6e6d4e3261c1c943fe44fa9e381bcf8bf1441fd6:/string.js?ds=inline diff --git a/string.js b/string.js index 3dc39ac..eb6f6fb 100644 --- a/string.js +++ b/string.js @@ -1,7 +1,7 @@ // ♓🌟 Piscēs ∷ string.js // ==================================================================== // -// Copyright © 2022 Lady [@ Lady’s Computer]. +// Copyright © 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 @@ -15,6 +15,7 @@ import { objectCreate, setPrototype, } from "./object.js"; +import { type } from "./value.js"; export const { /** @@ -34,6 +35,8 @@ export const { const { exec: reExec, toString: reToString } = rePrototype; const getDotAll = Object.getOwnPropertyDescriptor(rePrototype, "dotAll").get; + const getFlags = + Object.getOwnPropertyDescriptor(rePrototype, "flags").get; const getGlobal = Object.getOwnPropertyDescriptor(rePrototype, "global").get; const getHasIndices = @@ -175,6 +178,16 @@ export const { } } + /** + * Gets the flags present on this Matcher. + * + * ※ This needs to be defined because the internal RegExp object + * may have flags which are not yet recognized by ♓🌟 Piscēs. + */ + get flags() { + return call(getFlags, this.#regExp, []); + } + /** Gets whether the global flag is present on this Matcher. */ get global() { return call(getGlobal, this.#regExp, []);