vanillajs-browser-helpers
Version:
Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser
25 lines (24 loc) • 1.08 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const pascalCase_1 = __importDefault(require("vanillajs-helpers/pascalCase"));
const kebabCase_1 = __importDefault(require("vanillajs-helpers/kebabCase"));
/**
* Add vendor prefixes to a string
*
* @param str - String to add vendor prefixes to
* @return Array of the various vendor vendorPrefixed versions of the string
*/
function vendorPrefixed(str) {
const pascalStr = (0, pascalCase_1.default)(`${str}`);
const kebabCaseStr = (0, kebabCase_1.default)(str);
return [
{ prefix: 'webkit', js: `webkit${pascalStr}`, css: `-webkit-${kebabCaseStr}` },
{ prefix: 'moz', js: `moz${pascalStr}`, css: `-moz-${kebabCaseStr}` },
{ prefix: 'ms', js: `ms${pascalStr}`, css: `-ms-${kebabCaseStr}` },
{ prefix: 'o', js: `o${pascalStr}`, css: `-o-${kebabCaseStr}` }
];
}
exports.default = vendorPrefixed;