Git Product home page Git Product logo

alexjpotter / low-cal-storage Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 82 KB

A lightweight wrapper around window.localStorage that slims down your data for storage and fattens it up again on retrieval.

Home Page: https://www.npmjs.com/package/low-cal-storage

JavaScript 100.00%
localstorage localstorage-wrapper localstorage-adapter slim storage retrieval optimisation optimization optimize optimizer

low-cal-storage's Introduction

low-cal-storage

NB: This package is a work in progress.

low-cal-storage is a lightweight wrapper around window.localStorage that slims down your data for storage and fattens it up again on retrieval.

Do I need low-cal-storage?

For most use-cases plain old localStorage is good enough - but if you want to store a significant amount of similarly shaped data (i.e. large arrays of objects of the same type) with localStorage, you may find that you reach the browser limit quite fast. low-cal-storage replaces long object keys with shorter ones for storage purposes, and maps them back on retrieval.

Installation

With npm:

npm install low-cal-storage --save

With yarn:

yarn add low-cal-storage --save

Usage

import lowCal from 'low-cal-storage';

const myObject = { hello: 'world' };

// Store the object in "low-cal-storage" - note that we do not need to stringify first
lowCal.setItem('my object', myObject);

// Retrieve the object from "low-cal-storage" - note that we do not need to parse the result
const retrievedObject = lowCal.getItem('my object');

// Clear "low-cal-storage" out
lowCal.clear();

low-cal-storage's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.