@emotion/weak-memoize
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -1,2 +0,2 @@ | ||
export * from '../types' | ||
export { default } from '../types' | ||
declare let weakMemoize: <Arg extends object, Return>(func: (arg: Arg) => Return) => (arg: Arg) => Return; | ||
export default weakMemoize; |
@@ -6,7 +6,7 @@ 'use strict'; | ||
var weakMemoize = function weakMemoize(func) { | ||
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps | ||
var cache = new WeakMap(); | ||
return function (arg) { | ||
if (cache.has(arg)) { | ||
// $FlowFixMe | ||
// Use non-null assertion because we just checked that the cache `has` it | ||
// This allows us to remove `undefined` from the return value | ||
return cache.get(arg); | ||
@@ -13,0 +13,0 @@ } |
@@ -6,7 +6,7 @@ 'use strict'; | ||
var weakMemoize = function weakMemoize(func) { | ||
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps | ||
var cache = new WeakMap(); | ||
return function (arg) { | ||
if (cache.has(arg)) { | ||
// $FlowFixMe | ||
// Use non-null assertion because we just checked that the cache `has` it | ||
// This allows us to remove `undefined` from the return value | ||
return cache.get(arg); | ||
@@ -13,0 +13,0 @@ } |
var weakMemoize = function weakMemoize(func) { | ||
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps | ||
var cache = new WeakMap(); | ||
return function (arg) { | ||
if (cache.has(arg)) { | ||
// $FlowFixMe | ||
// Use non-null assertion because we just checked that the cache `has` it | ||
// This allows us to remove `undefined` from the return value | ||
return cache.get(arg); | ||
@@ -8,0 +8,0 @@ } |
{ | ||
"name": "@emotion/weak-memoize", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "A memoization function that uses a WeakMap", | ||
"main": "dist/emotion-weak-memoize.cjs.js", | ||
"module": "dist/emotion-weak-memoize.esm.js", | ||
"types": "types/index.d.ts", | ||
"types": "dist/emotion-weak-memoize.cjs.d.ts", | ||
"license": "MIT", | ||
@@ -18,8 +18,7 @@ "repository": "https://github.com/emotion-js/emotion/tree/main/packages/weak-memoize", | ||
"@definitelytyped/dtslint": "0.0.112", | ||
"typescript": "^4.5.5" | ||
"typescript": "^5.4.5" | ||
}, | ||
"files": [ | ||
"src", | ||
"dist", | ||
"types/*.d.ts" | ||
"dist" | ||
], | ||
@@ -26,0 +25,0 @@ "exports": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5807
16
78