# sbrm

> Scope bound resource management (lisp's with pattern, c++'s raii)

Latest version **1.0.0** (published 2023-03-01) · unlicense license · 0 weekly downloads

## Install

```sh
npm install sbrm
pnpm add sbrm
yarn add sbrm
bun add sbrm
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-03-01 |
| First published | 2023-03-01 |
| Weekly downloads | 0 |
| License | unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bruno Dias |
| Maintainers | diasbruno |
| Keywords | sbrm, scope, resource, management, lisp, with, withpattern, lifecycle, objects |

## Links

- npm: https://www.npmjs.com/package/sbrm
- Repository: https://github.com/diasbruno/sbrm
- Homepage: https://github.com/diasbruno/sbrm#readme
- Issues: https://github.com/diasbruno/sbrm/issues
- npm.io page: https://npm.io/package/sbrm

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-03-01
- 0.1.0 — 2023-03-01

## README

# sbrm - scoped bound resource management

lisp has the `with` pattern which is also present in python.
c++ has RAII (resource acquisition is instantiation).

there are 2 versions:

- scoped

```js
scope(
  () => new $class(),
  (instance) => instance.release()
)(
  (instance) => { /* use the instance */ }
);
```

- scopedClass

```js
class A {
  // acquire the object
  static acquire() { return new A; }
  // release object
  static release(i) { i.release(); }

  constructor() { /* acquire resources */ }
  work() { return 1; }
  release() { /* release stuff */ };
}

scopedClass(A)(
  (instance) => { /* use the instance */ }
);
```

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