Skip to content

Commit

Permalink
Merge pull request #206 from riya-amemiya/feature/main-1.9.0
Browse files Browse the repository at this point in the history
Feature/main 1.9.0
  • Loading branch information
riya-amemiya authored Sep 14, 2024
2 parents f4fd326 + 0702c62 commit e32d206
Show file tree
Hide file tree
Showing 274 changed files with 3,322 additions and 2,723 deletions.
50 changes: 41 additions & 9 deletions package/main/biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
"files": {
"ignore": [
"node_modules",
Expand Down Expand Up @@ -37,40 +37,65 @@
"enabled": true,
"ignore": [
"tests",
".dependency-cruiser.js"
".dependency-cruiser.js",
"eslint.config.mjs",
"jest.config.ts"
],
"rules": {
"a11y": {
"noSvgWithoutTitle": "warn"
},
"complexity": {
"noExcessiveCognitiveComplexity": "off",
"noUselessStringConcat": "error",
"noUselessUndefinedInitialization": "error",
"noVoid": "error",
"useDateNow": "error",
"useSimplifiedLogicExpression": "error"
},
"correctness": {
"noConstantMathMinMaxClamp": "error",
"noInvalidNewBuiltin": "error",
"noNewSymbol": "error",
"noNodejsModules": "error",
"noUndeclaredVariables": "warn",
"noUnusedFunctionParameters": "error",
"noUnusedImports": "error",
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": "warn",
"useExhaustiveDependencies": "warn",
"useHookAtTopLevel": "error"
},
"nursery": {
"noDoneCallback": "error",
"noDuplicateElseIf": "error",
"noDuplicateJsonKeys": "error",
"noEvolvingTypes": "error",
"noMisplacedAssertion": "error"
"noDynamicNamespaceImportAccess": "error",
"noEnum": "error",
"noExportedImports": "error",
"noIrregularWhitespace": "error",
"noSubstr": "error",
"noUselessEscapeInRegex": "error",
"useAdjacentOverloadSignatures": "error",
"useTrimStartEnd": "error"
},
"recommended": true,
"style": {
"noDefaultExport": "error",
"noDoneCallback": "error",
"noImplicitBoolean": "warn",
"noNamespace": "error",
"noNamespaceImport": "error",
"noNegationElse": "error",
"noParameterAssign": "off",
"noParameterAssign": "warn",
"noParameterProperties": "off",
"noShoutyConstants": "warn",
"noYodaExpression": "error",
"useBlockStatements": "error",
"useCollapsedElseIf": "error",
"useConsistentArrayType": "error",
"useConsistentBuiltinInstantiation": "error",
"useDefaultSwitchClause": "error",
"useExplicitLengthCheck": "error",
"useForOf": "error",
"useFragmentSyntax": "error",
"useNamingConvention": {
"level": "off",
Expand All @@ -79,13 +104,20 @@
"strictCase": true
}
},
"useNodeAssertStrict": "error",
"useShorthandArrayType": "error",
"useShorthandAssign": "error",
"useSingleCaseStatement": "error"
"useSingleCaseStatement": "error",
"useThrowNewError": "error",
"useThrowOnlyError": "error"
},
"suspicious": {
"noEmptyBlockStatements": "error",
"noSkippedTests": "error"
"noEvolvingTypes": "error",
"noMisplacedAssertion": "error",
"noSkippedTests": "error",
"useErrorMessage": "error",
"useNumberToFixedDigitsArgument": "error"
}
}
},
Expand Down
Binary file modified package/main/bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package/main/cjs.build.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// biome-ignore lint/correctness/noNodejsModules: <explanation>
import { readFileSync, writeFileSync } from "node:fs";

// package.jsonを読み込む
Expand Down
36 changes: 19 additions & 17 deletions package/main/common-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
},
"description": "個人的に作った便利関数集 個人用途なので破壊的変更がある可能性があります。 Main Packageに依存関係はありません。 JavaScriptからの呼び出しに対応しています。",
"devDependencies": {
"@biomejs/biome": "1.8.2",
"@swc/core": "^1.6.7",
"@biomejs/biome": "1.9.0",
"@swc/core": "^1.7.26",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"bun-types": "^1.1.18",
"dependency-cruiser": "^16.3.5",
"eslint": "^9.6.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-unicorn": "^54.0.0",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"bun-types": "^1.1.27",
"dependency-cruiser": "^16.4.1",
"eslint": "^9.10.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-unicorn": "^55.0.0",
"gh-pages": "^6.1.1",
"jest": "^29.7.0",
"ts-jest": "^29.1.5",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.10",
"typedoc": "^0.26.3",
"typescript": "^5.5.3"
"typedoc": "^0.26.7",
"typescript": "^5.6.2"
},
"directories": {
"doc": "doc",
Expand All @@ -48,18 +48,20 @@
"build": "tsc && tsc-alias -p tsconfig.json",
"build:clean": "rm -rf module && yarn build",
"build:cjs": "tsc -p tsconfig.cjs.json && node cjs.build.mjs && cp LICENSE common-module/LICENSE && cp README.md common-module/README.md",
"build:full": "yarn build && yarn build:cjs",
"build:clean:full": "rm -rf module && rm -rf common-module && yarn build:full",
"clean-build": "rm -rf module && yarn build",
"deploy": "yarn typedoc && gh-pages -d doc",
"eslint": "eslint src",
"format": "biome format . --write",
"lint": "yarn eslint --fix && biome ci . && tsc",
"lint": "yarn eslint --fix && biome check . --write && tsc",
"lint:ci": "yarn eslint && biome ci . && tsc",
"test": "jest",
"test-debug": "cd test && tsc",
"ts-node": "yarn build && ts-node --project tmp/tsconfig.json tmp/src/index.ts"
},
"type": "commonjs",
"types": "module/index.d.js",
"version": "1.8.2",
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
"version": "1.9.0",
"packageManager": "yarn@1.22.22"
}
1 change: 1 addition & 0 deletions package/main/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default [
"src/tests/",
".dependency-cruiser.js",
"cjs.build.mjs",
"eslint.config.mjs",
],
},
js.configs.recommended,
Expand Down
2 changes: 1 addition & 1 deletion package/main/module/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

