]>
Lady’s Gitweb - Pisces/blob - symbol.js
a96cb812636aca31952302955166c036fee18077
1 // ♓🌟 Piscēs ∷ symbol.js
2 // ====================================================================
4 // Copyright © 2023 Lady [@ Lady’s Computer].
6 // This Source Code Form is subject to the terms of the Mozilla Public
7 // License, v. 2.0. If a copy of the MPL was not distributed with this
8 // file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
10 import { createCallableFunction
} from "./function.js";
11 import { getOwnPropertyDescriptor
} from "./object.js";
14 * Returns the description for the provided symbol.
16 * ※ This is effectively an alias for the `Symbol::description`
19 * ☡ This function throws if the provided argument is not a symbol.
21 export const getSymbolDescription
= createCallableFunction(
22 getOwnPropertyDescriptor(Symbol
.prototype, "description").get,
23 "getSymbolDescription",
27 * Returns a string representation of the provided symbol.
29 * ※ Use `getSymbolDescription` instead if you just want the text
30 * description of a symbol.
32 * ※ This is effectively an alias for the `Symbol::toString`.
34 * ☡ This function throws if the provided argument is not a symbol.
36 export const symbolToString
= createCallableFunction(
37 Symbol
.prototype.toString
,
42 * Returns the value of the provided symbol.
44 * ※ This is effectively an alias for the `Symbol::valueOf`.
46 * ☡ This function throws if the provided argument is not a symbol and
47 * does not have a `[[SymbolData]]` slot.
49 export const symbolValue
= createCallableFunction(
50 Symbol
.prototype.valueOf
,
This page took 0.04398 seconds and 3 git commands to generate.