Skip to content

Commit

Permalink
chore: inline make_key
Browse files Browse the repository at this point in the history
  • Loading branch information
maraisr committed Jun 9, 2023
1 parent 9a38168 commit 7b0cdcf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { SHA1 } from 'worktop/crypto';

import type { Lifetimes, make as _make } from 'swrr';

const make_id = (...key: string[]) => key.join('::');

export const make: typeof _make = (binding, context) => (name, handler, options) => {
type Value = ReturnType<typeof handler>;
type Metadata = { expireAt: number };
Expand All @@ -19,7 +17,7 @@ export const make: typeof _make = (binding, context) => (name, handler, options)
return new Proxy(handler, {
async apply(target, this_arg, args_array) {
const key = args_array.length
? make_id(name, await identify(args_array, SHA1))
? name + '::' + await identify(args_array, SHA1)
: name;

const result = await read<Value, Metadata>(binding, key, {
Expand Down

0 comments on commit 7b0cdcf

Please sign in to comment.