Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

kevast/kevast-memory.js

Repository files navigation

kevast-memory.js

Build Status Coverage Status Dependencies Dev Dependencies Package Version Open Issues MIT License

A memory storage for kevast.js.

Installation

Node.js

Using yarn

yarn add kevast-memory

Using npm

npm install kevast-memory

Browser

<script src="https://cdn.jsdelivr.net/npm/kevast-memory/dist/kevast-memory.min.js"></script>

Usage

const { Kevast } = require('kevast');
const { KevastMemory } = require('kevast-memory');
const assert = require('assert');

(async () => {
  const kevast = new Kevast(new KevastMemory());
  await kevast.set('key', 'value');
  assert(await kevast.get('key') === 'value');
})();

Specify Map:

const { Kevast } = require('kevast');
const { KevastMemory } = require('kevast-memory');
const assert = require('assert');

(async () => {
  const map = new Map();
  const kevast = new Kevast(new KevastMemory(map));
  await kevast.set('key', 'value');
  assert(map.get('key') === 'value');
})();