Điểm qua terkelg/zet: 517 sao trên GitHub, viết chủ yếu bằng JavaScript. Set() as it should be.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
ECMAScript 6 sets have no methods for computing the union (∪), intersection (∩) or difference (⊖).
Zet is an extension of ES6 Set and comes with all its functionality included with extra set logic.
The API is similar to how sets work in Python.
Features
Additions to the default ECMAScript 6 set
Union (∪)
Intersection (∩)
Difference/subtract (-)
Symmetric difference (⊖)
Subset (⊆)
Superset (⊇)
Map
Filter
Reduce
Additionally, this module is delivered as:
ES Module: dist/zet.mjs
CommonJS: dist/zet.js
UMD: dist/zet.umd.js
Install
$ npm install --save zet
Usage
import Zet from 'zet';
let a = new Zet([1, 2, 3]);
let b = new Zet([3, 4, 5]);
let c = new Zet([2, 3, 4]);
Zet.union(a, b);
//=> [Zet] {1, 2, 3, 4, 5}
a.union(b, c);
//=> [Zet] {1, 2, 3, 4, 5}
a.intersection(b);
//=> [Zet] {3}
a.symmetricDifference(c);
//=> [Zet] {1, 4}
a.subset(b);
//=> false
a.filter(i => i % 2);
//=> [Zet] {1, 3}
API
Zet([iterable])
Returns:Zet
Returns the Zet instance.
Zet extends Set() and inherit all its functionality, like has(), size() etc.
Zet.union(...sets) ∪
Returns:zet
Static variadic function that return a new set with elements from all other sets.
sets
Type: Zet|Set
Two or more sets of type Zet or Set.
Zet.intersection(...sets) ∩
Returns:zet
Static variadic function that return a new set with elements common to this and all other sets.
sets
Type: Zet|Set
Two or more sets of type Zet or Set.
Zet.difference(...sets) - or \
Returns:zet
Returns the difference between two or more sets. The order of the sets matters. Sets are differentiated against the first argument/set.
sets
Type: Zet|Set
Two or more sets of type Zet or Set.
Zet.symmetricDifference(setA, setB) ⊖ or ∆
Returns:zet
Static function that return a new set with elements in either setA or setB but not both.
setA
Type: Zet|Set
Set A of type Zet or Set.
setB
Type: Zet|Set
Set B of type Zet or Set.
Zet.subset(setA, setB)
Returns: Boolean
Test whether every element in setB is in setA.
setA
Type: Zet|Set
Set of type Zet or Set.
setB
Type: Zet|Set
Set of type Zet or Set.
Zet.superset(setA, setB)
Returns: Boolean
Test whether every element in setA is in setB.
setA
Type: Zet|Set
Set of type Zet or Set.
setB
Type: Zet|Set
Set of type Zet or Set.
map(set, func)
Returns: Zet|Set
Creates a set with the results of calling the provided function on every element.
set
Type: Zet|Set
Set of type Zet or Set.
func
Type: Function
Function that produces an element of the new set.
filter(set, func)
Returns: Zet|Set
Creates a set with all elements that pass the test implemented by the provided function.
set
Type: Zet|Set
It is the set going to be examined.
func
Type: Function
It is a predicate, to test each element of the set.
reduce(set, func, initializer)
Returns: Number
Reduces the set to a single value, by executing the provided function for each element in the set (from left-to-right).
set
Type: Zet|Set
Set of type Zet or Set.
func
Type: Function
Function to be executed for each element in the set.
initializer
Type: Number
Optional. A value to be passed to the function as the initial value.
Instance Methods
union(...sets) ∪
Returns:zet
Variadic method that return a new set with elements from this and all other sets.
sets
Type: Zet|Set
One or more sets of type Zet or Set.
intersection(...sets) ∩
Returns:zet
Variadic method that return a new set with elements common to this and all other sets.
sets
Type: Zet|Set
One or more sets of type Zet or Set.
difference(...sets) - or \
Returns:zet
Variadic method tht return a new set with elements in this that are not in the other sets.
sets
Type: Zet|Set
One or more sets of type Zet or Set.
symmetricDifference(other) ⊖ or ∆
Returns:zet
Method that return a new set with elements in either this or other but not both. This is also known as xor.
other
Type: Zet|Set
Set of type Zet or Set.
subset(other)
Returns: Boolean
Test whether every element in the set is in other.
other
Type: Zet|Set
Set of type Zet or Set.
superset(other)
Returns: Boolean
Test whether every element in other is in the set.
other
Type: Zet|Set
Set of type Zet or Set.
map(func)
Returns: Zet|Set
Creates a set with the results of calling the provided function on every element.
func
Type: Function
Function that produces an element of the new set.
filter(func)
Returns: Zet|Set
Creates a set with all elements that pass the test implemented by the provided function.
func
Type: Function
It is a predicate, to test each element of the set.
reduce(func, initializer)
Returns: Number
Reduces the set to a single value, by executing the provided function for each element in the set (from left-to-right).
func
Type: Function
Function to be executed for each element in the set.
initializer
Type: Number
Optional. A value to be passed to the function as the initial value.
terkelg/zet có 517 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/terkelg/zet. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
terkelg/zet có những chủ đề gì?
GitHub topics của terkelg/zet: "difference", "intersection", "set", "set-theory", "sets", "union". TopGit xếp repo vào nhóm mã nguồn mở.
terkelg/zet còn đang phát triển không?
Commit gần nhất trên terkelg/zet là 6.6 năm trước (theo timestamp GitHub). Repo có 8 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
terkelg/zet là gì?
terkelg/zet (terkelg/zet) là dự án JavaScript trên GitHub. Theo mô tả gốc: Set() as it should be.
terkelg/zet viết bằng ngôn ngữ gì?
terkelg/zet chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về zet?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về zet.