# cube-side-array

> cube side array expansion for texture faces

Latest version **0.1.1** (published 2016-01-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install cube-side-array
pnpm add cube-side-array
yarn add cube-side-array
bun add cube-side-array
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-01-01 |
| First published | 2014-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | deathcap |
| Keywords | voxel, cube, sides, faces |

## Links

- npm: https://www.npmjs.com/package/cube-side-array
- Repository: https://github.com/voxel/cube-side-array
- Homepage: https://github.com/voxel/cube-side-array#readme
- Issues: https://github.com/voxel/cube-side-array/issues
- npm.io page: https://npm.io/package/cube-side-array

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2016-01-01
- 0.1.0 — 2014-04-24

## README

# cube-side-array

Convenient cube side array expansion for texture faces

[![Build Status](https://travis-ci.org/voxel/cube-side-array.png)](https://travis-ci.org/voxel/cube-side-array)

Usage:

    var expandName = require('cube-side-array');

    var array = expandName(name);

Returns a 6-element array, each element corresponding to a cube face. The `name`
parameter is intended to be user-specified; several formats are recognized:

* scalar: the same value is repeated for all sides
* 1-element array: same as scalar
* 2-element array: top/bottom, sides
* 3-element array: top, bottom, sides
* 4-element array: top, bottom, front/back, left/right
* 5-element array: top, bottom, front, back, left/right
* object with keys top, bottom, front, back, left, right

For example, `'dirt'` or `['dirt']` will return `['dirt', 'dirt', 'dirt', 'dirt', 'dirt', 'dirt']`,
saving you from having to tediously retype dirt over and over. Or `['grass_top', 'dirt', 'grass_side']`,
specifying `grass_top` for the top face, `dirt` for the bottom face, and `grass_side` for everything else.
See `test.js` for more examples.

Inspired by @shama's [voxel-texture](https://github.com/shama/voxel-texture) `_expandName`

## Custom Order
The second argument can optionally be a 6-character string representing the side order requested
for the return value. Examples:

* RTFLBK - used by [voxel-mesher](https://github.com/voxel/voxel-mesher), [ao-mesher](https://github.com/mikolalysenko/ao-mesher)
* KFTBLR - used by [voxel-texture-shader](https://github.com/deathcap/voxel-texture-shader), [voxel-texture](https://github.com/shama/voxel-texture)
* FKTBRL - used in this [Mozilla WebGL cube demo](https://developer.mozilla.org/en-US/docs/Web/WebGL/Using_textures_in_WebGL)

Default order if omitted is 'RTFLBK' (right, top, front, left, bottom, back)

## License

MIT

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