JSPM

decorator-cache-getter

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2336
  • Score
    100M100P100Q125542F
  • License MIT

Simple decorator for caching getters on first access

Package Exports

  • decorator-cache-getter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (decorator-cache-getter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Decorator Cache Getter

NPM version NPM downloads Build status Test coverage

Simple decorator for caching getters on first access.

Installation

npm install decorator-cache-getter --save

Usage

import { cache } from "decorator-cache-getter";

class User {
  @cache
  get friends() {
    return sql("SELECT * FROM users WHERE ...")
  }
}

const user = new User()
const friends = await user.friends;

License

MIT