
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
js-combinations
Advanced tools
calculate combinations of Math, find the amount of possible combinations of n elements
计算 n 个元素中,选出 k 个元素所有可能的组合数量
数学公式:
but, if k > n, return 0;
yarn add js-combinations
// or
npm install js-combinations --save
import combinations from 'js-combinations';
const result = combinations(6, 4);
// => 15
use cache by default in factorial function for high performance, if you dont want to use cache, you can import combinationsWithoutCache, eg:
默认在阶乘函数中使用缓存,以提高重复计算的性能表现,但会减加少许内存。
如果不想使用缓存版本,可以 import 无缓存版本 :combinationsWithoutCache
import { combinationsWithoutCache } from 'js-combinations'
// ... what you want to do
FAQs
n choose k for js
We found that js-combinations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.