# light-stub

> hbq-stub

Latest version **0.0.1** (published 2017-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install light-stub
pnpm add light-stub
yarn add light-stub
bun add light-stub
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-12-06 |
| First published | 2017-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.6 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | hubiqing |
| Maintainers | g120hbq |
| Keywords | typescript, stub |

## Links

- npm: https://www.npmjs.com/package/light-stub
- Repository: https://github.com/githbq/hbq-stub
- Homepage: https://github.com/githbq/hbq-stub#readme
- Issues: https://github.com/githbq/hbq-stub/issues
- npm.io page: https://npm.io/package/light-stub

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.6.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-12-06

## README

> stub: 存根,对对象属性赋值时,进行一个存根方便恢复之前的值

![my love](./logo.png)
## Install
```shell
yarn add light-stub
```

## Code
```javascript
module.exports = Stubs

function Stubs() { }

Stubs.prototype = Object.create(Array.prototype)

Stubs.prototype.stub = function (obj, prop, value) {
  this.push([obj, prop, obj[prop]])
  obj[prop] = value
}

Stubs.prototype.restore = function () {
  let stub
  while (stub = this.pop()) stub[0][stub[1]] = stub[2]
}

```

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