Skip to content

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

Merged
merged 20 commits into from
Feb 23, 2024
Merged

feat: added assert/is-negative-finite #1356

merged 20 commits into from
Feb 23, 2024

Conversation

gunjjoshi
Copy link
Member

@gunjjoshi gunjjoshi commented Feb 23, 2024

This commit adds the assert/is-negative-finite module for handling negative finite values.

Resolves #1345 .

Description

What is the purpose of this pull request?

Adds the package @stdlib/assert/is-negative-finite.

Related Issues

Does this pull request have any related issues?

Yes, it resolves #1345

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Test Logs:
Screenshot 2024-02-23 at 21 45 54

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

This commit adds the assert/is-negative-finite module for handling negative finite values.
Copy link
Contributor

@stdlib-bot stdlib-bot left a 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. 🏃 💨

Comment on lines +50 to +55
function isNegativeFinite( value ) {
return (
isNumber( value ) &&
value < 0.0 && isFinite(value)
);
}
Copy link
Member

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

Copy link
Member

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 //

Copy link
Member

@Pranavchiku Pranavchiku Feb 23, 2024

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

Copy link
Member

@Planeshifter Planeshifter left a 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.

gunjjoshi and others added 18 commits February 23, 2024 22:12
…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]>
…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]>
…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]>
@gunjjoshi
Copy link
Member Author

Thanks for your suggestions @Planeshifter @Pranavchiku, I have made the suggested changes.

@Planeshifter
Copy link
Member

@gunjjoshi CI has passed; will give it one more review and then merge. Thanks for your contribution!

@Planeshifter Planeshifter merged commit 609682c into stdlib-js:develop Feb 23, 2024
@gunjjoshi gunjjoshi deleted the is-negative-finite-object branch February 24, 2024 03:20
@gunjjoshi gunjjoshi changed the title feat: added assert/is-negative-finite feat: added assert/is-negative-finite Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: add @stdlib/assert/is-negative-finite
4 participants