# get-class-function-names

> Get all function names of a class up to a specified prototype.

Latest version **1.2.0** (published 2023-08-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install get-class-function-names
pnpm add get-class-function-names
yarn add get-class-function-names
bun add get-class-function-names
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-08-21 |
| First published | 2020-10-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Maximilian Mairinger |
| Maintainers | zzrv |
| Keywords | get, class, function, names |

## Links

- npm: https://www.npmjs.com/package/get-class-function-names
- Repository: https://github.com/maximilianMairinger/getClassFunctionNames
- Homepage: https://github.com/maximilianMairinger/getClassFunctionNames#readme
- Issues: https://github.com/maximilianMairinger/getClassFunctionNames/issues
- npm.io page: https://npm.io/package/get-class-function-names

## Recent versions

- 1.2.0 (latest) — 2023-08-21
- 1.1.5 — 2023-06-10
- 1.1.4 — 2022-06-28
- 1.1.3 — 2022-06-28
- 1.1.2 — 2020-11-18
- 1.1.1 — 2020-11-01
- 1.1.0 — 2020-11-01
- 1.0.0 — 2020-10-29
- 0.0.1 — 2020-10-29

## README

# Get class function names

Get all function names of a class up to a specified prototype.


## Installation

```shell
 $ npm i get-class-function-names
```

## Usage

Given the class `AA` extending Array:

```ts
class AA extends Array {
  qq() {

  }
  ww() {

  }
}
```

The method names up to `Array` / `Object` can be found like below:

```ts
import getClassFunctionNames from "get-class-function-names"

getClassFunctionNames(AA, Array)   // ["qq", "ww"]
getClassFunctionNames(AA)          // ["qq", "ww", "length", "concat", "copyWithin", "fill", ...]
```

### Filter

If you wanted to filter out only function names (thus omitting properties like length) you could:

```ts
getClassFunctionNames(AA, {includeInstanceOf: Function})   // ["qq", "ww", "concat", "copyWithin", "fill", ...]
getClassFunctionNames(AA, {excludeInstanceOf: "number"})   // ["qq", "ww", "concat", "copyWithin", "fill", ...]
```

> Note: that the constructor is always omitted

If you want to white / blacklist additional names do:

```ts
getClassFunctionNames(AA, {excludeInstanceOf: "number"})   // ["qq", "ww", "concat", "copyWithin", "fill", ...]s
getClassFunctionNames(AA, {includeInstanceOf: Function})   // ["qq", "ww", "concat", "copyWithin", "fill", ...]s
```

> Note: that length is missing in the above example


## Contribute

All feedback is appreciated. Create a pull request or write an issue.

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