All Projects → tc39 → Proposal Array Unique

tc39 / Proposal Array Unique

ECMAScript proposal for Deduplicating method of Array

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
ecmascript
72 projects
proposal
26 projects

Projects that are alternatives of or similar to Proposal Array Unique

Array.prototype.at
An ES-spec-compliant (proposed) `Array.prototype.at`shim/polyfill/replacement that works as far down as ES3.
Stars: ✭ 20 (-79.17%)
Mutual labels:  polyfill, array
array-includes
Array.prototype.includes spec-compliant polyfill
Stars: ✭ 42 (-56.25%)
Mutual labels:  polyfill, array
Document Register Element
A stand-alone working lightweight version of the W3C Custom Elements specification
Stars: ✭ 1,123 (+1069.79%)
Mutual labels:  polyfill
Graphical Debugging
GraphicalDebugging extension for Visual Studio
Stars: ✭ 88 (-8.33%)
Mutual labels:  array
Map
PHP Map package for easy and elegant handling of PHP arrays as array-like map objects
Stars: ✭ 1,180 (+1129.17%)
Mutual labels:  array
Mjextension
A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.
Stars: ✭ 8,458 (+8710.42%)
Mutual labels:  array
Tiledb Py
Python interface to the TileDB storage manager
Stars: ✭ 78 (-18.75%)
Mutual labels:  array
Pycuda
CUDA integration for Python, plus shiny features
Stars: ✭ 1,112 (+1058.33%)
Mutual labels:  array
Date Time Format Timezone
Surgically polyfills timezone support in Intl.DateTimeFormat API
Stars: ✭ 94 (-2.08%)
Mutual labels:  polyfill
Jewell
Javascript Syntax Sugar for Higher-Order Messaging
Stars: ✭ 72 (-25%)
Mutual labels:  array
Webpack Polyfill Injector
Webpack plugin to automatically inject polyfills into your bundle without affecting modern browsers.
Stars: ✭ 84 (-12.5%)
Mutual labels:  polyfill
Componentarrays.jl
Arrays with arbitrarily nested named components.
Stars: ✭ 72 (-25%)
Mutual labels:  array
Web Bluetooth Polyfill
Windows 10 Web Bluetooth Polyfill
Stars: ✭ 68 (-29.17%)
Mutual labels:  polyfill
Orthogonalarraytest
OrthogonalArrayTest. 正交实验法设计测试用例,自动生成测试集。
Stars: ✭ 79 (-17.71%)
Mutual labels:  array
Hibernate Types
The Hibernate Types library gives you extra types that are not supported by the Hibernate ORM core.
Stars: ✭ 1,122 (+1068.75%)
Mutual labels:  array
Smart Array To Tree
Convert large amounts of data array to tree fastly
Stars: ✭ 91 (-5.21%)
Mutual labels:  array
Patterns Library
AXA CH UI components library. Please share, comment, create issues and work with us!
Stars: ✭ 63 (-34.37%)
Mutual labels:  polyfill
Presento
Presento - Transformer & Presenter Package for PHP
Stars: ✭ 71 (-26.04%)
Mutual labels:  array
Scroll Behavior Polyfill
A polyfill for the 'scroll-behavior' CSS-property
Stars: ✭ 76 (-20.83%)
Mutual labels:  polyfill
Match Media
Universal polyfill for match media API using Expo APIs on mobile
Stars: ✭ 95 (-1.04%)
Mutual labels:  polyfill

Array deduplication proposal

ECMAScript proposal for Deduplicating method of Array.

Proposal Stage-1

NPM

Motivation

Deduplication is one of the most common requirements in Data processing, especially in large Web Apps nowadays.

[...new Set(array)] in ECMAScript 6 isn't enough for Non-primitive values, and now, we may need a Array.prototype.uniqueBy().

Core features

While Array.prototype.uniqueBy() invoked with:

  1. no parameter, it'll work as [...new Set(array)];

  2. one index-key parameter (Number, String or Symbol), it'll get values from each array element with the key, and then deduplicates the origin array based on these values;

  3. one function parameter, it'll call this function for each array element, and then deduplicates the origin array based on these returned values.

Notice:

  • the Returned value is a new array, no mutation happens in the original array
  • Empty/nullish items are treated as nullish values
  • 0 & -0 are treated as the same
  • All NaNs are treated as the same

Typical cases

[1, 2, 3, 3, 2, 1].uniqueBy();  // [1, 2, 3]

const data = [
    { id: 1, uid: 10000 },
    { id: 2, uid: 10000 },
    { id: 3, uid: 10001 }
];

data.uniqueBy('uid');
// [
//     { id: 1, uid: 10000 },
//     { id: 3, uid: 10001 }
// ]

data.uniqueBy(({ id, uid }) => `${id}-${uid}`);
// [
//     { id: 1, uid: 10000 },
//     { id: 2, uid: 10000 },
//     { id: 3, uid: 10001 }
// ]

Polyfill

A polyfill is available in the core-js library. You can find it in the ECMAScript proposals section.

A simple polyfill from the proposal repo write in TypeScript.

Proposer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].