npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lazycrate

v1.0.4

Published

Lazily serialize and deserialize variables

Readme

Lazycrate

Build Status Coverage Node LTS Node v15+

Lazily and easily serialize and deserialize variables

const lazycrate = require('laycrate').sync; // Use the synchronous version

function stringifiedClass() {

  // Test class
  class TestClass {
    constructor() {
      this.creationTime = new Date();
    }
    getCreationTime() {
      return this.creationTime;
    }
  }

  const test = new TestClass();

  return lazycrate.box(test); // Convert our object into a string!
}

const stringClass = stringifiedClass(); // Our class is now converted into a string

console.log(stringClass);

const revivedClass = lazycrate.unbox(stringClass);  // Convert the string back into the class!

console.log(revivedClass.getCreationTime().toLocaleDateString()); // This works!

Installation

npm install lazycrate

Features

  • Serialize and deserialize variables
  • Accepts primitives and objects
  • Compress serialized objects
  • Synchronous and asynchronous boxing/unboxing

Full List of Supported Primitives & Objects

Synchronous

lazycrate.sync.box(object)

  • object: <Variable> Variable to be serialized
  • Returns: <String> Serialized version of the variable. Can be compressed.

lazycrate.sync.unbox(string)

  • string: <String> | <Buffer> Serialized content
  • Returns: <Variable> Deserialized variable created from boxing

Example:

const { unbox, box } = require('lazycrate').sync;
let unserialized = {
  content: 'Hello World'
}
let serialized = box(unserialized);
console.log(unbox(serialized));
/*
  {
    content: 'Hello World'
  }
*/

Asynchronous

For the most part, the asynchronous code is available due to the usage of Brotli compression.

lazycrate.box(object)

  • object: <Variable> Variable to be serialized
  • Returns: <String> Serialized version of the variable. Can be compressed.

lazycrate.unbox(string)

  • string: <String> | <Buffer> Serialized content
  • Returns: <Variable> Deserialized variable created from boxing

Example:

const { unbox, box } = require('lazycrate');
let unserialized = {
  content: 'Hello World'
}
(async function(){
  let serialized = await box(unserialized);
  console.log(await unbox(serialized));
  /*
    {
      content: 'Hello World'
    }
  */
})();

Supported Primitives & Objects

  • [ ] Object
    • [x] Object
    • [x] Date
    • [x] Map
      • [x] Map
      • [ ] WeakMap
    • [x] Set
      • [x] Set
      • [ ] WeakSet
    • [x] RegExp
    • [x] Boolean
    • [x] Number
    • [x] String
    • [ ] Error
      • [x] Error
      • [x] AggregateError
      • [x] EvalError
      • [x] RangeError
      • [x] ReferenceError
      • [x] SyntaxError
      • [x] TypeError
      • [x] URIError
      • [ ] InternalError
    • [x] DataView
    • [x] Array
      • [x] ArrayBuffer
      • [x] SharedArrayBuffer
      • [x] BigInt64Array
      • [x] BigUint64Array
      • [x] Float32Array
      • [x] Float64Array
      • [x] Int8Array
      • [x] Int16Array
      • [x] Int32Array
      • [x] Uint8Array
      • [x] Uint16Array
      • [x] Uint32Array
      • [x] Uint8ClampedArray
    • [x] Buffer
    • [ ] Generator
    • [ ] Proxy
    • [ ] FinalizationRegistry
    • [ ] Promise
    • [ ] WeakRef
  • [x] undefined
  • [x] Boolean
  • [x] Number
  • [x] BigInt
  • [x] String
  • [x] Symbol
  • [x] Function
    • [x] Function
    • [x] AsyncFunction
    • [x] AsyncGeneratorFunction
    • [x] GeneratorFunction