summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
3b7b484)
Otherwise this code will break if new flags are added but not supported
by ♓🌟 Piscēs.
// ♓🌟 Piscēs ∷ string.js
// ====================================================================
//
// ♓🌟 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
//
// 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
objectCreate,
setPrototype,
} from "./object.js";
objectCreate,
setPrototype,
} from "./object.js";
+import { type } from "./value.js";
const { exec: reExec, toString: reToString } = rePrototype;
const getDotAll =
Object.getOwnPropertyDescriptor(rePrototype, "dotAll").get;
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 =
const getGlobal =
Object.getOwnPropertyDescriptor(rePrototype, "global").get;
const getHasIndices =
+ /**
+ * 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, []);
/** Gets whether the global flag is present on this Matcher. */
get global() {
return call(getGlobal, this.#regExp, []);
+ describe("::toString", () => {
+ it("[[Get]] does not throw an error", () => {
+ new Matcher(/(?:)/u).toString();
+ });
+ });
+
describe("::unicode", () => {
it("[[Get]] returns true when the unicode flag is present", () => {
assertStrictEquals(new Matcher(/(?:)/u).unicode, true);
describe("::unicode", () => {
it("[[Get]] returns true when the unicode flag is present", () => {
assertStrictEquals(new Matcher(/(?:)/u).unicode, true);