# safer-class

> Flattened classes with non configurable fields.

Latest version **0.2.1** (published 2019-06-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install safer-class
pnpm add safer-class
yarn add safer-class
bun add safer-class
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2019-06-03 |
| First published | 2019-05-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Andrea Giammarchi |
| Maintainers | webreflection |
| Keywords | secure, function, call, apply, bind |

## Links

- npm: https://www.npmjs.com/package/safer-class
- Repository: https://github.com/WebReflection/safer-class
- Homepage: https://github.com/WebReflection/safer-class#readme
- Issues: https://github.com/WebReflection/safer-class/issues
- npm.io page: https://npm.io/package/safer-class

## Dependencies (1)

- [safer-object](https://npm.io/package/safer-object.md) ^0.2.1

## Recent versions

- 0.2.1 (latest) — 2019-06-03
- 0.2.0 — 2019-05-16
- 0.1.0 — 2019-05-15
- 0.0.1 — 2019-05-15
- 0.0.0 — 2019-05-15

## README

# safer-class

<sup>**Social Media Photo by [freestocks.org](https://unsplash.com/@freestocks) on [Unsplash](https://unsplash.com/)**</sup>

[![Build Status](https://travis-ci.com/WebReflection/safer-class.svg?branch=master)](https://travis-ci.com/WebReflection/safer-class) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/safer-class/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/safer-promise?branch=master) ![WebReflection status](https://offline.report/status/webreflection.svg)

Flattened classes with non configurable fields (basically [safer-object](https://github.com/WebReflection/safer-object) applied to classes and prototypes).

```js
import saferClass from 'safer-class';

const MyPromise = saferClass(class extends Promise {});

// even if inherited methods change
Promise.prototype.then = function () {
  throw new Error('Muahahahahaha!');
};

// instances from MyPromise will work like a charm
MyPromise.resolve('whatever').then(() => console.log('all good'));

```

Remember to eventually freeze the instance if you want extra safety.

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