36 changes: 19 additions & 17 deletions package/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
},
"description": "個人的に作った便利関数集 個人用途なので破壊的変更がある可能性があります。 Main Packageに依存関係はありません。 JavaScriptからの呼び出しに対応しています。",
"devDependencies": {
"@biomejs/biome": "1.8.2",
"@swc/core": "^1.6.7",
"@biomejs/biome": "1.9.0",
"@swc/core": "^1.7.26",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"bun-types": "^1.1.18",
"dependency-cruiser": "^16.3.5",
"eslint": "^9.6.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-unicorn": "^54.0.0",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^8.5.0",
"@typescript-eslint/parser": "^8.5.0",
"bun-types": "^1.1.27",
"dependency-cruiser": "^16.4.1",
"eslint": "^9.10.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-unicorn": "^55.0.0",
"gh-pages": "^6.1.1",
"jest": "^29.7.0",
"ts-jest": "^29.1.5",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.10",
"typedoc": "^0.26.3",
"typescript": "^5.5.3"
"typedoc": "^0.26.7",
"typescript": "^5.6.2"
},
"directories": {
"doc": "doc",
Expand All @@ -48,18 +48,20 @@
"build": "tsc && tsc-alias -p tsconfig.json",
"build:clean": "rm -rf module && yarn build",
"build:cjs": "tsc -p tsconfig.cjs.json && node cjs.build.mjs && cp LICENSE common-module/LICENSE && cp README.md common-module/README.md",
"build:full": "yarn build && yarn build:cjs",
"build:clean:full": "rm -rf module && rm -rf common-module && yarn build:full",
"clean-build": "rm -rf module && yarn build",
"deploy": "yarn typedoc && gh-pages -d doc",
"eslint": "eslint src",
"format": "biome format . --write",
"lint": "yarn eslint --fix && biome ci . && tsc",
"lint": "yarn eslint --fix && biome check . --write && tsc",
"lint:ci": "yarn eslint && biome ci . && tsc",
"test": "jest",
"test-debug": "cd test && tsc",
"ts-node": "yarn build && ts-node --project tmp/tsconfig.json tmp/src/index.ts"
},
"type": "module",
"types": "module/index.d.js",
"version": "1.8.2",
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
"version": "1.9.0",
"packageManager": "yarn@1.22.22"
}
4 changes: 3 additions & 1 deletion package/main/src/Advance/rangeAdvance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const rangeAdvance = (
if (conditionalExpression) {
const array: number[] = [];
for (let index = start; index < (end as number); index++) {
conditionalExpression(index) && array.push(index);
if (conditionalExpression(index)) {
array.push(index);
}
}
return array;
}
Expand Down
2 changes: 1 addition & 1 deletion package/main/src/Array/arraysJoin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* 重複をしないで結合
* @param {unknown[]} array
* @param {unknown[]} ...arrays
* @param {unknown[]} arrays
* @returns unknown[]
* @example arraysJoin([1, 2, 3], [2, 3, 4]); // [1, 2, 3, 4]
*/
Expand Down
7 changes: 3 additions & 4 deletions package/main/src/Array/chunk.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ChunkArrayType } from "$/arrayType";
/**
import type { ChunkArrayType } from "$/array/chunk"; /**
* 配列を指定した数で分割する
* @param arr 配列
* @param n 分割数
* @param {T} array 配列
* @param {N} n 分割数
* @returns 分割された配列
* @example chunk([1, 2, 3, 4, 5, 6, 7, 8, 9], 3); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
*/
Expand Down
10 changes: 8 additions & 2 deletions package/main/src/Array/first.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import type { First } from "$/logic/first";

/**
* 配列の先頭の要素を返す
* @param array 配列
* @returns 配列の先頭の要素
* @example first([1, 2, 3]); // 1
*/
export const first = <T>(array: T[]): T | undefined => {
return array.length > 0 ? array[0] : undefined;
export const first = <T extends unknown[]>(
array: T,
): First<T> extends never ? T[number] | undefined : First<T> => {
return (array.length > 0 ? array[0] : undefined) as First<T> extends never
? T[number] | undefined
: First<T>;
};
4 changes: 2 additions & 2 deletions package/main/src/Array/getArraysCommon.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* 共通の要素をとりだす
* @param {any[]} array
* @param {any[]} ...arrays
* @param {T[]} array
* @param {T[]} arrays
* @returns unknown[]
* @example getArraysCommon([1, 2, 3], [2, 3, 4]); // [2, 3]
*/
Expand Down
4 changes: 2 additions & 2 deletions package/main/src/Array/getArraysDiff.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* 共通しない要素をとりだす
* @param {unknown[]} array
* @param {unknown[]} ...arrays
* @param {T[]} array
* @param {T[]} arrays
* @returns unknown[]
* @example getArraysDiff([1, 2, 3], [2, 3, 4]); // [1, 4]
*/
Expand Down
1 change: 1 addition & 0 deletions package/main/src/Array/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from "./getArraysDiff";
export * from "./groupBy";
export * from "./insertionSort";
export * from "./mergeSort";
export * from "./pop";
export * from "./quickSort";
export * from "./randomSelect";
export * from "./range";
Expand Down
8 changes: 8 additions & 0 deletions package/main/src/Array/pop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Removes the last element from an array and returns it.
* @param {T[]} array - The array to remove the last element from.
* @returns {T | undefined} - The last element of the array, or undefined if the array is empty.
*/
export const pop = <T>(array: T[]) => {
return [...array].pop();
};
Loading

0 comments on commit e32d206

Please sign in to comment.