Installations
npm install extra-object.web
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Node Version
22.9.0
NPM Version
10.8.3
Score
72.9
Supply Chain
98.9
Quality
77.1
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (90.89%)
JavaScript (9.11%)
Developer
Download Statistics
Total Downloads
7,630
Last Day
3
Last Week
25
Last Month
120
Last Year
1,495
GitHub Statistics
1 Stars
212 Commits
3 Forks
3 Watching
2 Branches
3 Contributors
Bundle Size
12.34 kB
Minified
3.10 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.2.0
Package Id
extra-object.web@3.2.0
Unpacked Size
66.80 kB
Size
14.72 kB
File Count
6
NPM Version
10.8.3
Node Version
22.9.0
Publised On
29 Sept 2024
Total Downloads
Cumulative downloads
Total Downloads
7,630
Last day
-40%
3
Compared to previous day
Last week
31.6%
25
Compared to previous week
Last month
207.7%
120
Compared to previous month
Last year
-9.1%
1,495
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
A collection of methods for working with Objects.
📦 Node.js,
🌐 Web,
📜 Files,
📰 Docs,
📘 Wiki.
An Object is a collection of properties (entries), each with a name (key) and a value. These properties can be values of any data type, including primitive data types like strings and numbers, as well as more complex data types like other objects. Objects in JavaScript are very similar to objects in other programming languages. They are used to store and organize data, and they can be manipulated and accessed using a variety of built-in methods and operators.
One of the quirks of objects is that they are dynamic, which means that properties can be added, removed, and modified at any time. This can be useful for some types of programming, but it can also make it difficult to keep track of an object's properties and values. Another quirk of JavaScript objects is that they are not strongly typed. This means that the same property can hold values of different data types, and the type of a property's value can change over time. This can make it difficult to ensure the correctness of your code, and it can lead to runtime errors if you are not careful. Despite these quirks, objects are a powerful and versatile tool for organizing and manipulating data in your code. They are an essential part of any program, and they are used in a wide range of applications.
This package includes common set functions related to querying about objects, generating them, comparing one with another, finding their size, adding and removing entries, obtaining its characteristics, getting a part of it, getting subset entries in it, finding an entry in it, performing functional operations, manipulating it in various ways, combining together objects or its entries, of performing set operations upon it.
All functions except from*()
take object as 1st parameter. Methods like
swap()
are pure and do not modify the object itself, while methods like
swap$()
do modify (update) the object itself.
Stability: Experimental.
1const object = require('extra-object'); 2// import * as object from "extra-object"; 3// import * as object from "https://unpkg.com/extra-object/index.mjs"; (deno) 4 5var x = {a: 1, b: 2, c: 3, d: 4}; 6object.swap(x, 'a', 'b'); 7// → { a: 2, b: 1, c: 3, d: 4 } 8 9var x = {a: 1, b: 2, c: 3, d: 4}; 10var y = {b: 20, c: 30, e: 50}; 11object.intersection(x, y); 12// → { b: 2, c: 3 } 13 14var x = {a: 1, b: 2, c: 3, d: -2}; 15object.searchAll(x, v => Math.abs(v) === 2); 16// → [ 'b', 'd' ] 17 18var x = {a: 1, b: 2, c: 3}; 19[...object.subsets(x)]; 20// → [ 21// → {}, 22// → { a: 1 }, 23// → { b: 2 }, 24// → { a: 1, b: 2 }, 25// → { c: 3 }, 26// → { a: 1, c: 3 }, 27// → { b: 2, c: 3 }, 28// → { a: 1, b: 2, c: 3 } 29// → ]
Index
Property | Description |
---|---|
is | Check if value is an object. |
keys | List all keys. |
values | List all values. |
entries | List all key-value pairs. |
fromEntries | Convert entries to object. |
fromLists | Convert lists to object. |
compare | Compare two objects. |
isEqual | Check if two objects are equal. |
size | Get the number of keys in an object. |
isEmpty | Check if an object is empty. |
get | Get value at specified key. |
getAll | Get values at keys. |
getPath | Get value at path in a nested object. |
hasPath | Check if nested object has a path. |
set | Set value at specified key. |
set$ | Set value at specified key. |
setPath$ | Set value at path in a nested object. |
swap | Exchange two values in an object. |
swap$ | Exchange two values in an object. |
remove | Remove an entry from object. |
remove$ | Remove an entry from object. |
removePath$ | Remove value at path in a nested object. |
count | Count values which satisfy a test. |
countAs | Count occurrences of values. |
min | Find smallest value. |
minEntry | Find smallest entry. |
max | Find largest value. |
maxEntry | Find largest entry. |
range | Find smallest and largest values. |
rangeEntries | Find smallest and largest entries. |
head | Gets first entry from object (default order). |
tail | Get object without its first entry (default order). |
take | Keep first n entries only (default order). |
take$ | Keep first n entries only (default order). |
drop | Remove first n entries (default order). |
drop$ | Remove first n entries (default order). |
subsets | List all possible subsets. |
randomKey | Pick an arbitrary key. |
randomEntry | Pick an arbitrary entry. |
randomSubset | Pick an arbitrary subset. |
has | Check if object has a key. |
hasValue | Check if object has a value. |
hasEntry | Check if object has an entry. |
hasSubset | Check if object has a subset. |
find | Find value of an entry passing a test. |
findAll | Find values of entries passing a test. |
search | Find key of an entry passing a test. |
searchAll | Find all keys of entries passing a test. |
searchValue | Find key with a given value. |
searchValueAll | Find keys with a given value. |
forEach | Call a function for each entry. |
some | Check if any value satisfies a test. |
every | Check if all values satisfy a test. |
map | Transform values of an object. |
map$ | Transform values of an object. |
reduce | Reduce values to a single value. |
filter | Keep entries which pass a test. |
filter$ | Keep entries which pass a test. |
filterAt | Get object with given keys. |
filterAt$ | Get object with given keys. |
reject | Discard entries which pass a test. |
reject$ | Discard entries which pass a test. |
rejectAt | Get object without given keys. |
rejectAt$ | Get object without given keys. |
flat | Flatten nested object to given depth. |
flatMap | Flatten nested object, using map function. |
zip | Combine matching entries from objects. |
partition | Segregate entries by test result. |
partitionAs | Segregate entries by similarity. |
chunk | Break object into chunks of given size. |
concat | Combine entries from objects, preferring last. |
concat$ | Combines entries from objects, preferring last. |
join | Join entries together into a string. |
isDisjoint | Check if objects have no common keys. |
unionKeys | Obtain keys present in any object. |
union | Obtain entries present in any object. |
union$ | Obtain entries present in any object. |
intersectionKeys | Obtain keys present in all objects. |
intersection | Obtain entries present in both objects. |
intersection$ | Obtain entries present in both objects. |
difference | Obtain entries not present in another object. |
difference$ | Obtain entries not present in another object. |
symmetricDifference | Obtain entries not present in both objects. |
symmetricDifference$ | Obtain entries not present in both objects. |
cartesianProduct | List cartesian product of objects. |
In the future when you think of just giving up on life, remember that the letter was in your hands, the cab was at the gate, only if you had thought about it once more, your entire life would have been better. (1)
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-object/pr.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:63
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:80
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
- Info: 5 out of 7 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Warn: no topLevel permission defined: .github/workflows/pr.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Score
3.6
/10
Last Scanned on 2025-01-27
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