Gathering detailed insights and metrics for cellx-collections
Gathering detailed insights and metrics for cellx-collections
npm install cellx-collections
Typescript
Module System
Node Version
NPM Version
74.8
Supply Chain
96.1
Quality
75.5
Maintenance
100
Vulnerability
100
License
TypeScript (96.76%)
JavaScript (3.24%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
3,337
Last Day
1
Last Week
10
Last Month
38
Last Year
571
2 Stars
7 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
cellx-collections@1.0.3
Unpacked Size
93.67 kB
Size
16.21 kB
File Count
21
NPM Version
7.6.3
Node Version
15.12.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-33.3%
10
Compared to previous week
Last month
-63.8%
38
Compared to previous month
Last year
5.5%
571
Compared to previous year
1
If you record to the cell an instance of class which inherits of cellx.EventEmitter
,
then the cell will subscribe to its change
event and will claim it as own:
1let value = cellx(new cellx.EventEmitter()); 2 3value.subscribe((err, evt) => { 4 console.log(evt.target instanceof cellx.EventEmitter); 5}); 6 7value().emit('change'); 8// => true
Due to this, you can create your collections, upon updating those collections you will update the cell containing them and dependent cells will be recalculated. Two such collections already is added to the cellx:
Example:
1let map = new cellx.ObservableMap({
2 key1: 1,
3 key2: 2,
4 key3: 3
5});
cellx.ObservableMap
repeats
Map from ECMAScript 2015,
except for the following differences:
cellx.EventEmitter
and generates an event change
when changing their records;clone
, which creates a copy of map;Example:
1let list = new cellx.ObservableList([1, 2, 3]);
Like cellx.ObservableMap
, list generates an event change
upon any change of its records.
During initialization the list may take option itemComparator
, which will implement the assortment of its items:
1let list = new cellx.ObservableList([ 2 { x: 5 }, 3 { x: 1 }, 4 { x: 10 } 5], { 6 itemComparator: (a, b) => { 7 if (a.x < b.x) { return -1; } 8 if (a.x > b.x) { return 1; } 9 return 0; 10 } 11}); 12 13console.log(list.toArray()); 14// => [{ x: 1 }, { x: 5 }, { x: 10 }] 15 16list.addRange([{ x: 100 }, { x: -100 }, { x: 7 }]); 17 18console.log(list.toArray()); 19// => [{ x: -100 }, { x: 1 }, { x: 5 }, { x: 7 }, { x: 10 }, { x: 100 }]
If instead of itemComparator
you pass the option sorted
with the value true
, it will use the standard itemComparator
:
1let list = new cellx.ObservableList([5, 1, 10], { sorted: true }); 2 3console.log(list.toArray()); 4// => [1, 5, 10] 5 6list.addRange([100, -100, 7]); 7 8console.log(list.toArray()); 9// => [-100, 1, 5, 7, 10, 100]
Length of the list. Read-only.
Function for comparing items in the sorted list. Read-only.
Whether or not the list is sorted. Read-only.
Important difference between list and array is that the list can't contain so-called "holes"
that is, when it will try to read or set the item of the index beyond the existing range of indexes,
an exception will be generated.
Range extension (adding of items) occurs through methods add
, addRange
, insert
and insertRange
.
In such case, in the last two methods passed index
can not be longer than the length of the list.
Sorted list suggests that its items are always in sorted order. Methods
set
, setRange
, insert
and insertRange
are contrary to this statement, they either will break the correct order
of sorting or (for preservation of this order) will install/paste past the specified index, i.e.
will not work properly. Therefore, when you call the sorted list, they always generate an exception. It is possible to
add items to the sorted list through the methods add
and addRange
, or during initialization of the list.
Type signature: (item) -> boolean;
.
Checks if the item is in the list.
Type signature: (item, fromIndex?: int) -> int;
.
Type signature: (item, fromIndex?: int) -> int;
.
Type signature: (index: int) -> *;
.
Type signature: (index: int, count?: uint) -> Array;
.
If count
is unspecified it makes copies till the end of the list.
Type signature: (index: int, item) -> cellx.ObservableList;
.
Type signature: (index: int, items: Array) -> cellx.ObservableList;
.
Type signature: (item, unique?: boolean) -> cellx.ObservableList;
.
Type signature: (items: Array, uniques?: boolean) -> cellx.ObservableList;
.
Type signature: (index: int, item) -> cellx.ObservableList;
.
Type signature: (index: int, items: Array) -> cellx.ObservableList;
.
Type signature: (item, fromIndex?: int) -> boolean;
.
Removes the first occurrence of item
in the list.
Type signature: (item, fromIndex?: int) -> boolean;
.
It removes all occurrences of item
list.
Type signature: (index: int) -> *;
.
Type signature: (index: int, count?: uint) -> Array;
.
If count
is unspecified it will remove everything till the end of the list.
Type signature: (oldItem, newItem, fromIndex?: int) -> boolean;
.
Type signature: (oldItem, newItem, fromIndex?: int) -> boolean;
.
Type signature: () -> cellx.ObservableList;
.
Type signature: (separator?: string) -> string;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList), context?);
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> *, context?) -> Array;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, context?) -> Array;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, context?) -> boolean;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, context?) -> boolean;
.
Type signature: (cb: (accumulator, item, index: uint, list: cellx.ObservableList) -> *, initialValue?) -> *;
.
Type signature: (cb: (accumulator, item, index: uint, list: cellx.ObservableList) -> *, initialValue?) -> *;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> *;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> *;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> int;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> int;
.
Type signature: () -> cellx.ObservableList;
.
Type signature: () -> Array;
.
Type signature: () -> string;
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
no SAST tool detected
Details
Reason
Found 0/7 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More