j-kompact 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,8 @@
1
+ /**
2
+ * Convert tanggal dalam bentuk angka dari spreadsheet ke objek MLDate
3
+ */
4
+ export declare function toMLDate(value: number): import("../../Date.ts").MLDate;
5
+ /**
6
+ * Cek apakah nilai yang diberikan merupakan rentang tahun yang valid (1999 - 2099)
7
+ */
8
+ export declare function isYear(value: any): boolean;
@@ -0,0 +1,18 @@
1
+ import { initDate, isDate } from '../../Date.js';
2
+ import { between } from '../../Comparison.js';
3
+ /**
4
+ * Convert tanggal dalam bentuk angka dari spreadsheet ke objek MLDate
5
+ */
6
+ export function toMLDate(value) {
7
+ const date = initDate(Math.round((value - 25569) * 86400000));
8
+ if (!isDate(date))
9
+ throw Error(`${value} bukanlah angka tanggal yang valid`);
10
+ return date;
11
+ }
12
+ /**
13
+ * Cek apakah nilai yang diberikan merupakan rentang tahun yang valid (1999 - 2099)
14
+ */
15
+ export function isYear(value) {
16
+ value = Number(value);
17
+ return !isNaN(value) && between(1999, value, 2099);
18
+ }
@@ -0,0 +1,12 @@
1
+ export * from './Array.ts';
2
+ export * from './Boolean.ts';
3
+ export * from './Comparison.ts';
4
+ export * from './Date.ts';
5
+ export * from './Dynamic.ts';
6
+ export * from './Error.ts';
7
+ export * from './Iteration.ts';
8
+ export * from './Manipulation.ts';
9
+ export * from './Object.ts';
10
+ export * from './String.ts';
11
+ export * from './Type.ts';
12
+ export * from './google/spreadsheet/Utilites.ts';
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ export * from './Array.js';
2
+ export * from './Boolean.js';
3
+ export * from './Comparison.js';
4
+ export * from './Date.js';
5
+ export * from './Dynamic.js';
6
+ export * from './Error.js';
7
+ export * from './Iteration.js';
8
+ export * from './Manipulation.js';
9
+ export * from './Object.js';
10
+ export * from './String.js';
11
+ export * from './Type.js';
12
+ export * from './google/spreadsheet/Utilites.js';
package/global.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { MLArray } from './src'
2
+
3
+ declare global {
4
+ interface Array<T> {
5
+ asMLArray<T>(): MLArray<T>
6
+ lazyFlat(): Array<T>
7
+ }
8
+ }
9
+
10
+ export {}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "j-kompact",
3
+ "version": "1.0.0",
4
+ "description": "A utility library to manipulate data in js based application",
5
+ "author": "Jundi",
6
+ "license": "MPL-2.0",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": ["dist", "global.d.ts"],
17
+ "scripts": {
18
+ "test": "vitest run",
19
+ "build": "tsc -p tsconfig.build.json",
20
+ "prebuild": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
21
+ "prepublishOnly": "bun run build && bun run test"
22
+ },
23
+ "dependencies": {
24
+ "dayjs": "^1.11.21"
25
+ },
26
+ "devDependencies": {
27
+ "@types/bun": "latest",
28
+ "@types/google-apps-script": "^2.0.13",
29
+ "ts-to-jsdoc": "^2.4.0",
30
+ "vitest": "5.0.0-rc.2",
31
+ "typescript": "^7.0.2"
32
+ }
33
+ }