如何检查对象是否已给出密钥

时间:2017-12-12 17:23:31

标签: javascript node.js

如何检查对象是否具有给定的键,属性及其类型?

    
const requiredKeys = {title: 'string', type: ['image', 'video', 'website'], src: 'string'};
const optionalKeys = {description: 'string', views: 'number', ranking: 'number'};
const internalKeys = {id: 'number', timestamp: 'number'};

0 个答案:

没有答案