lodash-id
lodash-id copied to clipboard
Typescript support?
Hello, I couldn't find any Typescript support for this library, does it exist?
Many thanks!
any news on this ?
I'm interested also. I'm obliged to cast db as any to modify the createId method:
// add basic getById methods
db._.mixin(lodashId);
// add collection() methods to remove magic strings
db._.mixin({
collection: function(obj) { return obj['col']; }
});
// override defaults from lodashId
(db._ as any).id = '_id';
(db._ as any).createId = (collection: any, doc: any) => {
return `${name}@${nanoid(10)}`;
};