@yookue/ts-lang-utils
Advanced tools
Comparing version 0.1.57 to 0.1.58
@@ -81,5 +81,5 @@ export declare abstract class StringUtils { | ||
static toChars(text?: string | null): string[] | undefined; | ||
static toCamelCase(text?: string | null, pattern?: RegExp | string): string | undefined | null; | ||
static toKebabCase(text?: string | null, pattern?: RegExp | string): string | undefined | null; | ||
static toCamelCase(text?: string | null): string | undefined | null; | ||
static toKebabCase(text?: string | null): string | undefined | null; | ||
static trim(text?: string | null, emptyAsNull?: boolean): string | undefined | null; | ||
} |
@@ -25,5 +25,5 @@ var __defProp = Object.defineProperty; | ||
module.exports = __toCommonJS(StringUtils_exports); | ||
var import_lodash = require("lodash"); | ||
var import_ArrayUtils = require("./ArrayUtils"); | ||
var import_ObjectUtils = require("./ObjectUtils"); | ||
var import_RegexUtils = require("./RegexUtils"); | ||
var StringUtils = class { | ||
@@ -1572,3 +1572,2 @@ /** | ||
* @param text the source string to inspect | ||
* @param pattern the regex to match | ||
* | ||
@@ -1580,14 +1579,8 @@ * @returns the camel case representation of the given string | ||
* StringUtils.toCamelCase('FOO BAR'); // 'fooBar' | ||
* StringUtils.toCamelCase('--FOO-BAR--'); // 'fooBar' | ||
* StringUtils.toCamelCase('--foo-bar--'); // 'fooBar' | ||
* StringUtils.toCamelCase('__FOO_BAR__'); // 'fooBar' | ||
* ``` | ||
*/ | ||
static toCamelCase(text, pattern) { | ||
if (!text || text.length === 0) { | ||
return text; | ||
} | ||
const words = import_RegexUtils.RegexUtils.extractWords(text, pattern); | ||
return !words ? void 0 : words.reduce((previous, current, index) => { | ||
current = current.toLowerCase(); | ||
return previous + (index > 0 ? this.capitalizeFirst(current) : current); | ||
}, ""); | ||
static toCamelCase(text) { | ||
return !text ? text : (0, import_lodash.camelCase)(text); | ||
} | ||
@@ -1598,3 +1591,2 @@ /** | ||
* @param text the source string to inspect | ||
* @param pattern the regex to match | ||
* | ||
@@ -1606,13 +1598,8 @@ * @returns the kebab case representation of the given string | ||
* StringUtils.toKebabCase('FOO BAR'); // 'foo-bar' | ||
* StringUtils.toKebabCase('--FOO-BAR--'); // 'foo-bar' | ||
* StringUtils.toKebabCase('fooBar'); // 'foo-bar' | ||
* StringUtils.toKebabCase('__FOO_BAR__'); // 'foo-bar' | ||
* ``` | ||
*/ | ||
static toKebabCase(text, pattern) { | ||
if (!text || text.length === 0) { | ||
return text; | ||
} | ||
const words = import_RegexUtils.RegexUtils.extractWords(text, pattern); | ||
return !words ? void 0 : words.reduce((previous, current, index) => { | ||
return previous + (index > 0 ? "-" : "") + current.toLowerCase(); | ||
}, ""); | ||
static toKebabCase(text) { | ||
return !text ? text : (0, import_lodash.kebabCase)(text); | ||
} | ||
@@ -1619,0 +1606,0 @@ /** |
@@ -81,5 +81,5 @@ export declare abstract class StringUtils { | ||
static toChars(text?: string | null): string[] | undefined; | ||
static toCamelCase(text?: string | null, pattern?: RegExp | string): string | undefined | null; | ||
static toKebabCase(text?: string | null, pattern?: RegExp | string): string | undefined | null; | ||
static toCamelCase(text?: string | null): string | undefined | null; | ||
static toKebabCase(text?: string | null): string | undefined | null; | ||
static trim(text?: string | null, emptyAsNull?: boolean): string | undefined | null; | ||
} |
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import { camelCase, kebabCase } from 'lodash'; | ||
import { ArrayUtils } from "./ArrayUtils"; | ||
import { ObjectUtils } from "./ObjectUtils"; | ||
import { RegexUtils } from "./RegexUtils"; | ||
export var StringUtils = /*#__PURE__*/function () { | ||
@@ -731,23 +731,9 @@ function StringUtils() { | ||
key: "toCamelCase", | ||
value: function toCamelCase(text, pattern) { | ||
var _this21 = this; | ||
if (!text || text.length === 0) { | ||
return text; | ||
} | ||
var words = RegexUtils.extractWords(text, pattern); | ||
return !words ? undefined : words.reduce(function (previous, current, index) { | ||
current = current.toLowerCase(); | ||
return previous + (index > 0 ? _this21.capitalizeFirst(current) : current); | ||
}, ''); | ||
value: function toCamelCase(text) { | ||
return !text ? text : camelCase(text); | ||
} | ||
}, { | ||
key: "toKebabCase", | ||
value: function toKebabCase(text, pattern) { | ||
if (!text || text.length === 0) { | ||
return text; | ||
} | ||
var words = RegexUtils.extractWords(text, pattern); | ||
return !words ? undefined : words.reduce(function (previous, current, index) { | ||
return previous + (index > 0 ? '-' : '') + current.toLowerCase(); | ||
}, ''); | ||
value: function toKebabCase(text) { | ||
return !text ? text : kebabCase(text); | ||
} | ||
@@ -754,0 +740,0 @@ }, { |
{ | ||
"name": "@yookue/ts-lang-utils", | ||
"version": "0.1.57", | ||
"version": "0.1.58", | ||
"title": "TsLangUtils", | ||
@@ -44,6 +44,7 @@ "description": "Common lang utilities for typescript", | ||
"dependencies": { | ||
"@babel/runtime": "^7.25.6" | ||
"@babel/runtime": "^7.25.7" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.12", | ||
"@types/lodash": "^4.17.10", | ||
"@typescript-eslint/eslint-plugin": "^7.18.0", | ||
@@ -50,0 +51,0 @@ "@yookue/babel-plugin-remove-comment": "^0.1.3", |
Sorry, the diff of this file is too big to display
361185
12
7327
Updated@babel/runtime@^7.25.7