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

ylru

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ylru - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

6

History.md
1.2.1 / 2018-07-11
==================
**others**
* [[`475abb0`](http://github.com/node-modules/ylru/commit/475abb0e9c787fd65d7c3dd3d2d74d67560b0bec)] - perf: only call Date.now() when necessary (#3) (Yiyu He <<dead_horse@qq.com>>)
1.2.0 / 2017-07-18

@@ -3,0 +9,0 @@ ==================

17

index.js

@@ -14,6 +14,11 @@ 'use strict';

const maxAge = options && options.maxAge;
// only call Date.now() when necessary
let now;
function getNow() {
now = now || Date.now();
return now;
}
if (item) {
const now = Date.now();
// check expired
if (item.expired && now > item.expired) {
if (item.expired && getNow() > item.expired) {
item.expired = 0;

@@ -24,3 +29,3 @@ item.value = undefined;

if (maxAge !== undefined) {
const expired = maxAge ? now + maxAge : 0;
const expired = maxAge ? getNow() + maxAge : 0;
item.expired = expired;

@@ -35,5 +40,4 @@ }

if (item) {
const now = Date.now();
// check expired
if (item.expired && now > item.expired) {
if (item.expired && getNow() > item.expired) {
item.expired = 0;

@@ -46,3 +50,3 @@ item.value = undefined;

if (maxAge !== undefined) {
const expired = maxAge ? now + maxAge : 0;
const expired = maxAge ? getNow() + maxAge : 0;
item.expired = expired;

@@ -106,1 +110,2 @@ }

module.exports = LRU;
{
"name": "ylru",
"description": "Extends LRU base on hashlru",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "https://github.com/node-modules/ylru",

@@ -6,0 +6,0 @@ "repository": {

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