momoa
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.00latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.00
1.1.10
1.1.00
1.0.20
1.0.10
1.0.00
0.0.01

Package Sidebar

Install

npm i momoa

Weekly Downloads

1

Version

1.2.0

License

ISC

Unpacked Size

8.2 kB

Total Files

7

Last publish

Collaborators

  • itaibo