2.6.0 • Published 5 months ago

@sapphire/type v2.6.0

Weekly downloads
223
License
MIT
Repository
github
Last release
5 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.6.1-next.0df3adb

10 months ago

2.5.2-next.6abdbfa

11 months ago

2.6.1-next.806b049

5 months ago

2.6.1-next.5d14110

7 months ago

2.6.1-next.8f11d69

10 months ago

2.6.1-next.43c2d68

6 months ago

2.6.1-next.6816d9d

9 months ago

2.6.1-next.0eebe9f

6 months ago

2.6.1-next.14c074f

9 months ago

2.6.1-next.c3a83e9

6 months ago

2.6.1-next.93dd763

9 months ago

2.6.1-next.96b6804

9 months ago

2.5.2-next.fb60ce8

11 months ago

2.6.1-next.a5fb606

9 months ago

2.6.1-next.e78c336

6 months ago

2.6.1-next.6076fc5

8 months ago

2.5.2-next.6265815

10 months ago

2.6.1-next.20efd61

7 months ago

2.6.1-next.1b6423c

9 months ago

2.6.1-next.51e21c4

5 months ago

2.6.1-next.d24e284

9 months ago

2.5.2-next.71844c7

11 months ago

2.6.1-next.e9565a5

7 months ago

2.6.1-next.c99eed9

6 months ago

2.5.2-next.bb8d25f

11 months ago

2.6.1-next.9161590

7 months ago

2.6.1-next.fae2841

8 months ago

2.6.0-next.eea0e79

10 months ago

2.6.0

10 months ago

2.6.1-next.dd5bd4b

8 months ago

2.6.1-next.dcfed1a

10 months ago

2.6.1-next.6f8abb4

7 months ago

2.6.0-next.b633fff

10 months ago

2.6.1-next.bb54585

8 months ago

2.6.1-next.bced11e

5 months ago

2.6.1-next.316f190

8 months ago

2.5.2-next.b141de9

10 months ago

2.6.1-next.07d1107

10 months ago

2.5.2-next.e077cce

10 months ago

2.6.1-next.470c370

5 months ago

2.5.2-next.4282ef0

11 months ago

2.6.1-next.54b7832

8 months ago

2.6.1-next.6558974

7 months ago

2.5.2-next.d078c9c

12 months ago

2.6.1-next.7bffd15

9 months ago

2.6.1-next.d152822

7 months ago

2.6.1-next.09c3446

7 months ago

2.6.1-next.16985b1

10 months ago

2.5.2-next.77c3c72

11 months ago

2.6.1-next.f63c515

6 months ago

2.6.1-next.0449c2e

9 months ago

2.6.1-next.ab4c4a5

7 months ago

2.6.1-next.b6a5298

8 months ago

2.5.2-next.0b63543

12 months ago

2.5.2-next.b5ab21d

12 months ago

2.5.2-next.1de90a0

12 months ago

2.5.2-next.15b3df8

12 months ago

2.5.2-next.0aaea62

12 months ago

2.5.2-next.3089c20

12 months ago

2.5.2-next.915e9ca

12 months ago

2.5.0

1 year ago

2.5.1

1 year ago

2.4.4

2 years ago

2.4.3

2 years ago

2.4.2

2 years ago

2.4.1

2 years ago

2.4.0

3 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

4 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

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 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