4.0.0 • Published 2 years ago

@straw-hat/fancy-map v4.0.0

Weekly downloads
10
License
MIT
Repository
github
Last release
2 years ago

@straw-hat/fancy-map

Usage

import * as fs from 'fs';
import { FancyMap } from '@straw-hat/fancy-map';

// It has all the functionalities of a Map
const map = new FancyMap<string, string>();

function readTemplate(key: string) {
  // The callback will be trigger only when `key` is not found in the map.
  // It could be useful to do some caching.
  return fs.promises.readFile('some/path/to/file', { encoding: 'utf-8' });
}

await map.getOrSet('template', readTemplate);
// You could also use `getOrSetSync`
4.0.0

2 years ago

3.0.1

3 years ago

2.0.0

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago