Javascript 中是否有用于 Set 数据类型的库?

2022-01-17 00:00:00 set javascript

由于 Javascript 没有内置的集合数据类型,有没有人遇到过适合集合和集合操作(​​如联合、交集等)的库?

Since Javascript doesn't have a built in set datatype has anyone come across a decent library for sets and set operations like union, intersection, etc?

推荐答案

看看JS.Set.

JS.Set 类可用于对独特对象的集合进行建模.集合确保其成员之间没有重复,并且它允许您使用自定义相等方法以及 JavaScript 的 === 运算符进行比较.

The JS.Set class can be used to model collections of unique objects. A set makes sure that there are no duplicates among its members, and it allows you to use custom equality methods for comparison as well as JavaScript’s === operator.

它包含联合、交集、合并等方法...

It contains methods like union, intersection, merge, etc ...

相关文章