https://github.com/supercharge/classes
Class utilities for Node.js and JavaScript
https://github.com/supercharge/classes
class nodejs supercharge utilities
Last synced: 5 months ago
JSON representation
Class utilities for Node.js and JavaScript
- Host: GitHub
- URL: https://github.com/supercharge/classes
- Owner: supercharge
- License: mit
- Created: 2020-02-12T10:09:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-10-08T14:15:37.000Z (about 3 years ago)
- Last Synced: 2025-04-17T01:13:59.879Z (6 months ago)
- Topics: class, nodejs, supercharge, utilities
- Language: JavaScript
- Homepage:
- Size: 54.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
Classes
Class utilities for Node.js and JavaScript
Installation ·
Usage ·
API
Follow @marcuspoehls and @superchargejs for updates!
---
## Introduction
The `@supercharge/classes` package provides a handful methods around classes in Node.js and JavaScript. For example, determine whether a given input is a class using the `.isClass(input)` method.## Installation
```
npm i @supercharge/classes
```## Usage
Using `@supercharge/classes` is pretty straightforward. Install and import the package and use it right away:```js
const { isClass } = require('@supercharge/classes')isClass(class Rabbit {})
// trueisClass(function classLikeRabbitFunc () {})
// false
```## API
#### `isClass(input)`
Determine whether the given `input` is a class.```js
const { isClass } = require('@supercharge/classes')isClass(class YourClass {})
// true
```#### `isFunction(input)`
Determine whether the given `input` is a function.```js
const { isFunction } = require('@supercharge/classes')isFunction(function sum () {})
// true
```## Contributing
Do you miss a class-related function? We very much appreciate your contribution! Please send in a pull request 😊1. Create a fork
2. Create your feature branch: `git checkout -b my-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request 🚀## License
MIT © [Supercharge](https://superchargejs.com)---
> [superchargejs.com](https://superchargejs.com) ·
> GitHub [@supercharge](https://github.com/supercharge) ·
> Twitter [@superchargejs](https://twitter.com/superchargejs)