A type detection utility for JavaScript.
Table of Contents
Sometimes there is a need to know what a value's type of something is, this package exists to satisfy those needs by implementing a parser that can retrieve the type of the value recursively and process a string similar to TypeScript's types.
yarn add @sapphire/type # npm install @sapphire/type
Note: While this section uses require
, the imports match 1:1 with ESM imports. For example const { Type } = require('@sapphire/type')
equals import { Type } from '@sapphire/type'
.
Note: When using ESM syntax you can also default-import Type
class: import Type from '@sapphire/type'
.
Note: The internal functions of getPromiseDetails
and getProxyDetails
are also exported. If you don't know what these are, then you need not be concerned about this.
// Import the Type class const { Type } = require('@sapphire/type'); // Define a Type with an array of two numbers const type = new Type([1, 2]); console.log(type.toString()); // Logs: Array<number>
Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
Please make sure to read the Contributing Guide before making a pull request.
Thank you to all the people who already contributed to Sapphire!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4