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.04 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 = pascalCase_1.default("" + str);
var kebabCaseStr = 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;