diff --git a/.eslintrc.json b/.eslintrc.json index 728903c..298c9b9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,58 +1,129 @@ { "env": { - "browser": true, - "commonjs": true, - "es2021": true, - "node": true + "browser": true, + "es2021": true }, "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended" + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "ignorePatterns": [ + "*.js" ], - "overrides": [], "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": "latest" + "ecmaVersion": "latest", + "sourceType": "module" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint" ], "rules": { - "@typescript-eslint/no-explicit-any": [ - "off" - ], - "@typescript-eslint/no-var-requires": [ - "off" - ], - "@typescript-eslint/no-inferrable-types": [ - "off" - ], - "indent": [ - "off", - "tab" - ], - "linebreak-style": [ - "warn", - "unix" - ], - "no-mixed-spaces-and-tabs": [ - "warn", - "smart-tabs" - ], - "quotes": [ - "warn", - "single", - { - "allowTemplateLiterals": true - } - ], - "semi": [ - "warn", - "always" - ], - "comma-dangle": [ - "warn", - "always-multiline" - ] + "@typescript-eslint/lines-between-class-members": [ + "error", + { + "exceptAfterOverload": true + } + ], + "@typescript-eslint/no-explicit-any": [ + "off" + ], + "@typescript-eslint/no-inferrable-types": [ + "off" + ], + "prefer-const": [ + "warn" + ], + "lines-between-class-members": [ + "off" + ], + "space-in-parens": [ + "error", + "never" + ], + "padding-line-between-statements": [ + "warn", + { + "blankLine": "always", + "prev": "*", + "next": "*" + }, + { + "blankLine": "always", + "prev": "import", + "next": "*" + }, + { + "blankLine": "never", + "prev": "import", + "next": "import" + }, + { + "blankLine": "any", + "prev": [ + "const", + "let", + "var" + ], + "next": [ + "const", + "let", + "var" + ] + }, + { + "blankLine": "any", + "prev": [ + "expression" + ], + "next": [ + "expression" + ] + }, + { + "blankLine": "any", + "prev": [ + "case", + "default" + ], + "next": [ + "case", + "default" + ] + } + ], + "indent": [ + "off", + 4 + ], + "linebreak-style": [ + "warn", + "unix" + ], + "keyword-spacing": [ + "warn", + { + "before": true + } + ], + "no-mixed-spaces-and-tabs": [ + "warn", + "smart-tabs" + ], + "quotes": [ + "warn", + "single", + { + "allowTemplateLiterals": true + } + ], + "semi": [ + "warn", + "always" + ], + "comma-dangle": [ + "warn", + "always-multiline" + ] } -} \ No newline at end of file + } \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6096f62..08081b5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ ui *.so *.min.js *.d.ts.map +*.d.ts dist # Packages # ############ diff --git a/CHANGELOG.md b/CHANGELOG.md index e05a4ec..971f950 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # CHANGELOG +#### 1.6.0 +- updated dependencies +- fixed "deprecated" text #### 1.5.0 - Using latest typescript version, please check if your environment still works with this version before upgrading! diff --git a/README.md b/README.md index 1ff6ffc..6bbf80a 100644 --- a/README.md +++ b/README.md @@ -74,14 +74,16 @@ format("the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of ``` -| Specifier | Result | -| :-------------: |:---------------------------:| -| `L` | LowerCase | -| `U` | UpperCase | -| `d` | ShortDatePattern | -| `s` | SortableDateTimePattern | -| `n` | Thousand seperator | -| `00` | Padding numbers | +| Specifier | Result | +| :-------------: | :---------------------------------------------: | +| `L` | LowerCase | +| `U` | UpperCase | +| `d` | ShortDatePattern | +| `s` | SortableDateTimePattern | +| `n` | Thousand seperator | +| `x` | Hexadecimal | +| `X` | Hexadecimal Uppercase | +| `00` | Padding numbers | diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index cd657b9..0000000 --- a/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -export declare const emptyString = ""; -export declare function isNullOrWhiteSpace(value: string | null): boolean; -export declare function joinString(delimiter: string, ...args: (string | object | Array<any>)[]): string; -export declare function formatString(format: string, ...args: any[]): string; -export declare class String { - private static readonly regexNumber; - private static readonly regexObject; - static empty: string; - /** - * @deprecated The property should not be used, and will be removed in future versions! Use `String.empty` instead. - */ - static Empty: string; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `String.isNullOrWhiteSpace()` instead. - */ - static IsNullOrWhiteSpace(value: string | null | undefined): boolean; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `String.join()` instead. - */ - static Join(delimiter: string, ...args: (string | object | Array<any>)[]): string; - /** - * @deprecated The method should not be used, and will be removed in future version!s Use `String.format()` instead. - */ - static Format(format: string, ...args: any[]): string; - static isNullOrWhiteSpace(value: string | null): boolean; - static join(delimiter: string, ...args: (string | object | Array<any>)[]): string; - static format(format: string, ...args: any[]): string; - private static formatString; - private static parsePattern; - private static decimalToHexString; - private static getDisplayDateFromString; - private static getSortableDateFromString; - private static formatNumber; - private static joinString; -} -export declare class StringBuilder { - Values: string[]; - constructor(value?: string); - toString(): string; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `toString()` instead. - */ - ToString(): string; - append(value: string): void; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `append()` instead. - */ - Append(value: string): void; - appendLine(value: string): void; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `appendLine()` instead. - */ - AppendLine(value: string): void; - appendFormat(format: string, ...args: any[]): void; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `appendFormat()` instead. - */ - AppendFormat(format: string, ...args: any[]): void; - appendLineFormat(format: string, ...args: any[]): void; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `appendLineFormat()` instead. - */ - AppendLineFormat(format: string, ...args: any[]): void; - clear(): void; - /** - * @deprecated The method should not be used, and will be removed in future versions! Use `clear()` instead. - */ - Clear(): void; -} diff --git a/index.ts b/index.ts index e49779b..afc008d 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,23 @@ -const EOL = '\r\n'; +let newLine = '\r\n'; + +function isNode() { + try { + return this === global; + } + catch { + return false; + } +} + +if (isNode()) { + const isWindows = typeof process != 'undefined' && 'win32' === process.platform; + + if (!isWindows) { + newLine = '\n'; + } +} + +export { newLine }; export const emptyString = ''; @@ -19,26 +38,26 @@ export class String { private static readonly regexObject = /{(\w+(:\w*)?)}/g; public static empty = ''; /** - * @deprecated The property should not be used, and will be removed in future versions! Use `String.empty` instead. + * @deprecated The property should not be used, and will be removed in future versions! Use `emptyString` instead. */ public static Empty = ''; /** - * @deprecated The method should not be used, and will be removed in future versions! Use `String.isNullOrWhiteSpace()` instead. + * @deprecated The method should not be used, and will be removed in future versions! Use `isNullOrWhiteSpace()` instead. */ public static IsNullOrWhiteSpace(value: string | null | undefined): boolean { return String.isNullOrWhiteSpace(value); } /** - * @deprecated The method should not be used, and will be removed in future versions! Use `String.join()` instead. + * @deprecated The method should not be used, and will be removed in future versions! Use `joinString()` instead. */ public static Join(delimiter: string, ...args: (string | object | Array<any>)[]): string { return String.join(delimiter, ...args); } /** - * @deprecated The method should not be used, and will be removed in future version!s Use `String.format()` instead. + * @deprecated The method should not be used, and will be removed in future version!s Use `formatString()` instead. */ public static Format(format: string, ...args: any[]): string { return String.format(format, ...args); @@ -54,6 +73,7 @@ export class String { } catch (e) { console.log(e); + return false; } } @@ -61,11 +81,13 @@ export class String { public static join(delimiter: string, ...args: (string | object | Array<any>)[]): string { try { const firstArg = args[0]; + if (Array.isArray(firstArg) || firstArg instanceof Array) { let tempString = String.empty; for (let i = 0; i < firstArg.length; i++) { const current = firstArg[i]; + if (i < firstArg.length - 1) { tempString += current + delimiter; } @@ -80,8 +102,10 @@ export class String { let tempString = String.empty; const objectArg = firstArg; const keys = Object.keys(firstArg); //get all Properties of the Object as Array + keys.forEach(element => { tempString += (<any>objectArg)[element] + delimiter; }); tempString = tempString.slice(0, tempString.length - delimiter.length); //remove last delimiter + return tempString; } @@ -91,6 +115,7 @@ export class String { } catch (e) { console.log(e); + return String.empty; } } @@ -109,6 +134,7 @@ export class String { } catch (e) { console.log(e); + return String.empty; } } @@ -116,12 +142,14 @@ export class String { private static formatString(regex: any, format: string, args: any, parseByObject = false): string { return format.replace(regex, function (match, x) { //0 const s = match.split(':'); + if (s.length > 1) { x = s[0].replace('{', ''); match = s[1].replace('}', ''); //U } let arg; + if (parseByObject) { arg = args[0][x]; } @@ -134,6 +162,7 @@ export class String { } arg = String.parsePattern(match, arg); + return typeof arg != 'undefined' && arg != null ? arg : String.empty; }); } @@ -142,10 +171,12 @@ export class String { switch (match) { case 'L': { arg = arg.toLocaleLowerCase(); + return arg; } case 'U': { arg = arg.toLocaleUpperCase(); + return arg; } case 'd': { @@ -155,6 +186,7 @@ export class String { else if (arg instanceof Date) { return String.format('{0:00}.{1:00}.{2:0000}', arg.getDate(), arg.getMonth(), arg.getFullYear()); } + break; } case 's': { @@ -164,12 +196,16 @@ export class String { else if (arg instanceof Date) { return String.format('{0:0000}-{1:00}-{2:00}', arg.getFullYear(), arg.getMonth(), arg.getDate()); } + break; } - case 'n': {//Tausender Trennzeichen + case 'n': { // thousands seperator + if (typeof (arg) !== 'string') arg = arg.toString(); + const replacedString = arg.replace(/,/g, '.'); + if (isNaN(parseFloat(replacedString)) || replacedString.length <= 3) { break; } @@ -187,8 +223,10 @@ export class String { let output = (mod > 0 ? (integer.substring(0, mod)) : String.empty); const remainingGroups = integer.substring(mod).match(/.{3}/g); + output = output + '.' + String.join('.', remainingGroups); arg = output + (parts.length > 1 ? ',' + parts[1] : ''); + return arg; } case 'x': { @@ -212,6 +250,7 @@ export class String { private static decimalToHexString(value: string, upperCase = false) { const parsed = parseFloat(value); const hexNumber = parsed.toString(16); + return upperCase ? hexNumber.toLocaleUpperCase() : hexNumber; } @@ -225,6 +264,7 @@ export class String { let day = splitted[splitted.length - 1]; const month = splitted[splitted.length - 2]; const year = splitted[splitted.length - 3]; + day = day.split('T')[0]; day = day.split(' ')[0]; @@ -233,12 +273,14 @@ export class String { private static getSortableDateFromString(input: string): string { const splitted = input.replace(',', '').split('.'); + if (splitted.length <= 1) { return input; } const times = splitted[splitted.length - 1].split(' '); let time = String.empty; + if (times.length > 1) { time = times[times.length - 1]; } @@ -261,11 +303,13 @@ export class String { private static formatNumber(input: number, formatTemplate: string): string { const count = formatTemplate.length; const stringValue = input.toString(); + if (count <= stringValue.length) { return stringValue; } let remainingCount = count - stringValue.length; + remainingCount += 1; //Array must have an extra entry return new Array(remainingCount).join('0') + stringValue; @@ -273,6 +317,7 @@ export class String { private static joinString(delimiter: string, ...args: string[]): string { let temp = String.empty; + for (let i = 0; i < args.length; i++) { if ((typeof args[i] == 'string' && String.isNullOrWhiteSpace(args[i])) || (typeof args[i] != 'number' && typeof args[i] != 'string')) { @@ -280,7 +325,9 @@ export class String { } const arg = '' + args[i]; + temp += arg; + for (let i2 = i + 1; i2 < args.length; i2++) { if (String.isNullOrWhiteSpace(args[i2])) { continue; @@ -288,6 +335,7 @@ export class String { temp += delimiter; i = i2 - 1; + break; } } @@ -331,7 +379,7 @@ export class StringBuilder { } public appendLine(value: string) { - this.Values.push(EOL + value); + this.Values.push(newLine + value); } /** @@ -353,7 +401,7 @@ export class StringBuilder { } public appendLineFormat(format: string, ...args: any[]) { - this.Values.push(EOL + String.format(format, ...args)); + this.Values.push(newLine + String.format(format, ...args)); } /** @@ -373,5 +421,4 @@ export class StringBuilder { public Clear() { this.clear(); } - -} \ No newline at end of file +} diff --git a/package.json b/package.json index f43680b..7ae944b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typescript-string-operations", - "version": "1.5.0-rc.15", + "version": "1.6.0", "description": "Simple lightweight string operation library for Typescript, works with Angular", "main": "dist/index.js", "types": "index.d.ts", @@ -20,30 +20,32 @@ "string operations", "stringbuilder", "string builder", - "angular" + "angular", + "browser", + "node", + "nodejs" ], - "author": "Sven Ulrich <mail@sven-ulrich.net> (sven-ulrich.net)", + "author": "Sven Ulrich", "license": "MIT", "bugs": { "url": "https://github.com/sevensc/typescript-string-operations/issues" }, "homepage": "https://github.com/sevensc/typescript-string-operations#readme", "devDependencies": { - "@types/chai": "^4.2.7", - "@types/mocha": "^9.1.1", - "@types/node": "^18.7.11", - "@typescript-eslint/eslint-plugin": "^5.34.0", - "@typescript-eslint/parser": "^5.34.0", - "chai": "^4.2.0", - "eslint": "^8.22.0", - "mocha": "^10.0.0", + "@types/chai": "^4.3.4", + "@types/mocha": "^10.0.1", + "@types/node": "^18.15.3", + "@typescript-eslint/eslint-plugin": "^5.55.0", + "@typescript-eslint/parser": "^5.55.0", + "chai": "^4.3.7", + "eslint": "^8.36.0", + "mocha": "^10.2.0", "ts-node": "^10.9.1", - "typescript": "^4.7.4", - "uglify-js": "^3.17.0" - }, - "directories": { + "typescript": "^4.9.5", + "uglify-js": "^3.17.4" }, + "directories": {}, "resolutions": { "natives": "1.1.3" } -} \ No newline at end of file +} diff --git a/tests/package.json b/tests/package.json index b6a530b..838c7be 100644 --- a/tests/package.json +++ b/tests/package.json @@ -3,6 +3,6 @@ "scripts": { }, "devDependencies": { - "typescript-string-operations": "^1.4.1" + "typescript-string-operations": "1.6.0" } } diff --git a/tests/tests.ts b/tests/tests.ts index a45c2ef..9a25281 100644 --- a/tests/tests.ts +++ b/tests/tests.ts @@ -1,15 +1,14 @@ -import { String, StringBuilder, isNullOrWhiteSpace, formatString, joinString } from '..'; +import { String, StringBuilder, isNullOrWhiteSpace, formatString, joinString, newLine } from '..'; import { Fruit } from './fruit'; import { expect } from 'chai'; import 'mocha'; -export const EOL = '\r\n'; - describe('String.IsNullOrWhitespace', () => { it('should return true on null string', () => { const teststring: string | null = null; let result = String.IsNullOrWhiteSpace(teststring); + expect(result).to.equal(true); result = String.isNullOrWhiteSpace(teststring); expect(result).to.equal(true); @@ -20,6 +19,7 @@ describe('String.IsNullOrWhitespace', () => { it('should return true on empty string', () => { const teststring = ''; let result = String.IsNullOrWhiteSpace(teststring); + expect(result).to.equal(true); result = String.isNullOrWhiteSpace(teststring); expect(result).to.equal(true); @@ -30,6 +30,7 @@ describe('String.IsNullOrWhitespace', () => { it('should return true only whitespace', () => { const teststring = ' '; let result = String.IsNullOrWhiteSpace(teststring); + expect(result).to.equal(true); result = String.isNullOrWhiteSpace(teststring); expect(result).to.equal(true); @@ -40,6 +41,7 @@ describe('String.IsNullOrWhitespace', () => { it('should return false contains non-whitespace characters', () => { const teststring = ' s '; let result = String.IsNullOrWhiteSpace(teststring); + expect(result).to.equal(false); result = String.isNullOrWhiteSpace(teststring); expect(result).to.equal(false); @@ -54,6 +56,7 @@ describe('String.Format Number Pattern', () => { const template = 'Bar'; const valueToInsert = 'Foo'; let result = String.Format(template, valueToInsert); + expect(result).to.equal(template); result = String.format(template, valueToInsert); expect(result).to.equal(template); @@ -65,6 +68,7 @@ describe('String.Format Number Pattern', () => { const template = '{0}'; const valueToInsert = 'Foo'; let result = String.Format(template, valueToInsert); + expect(result).to.equal(valueToInsert); result = String.format(template, valueToInsert); expect(result).to.equal(valueToInsert); @@ -77,6 +81,7 @@ describe('String.Format Number Pattern', () => { const valueToInsert = 'Foo'; const expectedValue = 'FooBarFoo'; let result = String.Format(template, valueToInsert); + expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); expect(result).to.equal(expectedValue); @@ -90,6 +95,7 @@ describe('String.Format Number Pattern', () => { const secondValueToInsert = 'Baz'; const expectedValue = 'FooBarBaz'; let result = String.Format(template, valueToInsert, secondValueToInsert); + expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert, secondValueToInsert); expect(result).to.equal(expectedValue); @@ -105,6 +111,7 @@ describe('String.Format Number Pattern', () => { const expectedValue = '13.04.2017'; let result = String.Format(template, valueToInsert); + console.log(result); expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); @@ -121,6 +128,7 @@ describe('String.Format Number Pattern', () => { const expectedValue = '2017-04-13'; let result = String.Format(template, valueToInsert); + console.log(result); expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); @@ -137,6 +145,7 @@ describe('String.Format Number Pattern', () => { const expectedValue = '23.01.2017'; let result = String.Format(template, valueToInsert); + console.log(result); expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); @@ -153,6 +162,7 @@ describe('String.Format Number Pattern', () => { const expectedValue = '2017-03-21T22:15:01'; let result = String.Format(template, valueToInsert); + console.log(result); expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); @@ -169,6 +179,7 @@ describe('String.Format Number Pattern', () => { const expectedValue = '2017-03-21T00:00:00'; let result = String.Format(template, valueToInsert); + console.log(result); expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); @@ -187,6 +198,7 @@ describe('String.Format Number Pattern', () => { const valueToInsert = 'awesome'; let actual = String.Format(template, valueToInsert); + expect(actual).to.equal(expectedValue); actual = String.format(template, valueToInsert); expect(actual).to.equal(expectedValue); @@ -200,6 +212,7 @@ describe('String.Format Number Pattern', () => { const valueToInsert = 'AWESOME'; let actual = String.Format(template, valueToInsert); + expect(actual).to.equal(expectedValue); actual = String.format(template, valueToInsert); expect(actual).to.equal(expectedValue); @@ -213,6 +226,7 @@ describe('String.Format Number Pattern', () => { it('should not pad without specifier using {0}', () => { const template = '{0}'; let result = String.Format(template, 5); + expect(result).to.equal('5'); result = String.format(template, 5); expect(result).to.equal('5'); @@ -223,6 +237,7 @@ describe('String.Format Number Pattern', () => { it('should pad 5 to 05 using {0:00}', () => { const template = '{0:00}'; let result = String.Format(template, 5); + expect(result).to.equal('05'); result = String.format(template, 5); expect(result).to.equal('05'); @@ -233,6 +248,7 @@ describe('String.Format Number Pattern', () => { it('should pad 5 to 005 using {0:000}', () => { const template = '{0:000}'; let result = String.Format(template, 5); + expect(result).to.equal('005'); result = String.format(template, 5); expect(result).to.equal('005'); @@ -243,6 +259,7 @@ describe('String.Format Number Pattern', () => { it('should ignore padding when input is longer then template', () => { const template = '{0:000}'; let result = String.Format(template, 50000); + expect(result).to.equal('50000'); result = String.format(template, 50000); expect(result).to.equal('50000'); @@ -256,18 +273,21 @@ describe('String.Format Number Pattern', () => { const expectedValue = '10.000.000.000'; let result = String.Format(template, valueToInsert); + expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); expect(result).to.equal(expectedValue); result = formatString(template, valueToInsert); expect(result).to.equal(expectedValue); }); + it('should set the correct thousands seperator keeping the decimals', () => { const template = '{0:n}'; const valueToInsert = '10000000000,12345'; const expectedValue = '10.000.000.000,12345'; let result = String.Format(template, valueToInsert); + expect(result).to.equal(expectedValue); result = String.format(template, valueToInsert); expect(result).to.equal(expectedValue); @@ -279,6 +299,7 @@ describe('String.Format Number Pattern', () => { describe('hexadecimal', () => { it('number should be converted to hex lowercase', () => { let result = String.Format('{0:x}', 500); + expect(result).to.equal('1f4'); result = String.format('{0:x}', 500); expect(result).to.equal('1f4'); @@ -288,6 +309,7 @@ describe('String.Format Number Pattern', () => { it('number should be converted to hex uppercase', () => { let result = String.Format('{0:X}', 500); + expect(result).to.equal('1F4'); result = String.format('{0:X}', 500); expect(result).to.equal('1F4'); @@ -297,6 +319,7 @@ describe('String.Format Number Pattern', () => { it('decimal should be converted to hex lowercase', () => { let result = String.Format('{0:x}', 321.124); + expect(result).to.equal('141.1fbe76c8b44'); result = String.format('{0:x}', 321.124); expect(result).to.equal('141.1fbe76c8b44'); @@ -306,6 +329,7 @@ describe('String.Format Number Pattern', () => { it('decimal should be converted to hex uppercase', () => { let result = String.Format('{0:X}', 321.124); + expect(result).to.equal('141.1FBE76C8B44'); result = String.format('{0:X}', 321.124); expect(result).to.equal('141.1FBE76C8B44'); @@ -315,6 +339,7 @@ describe('String.Format Number Pattern', () => { it('minus decimal should be converted to hex lowercase', () => { let result = String.Format('{0:x}', -321.124); + expect(result).to.equal('-141.1fbe76c8b44'); result = String.format('{0:x}', -321.124); expect(result).to.equal('-141.1fbe76c8b44'); @@ -324,6 +349,7 @@ describe('String.Format Number Pattern', () => { it('minus decimal should be converted to hex uppercase', () => { let result = String.Format('{0:X}', -321.124); + expect(result).to.equal('-141.1FBE76C8B44'); result = String.format('{0:X}', -321.124); expect(result).to.equal('-141.1FBE76C8B44'); @@ -344,6 +370,7 @@ describe('String.Format Text Pattern', () => { // Act // Assert let formatted = String.Format('the {type} is {color}', fruit); + expect(formatted).to.equal('the apple is red'); formatted = String.format('the {type} is {color}', fruit); expect(formatted).to.equal('the apple is red'); @@ -358,6 +385,7 @@ describe('String.Format Text Pattern', () => { // Act // Assert let formatted = String.Format('the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}', fruit); + expect(formatted).to.equal('the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000'); formatted = String.format('the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}', fruit); expect(formatted).to.equal('the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000'); @@ -372,6 +400,7 @@ describe('String.Join', () => { const stringOne = 'red', stringTwo = 'yellow', stringThree = 'blue'; let result = String.Join('; ', stringOne, stringTwo, stringThree); + expect(result).to.equal('red; yellow; blue'); result = String.join('; ', stringOne, stringTwo, stringThree); expect(result).to.equal('red; yellow; blue'); @@ -382,6 +411,7 @@ describe('String.Join', () => { it('should join the given array', () => { const object = ['red', 'yellow', 'blue']; let result = String.Join('; ', object); + expect(result).to.equal('red; yellow; blue'); result = String.join('; ', object); expect(result).to.equal('red; yellow; blue'); @@ -393,6 +423,7 @@ describe('String.Join', () => { const object = { Name: 'Foo', Value: 'Bar' }; let result = String.Join('.', object); + console.log(result); expect(result).to.equal('Foo.Bar'); result = String.join('.', object); @@ -407,6 +438,7 @@ describe('String.Join', () => { describe('StringBuilder initialization', () => { it('should not add empty string if there is no ctor parameter', () => { const builder = new StringBuilder(); + builder.Append('First Part... '); builder.Append('Second Part...'); @@ -416,6 +448,7 @@ describe('StringBuilder initialization', () => { it('should add a string if there is ctor parameter', () => { const builder = new StringBuilder(formatString('First {0}... ', 'Part')); + builder.AppendFormat('Second {0}...', 'Part'); console.log(builder.ToString()); @@ -427,6 +460,7 @@ describe('StringBuilder initialization', () => { describe('StringBuilderng.Append', () => { it('should append characters', () => { const builder = new StringBuilder(); + builder.Append('First Part... '); builder.Append('Second Part...'); @@ -436,6 +470,7 @@ describe('StringBuilderng.Append', () => { it('should append characters', () => { const builder = new StringBuilder(); + builder.AppendFormat('First {0}... ', 'Part'); builder.AppendFormat('Second {0}...', 'Part'); @@ -448,30 +483,33 @@ describe('StringBuilderng.Append', () => { describe('StringBuilder.AppendLine', () => { it('should append characters and new line', () => { const builder = new StringBuilder(); + builder.AppendLine('First Line...'); builder.AppendLine('Second Line...'); expect(builder.ToString()).to - .equal(`${EOL}First Line...${EOL}Second Line...`); + .equal(`${newLine}First Line...${newLine}Second Line...`); }); it('should append characters and new line', () => { const builder = new StringBuilder(); + builder.AppendLineFormat('First {0}...', 'Line'); builder.AppendLineFormat('Second {0}...', 'Line'); console.log(builder.ToString()); expect(builder.ToString()).to - .equal(`${EOL}First Line...${EOL}Second Line...`); + .equal(`${newLine}First Line...${newLine}Second Line...`); }); it('should append characters and new line', () => { const builder = new StringBuilder(); + builder.AppendLine('First Line...'); builder.AppendLine('Second Line...'); console.log(builder.ToString()); expect(builder.ToString()).to - .equal(`${EOL}First Line...${EOL}Second Line...`); + .equal(`${newLine}First Line...${newLine}Second Line...`); }); }); \ No newline at end of file diff --git a/tests/yarn.lock b/tests/yarn.lock index d7d9ba5..7e27279 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript-string-operations@^1.5.0-rc.10: - version "1.5.0-rc.10" - resolved "https://registry.yarnpkg.com/typescript-string-operations/-/typescript-string-operations-1.5.0-rc.10.tgz#1e0b3992d1f57768117ac88343633014215179b1" - integrity sha512-GUZC98vkgsp1ZmsDfGCZn/voV3sHRqbn22AeoAgMrwLoBOiu9VN9e55ZQpSIbLqUzQVERi4wwVoN00qpViYpmQ== +typescript-string-operations@1.6.0-rc.1: + version "1.6.0-rc.1" + resolved "https://registry.yarnpkg.com/typescript-string-operations/-/typescript-string-operations-1.6.0-rc.1.tgz#b13639fd19396a60271bb0a6766c347915b4c993" + integrity sha512-FX8oZEeH22AGzzBTf//b4FshTb3AiWRmC1i5m91Ezqcwh+WPpLWNS0yfe371HJ7qG/S/BdbvX6FIL8bsQiNXow== diff --git a/tsconfig.json b/tsconfig.json index 05f76af..a7f9251 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,6 @@ "skipLibCheck": true, "declaration": true, "declarationDir": "./", - "inlineSourceMap": true, + "inlineSourceMap": true } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 13d2a4b..e16b606 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,34 +9,51 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@eslint/eslintrc@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.0.tgz#29f92c30bb3e771e4a2048c95fa6855392dfac4f" - integrity sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw== +"@eslint-community/eslint-utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518" + integrity sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403" + integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ== + +"@eslint/eslintrc@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d" + integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.3.2" - globals "^13.15.0" + espree "^9.5.0" + globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" js-yaml "^4.1.0" minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@humanwhocodes/config-array@^0.10.4": - version "0.10.4" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.4.tgz#01e7366e57d2ad104feea63e72248f22015c520c" - integrity sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw== +"@eslint/js@8.36.0": + version "8.36.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe" + integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg== + +"@humanwhocodes/config-array@^0.11.8": + version "0.11.8" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" + integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" - minimatch "^3.0.4" + minimatch "^3.0.5" -"@humanwhocodes/gitignore-to-minimatch@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz#316b0a63b91c10e53f242efb4ace5c3b34e8728d" - integrity sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA== +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^1.2.1": version "1.2.1" @@ -74,7 +91,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -102,111 +119,115 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== -"@types/chai@^4.2.7": - version "4.3.3" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.3.tgz#3c90752792660c4b562ad73b3fbd68bf3bc7ae07" - integrity sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g== +"@types/chai@^4.3.4": + version "4.3.4" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.4.tgz#e913e8175db8307d78b4e8fa690408ba6b65dee4" + integrity sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw== "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== -"@types/mocha@^9.1.1": - version "9.1.1" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4" - integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== - -"@types/node@^18.7.11": - version "18.7.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.11.tgz#486e72cfccde88da24e1f23ff1b7d8bfb64e6250" - integrity sha512-KZhFpSLlmK/sdocfSAjqPETTMd0ug6HIMIAwkwUpU79olnZdQtMxpQP+G1wDzCH7na+FltSIhbaZuKdwZ8RDrw== - -"@typescript-eslint/eslint-plugin@^5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.34.0.tgz#d690f60e335596f38b01792e8f4b361d9bd0cb35" - integrity sha512-eRfPPcasO39iwjlUAMtjeueRGuIrW3TQ9WseIDl7i5UWuFbf83yYaU7YPs4j8+4CxUMIsj1k+4kV+E+G+6ypDQ== - dependencies: - "@typescript-eslint/scope-manager" "5.34.0" - "@typescript-eslint/type-utils" "5.34.0" - "@typescript-eslint/utils" "5.34.0" +"@types/mocha@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.1.tgz#2f4f65bb08bc368ac39c96da7b2f09140b26851b" + integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q== + +"@types/node@^18.15.3": + version "18.15.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.3.tgz#f0b991c32cfc6a4e7f3399d6cb4b8cf9a0315014" + integrity sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw== + +"@types/semver@^7.3.12": + version "7.3.13" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" + integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + +"@typescript-eslint/eslint-plugin@^5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.55.0.tgz#bc2400c3a23305e8c9a9c04aa40933868aaaeb47" + integrity sha512-IZGc50rtbjk+xp5YQoJvmMPmJEYoC53SiKPXyqWfv15XoD2Y5Kju6zN0DwlmaGJp1Iw33JsWJcQ7nw0lGCGjVg== + dependencies: + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.55.0" + "@typescript-eslint/type-utils" "5.55.0" + "@typescript-eslint/utils" "5.55.0" debug "^4.3.4" - functional-red-black-tree "^1.0.1" + grapheme-splitter "^1.0.4" ignore "^5.2.0" - regexpp "^3.2.0" + natural-compare-lite "^1.4.0" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@^5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.34.0.tgz#ca710858ea85dbfd30c9b416a335dc49e82dbc07" - integrity sha512-SZ3NEnK4usd2CXkoV3jPa/vo1mWX1fqRyIVUQZR4As1vyp4fneknBNJj+OFtV8WAVgGf+rOHMSqQbs2Qn3nFZQ== +"@typescript-eslint/parser@^5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.55.0.tgz#8c96a0b6529708ace1dcfa60f5e6aec0f5ed2262" + integrity sha512-ppvmeF7hvdhUUZWSd2EEWfzcFkjJzgNQzVST22nzg958CR+sphy8A6K7LXQZd6V75m1VKjp+J4g/PCEfSCmzhw== dependencies: - "@typescript-eslint/scope-manager" "5.34.0" - "@typescript-eslint/types" "5.34.0" - "@typescript-eslint/typescript-estree" "5.34.0" + "@typescript-eslint/scope-manager" "5.55.0" + "@typescript-eslint/types" "5.55.0" + "@typescript-eslint/typescript-estree" "5.55.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.34.0.tgz#14efd13dc57602937e25f188fd911f118781e527" - integrity sha512-HNvASMQlah5RsBW6L6c7IJ0vsm+8Sope/wu5sEAf7joJYWNb1LDbJipzmdhdUOnfrDFE6LR1j57x1EYVxrY4ow== +"@typescript-eslint/scope-manager@5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz#e863bab4d4183ddce79967fe10ceb6c829791210" + integrity sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw== dependencies: - "@typescript-eslint/types" "5.34.0" - "@typescript-eslint/visitor-keys" "5.34.0" + "@typescript-eslint/types" "5.55.0" + "@typescript-eslint/visitor-keys" "5.55.0" -"@typescript-eslint/type-utils@5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.34.0.tgz#7a324ab9ddd102cd5e1beefc94eea6f3eb32d32d" - integrity sha512-Pxlno9bjsQ7hs1pdWRUv9aJijGYPYsHpwMeCQ/Inavhym3/XaKt1ZKAA8FIw4odTBfowBdZJDMxf2aavyMDkLg== +"@typescript-eslint/type-utils@5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.55.0.tgz#74bf0233523f874738677bb73cb58094210e01e9" + integrity sha512-ObqxBgHIXj8rBNm0yh8oORFrICcJuZPZTqtAFh0oZQyr5DnAHZWfyw54RwpEEH+fD8suZaI0YxvWu5tYE/WswA== dependencies: - "@typescript-eslint/utils" "5.34.0" + "@typescript-eslint/typescript-estree" "5.55.0" + "@typescript-eslint/utils" "5.55.0" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.34.0.tgz#217bf08049e9e7b86694d982e88a2c1566330c78" - integrity sha512-49fm3xbbUPuzBIOcy2CDpYWqy/X7VBkxVN+DC21e0zIm3+61Z0NZi6J9mqPmSW1BDVk9FIOvuCFyUPjXz93sjA== +"@typescript-eslint/types@5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.55.0.tgz#9830f8d3bcbecf59d12f821e5bc6960baaed41fd" + integrity sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug== -"@typescript-eslint/typescript-estree@5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.34.0.tgz#ba7b83f4bf8ccbabf074bbf1baca7a58de3ccb9a" - integrity sha512-mXHAqapJJDVzxauEkfJI96j3D10sd567LlqroyCeJaHnu42sDbjxotGb3XFtGPYKPD9IyLjhsoULML1oI3M86A== +"@typescript-eslint/typescript-estree@5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz#8db7c8e47ecc03d49b05362b8db6f1345ee7b575" + integrity sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ== dependencies: - "@typescript-eslint/types" "5.34.0" - "@typescript-eslint/visitor-keys" "5.34.0" + "@typescript-eslint/types" "5.55.0" + "@typescript-eslint/visitor-keys" "5.55.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.34.0.tgz#0cae98f48d8f9e292e5caa9343611b6faf49e743" - integrity sha512-kWRYybU4Rn++7lm9yu8pbuydRyQsHRoBDIo11k7eqBWTldN4xUdVUMCsHBiE7aoEkFzrUEaZy3iH477vr4xHAQ== +"@typescript-eslint/utils@5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.55.0.tgz#34e97322e7ae5b901e7a870aabb01dad90023341" + integrity sha512-FkW+i2pQKcpDC3AY6DU54yl8Lfl14FVGYDgBTyGKB75cCwV3KpkpTMFi9d9j2WAJ4271LR2HeC5SEWF/CZmmfw== dependencies: + "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.34.0" - "@typescript-eslint/types" "5.34.0" - "@typescript-eslint/typescript-estree" "5.34.0" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.55.0" + "@typescript-eslint/types" "5.55.0" + "@typescript-eslint/typescript-estree" "5.55.0" eslint-scope "^5.1.1" - eslint-utils "^3.0.0" + semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.34.0": - version "5.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.34.0.tgz#d0fb3e31033e82ddd5de048371ad39eb342b2d40" - integrity sha512-O1moYjOSrab0a2fUvFpsJe0QHtvTC+cR+ovYpgKrAVXzqQyc74mv76TgY6z+aEtjQE2vgZux3CQVtGryqdcOAw== +"@typescript-eslint/visitor-keys@5.55.0": + version "5.55.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz#01ad414fca8367706d76cdb94adf788dc5b664a2" + integrity sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw== dependencies: - "@typescript-eslint/types" "5.34.0" + "@typescript-eslint/types" "5.55.0" eslint-visitor-keys "^3.3.0" -"@ungap/promise-all-settled@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" - integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== - acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -324,14 +345,14 @@ camelcase@^6.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -chai@^4.2.0: - version "4.3.6" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.6.tgz#ffe4ba2d9fa9d6680cc0b370adae709ec9011e9c" - integrity sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q== +chai@^4.3.7: + version "4.3.7" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" + integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== dependencies: assertion-error "^1.1.0" check-error "^1.0.2" - deep-eql "^3.0.1" + deep-eql "^4.1.2" get-func-name "^2.0.0" loupe "^2.3.1" pathval "^1.1.1" @@ -417,10 +438,10 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -deep-eql@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" - integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw== +deep-eql@^4.1.2: + version "4.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" + integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== dependencies: type-detect "^4.0.0" @@ -484,31 +505,23 @@ eslint-scope@^7.1.1: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - eslint-visitor-keys@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.22.0: - version "8.22.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.22.0.tgz#78fcb044196dfa7eef30a9d65944f6f980402c48" - integrity sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA== - dependencies: - "@eslint/eslintrc" "^1.3.0" - "@humanwhocodes/config-array" "^0.10.4" - "@humanwhocodes/gitignore-to-minimatch" "^1.0.2" +eslint@^8.36.0: + version "8.36.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf" + integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.4.0" + "@eslint/eslintrc" "^2.0.1" + "@eslint/js" "8.36.0" + "@humanwhocodes/config-array" "^0.11.8" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -516,23 +529,22 @@ eslint@^8.22.0: doctrine "^3.0.0" escape-string-regexp "^4.0.0" eslint-scope "^7.1.1" - eslint-utils "^3.0.0" eslint-visitor-keys "^3.3.0" - espree "^9.3.3" - esquery "^1.4.0" + espree "^9.5.0" + esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" find-up "^5.0.0" - functional-red-black-tree "^1.0.1" - glob-parent "^6.0.1" - globals "^13.15.0" - globby "^11.1.0" + glob-parent "^6.0.2" + globals "^13.19.0" grapheme-splitter "^1.0.4" ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" @@ -540,25 +552,23 @@ eslint@^8.22.0: minimatch "^3.1.2" natural-compare "^1.4.0" optionator "^0.9.1" - regexpp "^3.2.0" strip-ansi "^6.0.1" strip-json-comments "^3.1.0" text-table "^0.2.0" - v8-compile-cache "^2.0.3" -espree@^9.3.2, espree@^9.3.3: - version "9.3.3" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.3.tgz#2dd37c4162bb05f433ad3c1a52ddf8a49dc08e9d" - integrity sha512-ORs1Rt/uQTqUKjDdGCyrtYxbazf5umATSf/K4qxjmZHORR6HJk+2s/2Pqe+Kk49HHINC/xNIrGfgh8sZcll0ng== +espree@^9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.0.tgz#3646d4e3f58907464edba852fa047e6a27bdf113" + integrity sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw== dependencies: acorn "^8.8.0" acorn-jsx "^5.3.2" eslint-visitor-keys "^3.3.0" -esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" @@ -667,11 +677,6 @@ fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== - get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -689,7 +694,7 @@ glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob-parent@^6.0.1: +glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== @@ -720,10 +725,10 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^13.15.0: - version "13.17.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" - integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== +globals@^13.19.0: + version "13.20.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" + integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== dependencies: type-fest "^0.20.2" @@ -814,6 +819,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" @@ -829,6 +839,11 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== +js-sdsl@^4.1.4: + version "4.3.0" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.3.0.tgz#aeefe32a451f7af88425b11fdb5f58c90ae1d711" + integrity sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ== + js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -913,19 +928,18 @@ minimatch@5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" -mocha@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.0.0.tgz#205447d8993ec755335c4b13deba3d3a13c4def9" - integrity sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA== +mocha@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" + integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== dependencies: - "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" chokidar "3.5.3" @@ -968,6 +982,11 @@ natives@1.1.3: resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.3.tgz#44a579be64507ea2d6ed1ca04a9415915cf75558" integrity sha512-BZGSYV4YOLxzoTK73l0/s/0sH9l8SHs2ocReMH1f8JYSh5FUWu4ZrKCpJdRkWXV6HFR/pZDz7bwWOVAY07q77g== +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -1077,11 +1096,6 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" -regexpp@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -1242,15 +1256,15 @@ type-fest@^0.20.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -typescript@^4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@^4.9.5: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== -uglify-js@^3.17.0: - version "3.17.0" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.0.tgz#55bd6e9d19ce5eef0d5ad17cd1f587d85b180a85" - integrity sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg== +uglify-js@^3.17.4: + version "3.17.4" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" + integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== uri-js@^4.2.2: version "4.4.1" @@ -1264,11 +1278,6 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== -v8-compile-cache@^2.0.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" - integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"