-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for options #11
Conversation
add support to ignore_getters_and_setter options so ecma6 that have virtual properties that located in the schema will work
@@ -1,2 +1,2 @@ | |||
declare function loadClass(schema: any, target: any): void; | |||
declare function loadClass(schema: any, {target: any,options: object}:object): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work when developer uses it without options, like loadClass(schema, UserModel);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I kept on backward compatibility
README.md
Outdated
@@ -58,8 +58,13 @@ class UserModel { | |||
|
|||
} | |||
|
|||
//posible options, for instance if you want to ignore getter and setters put | |||
options={ | |||
ignore_getters_and_setters:true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please name options in camelCase, also use let or const for declaring options here.
src/index.js
Outdated
@@ -1,6 +1,7 @@ | |||
'use strict'; | |||
|
|||
function wrap(schema, target, hooks = []) { | |||
function wrap(schema,params, hooks = []) { | |||
let {options={},target=params} = params; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make your code consistent with existing code (add space after ,
and :
, around =
, use 2 spaces for indentation).
Fixed the request changes |
add support to ignore_getters_and_setter options so ecma6 that have
virtual properties that located in the schema will work
for instance if you have class
will throw an exception , let's let the user to decide if s/he wants to add virtual prorties or not