@alwatr/parse-duration 1.0.2 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/parse-duration@1.0.3...@alwatr/parse-duration@1.0.4) (2024-03-28)
7
+
8
+ **Note:** Version bump only for package @alwatr/parse-duration
9
+
10
+ ## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/parse-duration@1.0.2...@alwatr/parse-duration@1.0.3) (2024-01-31)
11
+
12
+ ### Miscellaneous Chores
13
+
14
+ * **deps:** update ([1a45030](https://github.com/Alwatr/nanolib/commit/1a450305440b710a300787d4ca24b1ed8c6a39d7)) by @AliMD
15
+
6
16
  ## [1.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/parse-duration@1.0.1...@alwatr/parse-duration@1.0.2) (2024-01-24)
7
17
 
8
18
  **Note:** Version bump only for package @alwatr/parse-duration
@@ -15,10 +25,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
15
25
 
16
26
  ### Bug Fixes
17
27
 
18
- * **parse-duration:** remove unused variables ([500f272](https://github.com/Alwatr/nanolib/commit/500f2727373daf12b6b8b84032244a88f197948e)) by @adltalab
28
+ - **parse-duration:** remove unused variables ([500f272](https://github.com/Alwatr/nanolib/commit/500f2727373daf12b6b8b84032244a88f197948e)) by @adltalab
19
29
 
20
30
  ### Features
21
31
 
22
- * **parse-duration:** rewrite module 🤦🏻 ([be62163](https://github.com/Alwatr/nanolib/commit/be6216345cb3d4458307f55b8ae44f5ac60dda89)) by @AliMD
23
- * **parse-duration:** rewrite with document ([43ffecc](https://github.com/Alwatr/nanolib/commit/43ffeccbc4a859ad838938a63fd52c82654cc9bb)) by @njfamirm
24
- * **parse-duration:** seperate parseDuration from `@alwatr/math` ([f5e32d0](https://github.com/Alwatr/nanolib/commit/f5e32d080be1b5355463f77a2f23fbd0955b8b67)) by @adltalab
32
+ - **parse-duration:** rewrite module 🤦🏻 ([be62163](https://github.com/Alwatr/nanolib/commit/be6216345cb3d4458307f55b8ae44f5ac60dda89)) by @AliMD
33
+ - **parse-duration:** rewrite with document ([43ffecc](https://github.com/Alwatr/nanolib/commit/43ffeccbc4a859ad838938a63fd52c82654cc9bb)) by @njfamirm
34
+ - **parse-duration:** seperate parseDuration from `@alwatr/math` ([f5e32d0](https://github.com/Alwatr/nanolib/commit/f5e32d080be1b5355463f77a2f23fbd0955b8b67)) by @adltalab
package/README.md CHANGED
@@ -26,11 +26,11 @@ parseDuration('10d', 'h'); // 240
26
26
  ### Unit Table
27
27
 
28
28
  | Unit | Description |
29
- |------|--------|
30
- | `s` | Second |
31
- | `m` | Minute |
32
- | `h` | Hour |
33
- | `d` | Day |
34
- | `w` | Week |
35
- | `M` | Month |
36
- | `y` | Year |
29
+ | ---- | ----------- |
30
+ | `s` | Second |
31
+ | `m` | Minute |
32
+ | `h` | Hour |
33
+ | `d` | Day |
34
+ | `w` | Week |
35
+ | `M` | Month |
36
+ | `y` | Year |
package/dist/main.cjs CHANGED
@@ -1,3 +1,3 @@
1
- /* @alwatr/parse-duration v1.0.2 */
1
+ /* @alwatr/parse-duration v1.0.4 */
2
2
  "use strict";var e=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,n)=>{for(var t in n)e(r,t,{get:n[t],enumerable:!0})},w=(r,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!d.call(r,o)&&o!==t&&e(r,o,{get:()=>n[o],enumerable:!(i=f(n,o))||i.enumerable});return r};var D=r=>w(e({},"__esModule",{value:!0}),r);var h={};p(h,{parseDuration:()=>b});module.exports=D(h);var c=require("@alwatr/is-number"),a={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5,M:2592e6,y:31536e6},b=(r,n)=>{let t=r.slice(0,r.length-1);if(!(0,c.isNumber)(t))throw new Error("not_a_number");let i=+t,o=r.slice(-1),u=a[o];if(u===void 0)throw new Error("invalid_unit",{cause:{duration:r}});let s=i*u;if(n===void 0)return s;let _=a[n];if(_===void 0)throw new Error("invalid_unit",{cause:{toUnit:n}});return s/_};0&&(module.exports={parseDuration});
3
3
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,3 +1,3 @@
1
- /* @alwatr/parse-duration v1.0.2 */
1
+ /* @alwatr/parse-duration v1.0.4 */
2
2
  import{isNumber as a}from"@alwatr/is-number";var u={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5,M:2592e6,y:31536e6},f=(n,r)=>{let t=n.slice(0,n.length-1);if(!a(t))throw new Error("not_a_number");let s=+t,_=n.slice(-1),o=u[_];if(o===void 0)throw new Error("invalid_unit",{cause:{duration:n}});let i=s*o;if(r===void 0)return i;let e=u[r];if(e===void 0)throw new Error("invalid_unit",{cause:{toUnit:r}});return i/e};export{f as parseDuration};
3
3
  //# sourceMappingURL=main.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwatr/parse-duration",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A simple utility to parse a duration string into milliseconds number.",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "keywords": [
@@ -69,15 +69,15 @@
69
69
  "clean": "rm -rfv dist *.tsbuildinfo"
70
70
  },
71
71
  "dependencies": {
72
- "@alwatr/is-number": "^1.0.2"
72
+ "@alwatr/is-number": "^1.0.4"
73
73
  },
74
74
  "devDependencies": {
75
- "@alwatr/nano-build": "^1.3.2",
75
+ "@alwatr/nano-build": "^1.3.4",
76
76
  "@alwatr/prettier-config": "^1.0.4",
77
- "@alwatr/tsconfig-base": "^1.1.1",
78
- "@types/node": "^20.11.6",
77
+ "@alwatr/tsconfig-base": "^1.1.2",
78
+ "@types/node": "^20.11.30",
79
79
  "jest": "^29.7.0",
80
- "typescript": "^5.3.3"
80
+ "typescript": "^5.4.3"
81
81
  },
82
- "gitHead": "3486060abc5f331a3b8c78da7f1d671ba1139b5d"
82
+ "gitHead": "df149736d1e85335aaeb9c547ff3bdd1161f9b33"
83
83
  }