# percom **Repository Path**: ArkTSCentralRepository/percom ## Basic Information - **Project Name**: percom - **Description**: Utility for listing and counting combinations and permutations. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-08 - **Last Updated**: 2026-06-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # percom 基于[percom](https://www.npmjs.com/package/percom)原库1.1.3版本进行适配 > Utility for listing and counting combinations and permutations. ## Install ```sh ohpm install percom ``` ## Usage ### 1. List all combinations ```typescript import percom from "percom"; percom.com(array, r); // array: source array // r: size of each combination ``` Example ```typescript const array = ["A", "B", "C"]; const result1 = percom.com(array, 2); // result1 = [["A", "B"], ["A", "C"], ["B", "C"]] const result2 = percom.com(array, 1); // result2 = [["A"], ["B"], ["C"]] ``` ### Count combinations ```typescript percom.countCom(n, r); // n: number of elements // r: size of each combination ``` Example ```typescript percom.countCom(8, 3); // => 56 ``` ## 2. List all permutations ```typescript percom.per(array, r); // array: source array // r: size of each permutation ``` Example ```typescript const array = ["A", "B", "C"]; const result1 = percom.per(array, 2); // result1 = [["A", "B"], ["A", "C"], ["B", "A"], ["B", "C"], ["C", "A"], ["C", "B"]] const result2 = percom.per(array, 1); // result2 = [["A"], ["B"], ["C"]] ``` ### Count permutations ```typescript percom.countPer(n, r); // n: number of elements // r: size of each permutation ``` Example ```typescript percom.countPer(8, 3); // => 336 ```