// ПСЕВДОКОДИЩЕ!!!
var ArticleSchema = new Schema({
title: {
type: String
}
});
ArticleSchema
.virtual('id') // вместо _id
.get(function() {
let hash = md5(this.title);
return encrypt(this._id, hash);
})
.set(function (setFullNameTo) {
// some setter code
});
let obj = {
id: 1,
value: "123",
func: function(){}
};
for(let value in obj){
switch(typeof obj[value]) {
case 'number':
console.log(`${value} is number`);
break;
case 'string':
console.log(`${value} is string`);
break;
default:
console.log(`${value} is ${typeof obj[value]}`);
// it`s not number and not string
break;
}
}