-
Notifications
You must be signed in to change notification settings - Fork 9
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
Custom methods on model? #53
Comments
+1, would love to know if this is in the future of Obey.js 👍 |
Just found https://github.com/node-modli/modli created by the same maintainers as Obey 💯 |
There isn't any built-in way to do this as it stands, however, as @ummjackson shared, Modli (built by our team) is a full CRUD solution which extends on Obey to allow for doing things like this. Given const user = {
schema: obey.model({
fname: { type: 'string' },
lname: { type: 'string' }
}),
getFullName: (data) => {
return data.fname + ' ' + data.lname
},
read: () => {
return db.read({...})
}
/* ...other custom methods... */
} The above is essentially what Modli does, just creating a model object with other methods associated, then on |
I'm willing to reopen this if there's a sound argument for including this functionality, or simply to discuss further. However, for now I'm going to close it. |
Hi, this project looks great!
Is it possible to add custom methods to a model, something like the following?
The text was updated successfully, but these errors were encountered: