# thin-wrap

> Thin Class Wrapper

Latest version **0.0.3** (published 2017-01-19) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install thin-wrap
pnpm add thin-wrap
yarn add thin-wrap
bun add thin-wrap
```

## 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.0.3 |
| Published | 2017-01-19 |
| First published | 2017-01-19 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tetsuya Mori |
| Maintainers | t2ym |
| Keywords | ES6, ES2015, wrap |

## Links

- npm: https://www.npmjs.com/package/thin-wrap
- Repository: https://github.com/t2ym/thin-wrap
- Homepage: https://github.com/t2ym/thin-wrap#readme
- Issues: https://github.com/t2ym/thin-wrap/issues
- npm.io page: https://npm.io/package/thin-wrap

## Recent versions

- 0.0.3 (latest) — 2017-01-19
- 0.0.2 — 2017-01-19
- 0.0.1 — 2017-01-19

## README

[![npm](https://img.shields.io/npm/v/thin-wrap.svg)](https://www.npmjs.com/package/thin-wrap)
[![Bower](https://img.shields.io/bower/v/thin-wrap.svg)](https://customelements.io/t2ym/thin-wrap/)

# thin-wrap

Thin Class Wrapper (experimental)

```javascript
function loggerForwarder(prop, f, args, self, newTarget) { 
  console.log('wrap: ' + (newTarget ? 'new ' : '') + f.name + ' is called for ', (self && self.name ? self.name : self), 'with arguments', args);
  return newTarget ? Reflect.construct(f, args) : f.apply(self, args);
}
wrap(XMLHttpRequest, loggerForwarder);
wrap(EventTarget, loggerForwarder);
```

## Install

### Browsers

```sh
  bower install --save thin-wrap
```

### NodeJS

```sh
  npm install --save thin-wrap
```

## Import

### Browsers

```html
<script src="path/to/bower_components/thin-wrap/wrap.js"></script>
```

### NodeJS

```javascript
const wrap = require('thin-wrap/wrap.js');
```

## API

TBD

## Advantages

- Small overheads (Significantly faster than ES6 Proxy)
- `this` is unique and identical for each instance

## Known Limitations

### Architectural Limitations

- `Class !== Class.prototype.constructor`
- `new Class()` is not trackable
- `new Class.prototype.constructor()` or `new (wrap(Class))()` is trackable
- Properties without setter/getter are not trackable

### Current Design Limitations

- Inherited properties are not tracked
- Generation of setter/getter for properties are not implemented

## License

[BSD-2-Clause](https://github.com/t2ym/thin-wrap/blob/master/LICENSE.md)

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