@vedanshshetti/zeit 1.0.0 → 1.1.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.
- package/package.json +29 -23
- package/src/index.ts +3 -3
- package/src/just-a-test.ts +1 -1
- package/src/modules/before.ts +2 -2
- package/src/modules/in.ts +2 -2
- package/src/modules/now.ts +1 -1
- package/src/stuff.ts +11 -8
- package/tsconfig.json +37 -0
package/package.json
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vedanshshetti/zeit",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A free, typed Date & Time
|
|
5
|
-
"keywords": [
|
|
6
|
-
"zeit"
|
|
7
|
-
],
|
|
8
|
-
"homepage": "https://github.com/vedanshshetti/zeit#readme",
|
|
9
|
-
"bugs": {
|
|
10
|
-
"url": "https://github.com/vedanshshetti/zeit/issues"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/vedanshshetti/zeit.git"
|
|
15
|
-
},
|
|
16
|
-
"license": "EUPL-1.2",
|
|
17
|
-
"author": "Vedansh Shetti <vedansh.shetti@gmail.com>",
|
|
18
|
-
"type": "module",
|
|
19
|
-
"main": "dist/index.js",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
-
}
|
|
23
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@vedanshshetti/zeit",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A free, typed Date & Time library",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"zeit"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/vedanshshetti/zeit#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/vedanshshetti/zeit/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/vedanshshetti/zeit.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "EUPL-1.2",
|
|
17
|
+
"author": "Vedansh Shetti <vedansh.shetti@gmail.com>",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^26.6.6"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"typescript": "^7.0.2"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
package/src/just-a-test.ts
CHANGED
package/src/modules/before.ts
CHANGED
package/src/modules/in.ts
CHANGED
package/src/modules/now.ts
CHANGED
package/src/stuff.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { UnitOfTime, Wording } from "./types";
|
|
1
|
+
import type { UnitOfTime, Wording } from "./types.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @private
|
|
5
5
|
*/
|
|
6
6
|
export function parseWording(x: Wording) {
|
|
7
|
-
const pieces = x.split(" ");
|
|
8
|
-
if(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const pieces = x.split(" ") as [string, string];
|
|
8
|
+
if (pieces.length !== 2) {
|
|
9
|
+
throw new Error(`Invalid wording format: "${x}". Expected format: "<number> <unit>"`);
|
|
10
|
+
}
|
|
11
|
+
const value = parseInt(pieces[0], 10);
|
|
12
|
+
if (isNaN(value)) {
|
|
13
|
+
throw new Error(`Invalid number in wording: "${x}"`);
|
|
14
|
+
}
|
|
12
15
|
return {
|
|
13
|
-
value
|
|
16
|
+
value,
|
|
14
17
|
unit: pieces[1] as UnitOfTime
|
|
15
|
-
}
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export function toLocalISOString(d: Date): string {
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment Settings
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"lib": ["esnext"],
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
|
|
9
|
+
// Output Layout
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"rootDir": "./src",
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
|
|
16
|
+
// Stricter Typechecking
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUncheckedIndexedAccess": true,
|
|
19
|
+
"exactOptionalPropertyTypes": true,
|
|
20
|
+
"noImplicitReturns": true,
|
|
21
|
+
"noImplicitOverride": true,
|
|
22
|
+
"noUnusedLocals": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
26
|
+
|
|
27
|
+
// Module & Syntax
|
|
28
|
+
"verbatimModuleSyntax": true,
|
|
29
|
+
"isolatedModules": true,
|
|
30
|
+
"moduleDetection": "force",
|
|
31
|
+
"skipLibCheck": true,
|
|
32
|
+
"esModuleInterop": true,
|
|
33
|
+
"forceConsistentCasingInFileNames": true
|
|
34
|
+
},
|
|
35
|
+
"include": ["src/**/*"],
|
|
36
|
+
"exclude": ["node_modules", "dist"]
|
|
37
|
+
}
|