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

cachit

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachit

A small, flexible, promisey, backend-agnostic caching helper function

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Cachit

A little backend-agnostic caching helper for JavaScript

Installation (NodeJS)

npm install cachit

Usage

var cachit, cache
if (typeof(require) === 'function')
  cachit = require('cachit')
else if (!!window)
  cachit = window.cachit
cache = cachit()
cache('foo', function() { console.log("Running foo!"); return "Foo." })
cache('foo', function() { console.log("Running foo!"); return "Foo." })

The preceding code will print "Running foo!" just once, as the second time, the return value of the function has been cached (in memory), and it will be returned.

Keywords

cache

FAQs

Package last updated on 11 Sep 2015

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