Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
knighttower committed Sep 12, 2023
1 parent 269fe22 commit 152d286
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# JsObjectProxyHelper
Convert to proxy to protect objects
Convert object to proxy to protect the objects

``npm install @knighttower/js-object-proxy-helper``

``yarn add @knighttower/js-object-proxy-helper``

```css
/**
* @module ProxyHelper
* Convert to proxy to protect objects
* Allows to declare _private, _protected and _mutable all arrays with prop names
* @example ProxyHelper({objectProps..., _protected: array(...)})
* @param {Object} object
* @return {Proxy}
* @usage const proxy = ProxyHelper({objectProps..., _protected: array(...), _private: array(...), _mutable: array(...)})
* @usage _protected: array(...) -> Cannot be modified
* @usage _private: array(...) -> Cannot be accessed
* @usage _mutable: array(...) -> Can be modified
*/
```
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "@knighttower/js-object-proxy-helper",
"version": "1.0.1",
"main": "./src/ProxyHelper.ts",
"browser": "./dist/ProxyHelper.js",
"main": "src/ProxyHelper.ts",
"jsdeliver": "dist/ProxyHelper.js",
"unpkg": "dist/ProxyHelper.js",
"browser": "dist/ProxyHelper.js",
"license": "MIT",
"description": "Convert Object to proxy to protect the objects",
"homepage": "https://github.com/knighttower/JsObjectProxyHelper",
Expand Down
17 changes: 17 additions & 0 deletions src/ProxyHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ type ProxyHelperConfig = {
[key: string]: any
};

/* Author Knighttower
MIT License
[2023] [Knighttower] https://github.com/knighttower
*/

/**
* @module ProxyHelper
* Convert to proxy to protect objects
* Allows to declare _private, _protected and _mutable all arrays with prop names
* @example ProxyHelper({objectProps..., _protected: array(...)})
* @param {Object} object
* @return {Proxy}
* @usage const proxy = ProxyHelper({objectProps..., _protected: array(...), _private: array(...), _mutable: array(...)})
* @usage _protected: array(...) -> Cannot be modified
* @usage _private: array(...) -> Cannot be accessed
* @usage _mutable: array(...) -> Can be modified
*/
export default function ProxyHelper(object: ProxyHelperConfig): ProxyHelperConfig {
'use strict';

Expand Down

0 comments on commit 152d286

Please sign in to comment.