https://github.com/darekf77/typescript-class-helpers
OOP in typescript class.name based.
https://github.com/darekf77/typescript-class-helpers
best-practises class-names helpers-library javascript-minification object-oriented-programming
Last synced: about 1 year ago
JSON representation
OOP in typescript class.name based.
- Host: GitHub
- URL: https://github.com/darekf77/typescript-class-helpers
- Owner: darekf77
- Created: 2019-01-02T17:40:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T04:24:49.000Z (about 2 years ago)
- Last Synced: 2024-05-22T12:39:55.868Z (about 2 years ago)
- Topics: best-practises, class-names, helpers-library, javascript-minification, object-oriented-programming
- Language: TypeScript
- Homepage:
- Size: 6.06 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# firedev-class-helpers (typescript-class-helpers)
- Part of [firedev.io](https://github.com/darekf77/firedev)
- Helpers for OOP (Object Oriented Programming) in TypeScript.
- Keep classnames metadata when minifying code (uglifyjs, webpack)
- Purpose:
+ take advantage of classes in TypeScript/JavaScript in most glegant way
+ prevent unusable class names during JS minification
## Installation:
```
npm i typescript-class-helpers
```
## Class manipulations (in nodejs)
```ts
import { CLASS } from 'typescript-class-helpers';
@CLASS.NAME('Example')
class Example {
}
console.log(CLASS.getName(Example) === 'Example') // true
console.log(CLASS.getNameFromObject(new Example()) === 'Example') // true
console.log(CLASS.getBy('Example') === Example) // true
```
## Class manipulations (in browser)
```ts
import { CLASS } from 'typescript-class-helpers/browser';
@CLASS.NAME('Example')
class Example {
}
console.log(CLASS.getName(Example) === 'Example') // true
console.log(CLASS.getNameFromObject(new Example()) === 'Example') // true
console.log(CLASS.getBy('Example') === Example) // true
```
This way you can use you class names even after uglify process.