New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@binyamin/data-cache

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@binyamin/data-cache - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

index.d.ts

20

index.js
const fs = require("fs");
const path = require("path");
const datacache = {};
const _cachedir = path.join(process.cwd(), ".cache");
function _initCache() {

@@ -16,7 +14,7 @@ if(fs.existsSync(_cachedir) === false) {

* Set a value
* @param {String} key - Uses dot-notation (no brackets)
* @param {String|JSON} value - data to store
* @param {string} key - Uses dot-notation (no brackets)
* @param {*} value - data to store
*/
datacache.set = function(key, value, ext="") {
function set(key, value, ext="") {
_initCache();

@@ -38,8 +36,7 @@

* Retrieve a value
* @param {String} key - Uses dot-notation (no brackets)
* @param {string} key - Uses dot-notation (no brackets)
* @param {BufferEncoding} [encoding="utf-8"] - (Optional)
* @returns {String|undefined}
* @returns {*}
*/
datacache.get = function(key, encoding="utf8") {
function get(key, encoding="utf8") {
const keypath = path.resolve(_cachedir, key.replace(/\./g, path.sep));

@@ -57,2 +54,5 @@

module.exports = datacache
module.exports = {
get,
set
}
{
"name": "@binyamin/data-cache",
"private": false,
"version": "1.0.1",
"version": "1.1.0",
"description": "Tiny module for caching data",

@@ -11,11 +11,15 @@ "main": "index.js",

"files": [
"index.js"
"index.js",
"index.d.ts"
],
"devDependencies": {
"@types/node": "^14.10.2",
"chai": "^4.2.0",
"mocha": "^8.1.3",
"mock-fs": "^4.13.0"
"mock-fs": "^4.13.0",
"typescript": "^4.0.2"
},
"scripts": {
"test": "mocha"
"test": "mocha",
"types": "tsc index.js --allowJS --declaration --emitDeclarationOnly"
},

@@ -22,0 +26,0 @@ "repository": {

@@ -1,5 +0,7 @@

# node-data-cache
[![Build Status](https://travis-ci.com/binyamin/data-cache.svg?branch=main)](https://travis-ci.com/binyamin/data-cache)
Tiny module for caching data
# Data-Cache
[![npm bundle size](https://img.shields.io/bundlephobia/min/@binyamin/data-cache)](https://npmjs.com/package/@binyamin/data-cache)
[![CI Test](https://github.com/binyamin/data-cache/workflows/Test/badge.svg)](https://github.com/binyamin/data-cache/actions)
> A tiny npm module for caching data
## Install

@@ -6,0 +8,0 @@ ```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc