
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
remove-item-array
Advanced tools
πͺremove array duplicates or customized with JS.
install:
yarn add remove-item-array
npm install remove-item-array --save
use:
const {
removeItems,
removeDuplicates
} = require('remove-item-array')
let arr = ['π', 'π', 'π','π«','π','π','π','π','π','π','π«']
// remove all
removeDuplicates(arr)
// or remove 'π'
removeDuplicates(arr, 'π')
// remove nums
removeItems(arr, 1, 4)
removeDuplicates(arr, item(?))
Removes item duplicates from an array.
arr
: {Array<*>} The target array.item
: {<*>} Removes item specified duplicate.removeItems(arr, start, count)
Performs better to splice, use Proxy can compare splice with removeItems.
arr
: {Array<*>} The target array.start
: {Number} start The index to begin removing.count
: The count of items need to remove.The function that removes all repeating elements, I code four methods, and made a comparison.
The array:
arr = [1, 1, 2, 5, 3, 1, 1, 2, 5, 3, 1, 1, 2, 5, 3, 1, 1, 2, 5, 3, 1, 1, 2, 5, 3, 1, 1, 2, 5, 3, 1, 1, 2, 5, 3]
You can view the results via the https://jsperf.com/removeduplicatesarray
The results:
By comparison, it can be seen that the performance of filter()
is better, so the function adopts the filter()
.
just run
yarn test
MIT.
FAQs
remove array duplicates or customized with JS
The npm package remove-item-array receives a total of 2 weekly downloads. As such, remove-item-array popularity was classified as not popular.
We found that remove-item-array 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.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.