1.1.2 • Published 1 year ago

@olian04/proxy_pool v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

proxy_pool

An object pool specifically for proxies

Installation

npm install @olian04/proxy_pool

Usage

import { ProxyPool, Proxy } from '@olian04/proxy_pool';

const pool = new ProxyPool<
  Record<string, number>,
  [ctx: { foo: number }, num: number]
>({
  set: () => false,
  get: (data, num, key) => data.foo * num,
});

const obj = pool.get({ foo: 10 }, 2);
assert(obj.foo === 20);

const obj2 = pool.get({ foo: 20 }, 4);
assert(obj2.foo === 80);

pool.release(obj);
pool.release(obj2);
1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago