@solar-kit/planets 1.0.6 → 1.0.8

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.
package/earth/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './entity';
2
2
  export * from './model';
3
3
  export * from './oss';
4
+ export * from './utils';
package/earth/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './entity.js';
2
2
  export * from './model.js';
3
3
  export * from './oss.js';
4
+ export * from './utils/index.js';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/planets/src/earth/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/planets/src/earth/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './weight';
@@ -0,0 +1,2 @@
1
+ export * from './weight.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/planets/src/earth/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 标准化各种重量为克
3
+ * @param value
4
+ * @param unitId
5
+ */
6
+ export declare function normalizedGram(value: number, unitId: number): number;
7
+ /**
8
+ * 标准化克为各种重量
9
+ * @param gram
10
+ * @param unitId
11
+ * @returns
12
+ */
13
+ export declare function formatWeight(gram: number, unitId: number): number;
14
+ /** 重量单位 */
15
+ export declare const WeightUnit: {
16
+ readonly Kilogram: 221;
17
+ readonly Gram: 292;
18
+ readonly Jin: 222;
19
+ readonly SimaJin: 447;
20
+ };
21
+ export type WeightUnit = typeof WeightUnit[keyof typeof WeightUnit];
@@ -0,0 +1,37 @@
1
+ import { jinToGram, kiloToGram, simaJinToGram, toJin, toKilo, toSimaJin } from '@solar-kit/core';
2
+ /**
3
+ * 标准化各种重量为克
4
+ * @param value
5
+ * @param unitId
6
+ */
7
+ export function normalizedGram(value, unitId) {
8
+ return {
9
+ [221]: kiloToGram(value),
10
+ [222]: jinToGram(value),
11
+ [292]: value,
12
+ [447]: simaJinToGram(value),
13
+ }[unitId];
14
+ }
15
+ /**
16
+ * 标准化克为各种重量
17
+ * @param gram
18
+ * @param unitId
19
+ * @returns
20
+ */
21
+ export function formatWeight(gram, unitId) {
22
+ var _a;
23
+ return (_a = {
24
+ [221]: toKilo(gram),
25
+ [222]: toJin(gram),
26
+ [292]: gram,
27
+ [447]: toSimaJin(gram),
28
+ }[unitId]) !== null && _a !== void 0 ? _a : gram;
29
+ }
30
+ /** 重量单位 */
31
+ export const WeightUnit = {
32
+ Kilogram: 221,
33
+ Gram: 292,
34
+ Jin: 222,
35
+ SimaJin: 447
36
+ };
37
+ //# sourceMappingURL=weight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weight.js","sourceRoot":"","sources":["../../../../../packages/planets/src/earth/utils/weight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjG;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,MAAc;IAC1D,OAAO;QACL,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC;QACxB,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;QACvB,CAAC,GAAG,CAAC,EAAE,KAAK;QACZ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC;KAC5B,CAAC,MAAM,CAAE,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc;;IACvD,OAAO,MAAA;QACL,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;QACnB,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;QAClB,CAAC,GAAG,CAAC,EAAE,IAAI;QACX,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;KACvB,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;AACpB,CAAC;AAED,WAAW;AACX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,GAAG;IACb,IAAI,EAAE,GAAG;IACT,GAAG,EAAE,GAAG;IACR,OAAO,EAAE,GAAG;CACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solar-kit/planets",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "sideEffects": false,
5
5
  "publishConfig": {
6
6
  "access": "public"