Socket
Socket
Sign inDemoInstall

@thi.ng/memoize

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/memoize - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/memoize@1.1.1...@thi.ng/memoize@1.1.2) (2019-07-31)
**Note:** Version bump only for package @thi.ng/memoize
## [1.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/memoize@1.1.0...@thi.ng/memoize@1.1.1) (2019-07-12)

@@ -8,0 +16,0 @@

50

lib/index.umd.js

@@ -1,49 +0,1 @@

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory((global.thi = global.thi || {}, global.thi.ng = global.thi.ng || {}, global.thi.ng.memoize = {})));
}(this, function (exports) { 'use strict';
const cache = {};
const defonce = (id, factory) => cache.hasOwnProperty(id) ? cache[id] : (cache[id] = factory());
function memoize(fn, cache) {
return (...args) => {
let res;
return cache.has(args)
? cache.get(args)
: (cache.set(args, (res = fn.apply(null, args))), res);
};
}
function memoize1(fn, cache) {
!cache && (cache = new Map());
return (x) => {
let res;
return cache.has(x)
? cache.get(x)
: (cache.set(x, (res = fn(x))), res);
};
}
function memoizeJ(fn, cache) {
!cache && (cache = {});
return (...args) => {
const key = JSON.stringify(args);
if (key !== undefined) {
return key in cache
? cache[key]
: (cache[key] = fn.apply(null, args));
}
return fn.apply(null, args);
};
}
exports.defonce = defonce;
exports.memoize = memoize;
exports.memoize1 = memoize1;
exports.memoizeJ = memoizeJ;
Object.defineProperty(exports, '__esModule', { value: true });
}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.memoize={}))}(this,function(e){"use strict";const t={};e.defonce=(e,n)=>t.hasOwnProperty(e)?t[e]:t[e]=n(),e.memoize=function(e,t){return(...n)=>{let i;return t.has(n)?t.get(n):(t.set(n,i=e.apply(null,n)),i)}},e.memoize1=function(e,t){return!t&&(t=new Map),n=>{let i;return t.has(n)?t.get(n):(t.set(n,i=e(n)),i)}},e.memoizeJ=function(e,t){return!t&&(t={}),(...n)=>{const i=JSON.stringify(n);return void 0!==i?i in t?t[i]:t[i]=e.apply(null,n):e.apply(null,n)}},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@thi.ng/memoize",
"version": "1.1.1",
"version": "1.1.2",
"description": "Function memoization with configurable caches",

@@ -17,21 +17,22 @@ "module": "./index.js",

"scripts": {
"build": "yarn clean && yarn build:es6 && yarn build:bundle",
"build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module",
"build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all",
"build:es6": "tsc --declaration",
"build:bundle": "../../scripts/bundle-module",
"test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js",
"build:test": "rimraf build && tsc -p test/tsconfig.json",
"test": "yarn build:test && mocha build/test/*.js",
"cover": "yarn build:test && nyc mocha build/test/*.js && nyc report --reporter=lcov",
"clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib",
"cover": "yarn test && nyc report --reporter=lcov",
"doc": "node_modules/.bin/typedoc --mode modules --out doc --ignoreCompilerErrors src",
"pub": "yarn build && yarn publish --access public"
"pub": "yarn build:release && yarn publish --access public"
},
"devDependencies": {
"@types/mocha": "^5.2.6",
"@types/node": "^12.0.8",
"@types/node": "^12.6.3",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"typedoc": "^0.14.2",
"typescript": "^3.5.2"
"typescript": "^3.5.3"
},
"dependencies": {
"@thi.ng/api": "^6.3.1"
"@thi.ng/api": "^6.3.2"
},

@@ -49,3 +50,3 @@ "keywords": [

"sideEffects": false,
"gitHead": "47075afc37f3a16adee7c903a2935304c7cf5daf"
"gitHead": "53eec7988c378fc37ae140e7174f36ef9b6208fe"
}
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