New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

time-state

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

time-state

A node package for keeping track of some state across time

latest
Source
npmnpm
Version
1.2.4
Version published
Maintainers
1
Created
Source

Time State

Store and fetch historical values of a state (Flow friendly!)

Installation

$ npm install time-state

Usage

First import time-state

const TS = require('time-state');

Then create a factory (see FactoryOptions)

const factory = TS.factory({/* options */});

Storage

Each factory requires a StorageProvider. time-state provides three options:

MongoDB

time-state will create a timestate and block collection

const storage = await TS.Storage.mongo('mongodb://localhost:27017/testdb');
// OR provide collection names
const storage = await TS.Storage.mongo('mongodb://localhost:27017/testdb', 'timestates', 'blocks');
Memory

time-state will store everything in memory

const storage = TS.Storage.memory();
// Save and load storage.provider.timeStates for persistence
Create your own

Feel free to implement StorageProvider. See storage/mongo.js and storage/memory.js.

Examples

FAQs

Package last updated on 13 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts