Simple idea:
1) providers are consumed within the module
2) imports/exports are consumed acrossed modules
3) controllers are registered within module, not related with 1 & 2
export function createBook(authorName, bookTitle)...isn't this a function? isn't this using "closure" to achieve the same thing as classes do? Thanks.
Vinicius De Antoni
what do you think about react-query as apposed to swr from nextjs? Thanks
What are they?

JSON String:
{
“firstName” : “name”,
….
}
How to convert between them?
class Human {
constructor() {
this.height = 180;
this.weight = 180;
}
getWeight() { return this.weight; }
}
const me =new Human()
- Convert to plain object
const {…plainObj} = me
console.dir(plainObj)
2. Helper function
function toObject(proto) {
let jsoned = {};
let toConvert = proto || this;
Object.getOwnPropertyNames(toConvert).forEach((prop) => {
const val = toConvert[prop];
if (typeof val === ‘function’) {
jsoned[prop] = val.bind(jsoned);
return;
}
jsoned[prop] = val;
});
const inherited = Object.getPrototypeOf(toConvert);
if (inherited !== null) {
Object.keys(this.toObject(inherited)).forEach(key => {
if (typeof inherited[key] === ‘function’) {
jsoned[key] = inherited[key].bind(jsoned);
return;
}
jsoned[key] = inherited[key];
});
}
return jsoned;
}
console.dir(toObject(me))
alias ll=”ls -al”
alias myip=”curl https://www.google.com.hk"
alias setproxy=”export all_proxy=http://127.0.0.1:3213"
alias unsetproxy=”unset all_proxy”
Please note that .create takes an array!!
// Insert one new `Character` document
await Character.create({ name: 'Jean-Luc Picard' });
// Insert multiple new `Character` documents
await Character.create([{ name: 'Will Riker' }, { name: 'Geordi LaForge' }]);
// Create a new character within a transaction. Note that you **must**
// pass an array as the first parameter to `create()` if you want to
// specify options.
await Character.create([{ name: 'Jean-Luc Picard' }], { session });

I