{"id":19009162,"url":"https://github.com/gamtiq/wrapme","last_synced_at":"2026-06-20T04:01:46.162Z","repository":{"id":57399736,"uuid":"243360702","full_name":"gamtiq/wrapme","owner":"gamtiq","description":"Functions to wrap other functions and fields/methods and to change/enhance their behavior, functionality or usage","archived":false,"fork":false,"pushed_at":"2020-06-28T11:42:08.000Z","size":423,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-17T01:48:37.294Z","etag":null,"topics":["after","aop","around","aspect","before","behavior","change","field","function","handler","intercept","interceptor","method","observe","property","transform","use","validate","watch","wrap"],"latest_commit_sha":null,"homepage":"https://gamtiq.github.io/wrapme/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gamtiq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-26T20:37:53.000Z","updated_at":"2020-06-28T11:42:10.000Z","dependencies_parsed_at":"2022-09-26T17:01:14.873Z","dependency_job_id":null,"html_url":"https://github.com/gamtiq/wrapme","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/gamtiq/wrapme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fwrapme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fwrapme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fwrapme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fwrapme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gamtiq","download_url":"https://codeload.github.com/gamtiq/wrapme/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fwrapme/sbom","scorecard":{"id":418055,"data":{"date":"2025-08-11","repo":{"name":"github.com/gamtiq/wrapme","commit":"d84690f9d65ea56044bd91237268b1687f99cea6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"54 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T00:26:03.696Z","repository_id":57399736,"created_at":"2025-08-19T00:26:03.696Z","updated_at":"2025-08-19T00:26:03.696Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34556495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["after","aop","around","aspect","before","behavior","change","field","function","handler","intercept","interceptor","method","observe","property","transform","use","validate","watch","wrap"],"created_at":"2024-11-08T19:06:47.841Z","updated_at":"2026-06-20T04:01:46.138Z","avatar_url":"https://github.com/gamtiq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wrapme \u003ca name=\"start\"\u003e\u003c/a\u003e\n\n[![NPM version](https://badge.fury.io/js/wrapme.png)](http://badge.fury.io/js/wrapme)\n\nFunctions to wrap other functions and fields/methods and to change/enhance their behavior, functionality or usage.  \nCan be used for Aspect-oriented programming.\n\n### Features\n\n* Wrap a single function/field/method (by `wrap`) or several fields and methods at once (by `intercept`).\n* Wrap only field's get operation (`get` option) or set operation (`set` option), or both (by default).\n* Provide special getter and/or setter for wrapped field if it is necessary.\n* Call original function/method or field's operation before (use `before` or `listen` option),\nafter (use `after` option) and/or inside `handler` (use `run()` or `runApply()`).\n* Totally control calling of original function/method or field's operation inside `handler`:\ncall depending on condition, filter/validate/convert passed arguments and/or provide another arguments.\n* Return result of original function/method or field's operation, or any other value from `handler`.\n* Save necessary data between `handler` calls.\n* Restore original fields/methods when it is needed.\n* Does not have dependencies and can be used in ECMAScript 5+ environment.\n* Small size.\n\n```js\nimport { intercept } from 'wrapme';\n\nconst api = {\n    sum(...numList) {\n        let result = 0;\n        for (let value of numList) {\n            result += value;\n        }\n        return result;\n    },\n    // Other methods\n    // ...\n};\n\n// Logging\n\nconst log = [];\n\nfunction logger(callData) {\n    log.push({\n        name: callData.field,\n        args: callData.arg,\n        result: callData.result,\n        callNum: callData.number,\n        time: new Date().getTime()\n    });\n}\n\nconst unwrap = intercept(api, 'sum', logger, {listen: true});\n\napi.sum(1, 2, 3, 4);   // Returns 10, adds item to log\napi.sum(1, -1, 2, -2, 3);   // Returns 3, adds item to log\n\n// Restore original method\nunwrap();\n```\n\n[See more examples below.](#examples)\n\n## Table of contents\n\n* [Installation](#install)\n* [Usage](#usage)\n* [Examples](#examples)\n* [API](#api)\n* [Related projects](#related)\n* [Inspiration](#inspiration)\n* [Contributing](#contributing)\n* [License](#license)\n\n## Installation \u003ca name=\"install\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n### Node\n\n    npm install wrapme\n\n### AMD, \u0026lt;script\u0026gt;\n\nUse `dist/wrapme.umd.development.js` or `dist/wrapme.umd.production.min.js` (minified version).\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n### ECMAScript 6+\n\n```js\nimport { intercept, wrap } from 'wrapme';\n```\n\n### Node\n\n```js\nconst wrapme = require('wrapme');\nconst { intercept, wrap } = wrapme;\n```\n\n### AMD\n\n```js\ndefine(['path/to/dist/wrapme.umd.production.min.js'], function(wrapme) {\n    const intercept = wrapme.intercept;\n    const wrap = wrapme.wrap;\n});\n```\n\n### \u0026lt;script\u0026gt;\n\n```html\n\u003cscript type=\"text/javascript\" src=\"path/to/dist/wrapme.umd.production.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    // wrapme is available via wrapme field of window object\n    const intercept = wrapme.intercept;\n    const wrap = wrapme.wrap;\n\u003c/script\u003e\n```\n\n## Examples \u003ca name=\"examples\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n```js\nimport { intercept, wrap } from 'wrapme';\n\nconst api = {\n    value: 1,\n    sum(...numList) {\n        let result = 0;\n        for (let value of numList) {\n            result += value;\n        }\n\n        return result;\n    },\n    positive(...numList) {\n        let result = [];\n        for (let value of numList) {\n            if (value \u003e 0) {\n                result.push(value);\n            }\n        }\n\n        return result;\n    },\n    factorial(num) {\n        let result = 1;\n        while (num \u003e 1) {\n            result *= num--;\n        }\n\n        return result;\n    },\n    binomCoeff(n, k) {\n        const { factorial } = api;\n\n        return factorial(n) / (factorial(k) * factorial(n - k));\n    }\n};\n\n\n// Logging\n\nconst log = [];\n\nfunction logger(callData) {\n    if (! callData.byUnwrap) {\n        callData.settings.log.push({\n            name: callData.field,\n            args: callData.arg,\n            result: callData.result,\n            callNum: callData.number,\n            time: new Date().getTime()\n        });\n    }\n}\n\nconst unwrap = intercept(api, ['sum', 'positive', 'value'], logger, {listen: true, log});\n\napi.sum(1, 2, 3, 4);   // Returns 10, adds item to log\napi.positive(1, 2, -3, 0, 10, -7);   // Returns [1, 2, 10], adds item to log\napi.value += api.sum(1, -1, 2, -2, 3);   // Changes value to 4, adds items to log\n\n// Restore original fields\nunwrap();\n\napi.positive(-1, 5, 0, api.value, -8);   // Returns [5, 4], doesn't add items to log\n\nconsole.log(\"call log:\\n\", JSON.stringify(log, null, 4));\n/* log looks like:\n    [\n        {\n            \"name\": \"sum\",\n            \"args\": [\n                1,\n                2,\n                3,\n                4\n            ],\n            \"result\": 10,\n            \"callNum\": 1,\n            \"time\": 1586602348174\n        },\n        {\n            \"name\": \"positive\",\n            \"args\": [\n                1,\n                2,\n                -3,\n                0,\n                10,\n                -7\n            ],\n            \"result\": [\n                1,\n                2,\n                10\n            ],\n            \"callNum\": 1,\n            \"time\": 1586602348174\n        },\n        {\n            \"name\": \"value\",\n            \"args\": [],\n            \"result\": 1,\n            \"callNum\": 1,\n            \"time\": 1586602348174\n        },\n        {\n            \"name\": \"sum\",\n            \"args\": [\n                1,\n                -1,\n                2,\n                -2,\n                3\n            ],\n            \"result\": 3,\n            \"callNum\": 2,\n            \"time\": 1586602348174\n        },\n        {\n            \"name\": \"value\",\n            \"args\": [\n                4\n            ],\n            \"result\": 4,\n            \"callNum\": 2,\n            \"time\": 1586602348175\n        }\n    ]\n*/\n\n\n// Simple memoization\n\nfunction memoize(callData) {\n    const { save } = callData;\n    const key = callData.arg.join(' ');\n\n    return (key in save)\n        ? save[key]\n        : (save[key] = callData.run());\n}\n\nintercept(api, ['factorial', 'binomCoeff'], memoize);\n\napi.factorial(10);\napi.factorial(5);\n\napi.binomCoeff(10, 5);   // Uses already calculated factorials\n\napi.binomCoeff(10, 5);   // Uses already calculated value\n\n\n// Side effects\n\nfunction saveToLocalStorage(callData) {\n    if (callData.bySet) {\n        const { save } = callData;\n        if ('id' in save) {\n            clearTimeout(save.id);\n        }\n\n        save.id = setTimeout(\n            () =\u003e localStorage.setItem(\n                `wrap:${callData.field}`,\n                typeof callData.result === 'undefined'\n                    ? callData.arg0\n                    : callData.result\n            ),\n            callData.settings.timeout || 0\n        );\n    }\n}\n\nwrap(api, 'value', saveToLocalStorage, {listen: true, timeout: 50});\n\n// Validation, filtering or conversion\n\nfunction filter(callData) {\n    const { arg, bySet } = callData;\n    const argList = [];\n    for (let item of arg) {\n        const itemType = typeof item;\n        if ( (itemType === 'number' \u0026\u0026 ! isNaN(item))\n                || (bySet \u0026\u0026 itemType === 'string' \u0026\u0026 item \u0026\u0026 (item = Number(item))) ) {\n            argList.push(item);\n        }\n    }\n    if (argList.length || ! bySet) {\n        return callData.runApply(argList);\n    }\n}\n\nwrap(api, 'value', filter);\napi.value = 'some data';   // value isn't changed, saveToLocalStorage isn't called\napi.value = 9;   // value is changed, saveToLocalStorage is called\napi.value = '-53';   // string is converted to number and value is changed, saveToLocalStorage is called\n\nconst sum = wrap(api.sum, filter);\nconst positive = wrap(api.positive, filter);\n\nsum(false, 3, NaN, new Date(), 8, {}, 'sum', '2');   // Returns 11\npositive(true, -5, NaN, 4, new Date(), 1, {a: 5}, 0, 'positive', -1);   // Returns [4, 1]\n```\n\nSee additional examples in tests.\n\n## API \u003ca name=\"api\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n### wrap(target, field, handler?, settings?): Function\n\nWraps specified object's field/method or standalone function into new (wrapping) function\nthat calls passed handler which eventually may run wrapped function or get/set field's value.\n\nArguments:\n\n* `target: Function | object` - Function that should be wrapped or an object whose field/method will be wrapped and replaced.\n* `field: Function | string` - Name of field/method that should be wrapped or a handler when function is passed for `target` parameter.\n* `handler: Function | object` - A function (interceptor) that should be executed when newly created function is called or get/set operation for the field is applied,\nor optional settings when function is passed for `target` parameter.\n* `settings: object` - Optional settings that will be available in `handler`.\n* `settings.after: boolean` (optional) - Whether original function, method or field's operation should be called after `handler`.\n* `settings.before: boolean` (optional) - Whether original function, method or field's operation should be called before `handler`.\n* `settings.bind: boolean` (optional) - Whether wrapping function should be bound to `target` object.\n* `settings.context: object` (optional) - Context (`this`) that should be used for `handler` call.\n* `settings.data: any` (optional) - Any data that should be available in `handler`.\n* `settings.get: boolean | Function` (optional) - Whether field's get operation should be intercepted\nand whether created wrapping function should be used as field's getter\n(by default `true` for usual (non-functional) field and `false` for method).\n* `settings.listen: boolean` (optional) - Whether original function, method or field's operation\nshould be called before `handler` and whether original's result should be returned.\n* `settings.set: boolean | Function` (optional) - Whether field's set operation should be intercepted\nand whether created wrapping function should be used as field's setter\n(by default `true` for usual (non-functional) field and `false` for method).\n\nReturns wrapping function when `target` is a function,\nor a function that restores original field/method when `target` is an object.\n\nAn object with the following fields will be passed into `handler`:\n\n* `arg: any[]` - Array of arguments that were passed to the wrapping function.\n* `arg0: any` - Value of `arg[0]`.\n* `byCall: boolean` - Whether wrapping function is called as object's method or as usual function (by a call operation).\n* `byGet: boolean` - Whether wrapping function is called to get field's value (by get operation, as field's getter).\n* `bySet: boolean` - Whether wrapping function is called to set field's value (by set operation, as field's setter).\n* `byUnwrap: boolean` - Whether wrapping function (and `handler`) is called during unwrapping.\n* `context: object` - Context (`this`) with which wrapping function is called.\n* `data: any` - Value of `settings.data` option.\n* `field: string | undefined` - Name of the field or method that was wrapped.\n* `fieldWrap: boolean` - Whether field's get and/or set operation was wrapped.\n* `funcWrap: boolean` - Whether standalone function (not object's field/method) was wrapped.\n* `get: (() =\u003e any) | undefined` - Function that returns field's current value if field was wrapped.\n* `method: string` - Name of the method or function that was wrapped.\n* `methodWrap: boolean` - Whether method was wrapped.\n* `number: number` - Number of `handler`'s call (starting from 1).\n* `result: any` - Result of original function/method when it is called before `handler`.\n* `run: (...args?) =\u003e any` - Method that calls original function/method or field's getter/setter;\nby default values from `arg` will be used as arguments;\nbut you may pass arguments to `run` and they will be used instead of the original arguments.\n* `runApply: (any[]?) =\u003e any` - Similar to `run` but accepts an array of new arguments,\ne.g. `runApply([1, 2, 3])` is equivalent to `run(1, 2, 3)`;\nif the first argument of `runApply` is not an array it will be wrapped into array (i.e. `[arguments[0]]`);\nonly the first argument  of `runApply` is used.\n* `save: object` - An object that can be used to preserve some values between `handler` calls.\n* `set: ((value: any) =\u003e any) | undefined` - Function that changes field's current value if field was wrapped.\n* `settings: object` - Value of `settings` parameter; except for `settings.bind` and `settings.context`,\nit is possible to change any setting to alter following execution;\nso be careful when you change a field's value of `settings` object.\n* `target: ((...args) =\u003e any) | string` - Original function or method that was wrapped, or name of wrapped field.\n* `targetObj: object | null` - An object whose field/method was wrapped and replaced.\n* `value: any` - Previous value returned by wrapping function.\n\nWhen `settings.after` and `settings.listen` are `false`, result of `handler` will be returned from wrapping function.\n\n### intercept(target, field, handler?, settings?): Function\n\nWraps specified object's field(s)/method(s) or standalone function into new (wrapping) function\nthat calls passed handler which eventually may run wrapped function or get/set field's value.\n\nArguments:\n\n* `target: Function | object` - Function that should be wrapped or an object whose field(s)/method(s) will be wrapped and replaced.\n* `field: Function | string | string[]` - Name of field/method (or list of field/method names)\nthat should be wrapped or a handler when function is passed for `target` parameter.\n* `handler: Function | object` - A function (interceptor) that should be executed when newly created function is called\nor get/set operation for the field is applied, or settings when function is passed for `target` parameter.\n* `settings: object` - Optional settings that will be available in `handler`. See `wrap` for details.\n\nReturns wrapping function when `target` is a function,\nor a function that restores original field(s)/method(s) when `target` is an object.\n\nSee [`docs`](https://gamtiq.github.io/wrapme/) for details.\n\n## Related projects \u003ca name=\"related\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n* [eva](https://github.com/gamtiq/eva)\n* [povtor](https://github.com/gamtiq/povtor)\n\n## Inspiration \u003ca name=\"inspiration\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\nThis library is inspired by [meld](https://github.com/cujojs/meld).\n\n## Contributing \u003ca name=\"contributing\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\nIn lieu of a formal styleguide, take care to maintain the existing coding style.\nAdd unit tests for any new or changed functionality.\nLint and test your code.\n\n## License \u003ca name=\"license\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\nCopyright (c) 2020 Denis Sikuler  \nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamtiq%2Fwrapme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgamtiq%2Fwrapme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamtiq%2Fwrapme/lists"}