-
-
Notifications
You must be signed in to change notification settings - Fork 813
feat: added assert/is-negative-finite
#1356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added assert/is-negative-finite
#1356
Conversation
This commit adds the assert/is-negative-finite module for handling negative finite values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hi there! 👋
And thank you for opening your first pull request! We will review it shortly. 🏃 💨
function isNegativeFinite( value ) { | ||
return ( | ||
isNumber( value ) && | ||
value < 0.0 && isFinite(value) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to import is-finite
just like var isNumber
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @gunjjoshi
--- a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
+++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
@@ -21,6 +21,7 @@
// MODULES //
var isNumber = require( '@stdlib/assert/is-number' ).isObject;
+var isFinite = require( '@stdlib/assert/is-finite' ).isObject;
// MAIN //
diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
index 02f04272b8..6e40cf290d 100644
--- a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
+++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
@@ -21,6 +21,7 @@
// MODULES //
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
+var isFinite = require( '@stdlib/assert/is-finite' ).isPrimitive;
// MAIN //
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see here is the error:
make[1]: Entering directory '/Users/pranavchiku/repos/stdlib-js/stdlib'
Linting file: lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
/Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
24:5 error isFinite is already defined stdlib/no-redeclare
✖ 1 problem (1 error, 0 warnings)
make[1]: *** [/Users/pranavchiku/repos/stdlib-js/stdlib/tools/make/lib/lint/javascript/eslint.mk:225: eslint-files] Error 1
make[1]: Leaving directory '/Users/pranavchiku/repos/stdlib-js/stdlib'
make: *** [/Users/pranavchiku/repos/stdlib-js/stdlib/tools/make/lib/lint/javascript/Makefile:158: lint-javascript-files] Error 2
JavaScript lint errors for source files.
To fix this use the following diff
--- a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
+++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
@@ -21,6 +21,7 @@
// MODULES //
var isNumber = require( '@stdlib/assert/is-number' ).isObject;
+var isFinite = require( '@stdlib/assert/is-finite' ).isObject; // eslint-disable-line stdlib/no-redeclare
// MAIN //
diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
index 02f04272b8..e7356daee4 100644
--- a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
+++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
@@ -21,6 +21,7 @@
// MODULES //
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
+var isFinite = require( '@stdlib/assert/is-finite' ).isPrimitive; // eslint-disable-line stdlib/no-redeclare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be close to being able to get merged, thanks for your contribution!
As @Pranavchiku mentioned, we should explicitly require @stdlib/assert/is-finite.
lib/node_modules/@stdlib/assert/is-negative-finite/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/index.d.ts
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/test.ts
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/test.ts
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/test/test.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/test/test.object.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/test/test.primitive.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…enchmark.js Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…test.ts Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…index.d.ts Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…test.ts Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…test.ts Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…bject.js Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…ve.js Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…rimitive.js Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…dex.js Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
…ain.js Co-authored-by: Philipp Burckhardt <[email protected]> Signed-off-by: GUNJ JOSHI <[email protected]>
Signed-off-by: GUNJ JOSHI <[email protected]>
Signed-off-by: GUNJ JOSHI <[email protected]>
Thanks for your suggestions @Planeshifter @Pranavchiku, I have made the suggested changes. |
@gunjjoshi CI has passed; will give it one more review and then merge. Thanks for your contribution! |
lib/node_modules/@stdlib/assert/is-negative-finite/docs/repl.txt
Outdated
Show resolved
Hide resolved
Signed-off-by: Philipp Burckhardt <[email protected]>
assert/is-negative-finite
This commit adds the assert/is-negative-finite module for handling negative finite values.
Resolves #1345 .
Description
Adds the package
@stdlib/assert/is-negative-finite
.Related Issues
Yes, it resolves #1345
This pull request:
@stdlib/assert/is-negative-finite
#1345Questions
No.
Other
Test Logs:

Checklist
@stdlib-js/reviewers