@etsoo/shared 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,4 @@
1
1
  import { Utils } from '../src/Utils';
2
- import '../src/String';
3
- import '../src/StringExtensions';
4
2
 
5
3
  test('Tests for getDataChanges', () => {
6
4
  const input = {
@@ -1,4 +1,15 @@
1
1
  import { DataTypes } from './DataTypes';
2
+ declare global {
3
+ interface String {
4
+ /**
5
+ * Format string
6
+ * @param this Template
7
+ * @param parameters Parameters to fill the template
8
+ * @returns Result
9
+ */
10
+ format(this: string, ...parameters: string[]): string;
11
+ }
12
+ }
2
13
  /**
3
14
  * Utilities
4
15
  */
package/lib/cjs/Utils.js CHANGED
@@ -2,6 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Utils = void 0;
4
4
  const DataTypes_1 = require("./DataTypes");
5
+ String.prototype.format = function (...parameters) {
6
+ let template = this;
7
+ parameters.forEach((value, index) => {
8
+ template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
9
+ });
10
+ return template;
11
+ };
5
12
  /**
6
13
  * Utilities
7
14
  */
@@ -5,5 +5,4 @@ export * from './DomUtils';
5
5
  export * from './ExtendUtils';
6
6
  export * from './NumberUtils';
7
7
  export * from './StorageUtils';
8
- export * from './StringExtensions';
9
8
  export * from './Utils';
package/lib/cjs/index.js CHANGED
@@ -17,5 +17,4 @@ __exportStar(require("./DomUtils"), exports);
17
17
  __exportStar(require("./ExtendUtils"), exports);
18
18
  __exportStar(require("./NumberUtils"), exports);
19
19
  __exportStar(require("./StorageUtils"), exports);
20
- __exportStar(require("./StringExtensions"), exports);
21
20
  __exportStar(require("./Utils"), exports);
@@ -1,4 +1,15 @@
1
1
  import { DataTypes } from './DataTypes';
2
+ declare global {
3
+ interface String {
4
+ /**
5
+ * Format string
6
+ * @param this Template
7
+ * @param parameters Parameters to fill the template
8
+ * @returns Result
9
+ */
10
+ format(this: string, ...parameters: string[]): string;
11
+ }
12
+ }
2
13
  /**
3
14
  * Utilities
4
15
  */
package/lib/mjs/Utils.js CHANGED
@@ -1,4 +1,11 @@
1
1
  import { DataTypes } from './DataTypes';
2
+ String.prototype.format = function (...parameters) {
3
+ let template = this;
4
+ parameters.forEach((value, index) => {
5
+ template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
6
+ });
7
+ return template;
8
+ };
2
9
  /**
3
10
  * Utilities
4
11
  */
@@ -5,5 +5,4 @@ export * from './DomUtils';
5
5
  export * from './ExtendUtils';
6
6
  export * from './NumberUtils';
7
7
  export * from './StorageUtils';
8
- export * from './StringExtensions';
9
8
  export * from './Utils';
package/lib/mjs/index.js CHANGED
@@ -5,5 +5,4 @@ export * from './DomUtils';
5
5
  export * from './ExtendUtils';
6
6
  export * from './NumberUtils';
7
7
  export * from './StorageUtils';
8
- export * from './StringExtensions';
9
8
  export * from './Utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/shared",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "TypeScript shared utilities and functions",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
package/src/Utils.ts CHANGED
@@ -1,5 +1,28 @@
1
1
  import { DataTypes } from './DataTypes';
2
2
 
3
+ declare global {
4
+ interface String {
5
+ /**
6
+ * Format string
7
+ * @param this Template
8
+ * @param parameters Parameters to fill the template
9
+ * @returns Result
10
+ */
11
+ format(this: string, ...parameters: string[]): string;
12
+ }
13
+ }
14
+
15
+ String.prototype.format = function (
16
+ this: string,
17
+ ...parameters: string[]
18
+ ): string {
19
+ let template = this;
20
+ parameters.forEach((value, index) => {
21
+ template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
22
+ });
23
+ return template;
24
+ };
25
+
3
26
  /**
4
27
  * Utilities
5
28
  */
package/src/index.ts CHANGED
@@ -5,5 +5,4 @@ export * from './DomUtils';
5
5
  export * from './ExtendUtils';
6
6
  export * from './NumberUtils';
7
7
  export * from './StorageUtils';
8
- export * from './StringExtensions';
9
8
  export * from './Utils';
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- String.prototype.format = function (...parameters) {
4
- let template = this;
5
- parameters.forEach((value, index) => {
6
- template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
7
- });
8
- return template;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- String.prototype.format = function (...parameters) {
2
- let template = this;
3
- parameters.forEach((value, index) => {
4
- template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
5
- });
6
- return template;
7
- };
8
- export {};
package/src/String.d.ts DELETED
@@ -1,9 +0,0 @@
1
- interface String {
2
- /**
3
- * Format string
4
- * @param this Template
5
- * @param parameters Parameters to fill the template
6
- * @returns Result
7
- */
8
- format(this: string, ...parameters: string[]): string;
9
- }
@@ -1,12 +0,0 @@
1
- String.prototype.format = function (
2
- this: string,
3
- ...parameters: string[]
4
- ): string {
5
- let template = this;
6
- parameters.forEach((value, index) => {
7
- template = template.replace(new RegExp(`\\{${index}\\}`, 'g'), value);
8
- });
9
- return template;
10
- };
11
-
12
- export {};