1
我想寫一個條件模型架構的基礎,如果存在其他模型。有條件的帆模型模式
例如,如果存在模式「消息」,然後添加一個收件箱/發件箱:
var userSchema = {
attributes: {
...
}
}
var messageSchema = {
attributes: {
inbox: {
collection: 'Message'
},
outbox: {
collection: 'Message'
}
}
};
if (<function to check that Message Model is available)
_.merge userSchema, messageSchema
是否有可能做這樣的事情?