1.2.0 • Published 1 year ago

momoa v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Momoa

CI

Operations with JSONs

Usage

Install the package:

npm install momoa

Then import it in your application and start an instance

import Momoa from 'momoa';
const momoa = new Momoa();

Enlist JSON Array

const multilineString = await momoa.enlist([{ test: 1 }, { test: 2 }, { test: 3 }]).output();
console.log(multilineString);

Output would be:

{"test":1}
{"test":2}
{"test":3}

Unlist JSON String

const array = await momoa.unlist("{\"test\":1}").json();
console.log(array);

Output would be:

[
  { "test": 1 }
]

Gzip results

const gzipped = await momoa.enlist([{ test: 1 }, { test: 2 }, { test: 3 }]).gzip().end();
console.log(gzipped);

Output would be:

<Buffer 1f 8b 08 00 00 00 00 00 00 13 ab 56 2a 49 2d 2e 51 b2 32 ac e5 e5 aa 86 b2 8d 90 d8 c6 40 36 00 64 7b 12 18 24 00 00 00>

UnGzip

const uncompressed = await momoa.ungzip(BUFFER).end();
console.log(uncompressed);

Output would be:

{"test":1}
{"test":2}
{"test":3}

Special thanks

Chaining async functions: Proxymise

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.0

1 year ago