@teamawesome/access
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "@teamawesome/access", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Provide an unified interface for objects.", | ||
"keywords": ["map", "object", "array", "interface", "access"], | ||
"keywords": [ | ||
"map", | ||
"object", | ||
"array", | ||
"interface", | ||
"access" | ||
], | ||
"main": "dist/index.js", | ||
@@ -10,3 +16,5 @@ "scripts": { | ||
"dev": "babel src --out-dir dist --watch --source-maps inline", | ||
"test": "mocha" | ||
"lint": "eslint src/", | ||
"test": "mocha", | ||
"prepublishOnly": "npm run-script lint && npm run-script test && npm run-script build" | ||
}, | ||
@@ -22,2 +30,3 @@ "author": "Tom Hooijenga <tomhooijenga@gmail.com>", | ||
"@babel/preset-env": "^7.0.0-beta.49", | ||
"eslint": "^4.19.1", | ||
"mocha": "^5.1.1", | ||
@@ -24,0 +33,0 @@ "should": "^13.2.1", |
# Installation | ||
``` | ||
npm i @th/access | ||
npm i @teamawesome/access | ||
``` | ||
@@ -26,2 +26,5 @@ | ||
// | ||
}, | ||
del(id) { | ||
// | ||
} | ||
@@ -34,7 +37,10 @@ } | ||
}, | ||
// etc | ||
// Alias methods in one line: | ||
delete: (obj, key) => obj.del(key) | ||
}); | ||
``` | ||
If a type implements one of the used methods, it is not necessary to also add it to the handler. It will be called | ||
automatically for you. For example, Map and WeakMap are fully compatible without being registered. | ||
If a type implements one of the methods with the same signature, it is not necessary to add it to the handler. It | ||
will be called automatically for you. For example, Map and WeakMap are fully compatible without being registered. | ||
A proxied method has precedence over auto-detected methods. | ||
@@ -44,7 +50,15 @@ ``` | ||
get(key) { | ||
// Still called! | ||
// Called automatically because it is detected. | ||
}, | ||
set(key, value) { | ||
// Not called automatically because it is proxied. | ||
} | ||
} | ||
access.register(Type, {}); | ||
access.register(Type, { | ||
set(obj, value) { | ||
// | ||
} | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23149
14
711
62
10