2.5.1 • Published 8 months ago

@sapphire/type v2.5.1

Weekly downloads
223
License
MIT
Repository
github
Last release
8 months ago

Sapphire Logo

@sapphire/type

A type detection utility for JavaScript.

GitHub codecov npm bundle size npm Depfu

Table of Contents

Description

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.

Features

  • Written in TypeScript
  • Bundled with Rollup so it can be used in NodeJS and browsers
  • Offers CommonJS, ESM and UMD bundles
  • Fully tested

Installation

yarn add @sapphire/type
# npm install @sapphire/type

Usage

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.

Basic Usage

// 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>

API Documentation

For the full API documentation please refer to the TypeDoc generated documentation.

Buy us some doughnuts

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.

Donate WithAddress
Open CollectiveClick Here
Ko-fiClick Here
PatreonClick Here
PayPalClick Here

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

2.5.2-next.0b63543

8 months ago

2.5.2-next.b5ab21d

8 months ago

2.5.2-next.1de90a0

8 months ago

2.5.2-next.15b3df8

8 months ago

2.5.2-next.0aaea62

9 months ago

2.5.2-next.3089c20

9 months ago

2.5.2-next.915e9ca

9 months ago

2.5.2-next.a70f8a4

9 months ago

2.5.2-next.0451ac9

9 months ago

2.5.2-next.47f3ecd

9 months ago

2.5.2-next.1597965

9 months ago

2.5.2-next.5d38668

10 months ago

2.5.2-next.1630623

10 months ago

2.5.2-next.a6e33fa

10 months ago

2.5.2-next.b6d5d48

10 months ago

2.5.2-next.9a2876d

10 months ago

2.5.2-next.c5fef59

11 months ago

2.5.2-next.85f6207

11 months ago

2.5.2-next.7da4c2f

11 months ago

2.5.2-next.0211e31

11 months ago

2.5.2-next.8bc7b7d

11 months ago

2.5.2-next.7ad8708

12 months ago

2.5.2-next.ccf409d

11 months ago

2.5.2-next.48b714b

12 months ago

2.5.2-next.f86f05f

12 months ago

2.5.2-next.fb158af

12 months ago

2.5.2-next.a99153b

11 months ago

2.5.2-next.609186d

11 months ago

2.5.2-next.2239db2

12 months ago

2.5.1-next.06e6afc

12 months ago

2.5.0

1 year ago

2.5.1

12 months ago

2.5.2-next.1867aca

12 months ago

2.4.4

1 year ago

2.4.3

2 years ago

2.4.2

2 years ago

2.4.1

2 years ago

2.4.0

2 years ago

2.3.0

3 years ago

2.2.5

3 years ago

2.2.6

3 years ago

2.2.1

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.4

3 years ago

2.2.0

3 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.11

4 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.8

4 years ago

2.0.5

4 years ago

2.0.3

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.0

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago