Gathering detailed insights and metrics for undefsafe-typed
Gathering detailed insights and metrics for undefsafe-typed
npm install undefsafe-typed
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (98.25%)
JavaScript (1.75%)
Total Downloads
77,537
Last Day
66
Last Week
237
Last Month
1,045
Last Year
9,603
34 Commits
2 Watching
13 Branches
2 Contributors
Latest Version
1.0.2
Package Id
undefsafe-typed@1.0.2
Unpacked Size
132.64 kB
Size
35.60 kB
File Count
5
NPM Version
5.6.0
Node Version
8.11.1
Cumulative downloads
Total Downloads
Last day
-26.7%
66
Compared to previous day
Last week
-42.2%
237
Compared to previous week
Last month
21.7%
1,045
Compared to previous month
Last year
-3.4%
9,603
Compared to previous year
Library to safely get subproperties of objects in typescript, without crashing if any child is undefined along the object tree. Inspired by undefsafe.
Fully supports types and inferres children types as return types.
yarn add undefsafe-typed
1interface IChild { 2 name?: string; 3 age?: number; 4} 5interface IMainObject { 6 value?: string; 7 children?: IChild[]; 8 someOtherNestedValue?: { 9 a?: { 10 b?: string; 11 }; 12 }; 13} 14 15const item = { 16 name: 'item1', 17 children: [{}, { name: 'John Doe', age: 21 }], 18}; 19 20const name = undefsafe(item, 'name'); // name is inferred to string 21const firstChildAge = undefsafe(item, 'children', 0, 'age'); // firstChildAge is inferred to number 22const thirdChildAge = undefsafe(item, 'children', 3, 'age'); // thirdChildAge is inferred to number 23const nestedB = undefsafe(item, 'someOtherNestedValue', 'a', 'b'); // is inferred to string
yarn install
yarn test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 1/4 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
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
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
55 existing vulnerabilities detected
Details
Score
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