mirror of
https://github.com/acamarata/date-fns-hijri.git
synced 2026-06-30 18:54:25 +00:00
refactor: code quality improvements across the board
This commit is contained in:
parent
9e88126a10
commit
815c0418a4
12 changed files with 1179 additions and 456 deletions
|
|
@ -1,12 +1,12 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{js,mjs,cjs,ts,mts,cts,json,yaml,yml,md}]
|
||||
[*.{ts,mts,cts,js,mjs,cjs,json,yaml,yml,md}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
|
|
|||
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
|
|
@ -22,8 +22,22 @@ jobs:
|
|||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm run build
|
||||
- run: node test.mjs
|
||||
- run: node test-cjs.cjs
|
||||
- run: node --test test.mjs
|
||||
- run: node --test test-cjs.cjs
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm run lint
|
||||
- run: pnpm run format:check
|
||||
|
||||
typecheck:
|
||||
name: Typecheck
|
||||
|
|
|
|||
14
.gitignore
vendored
14
.gitignore
vendored
|
|
@ -6,3 +6,17 @@ dist/
|
|||
.claude/
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# AI agent directories
|
||||
.cursor/
|
||||
.copilot/
|
||||
.aider*
|
||||
.aider.chat.history.md
|
||||
.continue/
|
||||
.codex/
|
||||
.gemini/
|
||||
.vscode/*
|
||||
.idea/
|
||||
.aider/
|
||||
.windsurf/
|
||||
.codeium/
|
||||
|
|
|
|||
6
.prettierrc
Normal file
6
.prettierrc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 100,
|
||||
"tabWidth": 2
|
||||
}
|
||||
12
eslint.config.mjs
Normal file
12
eslint.config.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
|
||||
export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
eslintConfigPrettier,
|
||||
{
|
||||
ignores: ['dist/', 'node_modules/', 'test.mjs', 'test-cjs.cjs'],
|
||||
},
|
||||
);
|
||||
42
package.json
42
package.json
|
|
@ -9,8 +9,14 @@
|
|||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": { "types": "./dist/index.d.mts", "default": "./dist/index.mjs" },
|
||||
"require": { "types": "./dist/index.d.ts", "default": "./dist/index.cjs" }
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
|
|
@ -23,13 +29,18 @@
|
|||
"CHANGELOG.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"engines": { "node": ">=20" },
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"packageManager": "pnpm@10.30.1",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"pretest": "tsup",
|
||||
"test": "node test.mjs && node test-cjs.cjs",
|
||||
"test": "node --test test.mjs && node --test test-cjs.cjs",
|
||||
"lint": "eslint src/",
|
||||
"format": "prettier --write src/",
|
||||
"format:check": "prettier --check src/",
|
||||
"prepublishOnly": "tsup"
|
||||
},
|
||||
"keywords": [
|
||||
|
|
@ -48,13 +59,26 @@
|
|||
"hijri-core": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@types/node": "^25.3.5",
|
||||
"eslint": "^10.0.3",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"hijri-core": "^1.0.0",
|
||||
"prettier": "^3.8.1",
|
||||
"tsup": "^8.0.0",
|
||||
"typescript": "^5.5.0"
|
||||
"typescript": "^5.5.0",
|
||||
"typescript-eslint": "^8.56.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acamarata/date-fns-hijri.git"
|
||||
},
|
||||
"publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
|
||||
"repository": { "type": "git", "url": "git+https://github.com/acamarata/date-fns-hijri.git" },
|
||||
"homepage": "https://github.com/acamarata/date-fns-hijri#readme",
|
||||
"bugs": { "url": "https://github.com/acamarata/date-fns-hijri/issues" }
|
||||
"bugs": {
|
||||
"url": "https://github.com/acamarata/date-fns-hijri/issues"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
751
pnpm-lock.yaml
751
pnpm-lock.yaml
|
|
@ -8,18 +8,33 @@ importers:
|
|||
|
||||
.:
|
||||
devDependencies:
|
||||
'@eslint/js':
|
||||
specifier: ^10.0.1
|
||||
version: 10.0.1(eslint@10.0.3)
|
||||
'@types/node':
|
||||
specifier: ^22.0.0
|
||||
version: 22.19.11
|
||||
specifier: ^25.3.5
|
||||
version: 25.3.5
|
||||
eslint:
|
||||
specifier: ^10.0.3
|
||||
version: 10.0.3
|
||||
eslint-config-prettier:
|
||||
specifier: ^10.1.8
|
||||
version: 10.1.8(eslint@10.0.3)
|
||||
hijri-core:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
prettier:
|
||||
specifier: ^3.8.1
|
||||
version: 3.8.1
|
||||
tsup:
|
||||
specifier: ^8.0.0
|
||||
version: 8.5.1(typescript@5.9.3)
|
||||
typescript:
|
||||
specifier: ^5.5.0
|
||||
version: 5.9.3
|
||||
typescript-eslint:
|
||||
specifier: ^8.56.1
|
||||
version: 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
|
||||
packages:
|
||||
|
||||
|
|
@ -179,6 +194,61 @@ packages:
|
|||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@eslint-community/eslint-utils@4.9.1':
|
||||
resolution: {integrity: sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
|
||||
|
||||
'@eslint-community/regexpp@4.12.2':
|
||||
resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==}
|
||||
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
|
||||
|
||||
'@eslint/config-array@0.23.3':
|
||||
resolution: {integrity: sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
'@eslint/config-helpers@0.5.3':
|
||||
resolution: {integrity: sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
'@eslint/core@1.1.1':
|
||||
resolution: {integrity: sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
'@eslint/js@10.0.1':
|
||||
resolution: {integrity: sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
peerDependencies:
|
||||
eslint: ^10.0.0
|
||||
peerDependenciesMeta:
|
||||
eslint:
|
||||
optional: true
|
||||
|
||||
'@eslint/object-schema@3.0.3':
|
||||
resolution: {integrity: sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
'@eslint/plugin-kit@0.6.1':
|
||||
resolution: {integrity: sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
'@humanfs/core@0.19.1':
|
||||
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
|
||||
engines: {node: '>=18.18.0'}
|
||||
|
||||
'@humanfs/node@0.16.7':
|
||||
resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==}
|
||||
engines: {node: '>=18.18.0'}
|
||||
|
||||
'@humanwhocodes/module-importer@1.0.1':
|
||||
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
|
||||
engines: {node: '>=12.22'}
|
||||
|
||||
'@humanwhocodes/retry@0.4.3':
|
||||
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
||||
engines: {node: '>=18.18'}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
|
||||
|
||||
|
|
@ -330,20 +400,101 @@ packages:
|
|||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@types/esrecurse@4.3.1':
|
||||
resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==}
|
||||
|
||||
'@types/estree@1.0.8':
|
||||
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
|
||||
|
||||
'@types/node@22.19.11':
|
||||
resolution: {integrity: sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==}
|
||||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/node@25.3.5':
|
||||
resolution: {integrity: sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA==}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.56.1':
|
||||
resolution: {integrity: sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': ^8.56.1
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/parser@8.56.1':
|
||||
resolution: {integrity: sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/project-service@8.56.1':
|
||||
resolution: {integrity: sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/scope-manager@8.56.1':
|
||||
resolution: {integrity: sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.56.1':
|
||||
resolution: {integrity: sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/type-utils@8.56.1':
|
||||
resolution: {integrity: sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/types@8.56.1':
|
||||
resolution: {integrity: sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.56.1':
|
||||
resolution: {integrity: sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/utils@8.56.1':
|
||||
resolution: {integrity: sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.56.1':
|
||||
resolution: {integrity: sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
acorn-jsx@5.3.2:
|
||||
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
|
||||
peerDependencies:
|
||||
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
|
||||
acorn@8.16.0:
|
||||
resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
ajv@6.14.0:
|
||||
resolution: {integrity: sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==}
|
||||
|
||||
any-promise@1.3.0:
|
||||
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
|
||||
|
||||
balanced-match@4.0.4:
|
||||
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
brace-expansion@5.0.4:
|
||||
resolution: {integrity: sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
bundle-require@5.1.0:
|
||||
resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
|
|
@ -369,6 +520,10 @@ packages:
|
|||
resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==}
|
||||
engines: {node: ^14.18.0 || >=16.10.0}
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
debug@4.4.3:
|
||||
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
|
||||
engines: {node: '>=6.0'}
|
||||
|
|
@ -378,11 +533,75 @@ packages:
|
|||
supports-color:
|
||||
optional: true
|
||||
|
||||
deep-is@0.1.4:
|
||||
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
||||
|
||||
esbuild@0.27.3:
|
||||
resolution: {integrity: sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
escape-string-regexp@4.0.0:
|
||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
eslint-config-prettier@10.1.8:
|
||||
resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
eslint: '>=7.0.0'
|
||||
|
||||
eslint-scope@9.1.2:
|
||||
resolution: {integrity: sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
eslint-visitor-keys@3.4.3:
|
||||
resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
|
||||
eslint-visitor-keys@5.0.1:
|
||||
resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
eslint@10.0.3:
|
||||
resolution: {integrity: sha512-COV33RzXZkqhG9P2rZCFl9ZmJ7WL+gQSCRzE7RhkbclbQPtLAWReL7ysA0Sh4c8Im2U9ynybdR56PV0XcKvqaQ==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
jiti: '*'
|
||||
peerDependenciesMeta:
|
||||
jiti:
|
||||
optional: true
|
||||
|
||||
espree@11.2.0:
|
||||
resolution: {integrity: sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
esquery@1.7.0:
|
||||
resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
esrecurse@4.3.0:
|
||||
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
estraverse@5.3.0:
|
||||
resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
esutils@2.0.3:
|
||||
resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
fast-deep-equal@3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
|
||||
fast-json-stable-stringify@2.1.0:
|
||||
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
||||
|
||||
fast-levenshtein@2.0.6:
|
||||
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
|
||||
|
||||
fdir@6.5.0:
|
||||
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
|
@ -392,22 +611,80 @@ packages:
|
|||
picomatch:
|
||||
optional: true
|
||||
|
||||
file-entry-cache@8.0.0:
|
||||
resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
|
||||
find-up@5.0.0:
|
||||
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
fix-dts-default-cjs-exports@1.0.1:
|
||||
resolution: {integrity: sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==}
|
||||
|
||||
flat-cache@4.0.1:
|
||||
resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
flatted@3.3.4:
|
||||
resolution: {integrity: sha512-3+mMldrTAPdta5kjX2G2J7iX4zxtnwpdA8Tr2ZSjkyPSanvbZAcy6flmtnXbEybHrDcU9641lxrMfFuUxVz9vA==}
|
||||
|
||||
fsevents@2.3.3:
|
||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
|
||||
glob-parent@6.0.2:
|
||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
hijri-core@1.0.0:
|
||||
resolution: {integrity: sha512-wImBZLBKbEWEEUE1nrc1CFY/uvx4XjGNWYChImJZlswXIVhrBCzSVaj6DP1AU2gUMJ6KDh2ygXo/u/Qx232CXA==}
|
||||
engines: {node: '>=20'}
|
||||
|
||||
ignore@5.3.2:
|
||||
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
|
||||
engines: {node: '>= 4'}
|
||||
|
||||
ignore@7.0.5:
|
||||
resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==}
|
||||
engines: {node: '>= 4'}
|
||||
|
||||
imurmurhash@0.1.4:
|
||||
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
|
||||
engines: {node: '>=0.8.19'}
|
||||
|
||||
is-extglob@2.1.1:
|
||||
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-glob@4.0.3:
|
||||
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
isexe@2.0.0:
|
||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
|
||||
joycon@3.1.1:
|
||||
resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
json-buffer@3.0.1:
|
||||
resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
|
||||
|
||||
json-schema-traverse@0.4.1:
|
||||
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
|
||||
|
||||
json-stable-stringify-without-jsonify@1.0.1:
|
||||
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
|
||||
|
||||
keyv@4.5.4:
|
||||
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
|
||||
|
||||
levn@0.4.1:
|
||||
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
lilconfig@3.1.3:
|
||||
resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==}
|
||||
engines: {node: '>=14'}
|
||||
|
|
@ -419,9 +696,17 @@ packages:
|
|||
resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
|
||||
locate-path@6.0.0:
|
||||
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
magic-string@0.30.21:
|
||||
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
|
||||
|
||||
minimatch@10.2.4:
|
||||
resolution: {integrity: sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
mlly@1.8.0:
|
||||
resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==}
|
||||
|
||||
|
|
@ -431,10 +716,33 @@ packages:
|
|||
mz@2.7.0:
|
||||
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
|
||||
|
||||
natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
|
||||
object-assign@4.1.1:
|
||||
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
optionator@0.9.4:
|
||||
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
p-limit@3.1.0:
|
||||
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
p-locate@5.0.0:
|
||||
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
path-exists@4.0.0:
|
||||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
path-key@3.1.1:
|
||||
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
pathe@2.0.3:
|
||||
resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
|
||||
|
||||
|
|
@ -470,6 +778,19 @@ packages:
|
|||
yaml:
|
||||
optional: true
|
||||
|
||||
prelude-ls@1.2.1:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
prettier@3.8.1:
|
||||
resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
|
||||
punycode@2.3.1:
|
||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
readdirp@4.1.2:
|
||||
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
|
||||
engines: {node: '>= 14.18.0'}
|
||||
|
|
@ -483,6 +804,19 @@ packages:
|
|||
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
|
||||
hasBin: true
|
||||
|
||||
semver@7.7.4:
|
||||
resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
shebang-regex@3.0.0:
|
||||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
source-map@0.7.6:
|
||||
resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==}
|
||||
engines: {node: '>= 12'}
|
||||
|
|
@ -510,6 +844,12 @@ packages:
|
|||
resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
|
||||
hasBin: true
|
||||
|
||||
ts-api-utils@2.4.0:
|
||||
resolution: {integrity: sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==}
|
||||
engines: {node: '>=18.12'}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4'
|
||||
|
||||
ts-interface-checker@0.1.13:
|
||||
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
|
||||
|
||||
|
|
@ -532,6 +872,17 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
|
||||
type-check@0.4.0:
|
||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
typescript-eslint@8.56.1:
|
||||
resolution: {integrity: sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.0.0'
|
||||
|
||||
typescript@5.9.3:
|
||||
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
||||
engines: {node: '>=14.17'}
|
||||
|
|
@ -540,8 +891,24 @@ packages:
|
|||
ufo@1.6.3:
|
||||
resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==}
|
||||
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
undici-types@7.18.2:
|
||||
resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==}
|
||||
|
||||
uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
|
||||
which@2.0.2:
|
||||
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
|
||||
engines: {node: '>= 8'}
|
||||
hasBin: true
|
||||
|
||||
word-wrap@1.2.5:
|
||||
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
yocto-queue@0.1.0:
|
||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
snapshots:
|
||||
|
||||
|
|
@ -623,6 +990,51 @@ snapshots:
|
|||
'@esbuild/win32-x64@0.27.3':
|
||||
optional: true
|
||||
|
||||
'@eslint-community/eslint-utils@4.9.1(eslint@10.0.3)':
|
||||
dependencies:
|
||||
eslint: 10.0.3
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
'@eslint-community/regexpp@4.12.2': {}
|
||||
|
||||
'@eslint/config-array@0.23.3':
|
||||
dependencies:
|
||||
'@eslint/object-schema': 3.0.3
|
||||
debug: 4.4.3
|
||||
minimatch: 10.2.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@eslint/config-helpers@0.5.3':
|
||||
dependencies:
|
||||
'@eslint/core': 1.1.1
|
||||
|
||||
'@eslint/core@1.1.1':
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.15
|
||||
|
||||
'@eslint/js@10.0.1(eslint@10.0.3)':
|
||||
optionalDependencies:
|
||||
eslint: 10.0.3
|
||||
|
||||
'@eslint/object-schema@3.0.3': {}
|
||||
|
||||
'@eslint/plugin-kit@0.6.1':
|
||||
dependencies:
|
||||
'@eslint/core': 1.1.1
|
||||
levn: 0.4.1
|
||||
|
||||
'@humanfs/core@0.19.1': {}
|
||||
|
||||
'@humanfs/node@0.16.7':
|
||||
dependencies:
|
||||
'@humanfs/core': 0.19.1
|
||||
'@humanwhocodes/retry': 0.4.3
|
||||
|
||||
'@humanwhocodes/module-importer@1.0.1': {}
|
||||
|
||||
'@humanwhocodes/retry@0.4.3': {}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
|
@ -712,16 +1124,128 @@ snapshots:
|
|||
'@rollup/rollup-win32-x64-msvc@4.59.0':
|
||||
optional: true
|
||||
|
||||
'@types/esrecurse@4.3.1': {}
|
||||
|
||||
'@types/estree@1.0.8': {}
|
||||
|
||||
'@types/node@22.19.11':
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
'@types/node@25.3.5':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
undici-types: 7.18.2
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.56.1(@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3))(eslint@10.0.3)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.12.2
|
||||
'@typescript-eslint/parser': 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
'@typescript-eslint/scope-manager': 8.56.1
|
||||
'@typescript-eslint/type-utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
'@typescript-eslint/utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
'@typescript-eslint/visitor-keys': 8.56.1
|
||||
eslint: 10.0.3
|
||||
ignore: 7.0.5
|
||||
natural-compare: 1.4.0
|
||||
ts-api-utils: 2.4.0(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 8.56.1
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
'@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3)
|
||||
'@typescript-eslint/visitor-keys': 8.56.1
|
||||
debug: 4.4.3
|
||||
eslint: 10.0.3
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/project-service@8.56.1(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.56.1(typescript@5.9.3)
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
debug: 4.4.3
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.56.1':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
'@typescript-eslint/visitor-keys': 8.56.1
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.56.1(typescript@5.9.3)':
|
||||
dependencies:
|
||||
typescript: 5.9.3
|
||||
|
||||
'@typescript-eslint/type-utils@8.56.1(eslint@10.0.3)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
'@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3)
|
||||
'@typescript-eslint/utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
debug: 4.4.3
|
||||
eslint: 10.0.3
|
||||
ts-api-utils: 2.4.0(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/types@8.56.1': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.56.1(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/project-service': 8.56.1(typescript@5.9.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.56.1(typescript@5.9.3)
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
'@typescript-eslint/visitor-keys': 8.56.1
|
||||
debug: 4.4.3
|
||||
minimatch: 10.2.4
|
||||
semver: 7.7.4
|
||||
tinyglobby: 0.2.15
|
||||
ts-api-utils: 2.4.0(typescript@5.9.3)
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.56.1(eslint@10.0.3)(typescript@5.9.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.9.1(eslint@10.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.56.1
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
'@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3)
|
||||
eslint: 10.0.3
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.56.1':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.56.1
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.16.0):
|
||||
dependencies:
|
||||
acorn: 8.16.0
|
||||
|
||||
acorn@8.16.0: {}
|
||||
|
||||
ajv@6.14.0:
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
json-schema-traverse: 0.4.1
|
||||
uri-js: 4.4.1
|
||||
|
||||
any-promise@1.3.0: {}
|
||||
|
||||
balanced-match@4.0.4: {}
|
||||
|
||||
brace-expansion@5.0.4:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
bundle-require@5.1.0(esbuild@0.27.3):
|
||||
dependencies:
|
||||
esbuild: 0.27.3
|
||||
|
|
@ -739,10 +1263,18 @@ snapshots:
|
|||
|
||||
consola@3.4.2: {}
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
dependencies:
|
||||
path-key: 3.1.1
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
debug@4.4.3:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
deep-is@0.1.4: {}
|
||||
|
||||
esbuild@0.27.3:
|
||||
optionalDependencies:
|
||||
'@esbuild/aix-ppc64': 0.27.3
|
||||
|
|
@ -772,33 +1304,166 @@ snapshots:
|
|||
'@esbuild/win32-ia32': 0.27.3
|
||||
'@esbuild/win32-x64': 0.27.3
|
||||
|
||||
escape-string-regexp@4.0.0: {}
|
||||
|
||||
eslint-config-prettier@10.1.8(eslint@10.0.3):
|
||||
dependencies:
|
||||
eslint: 10.0.3
|
||||
|
||||
eslint-scope@9.1.2:
|
||||
dependencies:
|
||||
'@types/esrecurse': 4.3.1
|
||||
'@types/estree': 1.0.8
|
||||
esrecurse: 4.3.0
|
||||
estraverse: 5.3.0
|
||||
|
||||
eslint-visitor-keys@3.4.3: {}
|
||||
|
||||
eslint-visitor-keys@5.0.1: {}
|
||||
|
||||
eslint@10.0.3:
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.9.1(eslint@10.0.3)
|
||||
'@eslint-community/regexpp': 4.12.2
|
||||
'@eslint/config-array': 0.23.3
|
||||
'@eslint/config-helpers': 0.5.3
|
||||
'@eslint/core': 1.1.1
|
||||
'@eslint/plugin-kit': 0.6.1
|
||||
'@humanfs/node': 0.16.7
|
||||
'@humanwhocodes/module-importer': 1.0.1
|
||||
'@humanwhocodes/retry': 0.4.3
|
||||
'@types/estree': 1.0.8
|
||||
ajv: 6.14.0
|
||||
cross-spawn: 7.0.6
|
||||
debug: 4.4.3
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint-scope: 9.1.2
|
||||
eslint-visitor-keys: 5.0.1
|
||||
espree: 11.2.0
|
||||
esquery: 1.7.0
|
||||
esutils: 2.0.3
|
||||
fast-deep-equal: 3.1.3
|
||||
file-entry-cache: 8.0.0
|
||||
find-up: 5.0.0
|
||||
glob-parent: 6.0.2
|
||||
ignore: 5.3.2
|
||||
imurmurhash: 0.1.4
|
||||
is-glob: 4.0.3
|
||||
json-stable-stringify-without-jsonify: 1.0.1
|
||||
minimatch: 10.2.4
|
||||
natural-compare: 1.4.0
|
||||
optionator: 0.9.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
espree@11.2.0:
|
||||
dependencies:
|
||||
acorn: 8.16.0
|
||||
acorn-jsx: 5.3.2(acorn@8.16.0)
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
esquery@1.7.0:
|
||||
dependencies:
|
||||
estraverse: 5.3.0
|
||||
|
||||
esrecurse@4.3.0:
|
||||
dependencies:
|
||||
estraverse: 5.3.0
|
||||
|
||||
estraverse@5.3.0: {}
|
||||
|
||||
esutils@2.0.3: {}
|
||||
|
||||
fast-deep-equal@3.1.3: {}
|
||||
|
||||
fast-json-stable-stringify@2.1.0: {}
|
||||
|
||||
fast-levenshtein@2.0.6: {}
|
||||
|
||||
fdir@6.5.0(picomatch@4.0.3):
|
||||
optionalDependencies:
|
||||
picomatch: 4.0.3
|
||||
|
||||
file-entry-cache@8.0.0:
|
||||
dependencies:
|
||||
flat-cache: 4.0.1
|
||||
|
||||
find-up@5.0.0:
|
||||
dependencies:
|
||||
locate-path: 6.0.0
|
||||
path-exists: 4.0.0
|
||||
|
||||
fix-dts-default-cjs-exports@1.0.1:
|
||||
dependencies:
|
||||
magic-string: 0.30.21
|
||||
mlly: 1.8.0
|
||||
rollup: 4.59.0
|
||||
|
||||
flat-cache@4.0.1:
|
||||
dependencies:
|
||||
flatted: 3.3.4
|
||||
keyv: 4.5.4
|
||||
|
||||
flatted@3.3.4: {}
|
||||
|
||||
fsevents@2.3.3:
|
||||
optional: true
|
||||
|
||||
glob-parent@6.0.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
||||
hijri-core@1.0.0: {}
|
||||
|
||||
ignore@5.3.2: {}
|
||||
|
||||
ignore@7.0.5: {}
|
||||
|
||||
imurmurhash@0.1.4: {}
|
||||
|
||||
is-extglob@2.1.1: {}
|
||||
|
||||
is-glob@4.0.3:
|
||||
dependencies:
|
||||
is-extglob: 2.1.1
|
||||
|
||||
isexe@2.0.0: {}
|
||||
|
||||
joycon@3.1.1: {}
|
||||
|
||||
json-buffer@3.0.1: {}
|
||||
|
||||
json-schema-traverse@0.4.1: {}
|
||||
|
||||
json-stable-stringify-without-jsonify@1.0.1: {}
|
||||
|
||||
keyv@4.5.4:
|
||||
dependencies:
|
||||
json-buffer: 3.0.1
|
||||
|
||||
levn@0.4.1:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
|
||||
lilconfig@3.1.3: {}
|
||||
|
||||
lines-and-columns@1.2.4: {}
|
||||
|
||||
load-tsconfig@0.2.5: {}
|
||||
|
||||
locate-path@6.0.0:
|
||||
dependencies:
|
||||
p-locate: 5.0.0
|
||||
|
||||
magic-string@0.30.21:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
minimatch@10.2.4:
|
||||
dependencies:
|
||||
brace-expansion: 5.0.4
|
||||
|
||||
mlly@1.8.0:
|
||||
dependencies:
|
||||
acorn: 8.16.0
|
||||
|
|
@ -814,8 +1479,31 @@ snapshots:
|
|||
object-assign: 4.1.1
|
||||
thenify-all: 1.6.0
|
||||
|
||||
natural-compare@1.4.0: {}
|
||||
|
||||
object-assign@4.1.1: {}
|
||||
|
||||
optionator@0.9.4:
|
||||
dependencies:
|
||||
deep-is: 0.1.4
|
||||
fast-levenshtein: 2.0.6
|
||||
levn: 0.4.1
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
word-wrap: 1.2.5
|
||||
|
||||
p-limit@3.1.0:
|
||||
dependencies:
|
||||
yocto-queue: 0.1.0
|
||||
|
||||
p-locate@5.0.0:
|
||||
dependencies:
|
||||
p-limit: 3.1.0
|
||||
|
||||
path-exists@4.0.0: {}
|
||||
|
||||
path-key@3.1.1: {}
|
||||
|
||||
pathe@2.0.3: {}
|
||||
|
||||
picocolors@1.1.1: {}
|
||||
|
|
@ -834,6 +1522,12 @@ snapshots:
|
|||
dependencies:
|
||||
lilconfig: 3.1.3
|
||||
|
||||
prelude-ls@1.2.1: {}
|
||||
|
||||
prettier@3.8.1: {}
|
||||
|
||||
punycode@2.3.1: {}
|
||||
|
||||
readdirp@4.1.2: {}
|
||||
|
||||
resolve-from@5.0.0: {}
|
||||
|
|
@ -869,6 +1563,14 @@ snapshots:
|
|||
'@rollup/rollup-win32-x64-msvc': 4.59.0
|
||||
fsevents: 2.3.3
|
||||
|
||||
semver@7.7.4: {}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
|
||||
shebang-regex@3.0.0: {}
|
||||
|
||||
source-map@0.7.6: {}
|
||||
|
||||
sucrase@3.35.1:
|
||||
|
|
@ -898,6 +1600,10 @@ snapshots:
|
|||
|
||||
tree-kill@1.2.2: {}
|
||||
|
||||
ts-api-utils@2.4.0(typescript@5.9.3):
|
||||
dependencies:
|
||||
typescript: 5.9.3
|
||||
|
||||
ts-interface-checker@0.1.13: {}
|
||||
|
||||
tsup@8.5.1(typescript@5.9.3):
|
||||
|
|
@ -927,8 +1633,35 @@ snapshots:
|
|||
- tsx
|
||||
- yaml
|
||||
|
||||
type-check@0.4.0:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
|
||||
typescript-eslint@8.56.1(eslint@10.0.3)(typescript@5.9.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 8.56.1(@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3))(eslint@10.0.3)(typescript@5.9.3)
|
||||
'@typescript-eslint/parser': 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
'@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3)
|
||||
'@typescript-eslint/utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3)
|
||||
eslint: 10.0.3
|
||||
typescript: 5.9.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
typescript@5.9.3: {}
|
||||
|
||||
ufo@1.6.3: {}
|
||||
|
||||
undici-types@6.21.0: {}
|
||||
undici-types@7.18.2: {}
|
||||
|
||||
uri-js@4.4.1:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
|
||||
which@2.0.2:
|
||||
dependencies:
|
||||
isexe: 2.0.0
|
||||
|
||||
word-wrap@1.2.5: {}
|
||||
|
||||
yocto-queue@0.1.0: {}
|
||||
|
|
|
|||
87
src/index.ts
87
src/index.ts
|
|
@ -44,9 +44,7 @@ export function fromHijriDate(
|
|||
): Date {
|
||||
const result = coreToGregorian(hy, hm, hd, options);
|
||||
if (result === null) {
|
||||
throw new Error(
|
||||
`Hijri date ${hy}/${hm}/${hd} is invalid or outside the supported range.`,
|
||||
);
|
||||
throw new Error(`Hijri date ${hy}/${hm}/${hd} is invalid or outside the supported range.`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -106,11 +104,7 @@ export function getHijriDay(date: Date, options?: ConversionOptions): number | n
|
|||
*
|
||||
* @throws {RangeError} If the year is outside the calendar's supported range.
|
||||
*/
|
||||
export function getDaysInHijriMonth(
|
||||
hy: number,
|
||||
hm: number,
|
||||
options?: ConversionOptions,
|
||||
): number {
|
||||
export function getDaysInHijriMonth(hy: number, hm: number, options?: ConversionOptions): number {
|
||||
return coreDaysInHijriMonth(hy, hm, options);
|
||||
}
|
||||
|
||||
|
|
@ -147,10 +141,7 @@ export function getHijriMonthName(
|
|||
* @param date - Any Gregorian `Date`.
|
||||
* @param length - `'long'` (default) or `'short'`.
|
||||
*/
|
||||
export function getHijriWeekdayName(
|
||||
date: Date,
|
||||
length: 'long' | 'short' = 'long',
|
||||
): string {
|
||||
export function getHijriWeekdayName(date: Date, length: 'long' | 'short' = 'long'): string {
|
||||
const day = date.getDay(); // 0–6
|
||||
return length === 'short' ? hwShort[day] : hwLong[day];
|
||||
}
|
||||
|
|
@ -197,20 +188,34 @@ export function formatHijriDate(
|
|||
|
||||
return formatStr.replace(TOKEN_RE, (token) => {
|
||||
switch (token) {
|
||||
case 'iYYYY': return String(h.hy);
|
||||
case 'iYY': return String(h.hy).slice(-2).padStart(2, '0');
|
||||
case 'iMMMM': return hmLong[h.hm - 1];
|
||||
case 'iMMM': return hmMedium[h.hm - 1];
|
||||
case 'iMM': return String(h.hm).padStart(2, '0');
|
||||
case 'iM': return String(h.hm);
|
||||
case 'iDD': return String(h.hd).padStart(2, '0');
|
||||
case 'iD': return String(h.hd);
|
||||
case 'iEEEE': return hwLong[day];
|
||||
case 'iEEE': return hwShort[day];
|
||||
case 'iE': return String(hwNumeric[day]);
|
||||
case 'ioooo': return 'AH';
|
||||
case 'iooo': return 'AH';
|
||||
default: return token;
|
||||
case 'iYYYY':
|
||||
return String(h.hy);
|
||||
case 'iYY':
|
||||
return String(h.hy).slice(-2).padStart(2, '0');
|
||||
case 'iMMMM':
|
||||
return hmLong[h.hm - 1];
|
||||
case 'iMMM':
|
||||
return hmMedium[h.hm - 1];
|
||||
case 'iMM':
|
||||
return String(h.hm).padStart(2, '0');
|
||||
case 'iM':
|
||||
return String(h.hm);
|
||||
case 'iDD':
|
||||
return String(h.hd).padStart(2, '0');
|
||||
case 'iD':
|
||||
return String(h.hd);
|
||||
case 'iEEEE':
|
||||
return hwLong[day];
|
||||
case 'iEEE':
|
||||
return hwShort[day];
|
||||
case 'iE':
|
||||
return String(hwNumeric[day]);
|
||||
case 'ioooo':
|
||||
return 'AH';
|
||||
case 'iooo':
|
||||
return 'AH';
|
||||
default:
|
||||
return token;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -246,11 +251,7 @@ function utcMidnightToLocalNoon(d: Date): Date {
|
|||
*
|
||||
* @throws {Error} If the resulting Hijri date is outside the supported range.
|
||||
*/
|
||||
export function addHijriMonths(
|
||||
date: Date,
|
||||
months: number,
|
||||
options?: ConversionOptions,
|
||||
): Date {
|
||||
export function addHijriMonths(date: Date, months: number, options?: ConversionOptions): Date {
|
||||
const h = coreToHijri(date, options);
|
||||
if (!h) {
|
||||
throw new Error('Date is outside the supported Hijri calendar range.');
|
||||
|
|
@ -258,7 +259,7 @@ export function addHijriMonths(
|
|||
|
||||
// Total months from epoch: 0-based
|
||||
const totalMonths = (h.hy - 1) * 12 + (h.hm - 1) + months;
|
||||
const newYear = Math.floor(totalMonths / 12) + 1;
|
||||
const newYear = Math.floor(totalMonths / 12) + 1;
|
||||
const newMonth = (((totalMonths % 12) + 12) % 12) + 1;
|
||||
|
||||
// Clamp day to the target month's length
|
||||
|
|
@ -276,19 +277,15 @@ export function addHijriMonths(
|
|||
*
|
||||
* @throws {Error} If the resulting Hijri date is outside the supported range.
|
||||
*/
|
||||
export function addHijriYears(
|
||||
date: Date,
|
||||
years: number,
|
||||
options?: ConversionOptions,
|
||||
): Date {
|
||||
export function addHijriYears(date: Date, years: number, options?: ConversionOptions): Date {
|
||||
const h = coreToHijri(date, options);
|
||||
if (!h) {
|
||||
throw new Error('Date is outside the supported Hijri calendar range.');
|
||||
}
|
||||
|
||||
const newYear = h.hy + years;
|
||||
const maxDay = coreDaysInHijriMonth(newYear, h.hm, options);
|
||||
const newDay = Math.min(h.hd, maxDay);
|
||||
const maxDay = coreDaysInHijriMonth(newYear, h.hm, options);
|
||||
const newDay = Math.min(h.hd, maxDay);
|
||||
|
||||
return utcMidnightToLocalNoon(fromHijriDate(newYear, h.hm, newDay, options));
|
||||
}
|
||||
|
|
@ -333,11 +330,7 @@ export function endOfHijriMonth(date: Date, options?: ConversionOptions): Date {
|
|||
*
|
||||
* Returns `false` if either date is outside the supported range.
|
||||
*/
|
||||
export function isSameHijriMonth(
|
||||
dateA: Date,
|
||||
dateB: Date,
|
||||
options?: ConversionOptions,
|
||||
): boolean {
|
||||
export function isSameHijriMonth(dateA: Date, dateB: Date, options?: ConversionOptions): boolean {
|
||||
const a = coreToHijri(dateA, options);
|
||||
const b = coreToHijri(dateB, options);
|
||||
if (!a || !b) return false;
|
||||
|
|
@ -349,11 +342,7 @@ export function isSameHijriMonth(
|
|||
*
|
||||
* Returns `false` if either date is outside the supported range.
|
||||
*/
|
||||
export function isSameHijriYear(
|
||||
dateA: Date,
|
||||
dateB: Date,
|
||||
options?: ConversionOptions,
|
||||
): boolean {
|
||||
export function isSameHijriYear(dateA: Date, dateB: Date, options?: ConversionOptions): boolean {
|
||||
const a = coreToHijri(dateA, options);
|
||||
const b = coreToHijri(dateB, options);
|
||||
if (!a || !b) return false;
|
||||
|
|
|
|||
99
test-cjs.cjs
99
test-cjs.cjs
|
|
@ -1,5 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const { describe, it } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const {
|
||||
toHijriDate,
|
||||
|
|
@ -12,71 +13,63 @@ const {
|
|||
getHijriDay,
|
||||
} = require('./dist/index.cjs');
|
||||
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
|
||||
function test(name, fn) {
|
||||
try {
|
||||
fn();
|
||||
console.log(`[${name}]... PASS`);
|
||||
passed++;
|
||||
} catch (err) {
|
||||
console.error(`[${name}]... FAIL: ${err.message}`);
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
|
||||
const REF = new Date(2023, 2, 23, 12); // 1 Ramadan 1444
|
||||
|
||||
test('CJS: toHijriDate returns correct HijriDate', () => {
|
||||
const h = toHijriDate(REF);
|
||||
assert.ok(h !== null);
|
||||
assert.equal(h.hy, 1444);
|
||||
assert.equal(h.hm, 9);
|
||||
assert.equal(h.hd, 1);
|
||||
describe('CJS: toHijriDate', () => {
|
||||
it('returns correct HijriDate', () => {
|
||||
const h = toHijriDate(REF);
|
||||
assert.ok(h !== null);
|
||||
assert.equal(h.hy, 1444);
|
||||
assert.equal(h.hm, 9);
|
||||
assert.equal(h.hd, 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('CJS: fromHijriDate converts to correct Gregorian date', () => {
|
||||
const d = fromHijriDate(1444, 9, 1);
|
||||
assert.equal(d.getUTCFullYear(), 2023);
|
||||
assert.equal(d.getUTCMonth(), 2);
|
||||
assert.equal(d.getUTCDate(), 23);
|
||||
describe('CJS: fromHijriDate', () => {
|
||||
it('converts to correct Gregorian date', () => {
|
||||
const d = fromHijriDate(1444, 9, 1);
|
||||
assert.equal(d.getUTCFullYear(), 2023);
|
||||
assert.equal(d.getUTCMonth(), 2);
|
||||
assert.equal(d.getUTCDate(), 23);
|
||||
});
|
||||
});
|
||||
|
||||
test('CJS: isValidHijriDate true for valid date', () => {
|
||||
assert.equal(isValidHijriDate(1444, 9, 1), true);
|
||||
describe('CJS: isValidHijriDate', () => {
|
||||
it('true for valid date', () => {
|
||||
assert.equal(isValidHijriDate(1444, 9, 1), true);
|
||||
});
|
||||
|
||||
it('false for invalid month', () => {
|
||||
assert.equal(isValidHijriDate(1444, 13, 1), false);
|
||||
});
|
||||
});
|
||||
|
||||
test('CJS: isValidHijriDate false for invalid month', () => {
|
||||
assert.equal(isValidHijriDate(1444, 13, 1), false);
|
||||
describe('CJS: getHijriMonthName', () => {
|
||||
it('long', () => {
|
||||
assert.equal(getHijriMonthName(9), 'Ramadan');
|
||||
});
|
||||
|
||||
it('short', () => {
|
||||
assert.equal(getHijriMonthName(9, 'short'), 'Ram');
|
||||
});
|
||||
});
|
||||
|
||||
test('CJS: getHijriMonthName long', () => {
|
||||
assert.equal(getHijriMonthName(9), 'Ramadan');
|
||||
describe('CJS: formatHijriDate', () => {
|
||||
it('iYYYY-iMM-iDD', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iYYYY-iMM-iDD'), '1444-09-01');
|
||||
});
|
||||
});
|
||||
|
||||
test('CJS: getHijriMonthName short', () => {
|
||||
assert.equal(getHijriMonthName(9, 'short'), 'Ram');
|
||||
});
|
||||
describe('CJS: field getters', () => {
|
||||
it('getHijriYear', () => {
|
||||
assert.equal(getHijriYear(REF), 1444);
|
||||
});
|
||||
|
||||
test('CJS: formatHijriDate iYYYY-iMM-iDD', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iYYYY-iMM-iDD'), '1444-09-01');
|
||||
});
|
||||
it('getHijriMonth', () => {
|
||||
assert.equal(getHijriMonth(REF), 9);
|
||||
});
|
||||
|
||||
test('CJS: getHijriYear', () => {
|
||||
assert.equal(getHijriYear(REF), 1444);
|
||||
it('getHijriDay', () => {
|
||||
assert.equal(getHijriDay(REF), 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('CJS: getHijriMonth', () => {
|
||||
assert.equal(getHijriMonth(REF), 9);
|
||||
});
|
||||
|
||||
test('CJS: getHijriDay', () => {
|
||||
assert.equal(getHijriDay(REF), 1);
|
||||
});
|
||||
|
||||
const total = passed + failed;
|
||||
console.log(`\n${passed}/${total} tests passed`);
|
||||
if (failed > 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
596
test.mjs
596
test.mjs
|
|
@ -1,3 +1,4 @@
|
|||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
toHijriDate,
|
||||
|
|
@ -19,365 +20,300 @@ import {
|
|||
getHijriQuarter,
|
||||
} from './dist/index.mjs';
|
||||
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
|
||||
function test(name, fn) {
|
||||
try {
|
||||
fn();
|
||||
console.log(`[${name}]... PASS`);
|
||||
passed++;
|
||||
} catch (err) {
|
||||
console.error(`[${name}]... FAIL: ${err.message}`);
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// toHijriDate
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('toHijriDate: 1 Ramadan 1444', () => {
|
||||
const h = toHijriDate(new Date(2023, 2, 23, 12));
|
||||
assert.ok(h !== null, 'expected non-null');
|
||||
assert.equal(h.hy, 1444);
|
||||
assert.equal(h.hm, 9);
|
||||
assert.equal(h.hd, 1);
|
||||
});
|
||||
|
||||
test('toHijriDate: 1 Muharram 1446', () => {
|
||||
const h = toHijriDate(new Date(2024, 6, 7, 12));
|
||||
assert.ok(h !== null, 'expected non-null');
|
||||
assert.equal(h.hy, 1446);
|
||||
assert.equal(h.hm, 1);
|
||||
assert.equal(h.hd, 1);
|
||||
});
|
||||
|
||||
test('toHijriDate: out of range returns null', () => {
|
||||
const h = toHijriDate(new Date(1800, 0, 1));
|
||||
assert.equal(h, null);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// fromHijriDate
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('fromHijriDate: 1 Ramadan 1444 -> 2023-03-23', () => {
|
||||
const d = fromHijriDate(1444, 9, 1);
|
||||
assert.equal(d.getUTCFullYear(), 2023);
|
||||
assert.equal(d.getUTCMonth(), 2); // March
|
||||
assert.equal(d.getUTCDate(), 23);
|
||||
});
|
||||
|
||||
test('fromHijriDate: 1 Muharram 1446 -> 2024-07-07', () => {
|
||||
const d = fromHijriDate(1446, 1, 1);
|
||||
assert.equal(d.getUTCFullYear(), 2024);
|
||||
assert.equal(d.getUTCMonth(), 6); // July
|
||||
assert.equal(d.getUTCDate(), 7);
|
||||
});
|
||||
|
||||
test('fromHijriDate: throws on invalid month', () => {
|
||||
assert.throws(() => fromHijriDate(1444, 13, 1), /invalid|range/i);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// isValidHijriDate
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('isValidHijriDate: valid date', () => {
|
||||
assert.equal(isValidHijriDate(1444, 9, 1), true);
|
||||
});
|
||||
|
||||
test('isValidHijriDate: invalid month 13', () => {
|
||||
assert.equal(isValidHijriDate(1444, 13, 1), false);
|
||||
});
|
||||
|
||||
test('isValidHijriDate: day 0 is invalid', () => {
|
||||
assert.equal(isValidHijriDate(1444, 9, 0), false);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Field getters
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const REF = new Date(2023, 2, 23, 12); // 1 Ramadan 1444
|
||||
|
||||
test('getHijriYear', () => {
|
||||
assert.equal(getHijriYear(REF), 1444);
|
||||
describe('toHijriDate', () => {
|
||||
it('1 Ramadan 1444', () => {
|
||||
const h = toHijriDate(new Date(2023, 2, 23, 12));
|
||||
assert.ok(h !== null, 'expected non-null');
|
||||
assert.equal(h.hy, 1444);
|
||||
assert.equal(h.hm, 9);
|
||||
assert.equal(h.hd, 1);
|
||||
});
|
||||
|
||||
it('1 Muharram 1446', () => {
|
||||
const h = toHijriDate(new Date(2024, 6, 7, 12));
|
||||
assert.ok(h !== null, 'expected non-null');
|
||||
assert.equal(h.hy, 1446);
|
||||
assert.equal(h.hm, 1);
|
||||
assert.equal(h.hd, 1);
|
||||
});
|
||||
|
||||
it('out of range returns null', () => {
|
||||
const h = toHijriDate(new Date(1800, 0, 1));
|
||||
assert.equal(h, null);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonth', () => {
|
||||
assert.equal(getHijriMonth(REF), 9);
|
||||
describe('fromHijriDate', () => {
|
||||
it('1 Ramadan 1444 -> 2023-03-23', () => {
|
||||
const d = fromHijriDate(1444, 9, 1);
|
||||
assert.equal(d.getUTCFullYear(), 2023);
|
||||
assert.equal(d.getUTCMonth(), 2);
|
||||
assert.equal(d.getUTCDate(), 23);
|
||||
});
|
||||
|
||||
it('1 Muharram 1446 -> 2024-07-07', () => {
|
||||
const d = fromHijriDate(1446, 1, 1);
|
||||
assert.equal(d.getUTCFullYear(), 2024);
|
||||
assert.equal(d.getUTCMonth(), 6);
|
||||
assert.equal(d.getUTCDate(), 7);
|
||||
});
|
||||
|
||||
it('throws on invalid month', () => {
|
||||
assert.throws(() => fromHijriDate(1444, 13, 1), /invalid|range/i);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriDay', () => {
|
||||
assert.equal(getHijriDay(REF), 1);
|
||||
describe('isValidHijriDate', () => {
|
||||
it('valid date', () => {
|
||||
assert.equal(isValidHijriDate(1444, 9, 1), true);
|
||||
});
|
||||
|
||||
it('invalid month 13', () => {
|
||||
assert.equal(isValidHijriDate(1444, 13, 1), false);
|
||||
});
|
||||
|
||||
it('day 0 is invalid', () => {
|
||||
assert.equal(isValidHijriDate(1444, 9, 0), false);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriYear: out of range returns null', () => {
|
||||
assert.equal(getHijriYear(new Date(1800, 0, 1)), null);
|
||||
describe('field getters', () => {
|
||||
it('getHijriYear', () => {
|
||||
assert.equal(getHijriYear(REF), 1444);
|
||||
});
|
||||
|
||||
it('getHijriMonth', () => {
|
||||
assert.equal(getHijriMonth(REF), 9);
|
||||
});
|
||||
|
||||
it('getHijriDay', () => {
|
||||
assert.equal(getHijriDay(REF), 1);
|
||||
});
|
||||
|
||||
it('getHijriYear: out of range returns null', () => {
|
||||
assert.equal(getHijriYear(new Date(1800, 0, 1)), null);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// getDaysInHijriMonth
|
||||
// ---------------------------------------------------------------------------
|
||||
describe('getDaysInHijriMonth', () => {
|
||||
it('Ramadan 1444', () => {
|
||||
const days = getDaysInHijriMonth(1444, 9);
|
||||
assert.ok(days === 29 || days === 30, `expected 29 or 30, got ${days}`);
|
||||
});
|
||||
|
||||
test('getDaysInHijriMonth: Ramadan 1444', () => {
|
||||
const days = getDaysInHijriMonth(1444, 9);
|
||||
// Must be either 29 or 30
|
||||
assert.ok(days === 29 || days === 30, `expected 29 or 30, got ${days}`);
|
||||
it('month 1 of 1444', () => {
|
||||
const days = getDaysInHijriMonth(1444, 1);
|
||||
assert.ok(days === 29 || days === 30, `expected 29 or 30, got ${days}`);
|
||||
});
|
||||
});
|
||||
|
||||
test('getDaysInHijriMonth: month 1 of 1444', () => {
|
||||
const days = getDaysInHijriMonth(1444, 1);
|
||||
assert.ok(days === 29 || days === 30, `expected 29 or 30, got ${days}`);
|
||||
describe('getHijriMonthName', () => {
|
||||
it('long (default)', () => {
|
||||
assert.equal(getHijriMonthName(9), 'Ramadan');
|
||||
});
|
||||
|
||||
it('medium', () => {
|
||||
assert.equal(getHijriMonthName(9, 'medium'), 'Ramadan');
|
||||
});
|
||||
|
||||
it('short', () => {
|
||||
assert.equal(getHijriMonthName(9, 'short'), 'Ram');
|
||||
});
|
||||
|
||||
it('Muharram long', () => {
|
||||
assert.equal(getHijriMonthName(1), 'Muharram');
|
||||
});
|
||||
|
||||
it('Dhul Hijjah long', () => {
|
||||
assert.equal(getHijriMonthName(12), 'Dhul Hijjah');
|
||||
});
|
||||
|
||||
it('throws on month 0', () => {
|
||||
assert.throws(() => getHijriMonthName(0), RangeError);
|
||||
});
|
||||
|
||||
it('throws on month 13', () => {
|
||||
assert.throws(() => getHijriMonthName(13), RangeError);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// getHijriMonthName
|
||||
// ---------------------------------------------------------------------------
|
||||
describe('getHijriWeekdayName', () => {
|
||||
it('Thursday long', () => {
|
||||
assert.equal(getHijriWeekdayName(new Date(2023, 2, 23)), 'Yawm al-Khamis');
|
||||
});
|
||||
|
||||
test('getHijriMonthName: long (default)', () => {
|
||||
assert.equal(getHijriMonthName(9), 'Ramadan');
|
||||
it('Thursday short', () => {
|
||||
assert.equal(getHijriWeekdayName(new Date(2023, 2, 23), 'short'), 'Kham');
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonthName: medium', () => {
|
||||
assert.equal(getHijriMonthName(9, 'medium'), 'Ramadan');
|
||||
describe('formatHijriDate', () => {
|
||||
it('iYYYY-iMM-iDD', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iYYYY-iMM-iDD'), '1444-09-01');
|
||||
});
|
||||
|
||||
it('iMMMM', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iMMMM'), 'Ramadan');
|
||||
});
|
||||
|
||||
it('iEEEE', () => {
|
||||
assert.equal(formatHijriDate(new Date(2023, 2, 23), 'iEEEE'), 'Yawm al-Khamis');
|
||||
});
|
||||
|
||||
it('iEEE', () => {
|
||||
assert.equal(formatHijriDate(new Date(2023, 2, 23), 'iEEE'), 'Kham');
|
||||
});
|
||||
|
||||
it('ioooo era', () => {
|
||||
assert.equal(formatHijriDate(REF, 'ioooo'), 'AH');
|
||||
});
|
||||
|
||||
it('iooo era', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iooo'), 'AH');
|
||||
});
|
||||
|
||||
it('iYY two-digit year', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iYY'), '44');
|
||||
});
|
||||
|
||||
it('iMMM medium month', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iMMM'), 'Ramadan');
|
||||
});
|
||||
|
||||
it('iM bare month', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iM'), '9');
|
||||
});
|
||||
|
||||
it('iD bare day', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iD'), '1');
|
||||
});
|
||||
|
||||
it('iE numeric weekday (Thursday = 5)', () => {
|
||||
assert.equal(formatHijriDate(new Date(2023, 2, 23), 'iE'), '5');
|
||||
});
|
||||
|
||||
it('out of range returns empty string', () => {
|
||||
assert.equal(formatHijriDate(new Date(1800, 0, 1), 'iYYYY-iMM-iDD'), '');
|
||||
});
|
||||
|
||||
it('mixed literal and tokens', () => {
|
||||
const result = formatHijriDate(REF, 'iD iMMMM iYYYY ioooo');
|
||||
assert.equal(result, '1 Ramadan 1444 AH');
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonthName: short', () => {
|
||||
assert.equal(getHijriMonthName(9, 'short'), 'Ram');
|
||||
describe('addHijriMonths', () => {
|
||||
it('+1 from Ramadan -> Shawwal', () => {
|
||||
const result = toHijriDate(addHijriMonths(REF, 1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1444);
|
||||
assert.equal(result.hm, 10);
|
||||
});
|
||||
|
||||
it('+3 from month 10 -> wraps to next year', () => {
|
||||
const dec = new Date(2023, 3, 21, 12);
|
||||
const result = toHijriDate(addHijriMonths(dec, 3));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1445);
|
||||
});
|
||||
|
||||
it('+0 is identity', () => {
|
||||
const result = toHijriDate(addHijriMonths(REF, 0));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1444);
|
||||
assert.equal(result.hm, 9);
|
||||
assert.equal(result.hd, 1);
|
||||
});
|
||||
|
||||
it('-1 from Ramadan -> Shaban', () => {
|
||||
const result = toHijriDate(addHijriMonths(REF, -1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hm, 8);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonthName: Muharram long', () => {
|
||||
assert.equal(getHijriMonthName(1), 'Muharram');
|
||||
describe('addHijriYears', () => {
|
||||
it('+1 from Ramadan 1444 -> Ramadan 1445', () => {
|
||||
const result = toHijriDate(addHijriYears(REF, 1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1445);
|
||||
assert.equal(result.hm, 9);
|
||||
});
|
||||
|
||||
it('-1 from Ramadan 1444 -> Ramadan 1443', () => {
|
||||
const result = toHijriDate(addHijriYears(REF, -1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1443);
|
||||
assert.equal(result.hm, 9);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonthName: Dhul Hijjah long', () => {
|
||||
assert.equal(getHijriMonthName(12), 'Dhul Hijjah');
|
||||
describe('startOfHijriMonth / endOfHijriMonth', () => {
|
||||
it('startOfHijriMonth: 1 Ramadan 1444 = 2023-03-23', () => {
|
||||
const start = startOfHijriMonth(REF);
|
||||
assert.equal(start.getFullYear(), 2023);
|
||||
assert.equal(start.getMonth(), 2);
|
||||
assert.equal(start.getDate(), 23);
|
||||
});
|
||||
|
||||
it('endOfHijriMonth: last day of Ramadan 1444', () => {
|
||||
const end = toHijriDate(endOfHijriMonth(REF));
|
||||
assert.ok(end !== null);
|
||||
assert.equal(end.hy, 1444);
|
||||
assert.equal(end.hm, 9);
|
||||
assert.ok(end.hd === 29 || end.hd === 30, `expected 29 or 30, got ${end.hd}`);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonthName: throws on month 0', () => {
|
||||
assert.throws(() => getHijriMonthName(0), RangeError);
|
||||
describe('isSameHijriMonth / isSameHijriYear', () => {
|
||||
it('both in Ramadan 1444', () => {
|
||||
assert.equal(isSameHijriMonth(new Date(2023, 2, 23, 12), new Date(2023, 3, 10, 12)), true);
|
||||
});
|
||||
|
||||
it('different months', () => {
|
||||
assert.equal(isSameHijriMonth(new Date(2023, 2, 23, 12), new Date(2023, 4, 1, 12)), false);
|
||||
});
|
||||
|
||||
it('out of range returns false', () => {
|
||||
assert.equal(isSameHijriMonth(new Date(1800, 0, 1), new Date(2023, 2, 23, 12)), false);
|
||||
});
|
||||
|
||||
it('both in 1444', () => {
|
||||
assert.equal(isSameHijriYear(new Date(2023, 2, 23, 12), new Date(2023, 1, 10, 12)), true);
|
||||
});
|
||||
|
||||
it('different years', () => {
|
||||
assert.equal(isSameHijriYear(new Date(2023, 2, 23, 12), new Date(2024, 6, 7, 12)), false);
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriMonthName: throws on month 13', () => {
|
||||
assert.throws(() => getHijriMonthName(13), RangeError);
|
||||
describe('getHijriQuarter', () => {
|
||||
it('month 9 = Q3', () => {
|
||||
assert.equal(getHijriQuarter(REF), 3);
|
||||
});
|
||||
|
||||
it('month 1 = Q1', () => {
|
||||
assert.equal(getHijriQuarter(new Date(2024, 6, 7, 12)), 1);
|
||||
});
|
||||
|
||||
it('out of range returns null', () => {
|
||||
assert.equal(getHijriQuarter(new Date(1800, 0, 1)), null);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// getHijriWeekdayName
|
||||
// ---------------------------------------------------------------------------
|
||||
describe('FCNA calendar', () => {
|
||||
it('toHijriDate returns valid HijriDate', () => {
|
||||
const h = toHijriDate(new Date(2023, 2, 23, 12), { calendar: 'fcna' });
|
||||
assert.ok(h !== null, 'expected non-null for FCNA');
|
||||
assert.ok(typeof h.hy === 'number');
|
||||
assert.ok(h.hm >= 1 && h.hm <= 12);
|
||||
assert.ok(h.hd >= 1 && h.hd <= 30);
|
||||
});
|
||||
|
||||
// March 23, 2023 was a Thursday (getDay() === 4)
|
||||
test('getHijriWeekdayName: Thursday long', () => {
|
||||
assert.equal(getHijriWeekdayName(new Date(2023, 2, 23)), 'Yawm al-Khamis');
|
||||
it('formatHijriDate works', () => {
|
||||
const result = formatHijriDate(new Date(2023, 2, 23, 12), 'iYYYY-iMM-iDD', { calendar: 'fcna' });
|
||||
assert.ok(result.length > 0, 'expected non-empty string');
|
||||
});
|
||||
});
|
||||
|
||||
test('getHijriWeekdayName: Thursday short', () => {
|
||||
assert.equal(getHijriWeekdayName(new Date(2023, 2, 23), 'short'), 'Kham');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// formatHijriDate
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('formatHijriDate: iYYYY-iMM-iDD', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iYYYY-iMM-iDD'), '1444-09-01');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iMMMM', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iMMMM'), 'Ramadan');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iEEEE', () => {
|
||||
assert.equal(formatHijriDate(new Date(2023, 2, 23), 'iEEEE'), 'Yawm al-Khamis');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iEEE', () => {
|
||||
assert.equal(formatHijriDate(new Date(2023, 2, 23), 'iEEE'), 'Kham');
|
||||
});
|
||||
|
||||
test('formatHijriDate: ioooo era', () => {
|
||||
assert.equal(formatHijriDate(REF, 'ioooo'), 'AH');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iooo era', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iooo'), 'AH');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iYY two-digit year', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iYY'), '44');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iMMM medium month', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iMMM'), 'Ramadan');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iM bare month', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iM'), '9');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iD bare day', () => {
|
||||
assert.equal(formatHijriDate(REF, 'iD'), '1');
|
||||
});
|
||||
|
||||
test('formatHijriDate: iE numeric weekday (Thursday = 5)', () => {
|
||||
// hwNumeric[4] = 5 (Thursday, 0-indexed from Sunday)
|
||||
assert.equal(formatHijriDate(new Date(2023, 2, 23), 'iE'), '5');
|
||||
});
|
||||
|
||||
test('formatHijriDate: out of range returns empty string', () => {
|
||||
assert.equal(formatHijriDate(new Date(1800, 0, 1), 'iYYYY-iMM-iDD'), '');
|
||||
});
|
||||
|
||||
test('formatHijriDate: mixed literal and tokens', () => {
|
||||
const result = formatHijriDate(REF, 'iD iMMMM iYYYY ioooo');
|
||||
assert.equal(result, '1 Ramadan 1444 AH');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// addHijriMonths
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('addHijriMonths: +1 from Ramadan -> Shawwal', () => {
|
||||
const result = toHijriDate(addHijriMonths(REF, 1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1444);
|
||||
assert.equal(result.hm, 10); // Shawwal
|
||||
});
|
||||
|
||||
test('addHijriMonths: +3 from month 10 -> wraps to month 1 of next year', () => {
|
||||
const dec = new Date(2023, 3, 21, 12); // Shawwal 1444 approx
|
||||
const result = toHijriDate(addHijriMonths(dec, 3));
|
||||
assert.ok(result !== null);
|
||||
// Should be in 1445
|
||||
assert.equal(result.hy, 1445);
|
||||
});
|
||||
|
||||
test('addHijriMonths: +0 is identity', () => {
|
||||
const result = toHijriDate(addHijriMonths(REF, 0));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1444);
|
||||
assert.equal(result.hm, 9);
|
||||
assert.equal(result.hd, 1);
|
||||
});
|
||||
|
||||
test('addHijriMonths: -1 from Ramadan -> Sha\'ban', () => {
|
||||
const result = toHijriDate(addHijriMonths(REF, -1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hm, 8); // Sha'ban
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// addHijriYears
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('addHijriYears: +1 from Ramadan 1444 -> Ramadan 1445', () => {
|
||||
const result = toHijriDate(addHijriYears(REF, 1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1445);
|
||||
assert.equal(result.hm, 9);
|
||||
});
|
||||
|
||||
test('addHijriYears: -1 from Ramadan 1444 -> Ramadan 1443', () => {
|
||||
const result = toHijriDate(addHijriYears(REF, -1));
|
||||
assert.ok(result !== null);
|
||||
assert.equal(result.hy, 1443);
|
||||
assert.equal(result.hm, 9);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// startOfHijriMonth / endOfHijriMonth
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('startOfHijriMonth: 1 Ramadan 1444 = 2023-03-23', () => {
|
||||
const start = startOfHijriMonth(REF);
|
||||
// Use local date components — startOfHijriMonth returns a local-noon Date
|
||||
// to round-trip correctly with toHijriDate across all timezones.
|
||||
assert.equal(start.getFullYear(), 2023);
|
||||
assert.equal(start.getMonth(), 2);
|
||||
assert.equal(start.getDate(), 23);
|
||||
});
|
||||
|
||||
test('endOfHijriMonth: last day of Ramadan 1444', () => {
|
||||
const end = toHijriDate(endOfHijriMonth(REF));
|
||||
assert.ok(end !== null);
|
||||
assert.equal(end.hy, 1444);
|
||||
assert.equal(end.hm, 9);
|
||||
// Last day is either 29 or 30
|
||||
assert.ok(end.hd === 29 || end.hd === 30, `expected 29 or 30, got ${end.hd}`);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// isSameHijriMonth / isSameHijriYear
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// April 10, 2023 is 19 Ramadan 1444 — same Hijri month as March 23, 2023
|
||||
test('isSameHijriMonth: both in Ramadan 1444', () => {
|
||||
assert.equal(isSameHijriMonth(new Date(2023, 2, 23, 12), new Date(2023, 3, 10, 12)), true);
|
||||
});
|
||||
|
||||
test('isSameHijriMonth: different months', () => {
|
||||
assert.equal(isSameHijriMonth(new Date(2023, 2, 23, 12), new Date(2023, 4, 1, 12)), false);
|
||||
});
|
||||
|
||||
test('isSameHijriMonth: out of range returns false', () => {
|
||||
assert.equal(isSameHijriMonth(new Date(1800, 0, 1), new Date(2023, 2, 23, 12)), false);
|
||||
});
|
||||
|
||||
// March 10, 2024 is in Ramadan 1445 — different year
|
||||
// But we need same year: 1444 spans roughly April 2022 - April 2023
|
||||
// 1444 starts ~July 30, 2022. Let's pick two dates in 1444:
|
||||
// March 23, 2023 = 1 Ramadan 1444
|
||||
// Feb 10, 2023 = in Jumadal Thani 1444 (still year 1444)
|
||||
test('isSameHijriYear: both in 1444', () => {
|
||||
assert.equal(isSameHijriYear(new Date(2023, 2, 23, 12), new Date(2023, 1, 10, 12)), true);
|
||||
});
|
||||
|
||||
test('isSameHijriYear: different years', () => {
|
||||
assert.equal(isSameHijriYear(new Date(2023, 2, 23, 12), new Date(2024, 6, 7, 12)), false);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// getHijriQuarter
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('getHijriQuarter: month 9 = Q3', () => {
|
||||
assert.equal(getHijriQuarter(REF), 3);
|
||||
});
|
||||
|
||||
test('getHijriQuarter: month 1 = Q1', () => {
|
||||
assert.equal(getHijriQuarter(new Date(2024, 6, 7, 12)), 1); // 1 Muharram 1446
|
||||
});
|
||||
|
||||
test('getHijriQuarter: out of range returns null', () => {
|
||||
assert.equal(getHijriQuarter(new Date(1800, 0, 1)), null);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// FCNA calendar
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('toHijriDate: FCNA calendar returns valid HijriDate', () => {
|
||||
const h = toHijriDate(new Date(2023, 2, 23, 12), { calendar: 'fcna' });
|
||||
assert.ok(h !== null, 'expected non-null for FCNA');
|
||||
assert.ok(typeof h.hy === 'number');
|
||||
assert.ok(h.hm >= 1 && h.hm <= 12);
|
||||
assert.ok(h.hd >= 1 && h.hd <= 30);
|
||||
});
|
||||
|
||||
test('formatHijriDate: FCNA calendar', () => {
|
||||
const result = formatHijriDate(new Date(2023, 2, 23, 12), 'iYYYY-iMM-iDD', { calendar: 'fcna' });
|
||||
assert.ok(result.length > 0, 'expected non-empty string');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Summary
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const total = passed + failed;
|
||||
console.log(`\n${passed}/${total} tests passed`);
|
||||
if (failed > 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
"esModuleInterop": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ export default defineConfig({
|
|||
clean: true,
|
||||
outDir: 'dist',
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
sourcemap: false,
|
||||
target: 'es2020',
|
||||
platform: 'node',
|
||||
platform: 'neutral',
|
||||
external: ['hijri-core'],
|
||||
outExtension({ format }) {
|
||||
return { js: format === 'esm' ? '.mjs' : '.cjs' };
|
||||
|
|
|
|||
Loading…
Reference in a new issue