UNPKG

css-mangle-webpack-plugin

Version:

This webpack plugin package is a CSS mangler that globally optimizes and shortens identifier names.

36 lines (35 loc) 1.28 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringUtil = void 0; /** This class provides additional functionality for `String` value type. */ class StringUtil { /** * Replaces a given range(start, end) with the given string value, * and returns it. */ static replaceRange(str, start, end, replaceValue) { return str.substring(0, start) + replaceValue + str.substring(end); } /** * Returns the length difference between a given old string * and a given new string. */ static replacedLength(oldStr, newStr) { return newStr.length - oldStr.length; } /** Returns the bytes size of a given string value. */ static BytesOf(str) { return new TextEncoder().encode(str).length; } } exports.StringUtil = StringUtil; });