2.6.1-next.6558974 • Published 10 months ago

@sapphire/type v2.6.1-next.6558974

Weekly downloads
223
License
MIT
Repository
github
Last release
10 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.806b049

7 months ago

2.6.1-next.5d14110

10 months ago

2.6.1-next.43c2d68

8 months ago

2.6.1-next.6816d9d

12 months ago

2.6.1-next.0eebe9f

9 months ago

2.6.1-next.14c074f

12 months ago

2.6.1-next.c3a83e9

9 months ago

2.6.1-next.93dd763

12 months ago

2.6.1-next.96b6804

12 months ago

2.6.1-next.a5fb606

12 months ago

2.6.1-next.e78c336

9 months ago

2.6.1-next.6076fc5

11 months ago

2.6.1-next.20efd61

10 months ago

2.6.1-next.1b6423c

12 months ago

2.6.1-next.51e21c4

8 months ago

2.6.1-next.d24e284

12 months ago

2.6.1-next.e9565a5

10 months ago

2.6.1-next.c99eed9

9 months ago

2.6.1-next.9161590

9 months ago

2.6.1-next.fae2841

11 months ago

2.6.0

1 year ago

2.6.1-next.dd5bd4b

11 months ago

2.6.1-next.6f8abb4

10 months ago

2.6.1-next.bb54585

11 months ago

2.6.1-next.bced11e

8 months ago

2.6.1-next.316f190

11 months ago

2.6.1-next.470c370

7 months ago

2.6.1-next.54b7832

11 months ago

2.6.1-next.6558974

10 months ago

2.6.1-next.7bffd15

11 months ago

2.6.1-next.d152822

10 months ago

2.6.1-next.09c3446

10 months ago

2.6.1-next.f63c515

8 months ago

2.6.1-next.ab4c4a5

10 months ago

2.6.1-next.b6a5298

11 months ago

2.5.0

2 years ago

2.5.1

2 years 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

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.4

4 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

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.8

5 years ago

2.0.5

5 years ago

2.0.3

5 years ago

2.0.4

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 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