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

1.2.2 • Public • Published

bson-util

bson-util is a super light (0.5K) and fast circular JSON and BSON serializer and parser. This package is supported on all browsers

Install

npm install bson-util

Features

  • stringifies and parses json documents
  • Observe the structural differences between two objects.
  • Supports different result structure based on different needs such as Restful APIs, or MongoDB patches.

Importing

nodejs

// ESM
import {parse, stringify} from 'bson-util';

// CJS
const {parse, stringify} = require('bson-util');

Examples

You can find more samples in main.test.ts.

let A: any = {b: new ObjectID(), c: 1};
A.a = A;

let newA = parse(stringify(A, true), true);
// newA == A

Package Sidebar

Install

npm i bson-util

Weekly Downloads

0

Version

1.2.2

License

ISC

Unpacked Size

9.2 kB

Total Files

5

Last publish

Collaborators

  • farhadjalali
  • jilaamini