Installations
npm install chai-shallow-deep-almost-equal
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 0.6.0
Node Version
2.5.0
NPM Version
2.13.2
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
gbezyuk
Download Statistics
Total Downloads
145,920
Last Day
5
Last Week
9
Last Month
38
Last Year
1,564
GitHub Statistics
1 Stars
35 Commits
2 Watching
1 Branches
1 Contributors
Bundle Size
1.43 kB
Minified
584.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.3.0
Package Id
chai-shallow-deep-almost-equal@1.3.0
Size
3.44 kB
NPM Version
2.13.2
Node Version
2.5.0
Total Downloads
Cumulative downloads
Total Downloads
145,920
Last day
400%
5
Compared to previous day
Last week
80%
9
Compared to previous week
Last month
40.7%
38
Compared to previous month
Last year
-20.8%
1,564
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
chai-shallow-deep-almost-equal
It's a fork of https://github.com/michelsalib/chai-shallow-deep-equal which adds .001 float treshold almost-equality feature.
Will shallowly perform a deep almost equal assertion. In other terms is consist of checking that an object, or objects graph, is contained within another one (see examples bellow).
Usage
Browser
1<script src="chai.js"></script> 2<script src="chai-shallow-deep-almost-equal.js"></script>
Node
1var chai = require('chai'); 2chai.use(require('chai-shallow-deep-almost-equal'));
Assertions
ShallowDeepAlmostEqual is available for all chai assertion styles:
1var a = {x: 10, y: 10}; 2var b = {x: 10.001}; 3 4a.should.ShallowDeepAlmostEqual(b); 5expect(a).to.ShallowDeepAlmostEqual(b); 6assert.ShallowDeepAlmostEqual(a, b);
Example
1assert.ShallowDeepAlmostEqual({x: 10, y: 10}, {x: 10.001}); // true 2assert.ShallowDeepAlmostEqual({x: 10, y: 10}, {x: 9.999}); // true 3// assert.ShallowDeepAlmostEqual({x: 10, y: 10}, {x: 9.9}); // fails 4 5// the rest are the original shallowDeepEqualTests 6assert.ShallowDeepAlmostEqual({ 7 name: 'Michel', 8 language: 'javascript', 9 tags: [ 10 'developer', 11 'gamer' 12 ]}, 13 { 14 name: 'Michel', 15 tags: [ 16 'developer' 17 ]}); // true 18 19assert.ShallowDeepAlmostEqual([ 20 {brand: 'apple', color: 'red'}, 21 {brand: 'samsung', color: 'blue'}, 22 ], 23 { 24 length: 2, 25 0: {color: 'red'}, 26 1: {brand: 'samsung'}, 27 }); // true 28 29assert.ShallowDeepAlmostEqual({ 30 name: 'Michel', 31 age: undefined 32 }, 33 { 34 name: 'Michel', 35 age: 37 36 }); // false (age should not be defined)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 1/30 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
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
license file not detected
Details
- Warn: project does not have a license file
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 1 are checked with a SAST tool
Score
2.6
/10
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