Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/js-lib

Package Overview
Dependencies
Maintainers
3
Versions
525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/js-lib - npm Package Compare versions

Comparing version 4.5.0 to 4.5.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [4.5.1](https://github.com/NaturalCycles/js-lib/compare/v4.5.0...v4.5.1) (2019-04-08)
### Bug Fixes
* **memo:** disable 0-arg optimization ([56ff7d4](https://github.com/NaturalCycles/js-lib/commit/56ff7d4))
# [4.5.0](https://github.com/NaturalCycles/js-lib/compare/v4.4.1...v4.5.0) (2019-03-30)

@@ -2,0 +9,0 @@

22

dist-esm/decorators/memo.decorator.js

@@ -13,3 +13,3 @@ // Based on:

/* tslint:disable:no-invalid-this */
import { jsonMemoSerializer, MapMemoCache, SingleValueMemoCache } from './memo.util';
import { jsonMemoSerializer, MapMemoCache } from './memo.util';
/**

@@ -28,13 +28,17 @@ * Memoizes the method of the class, so it caches the output and returns the cached version if the "key"

const originalFn = descriptor.value;
// console.log('len: ' + originalFn.length)
let cache;
// console.log(`${key} len: ${originalFn.length}`)
// todo: optimization disabled until "default arg value" use case is solved (see memo.decorator.test.ts)
/*
let cache: MemoCache
// Function with 0 arguments
if (!originalFn.length) {
cache = new SingleValueMemoCache();
cache = new SingleValueMemoCache()
} else {
// Function with > 0 arguments
cache = new MapMemoCache()
// cache = new ObjectMemoCache()
}
else {
// Function with > 0 arguments
cache = new MapMemoCache();
// cache = new ObjectMemoCache()
}
*/
const cache = new MapMemoCache();
descriptor.value = function (...args) {

@@ -41,0 +45,0 @@ const cacheKey = jsonMemoSerializer(args);

@@ -29,13 +29,17 @@ "use strict";

const originalFn = descriptor.value;
// console.log('len: ' + originalFn.length)
let cache;
// console.log(`${key} len: ${originalFn.length}`)
// todo: optimization disabled until "default arg value" use case is solved (see memo.decorator.test.ts)
/*
let cache: MemoCache
// Function with 0 arguments
if (!originalFn.length) {
cache = new memo_util_1.SingleValueMemoCache();
cache = new SingleValueMemoCache()
} else {
// Function with > 0 arguments
cache = new MapMemoCache()
// cache = new ObjectMemoCache()
}
else {
// Function with > 0 arguments
cache = new memo_util_1.MapMemoCache();
// cache = new ObjectMemoCache()
}
*/
const cache = new memo_util_1.MapMemoCache();
descriptor.value = function (...args) {

@@ -42,0 +46,0 @@ const cacheKey = memo_util_1.jsonMemoSerializer(args);

{
"name": "@naturalcycles/js-lib",
"version": "4.5.0",
"version": "4.5.1",
"scripts": {

@@ -5,0 +5,0 @@ "build": "del ./dist && tsc",

@@ -16,3 +16,3 @@ // Based on:

import { jsonMemoSerializer, MapMemoCache, MemoCache, SingleValueMemoCache } from './memo.util'
import { jsonMemoSerializer, MapMemoCache, MemoCache } from './memo.util'

@@ -37,4 +37,6 @@ /**

const originalFn = descriptor.value
// console.log('len: ' + originalFn.length)
// console.log(`${key} len: ${originalFn.length}`)
// todo: optimization disabled until "default arg value" use case is solved (see memo.decorator.test.ts)
/*
let cache: MemoCache

@@ -50,2 +52,4 @@

}
*/
const cache: MemoCache = new MapMemoCache()

@@ -52,0 +56,0 @@ descriptor.value = function (...args: any[]): any {

Sorry, the diff of this file is not supported yet

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