i found js(“({})“) but it can not declare sub obj...
# javascript
t
i found js(“({})“) but it can not declare sub object like date{ type : … , default … }
b
@thos you can write whole object inside string paratmter of
js
, like:
Copy code
js("""({
  title:  String,
  author: String,
  body:   String,
  comments: [{ body: String, date: Date }],
  date: { type: Date, "default": Date.now },
  hidden: Boolean,
  meta: {
    votes: Number,
    favs:  Number
  }
})""")