filter-limit
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

filter-limit

Tests License: MIT

Overview

filter-limit is a lightweight JavaScript library that provides a convenient method for filtering arrays while limiting the number of results. This is particularly useful for efficiently handling large datasets when you are interested in only a subset of elements.

Features

  • 🚀 Performance-focused
  • 🔎 Filters arrays based on custom criteria
  • 🚧 Limit the number of results
  • 🕊️ Dependency-free
  • 🛠️ Works with CJS and ESM
  • 🪶 Lightweight
    • ESM 226B (201B gzipped)
    • CJS 302B (254B gzipped)

Installation

You can install the library via npm:

npm install filter-limit

Or import ESM module from CDN

import filterLimit from 'https://unpkg.com/filter-limit/dist/esm/index.min.js';

Usage

import filterLimit from 'filter-limit';

const input = [1, 2, '3', 4, '5', 6, '7', '8', 9];

const result = filterLimit(input, 3, (value) => typeof value === 'number');

console.log(result); // [1, 2, 4]

License

MIT

Package Sidebar

Install

npm i filter-limit

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

9.85 kB

Total Files

15

Last publish

Collaborators

  • yuriyyakym