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.13 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var pascalCase_1 = __importDefault(require("vanillajs-helpers/pascalCase"));
var 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) {
var pascalStr = (0, pascalCase_1.default)("".concat(str));
var kebabCaseStr = (0, kebabCase_1.default)(str);
return [
{ prefix: 'webkit', js: "webkit".concat(pascalStr), css: "-webkit-".concat(kebabCaseStr) },
{ prefix: 'moz', js: "moz".concat(pascalStr), css: "-moz-".concat(kebabCaseStr) },
{ prefix: 'ms', js: "ms".concat(pascalStr), css: "-ms-".concat(kebabCaseStr) },
{ prefix: 'o', js: "o".concat(pascalStr), css: "-o-".concat(kebabCaseStr) }
];
}
exports.default = vendorPrefixed;