> On Jan 6, 2015, at 7:19 PM, Prabhash Rathore <[email protected]> > wrote: > > I recently started programming in JavaScript (Server side) and Node.js. I > come from Java background where there is a concrete standard on how you > define Data Object, which is Java Bean. Do we have any such standards in > JavaScript/Node on how we define Data Objects (similar to Java Beans) > [snip]
>
> //bean4.js
> module.exports = {
> name : '';
> department : '';
> }
All of them work, just a plain object literal is my favorite. They're so
trivial that there's no name for them in Javascript other than "an object".
"Just make an object".
If you need to make it a requireable module, what you posted there is exactly
it. If it varies over the life of your program, then you'd probably read it as
a file and JSON.parse instead. Either way, the result is an object you can pass
around.
Aria
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/4EE53F45-59FB-4161-BDF1-2200261E4489%40nbtsc.org.
For more options, visit https://groups.google.com/d/optout.
smime.p7s
Description: S/MIME cryptographic signature
