proxify-method
Advanced tools
+10
-2
| { | ||
| "name": "proxify-method", | ||
| "version": "0.0.5", | ||
| "description": "", | ||
| "version": "0.0.7", | ||
| "description": "Project for flexible extension of the existing functionality", | ||
| "main": "built/index.js", | ||
@@ -20,2 +20,9 @@ "scripts": { | ||
| }, | ||
| "keywords": [ | ||
| "proxy object", | ||
| "proxify", | ||
| "flexible extension", | ||
| "extension", | ||
| "proxy method" | ||
| ], | ||
| "homepage": "https://github.com/Simple-Automation-Testing/api-framework#readme", | ||
@@ -28,2 +35,3 @@ "devDependencies": { | ||
| "@typescript-eslint/parser": "^3.8.0", | ||
| "assertior": "0.0.9", | ||
| "chai": "^4.2.0", | ||
@@ -30,0 +38,0 @@ "eslint": "^7.6.0", |
+27
-2
@@ -10,7 +10,8 @@ | ||
| [ts example](/example/example.ts) | ||
| [js example](#js) | ||
| [ts example chainProxify](/example/example.ts) | ||
| [js example chainProxify](#js) | ||
| #### js | ||
| ## chainProxify usage | ||
| ```js | ||
@@ -74,1 +75,25 @@ // example with node-fetch and chai | ||
| ``` | ||
| ## proxify usage | ||
| ```ts | ||
| import {proxify} from 'proxify-method'; | ||
| const obj = {a: 2, b: 3, c: 4}; | ||
| function isPropExists(prop, value, targetObj) { | ||
| expect(targetObj[prop]).toEqual(value); | ||
| } | ||
| const proxedObj = proxify(obj, {isPropExists: isPropExists}); | ||
| const {a, b, c} = proxedObj | ||
| .isPropExists('a', 2) | ||
| .isPropExists('b', 3) | ||
| .isPropExists('c', 4); | ||
| expect(a).toEqual(obj.a); | ||
| expect(b).toEqual(obj.b); | ||
| expect(c).toEqual(obj.c); | ||
| expect(proxedObj).toDeepEqual(obj); | ||
| ``` |
22509
3.33%97
32.88%14
7.69%