memcache-client-memoizer
Advanced tools
Comparing version 2.2.0 to 2.2.1
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -26,3 +27,3 @@ }); | ||
} | ||
return (...fnArgs) => __awaiter(this, void 0, void 0, function* () { | ||
return (...fnArgs) => __awaiter(void 0, void 0, void 0, function* () { | ||
if (skipCacheFn(...fnArgs)) { | ||
@@ -29,0 +30,0 @@ return fn(...fnArgs); |
@@ -35,3 +35,3 @@ export type InputFunction = (...args: any[]) => Promise<any>; | ||
const memoizer = (args: IMemoizerArgs): InputFunction => { | ||
const {client, clientProviderFn, fn, keyFn, setOptions = {}, cacheResultTransformFn = (x: any) => x, skipCacheFn = () => false} = args; | ||
const {client, clientProviderFn, fn, keyFn, setOptions = {}, cacheResultTransformFn = (x: {}): {} => x, skipCacheFn = (): boolean => false} = args; | ||
const localClient = getClient(client, clientProviderFn); | ||
@@ -43,3 +43,3 @@ | ||
return async (...fnArgs) => { | ||
return async (...fnArgs): Promise<any> => { | ||
if (skipCacheFn(...fnArgs)) { | ||
@@ -46,0 +46,0 @@ return fn(...fnArgs); |
{ | ||
"name": "memcache-client-memoizer", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Memoizes promise-returning functions via memcache-client", | ||
@@ -8,6 +8,5 @@ "main": "dist/index", | ||
"scripts": { | ||
"build": "./node_modules/.bin/tsc", | ||
"lint": "./node_modules/.bin/tslint --format stylish --project .", | ||
"pretest": "npm run lint && npm run build", | ||
"test": "jest", | ||
"build": "$(npm bin)/tsc", | ||
"pretest": "npm run build", | ||
"test": "$(npm bin)/jest dist/tests", | ||
"prepublishOnly": "npm test" | ||
@@ -30,10 +29,8 @@ }, | ||
"devDependencies": { | ||
"@types/jest": "^23.3.9", | ||
"@types/uuid": "^3.4.4", | ||
"jest": "^23.6.0", | ||
"tslint": "^5.11.0", | ||
"tslint-xo": "^0.10.0", | ||
"typescript": "^3.1.6", | ||
"uuid": "^3.3.2" | ||
"@types/jest": "^24.0.18", | ||
"@types/uuid": "^3.4.5", | ||
"jest": "^25.0.0", | ||
"typescript": "^3.6.3", | ||
"uuid": "^3.3.3" | ||
} | ||
} |
## memcache-client-memoizer | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/maxnachlinger/memcache-client-memoizer.svg)](https://greenkeeper.io/) | ||
A function memoizer using a get/set cache client. | ||
@@ -4,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
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
5
103
95
10018
6