Open CyanSalt opened 4 years ago
path: worst-casing-convertion
let transformer = document.createElement('span') function camel2kebab(name) { const dataset = transformer.dataset dataset[name] = '1' const key = transformer.attributes[0].name delete dataset[name] return key.substring(5) } function kebab2camel(name) { transformer.setAttribute(`data-${name}`, '1') const dataset = transformer.dataset const key = Object.keys(dataset)[0] delete dataset[key] return key }
path: worst-casing-convertion