# urals-fnjs-function-serializer

> Function serializer, inspired by stackoverfow answer: https://stackoverflow.com/questions/7395686/how-can-i-serialize-a-function-in-javascript

Latest version **0.0.3** (published 2023-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install urals-fnjs-function-serializer
pnpm add urals-fnjs-function-serializer
yarn add urals-fnjs-function-serializer
bun add urals-fnjs-function-serializer
```

## 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.3 |
| Published | 2023-07-31 |
| First published | 2023-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Anatoly Starodubtsev |
| Maintainers | pantagruel74 |
| Keywords | uralsjs, function, serialize |

## Links

- npm: https://www.npmjs.com/package/urals-fnjs-function-serializer
- npm.io page: https://npm.io/package/urals-fnjs-function-serializer

## Recent versions

- 0.0.3 (latest) — 2023-07-31
- 0.0.2 — 2023-07-30

## README

# urals-fnjs-function-serializer
Function serializer, inspired by stackoverfow answer: 
https://stackoverflow.com/questions/7395686/how-can-i-serialize-a-function-in-javascript

## Description
Json serializer able to serialize pure functions

## Example
```typescript
import * as index from "urals-fnjs-function-serializer";

const obj = {
    a: 12,
    b: (x) => x + 2,
    c: [3, 14, (a, b) => (a + b)],
    d: "alsd"
}
const serialized = index.serialize(obj);
const deserialized = index.deserialise(serialized) as any
assert.strictEqual(deserialized.b(4), 6)
assert.strictEqual(deserialized.a, 12)
assert.strictEqual(deserialized.c[0], 3)
assert.strictEqual(deserialized.c[1], 14)
assert.strictEqual(deserialized.c[2](2, 5), 7)
assert.strictEqual(deserialized.d, "alsd")
```

## Author
Anatoly Starodubtsev
tostar74@mail.ru

## Licence
MIT

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