From 1b7b5a58f9ede659a58f20b2c1bf825675c34980 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 10 Oct 2020 18:21:17 +0200 Subject: [PATCH] Meta tweaks --- .travis.yml | 1 + index.ts | 6 +++--- license | 2 +- package.json | 4 ++-- readme.md | 2 +- test-d/index.test-d.ts | 6 +++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94ab01f..9d7745e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: node_js node_js: + - '14' - '12' - '10' diff --git a/index.ts b/index.ts index a91bf56..ee28a07 100644 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import mimicFn = require('mimic-fn'); import mapAgeCleaner = require('map-age-cleaner'); -type AnyFunction = (...args: any) => any; +type AnyFunction = (...arguments_: any) => any; const cacheStore = new WeakMap(); @@ -55,7 +55,7 @@ interface Options< @default arguments_ => arguments_[0] @example arguments_ => JSON.stringify(arguments_) */ - readonly cacheKey?: (args: Parameters) => CacheKeyType; + readonly cacheKey?: (arguments_: Parameters) => CacheKeyType; /** Use a different cache storage. Must implement the following methods: `.has(key)`, `.get(key)`, `.set(key, value)`, `.delete(key)`, and optionally `.clear()`. You could for example use a `WeakMap` instead or [`quick-lru`](https://github.com/sindresorhus/quick-lru) for a LRU cache. @@ -106,7 +106,7 @@ const mem = < }: Options = {} ): FunctionToMemoize => { if (typeof maxAge === 'number') { - // TODO: drop after https://github.com/SamVerschueren/map-age-cleaner/issues/5 + // TODO: Drop after https://github.com/SamVerschueren/map-age-cleaner/issues/5 // @ts-expect-error mapAgeCleaner(cache); } diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index 51398d2..ec29eb6 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ ], "dependencies": { "map-age-cleaner": "^0.1.3", - "mimic-fn": "^3.0.0" + "mimic-fn": "^3.1.0" }, "devDependencies": { "@ava/typescript": "^1.1.1", @@ -47,7 +47,7 @@ "@types/serialize-javascript": "^4.0.0", "ava": "^3.13.0", "del-cli": "^3.0.1", - "delay": "^4.1.0", + "delay": "^4.4.0", "serialize-javascript": "^5.0.1", "tsd": "^0.13.1", "typescript": "^4.0.3", diff --git a/readme.md b/readme.md index 824ec47..3bd9388 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# mem [![Build Status](https://travis-ci.org/sindresorhus/mem.svg?branch=master)](https://travis-ci.org/sindresorhus/mem) +# mem [![Build Status](https://travis-ci.com/sindresorhus/mem.svg?branch=master)](https://travis-ci.com/github/sindresorhus/mem) > [Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input diff --git a/test-d/index.test-d.ts b/test-d/index.test-d.ts index a60ccfc..2483f80 100644 --- a/test-d/index.test-d.ts +++ b/test-d/index.test-d.ts @@ -31,7 +31,7 @@ expectType(mem(overloadedFn)(false)); mem.clear(fn); -// CacheKey tests. +// `cacheKey` tests. // The argument should match the memoized function’s parameters mem((text: string) => Boolean(text), { cacheKey: arguments_ => { @@ -45,8 +45,8 @@ mem(() => 1, { } }); -// Ensures that the various cache functions infer their arguments type from the return type of cacheKey() -mem((_args: {key: string}) => 1, { +// Ensures that the various cache functions infer their arguments type from the return type of `cacheKey` +mem((_arguments: {key: string}) => 1, { cacheKey: (arguments_: [{key: string}]) => { expectType<[{key: string}]>(arguments_); return new Date();