How do I create getter and setter overrides?

前端 未结 1 2110
自闭症患者
自闭症患者 2020-12-19 12:38

I\'d like to encrypt fields similar to this example with mongoose: https://gist.github.com/kljensen/7505729

The code in the above link maps a field to a custom

相关标签:
1条回答
  • 2020-12-19 12:54

    You can set up setter and getter as follows:

    <Model>.setter['myProp'] = function(val) {};
    

    See an example in LoopBack's common/models/user.js

    0 讨论(0)
提交回复
热议问题