JSFiddle - React, Tailwind, and code Playground
JavaScript
function MyPlugin(options) {
if (typeof optoins === null || typeof options !== 'object') options = {};
var defaults = {
prop1: true,
prop2: false,
prop3: 0,
prop4: 100,
}
// Set default options
for (var name in defaults) {
!(name in options) && (this.options[name] = defaults[name]);
}
}
var test = new MyPlugin();