@dandelion-promise/utils 1.0.0

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.
@@ -0,0 +1,15 @@
1
+ import * as math from "../src/math";
2
+
3
+ describe("math utils", () => {
4
+ it("add:1 + 2 = 3", () => {
5
+ expect(math.sum(1, 2)).toBe(3);
6
+ });
7
+
8
+ it("subtract: 5 - 2 = 3", () => {
9
+ expect(math.subtract(5, 2)).toBe(3);
10
+ });
11
+
12
+ it("multiply: 2 * 3 = 6", () => {
13
+ expect(math.multiply(2, 3)).toBe(6);
14
+ });
15
+ });
@@ -0,0 +1,13 @@
1
+ import * as string from "../src/string";
2
+
3
+ describe("string utils", () => {
4
+ it("capitalize:首字母大写", () => {
5
+ expect(string.capitalize("hello")).toBe("Hello");
6
+ expect(string.capitalize("test")).toBe("Test");
7
+ });
8
+
9
+ it("capitalize:去除首尾空格字符串", () => {
10
+ expect(string.trim(" hello ")).toBe("hello");
11
+ expect(string.trim(" test ")).toBe("test");
12
+ });
13
+ });
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const sum = (a, b) => {
4
+ return a + b;
5
+ };
6
+ const multiply = (a, b) => {
7
+ return a * b;
8
+ };
9
+ const subtract = (a, b) => {
10
+ return a - b;
11
+ };
12
+
13
+ const capitalize = (str) => {
14
+ return str.charAt(0).toUpperCase() + str.slice(1);
15
+ };
16
+ const trim = (str) => {
17
+ return str.trim();
18
+ };
19
+
20
+ exports.capitalize = capitalize;
21
+ exports.multiply = multiply;
22
+ exports.subtract = subtract;
23
+ exports.sum = sum;
24
+ exports.trim = trim;
25
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/math.ts","../src/string.ts"],"sourcesContent":["export const sum = (a: number, b: number): number => {\r\n return a + b;\r\n};\r\n\r\nexport const multiply = (a: number, b: number): number => {\r\n return a * b;\r\n};\r\n\r\nexport const subtract = (a: number, b: number): number => {\r\n return a - b;\r\n};\r\n","export const capitalize = (str: string): string => {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n};\r\n\r\nexport const trim = (str: string): string => {\r\n return str.trim();\r\n};\r\n"],"names":[],"mappings":";;MAAa,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IAClD,OAAO,CAAC,GAAG,CAAC;AACd;MAEa,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IACvD,OAAO,CAAC,GAAG,CAAC;AACd;MAEa,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IACvD,OAAO,CAAC,GAAG,CAAC;AACd;;ACVO,MAAM,UAAU,GAAG,CAAC,GAAW,KAAY;AAChD,IAAA,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD;AAEO,MAAM,IAAI,GAAG,CAAC,GAAW,KAAY;AAC1C,IAAA,OAAO,GAAG,CAAC,IAAI,EAAE;AACnB;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ export * from "./math";
2
+ export * from "./string";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,19 @@
1
+ const sum = (a, b) => {
2
+ return a + b;
3
+ };
4
+ const multiply = (a, b) => {
5
+ return a * b;
6
+ };
7
+ const subtract = (a, b) => {
8
+ return a - b;
9
+ };
10
+
11
+ const capitalize = (str) => {
12
+ return str.charAt(0).toUpperCase() + str.slice(1);
13
+ };
14
+ const trim = (str) => {
15
+ return str.trim();
16
+ };
17
+
18
+ export { capitalize, multiply, subtract, sum, trim };
19
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/math.ts","../src/string.ts"],"sourcesContent":["export const sum = (a: number, b: number): number => {\r\n return a + b;\r\n};\r\n\r\nexport const multiply = (a: number, b: number): number => {\r\n return a * b;\r\n};\r\n\r\nexport const subtract = (a: number, b: number): number => {\r\n return a - b;\r\n};\r\n","export const capitalize = (str: string): string => {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n};\r\n\r\nexport const trim = (str: string): string => {\r\n return str.trim();\r\n};\r\n"],"names":[],"mappings":"MAAa,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IAClD,OAAO,CAAC,GAAG,CAAC;AACd;MAEa,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IACvD,OAAO,CAAC,GAAG,CAAC;AACd;MAEa,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IACvD,OAAO,CAAC,GAAG,CAAC;AACd;;ACVO,MAAM,UAAU,GAAG,CAAC,GAAW,KAAY;AAChD,IAAA,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD;AAEO,MAAM,IAAI,GAAG,CAAC,GAAW,KAAY;AAC1C,IAAA,OAAO,GAAG,CAAC,IAAI,EAAE;AACnB;;;;"}
@@ -0,0 +1,30 @@
1
+ var DandelionMonorepoUtils = (function (exports) {
2
+ 'use strict';
3
+
4
+ const sum = (a, b) => {
5
+ return a + b;
6
+ };
7
+ const multiply = (a, b) => {
8
+ return a * b;
9
+ };
10
+ const subtract = (a, b) => {
11
+ return a - b;
12
+ };
13
+
14
+ const capitalize = (str) => {
15
+ return str.charAt(0).toUpperCase() + str.slice(1);
16
+ };
17
+ const trim = (str) => {
18
+ return str.trim();
19
+ };
20
+
21
+ exports.capitalize = capitalize;
22
+ exports.multiply = multiply;
23
+ exports.subtract = subtract;
24
+ exports.sum = sum;
25
+ exports.trim = trim;
26
+
27
+ return exports;
28
+
29
+ })({});
30
+ //# sourceMappingURL=index.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.iife.js","sources":["../src/math.ts","../src/string.ts"],"sourcesContent":["export const sum = (a: number, b: number): number => {\r\n return a + b;\r\n};\r\n\r\nexport const multiply = (a: number, b: number): number => {\r\n return a * b;\r\n};\r\n\r\nexport const subtract = (a: number, b: number): number => {\r\n return a - b;\r\n};\r\n","export const capitalize = (str: string): string => {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n};\r\n\r\nexport const trim = (str: string): string => {\r\n return str.trim();\r\n};\r\n"],"names":[],"mappings":";;;QAAa,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;MAClD,OAAO,CAAC,GAAG,CAAC;EACd;QAEa,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;MACvD,OAAO,CAAC,GAAG,CAAC;EACd;QAEa,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;MACvD,OAAO,CAAC,GAAG,CAAC;EACd;;ACVO,QAAM,UAAU,GAAG,CAAC,GAAW,KAAY;EAChD,IAAA,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;EACnD;AAEO,QAAM,IAAI,GAAG,CAAC,GAAW,KAAY;EAC1C,IAAA,OAAO,GAAG,CAAC,IAAI,EAAE;EACnB;;;;;;;;;;;;;;"}
package/dist/math.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const sum: (a: number, b: number) => number;
2
+ export declare const multiply: (a: number, b: number) => number;
3
+ export declare const subtract: (a: number, b: number) => number;
4
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAE1C,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAE/C,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAE/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const capitalize: (str: string) => string;
2
+ export declare const trim: (str: string) => string;
3
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAExC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,KAAG,MAElC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@dandelion-promise/utils",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "module": "./dist/index.esm.js",
8
+ "types": "./dist/index.d.ts",
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "buildOptions": {
13
+ "name": "DandelionPromiseUtils",
14
+ "formats": [
15
+ "esm",
16
+ "cjs",
17
+ "iife"
18
+ ]
19
+ },
20
+ "scripts": {
21
+ "test": "echo \"Error: no test specified\" && exit 1"
22
+ }
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./math";
2
+ export * from "./string";
package/src/math.ts ADDED
@@ -0,0 +1,11 @@
1
+ export const sum = (a: number, b: number): number => {
2
+ return a + b;
3
+ };
4
+
5
+ export const multiply = (a: number, b: number): number => {
6
+ return a * b;
7
+ };
8
+
9
+ export const subtract = (a: number, b: number): number => {
10
+ return a - b;
11
+ };
package/src/string.ts ADDED
@@ -0,0 +1,7 @@
1
+ export const capitalize = (str: string): string => {
2
+ return str.charAt(0).toUpperCase() + str.slice(1);
3
+ };
4
+
5
+ export const trim = (str: string): string => {
6
+ return str.trim();
7
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "lib": ["ESNext"],
6
+ "types": []
7
+ },
8
+ "include": ["src"]
9
+ }