Gathering detailed insights and metrics for @stdlib/array-base-to-deduped
Gathering detailed insights and metrics for @stdlib/array-base-to-deduped
Gathering detailed insights and metrics for @stdlib/array-base-to-deduped
Gathering detailed insights and metrics for @stdlib/array-base-to-deduped
Copy elements to a new generic array after removing consecutive duplicated values.
npm install @stdlib/array-base-to-deduped
Typescript
Module System
Min. Node Version
Node Version
NPM Version
66.7
Supply Chain
86
Quality
81.2
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
972
Last Day
1
Last Week
2
Last Month
15
Last Year
423
Apache-2.0 License
1 Stars
18 Commits
3 Watchers
5 Branches
14 Contributors
Updated on May 12, 2025
Minified
Minified + Gzipped
Latest Version
0.2.2
Package Id
@stdlib/array-base-to-deduped@0.2.2
Unpacked Size
32.06 kB
Size
8.77 kB
File Count
11
NPM Version
8.19.4
Node Version
16.20.2
Published on
Jul 28, 2024
Cumulative downloads
Total Downloads
Last Day
-50%
1
Compared to previous day
Last Week
-33.3%
2
Compared to previous week
Last Month
-28.6%
15
Compared to previous month
Last Year
-23%
423
Compared to previous year
1
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Copy elements to a new "generic" array after removing consecutive duplicated values.
1npm install @stdlib/array-base-to-deduped
1var toDeduped = require( '@stdlib/array-base-to-deduped' );
Copies elements to a new "generic" array after removing consecutive duplicated values.
1var x = [ 1, 1, 2, 3, 3 ]; 2 3var y = toDeduped( x, 1, false ); 4// returns [ 1, 2, 3 ] 5 6var bool = ( x === y ); 7// returns false
When equalNaNs
is false
, NaN
values are considered distinct, and, when equalNaNs
is true
, NaN
values are considered equal.
1var x = [ NaN, NaN, 2, NaN, NaN ]; 2 3var y1 = toDeduped( x, 1, false ); 4// returns [ NaN, NaN, 2, NaN, NaN ] 5 6var y2 = toDeduped( x, 1, true ); 7// returns [ NaN, 2, NaN ]
To allow consecutive duplicate values up to a specified limit, provide a limit
argument greater than one.
1var x = [ 1, 1, 1, 2, 2, 3, 3, 3 ]; 2 3var y = toDeduped( x, 2, false ); 4// returns [ 1, 1, 2, 2, 3, 3 ]
1var discreteUniform = require( '@stdlib/random-array-discrete-uniform' ); 2var toDeduped = require( '@stdlib/array-base-to-deduped' ); 3 4// Create an array of random numbers: 5var x = discreteUniform( 30, 0, 5, { 6 'dtype': 'generic' 7}); 8// returns [...] 9 10// Remove consecutive duplicates: 11var y = toDeduped( x, 1, false ); 12// returns [...] 13 14console.log( x ); 15console.log( y );
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2024. The Stdlib Authors.
No vulnerabilities found.
No security vulnerabilities found.