# enum2array

> A function to help converting enums to an array

Latest version **2023.3.19** (published 2023-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install enum2array
pnpm add enum2array
yarn add enum2array
bun add enum2array
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2023.3.19 |
| Published | 2023-03-19 |
| First published | 2021-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Samet ÇELİKBIÇAK |
| Maintainers | sametcelikbicak |
| Keywords | enum, array, enum to array, enum2array, front-end, frontend |

## Links

- npm: https://www.npmjs.com/package/enum2array
- Repository: https://github.com/sametcelikbicak/enum2array
- Homepage: https://github.com/sametcelikbicak/enum2array#readme
- Issues: https://github.com/sametcelikbicak/enum2array/issues
- npm.io page: https://npm.io/package/enum2array

## Recent versions

- 2023.3.19 (latest) — 2023-03-19
- 2023.1.2 — 2023-01-02
- 2022.12.5 — 2022-12-05
- 2022.11.11 — 2022-11-11
- 2022.10.23 — 2022-10-23
- 2022.9.10 — 2022-09-10
- 2022.8.6 — 2022-08-06
- 1.1.30 — 2022-07-04
- 1.1.29 — 2022-06-03
- 1.1.28 — 2022-05-11
- 1.1.27 — 2022-04-02
- 1.1.26 — 2022-03-29
- 1.1.25 — 2022-03-19
- 1.1.24 — 2022-02-09
- 1.1.23 — 2022-01-02
- … 30 more at https://npm.io/package/enum2array/versions

## README

<div align="center">
 <img src="assets/enum2array.svg" alt="Logo" width="256" height="256">

# Enum2Array  
![npm](https://img.shields.io/npm/v/enum2array?color=g&label=enum2array&logo=npm) ![npm](https://img.shields.io/npm/dy/enum2array?label=Downloads&logo=npm) [![CodeQL Analyze](https://github.com/sametcelikbicak/enum2array/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/sametcelikbicak/enum2array/actions/workflows/codeql-analysis.yml) [![Build & Test](https://github.com/sametcelikbicak/enum2array/actions/workflows/build-test.yml/badge.svg)](https://github.com/sametcelikbicak/enum2array/actions/workflows/build-test.yml) ![dependabot](https://img.shields.io/badge/Dependabot-active-g?logo=dependabot)

 ![GitHub Repo stars](https://img.shields.io/github/stars/sametcelikbicak/enum2array?style=social)
 
A function to help converting enums to an array. Define an enum then use this function to convert that enum to an array.
</div>

## Installation

```
npm i enum2array
```

## Usage

### Define an enum for testing
```typescript
export enum CustomType {
    TypeA = 1,
    TypeB = 2,
    TypeC = 3,
    TypeD = 4,
}

export enum CustomValue {
    TypeA = "valueA",
    TypeB = "valueB",
    TypeC = "valueC",
    TypeD = "valueD",
}
```

### Usage enum2array function

```typescript
import { enum2array } from "enum2array";

console.log(enum2array(CustomType));

console.log(enum2array(CustomValue));
```

## Results

### That is the result about function with "CustomType" enum

```
(4) [ArrayValue, ArrayValue, ArrayValue, ArrayValue]
0: ArrayValue {title: "TypeA", value: 1}
1: ArrayValue {title: "TypeB", value: 2}
2: ArrayValue {title: "TypeC", value: 3}
3: ArrayValue {title: "TypeD", value: 4}
length: 4
__proto__: Array(0)
```

### That is the result about function with "CustomValue" enum

```
(4) [ArrayValue, ArrayValue, ArrayValue, ArrayValue]
0: ArrayValue {title: "TypeA", value: "valueA"}
1: ArrayValue {title: "TypeB", value: "valueB"}
2: ArrayValue {title: "TypeC", value: "valueC"}
3: ArrayValue {title: "TypeD", value: "valueD"}
length: 4
__proto__: Array(0)
```

### Want to contribute?
You can read and follow our [CONTRIBUTING.md](CONTRIBUTING.md) and report it using
[GitHub Issues](https://github.com/sametcelikbicak/enum2array/issues)! for reporting bugs, suggesting enhancements, bugfixes, new features and extras are welcome.


## Contributors ✨
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center"><a href="https://sametcelikbicak.com/"><img src="https://avatars.githubusercontent.com/u/5312741?v=4?s=100" width="100px;" alt="Samet ÇELİKBIÇAK"/><br /><sub><b>Samet ÇELİKBIÇAK</b></sub></a><br /><a href="#infra-sametcelikbicak" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/sametcelikbicak/enum2array/commits?author=sametcelikbicak" title="Code">💻</a> <a href="https://github.com/sametcelikbicak/enum2array/issues?q=author%3Asametcelikbicak" title="Bug reports">🐛</a> <a href="https://github.com/sametcelikbicak/enum2array/commits?author=sametcelikbicak" title="Documentation">📖</a> <a href="#example-sametcelikbicak" title="Examples">💡</a> <a href="#maintenance-sametcelikbicak" title="Maintenance">🚧</a> <a href="https://github.com/sametcelikbicak/enum2array/commits?author=sametcelikbicak" title="Tests">⚠️</a></td>
    </tr>
  </tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->


This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

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