# gl-to-dtype

> turns a gl type into a dtype string

Latest version **1.1.0** (published 2015-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install gl-to-dtype
pnpm add gl-to-dtype
yarn add gl-to-dtype
bun add gl-to-dtype
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2015-05-25 |
| First published | 2015-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | dtype, gl, constant, flag, flags, texture, float, uint8, uint8_clamped |

## Links

- npm: https://www.npmjs.com/package/gl-to-dtype
- Repository: https://github.com/mattdesl/gl-to-dtype
- Issues: https://github.com/mattdesl/gl-to-dtype/issues
- npm.io page: https://npm.io/package/gl-to-dtype

## Recent versions

- 1.1.0 (latest) — 2015-05-25
- 1.0.0 — 2015-05-25

## README

# gl-to-dtype

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

Turns a WebGL constant into a [dtype](https://www.npmjs.com/package/dtype) string.

```js
var asDtype = require('gl-to-dtype')
var dtype = require('dtype')

var glType = gl.FLOAT
var type = asDtype(glType)
var array = new (dtype(type))(16)
```

Converts the following:

```js
gl.FLOAT          -> 'float32'
gl.UNSIGNED_INT   -> 'uint32'
gl.INT            -> 'int32'
gl.UNSIGNED_SHORT -> 'uint16'
gl.SHORT          -> 'int16'
gl.UNSIGNED_BYTE  -> 'uint8'
gl.BYTE           -> 'int8'
gl.UNSIGNED_SHORT_4_4_4_4 -> 'uint16'
gl.UNSIGNED_SHORT_5_5_5_1 -> 'uint16'
gl.UNSIGNED_SHORT_5_6_5 -> 'uint16'
```

## Usage

[![NPM](https://nodei.co/npm/gl-to-dtype.png)](https://www.npmjs.com/package/gl-to-dtype)

#### `require('gl-to-dtype')(glType)`

Takes `glType` constant and returns a string representation aligning with [ndarray](https://www.npmjs.com/package/ndarray), [dtype](https://www.npmjs.com/package/dtype) and other modules.

Returns `null` if the flag isn't recognized as a supported type.

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/gl-to-dtype/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/gl-to-dtype · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
