{"_id":"3h-pool","_rev":"1-adbb482fe020472b25a3daa09d07f8ae","name":"3h-pool","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"3h-pool","version":"0.1.0","description":"A simple object pool lib.","module":"./dist/3h-pool.min.js","main":"./dist/3h-pool.umd.min.js","types":"./index.d.ts","author":{"name":"3h"},"license":"MIT","scripts":{"prebuild":"tsc","build":"rollup -c","postbuild":"terser dist/3h-pool.js --config-file terser.json --module -o dist/3h-pool.min.js && terser dist/3h-pool.umd.js --config-file terser.json -o dist/3h-pool.umd.min.js && node stat","test":"node ./test/index.js"},"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-pool.git"},"keywords":["object","pool","3h"],"devDependencies":{"@babel/core":"^7.10.0","@babel/preset-env":"^7.10.0","@rollup/plugin-babel":"^5.2.0","3h-test":"^0.6.0","rollup":"^2.26.0","terser":"^5.2.0","typescript":"^4.0.0"},"gitHead":"792cb199e44da25b24d7133772866c029cc5f9f1","bugs":{"url":"https://github.com/huang2002/3h-pool/issues"},"homepage":"https://github.com/huang2002/3h-pool#readme","_id":"3h-pool@0.1.0","_nodeVersion":"16.13.1","_npmVersion":"8.3.0","dist":{"integrity":"sha512-WLaAG2etjGXPFf8bKS091DVwwX5HCyzlOXP7ryUJVGX9WGFhSaSXuapKFM11RUBwKXWkcZhPB2xUSeJEgXLVIw==","shasum":"e95a6c389c15ca0ff4c7e89c0dc5af0586585f67","tarball":"https://registry.npmjs.org/3h-pool/-/3h-pool-0.1.0.tgz","fileCount":9,"unpackedSize":10421,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiA2R9CRA9TVsSAnZWagAAmLYP/juDQXha9S8dJgYMbEJf\nP3nSJHx+9vTijkbCZpEovBF168qbsmpCEfS1Yjac93USBeizKl90gwHa3ayG\n0dABV8JLX6P6vgTpt6duwJJtAaM1wf/nYzbOu/A5e9ogEO8ff+VPQ6i4dkEv\nKLpIBCMNLTd/Ix0OTEp6wTe1BWY16SyH4S93JqAFAFF9X6eZ/WMTIcVibYu5\nHaaLerbMOqYDo9dViLmNOznCf1nEn1S3Qj7OXU1nPyYIBuHJbs7AE4WhZ6Et\nPsdEqlvtMMduFs1miJRGFklwh40bV8p0oafTpgOtBxf0O21dLqjhPhuAzYSM\n5jXu+YZhsLl9KZ85FZfDe/psMkuC2X+j2jVmztIjBBN7OaRUOXlD3sjI6mDq\nVStr1f0yE4zmYE5QVUr8OjXtve6ES9lDgWi9FDi5NTHV9jx46A6Ja/1fqCOR\n8Vj1hMG2omRupjrZwLcfcC3Yf1VIbU+FVKpiwPPtoLNfCRRMx3A3ETniBPOj\nU3nDcCOMJk1mXvKejeFeYEdwArm+VYKXumym37bTBGsXWRS7rkcZS1BlqjdU\ngpCH3CSfnVsXpm74b9O9lbL+sSeClAk2cfW/caBDrmgmX1aTaxxwD6OzDe6V\nPd8fLdL7MFPny4cZI5iXyNIKN+pDP5y+9AH8qdPy78L+p6ESCRGLmu/re9Zg\nID/P\r\n=jDra\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClGuyXyQPt0HT4V36ovIYYDrWPYRkK85HYQraVmE4vLwIgM2Y/O3lsj/BN8cf8SGdBUXFUzV3ZnKLKvwYagUdEyF4="}]},"_npmUser":{"name":"3h","email":"1340545944@qq.com"},"directories":{},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/3h-pool_0.1.0_1644389501719_0.8451003552508742"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-09T06:51:41.718Z","0.1.0":"2022-02-09T06:51:41.850Z","modified":"2022-04-04T10:21:35.010Z"},"maintainers":[{"name":"3h","email":"1340545944@qq.com"}],"description":"A simple object pool lib.","homepage":"https://github.com/huang2002/3h-pool#readme","keywords":["object","pool","3h"],"repository":{"type":"git","url":"git+https://github.com/huang2002/3h-pool.git"},"author":{"name":"3h"},"bugs":{"url":"https://github.com/huang2002/3h-pool/issues"},"license":"MIT","readme":"# 3h-pool\n\n> A simple object pool lib.\n\n## API Reference\n\n```typescript\n// Access the APIs via `require('3h-pool')`\n// or `HP.*`(UMD namespace).\nexport as namespace HP;\n\n/**\n * Type of pool creators.\n */\nexport declare type PoolCreator<T> = () => T;\n\n/**\n * Type of pool processors.\n */\nexport declare type PoolProcessor<T> = (object: T) => void;\n\n/**\n * Type of pool options.\n */\nexport interface PoolOptions<T> {\n\n    /**\n     * The creator of objects.\n     */\n    create: PoolCreator<T>;\n\n    /**\n     * The initializer of objects,\n     * which will be invoked to initialize\n     * objects that will be returned by `pop`.\n     */\n    init?: PoolProcessor<T> | null;\n\n    /**\n     * The cleaner of objects,\n     * which will be invoked to clear\n     * objects that are received by `push`.\n     */\n    clear?: PoolProcessor<T> | null;\n\n    /**\n     * The initial pool size.\n     * (`prepare(initSize)` will be executed.)\n     */\n    initSize?: number;\n\n}\n\n/**\n * Class of object pools.\n */\nexport declare class Pool<T> {\n\n    /**\n     * Constructor {@link Pool}.\n     */\n    constructor(options: PoolOptions<T>);\n\n    /**\n     * Creator of objects.\n     */\n    create: PoolCreator<T>;\n\n    /**\n     * The initializer of objects,\n     * which will be invoked to initialize\n     * objects that will be returned by `pop`.\n     */\n    init: PoolProcessor<T> | null;\n\n    /**\n     * The cleaner of objects,\n     * which will be invoked to clear\n     * objects that are received by `push`.\n     */\n    clear: PoolProcessor<T> | null;\n\n    /**\n     * Internal pool.\n     */\n    pool: T[];\n\n    /**\n     * Prepare specific amount of objects in the pool.\n     */\n    prepare(count: number): void;\n\n    /**\n     * Get an object from the pool.\n     */\n    pop(): T;\n\n    /**\n     * Put an object into the pool. (recycle)\n     */\n    push(object: T): void;\n\n}\n```\n","readmeFilename":"README.md"}