-
-
Notifications
You must be signed in to change notification settings - Fork 959
feat: add symbol/match package #8495
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
base: develop
Are you sure you want to change the base?
Conversation
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
Signed-off-by: Saloni Tarone <taronesaloni@gamil.com>
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
/cc @kgryte |
|
|
||
| # MatchSymbol | ||
|
|
||
| > Match [symbol][mdn-symbol] which is used to determine if a constructor object recognizes an object as its instance. |
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.
Description is incorrect.
|
|
||
| #### MatchSymbol | ||
|
|
||
| Match [`symbol`][mdn-symbol] which is used to determine if a constructor object recognizes an object as its instance. |
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.
Description is incorrect.
| - The `instanceof` operator uses the following algorithm to determine the return value of `object instanceof constructor`: | ||
|
|
||
| - If `constructor` has a `[MatchSymbol]()` method, the `instanceof` operator calls the method with `object` as the first argument and returns the result (coerced to a boolean). If `constructor` is not an object or if `constructor[MatchSymbol]` is neither `null`, `undefined`, nor a function, the `instanceof` operator raises an exception. | ||
| - Otherwise, if `constructor` does not have a `[MatchSymbol]()` method (i.e., `constructor[MatchSymbol]` is `null` or `undefined`), the `instanceof` operator determines the result using the same algorithm as `Function.prototype[MatchSymbol]()`. If `constructor` is not a function, the `instanceof` operator raises an exception. |
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 is all incorrect. You need to update to reflect the actual usage of the match symbol.
| var isArray = require( '@stdlib/assert/is-array' ); | ||
| var instanceOf = require( '@stdlib/assert/instance-of' ); | ||
| var defineProperty = require( '@stdlib/utils/define-property' ); | ||
| var MatchSymbol = require( '@stdlib/symbol/match' ); |
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 example is not correct. You need to update to reflect the actual use case for the match symbol.
| * | ||
| * ## Notes | ||
| * | ||
| * - This symbol is used to determine whether a constructor object recognizes an object as its instance. |
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.
Description is incorrect.
| var isArray = require( '@stdlib/assert/is-array' ); | ||
| var instanceOf = require( '@stdlib/assert/instance-of' ); | ||
| var defineProperty = require( '@stdlib/utils/define-property' ); | ||
| var MatchSymbol = require( './../lib' ); |
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.
Example needs updating.
| 'use strict'; | ||
|
|
||
| /** | ||
| * Symbol used to determine if a constructor object recognizes an object as its instance. |
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.
Description is incorrect.
|
|
||
| // MODULES // | ||
|
|
||
| var matchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // eslint-disable-line id-length |
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.
Import statement is incorrect.
| * @type {(symbol|null)} | ||
| * | ||
| * @example | ||
| * var isArray = require( '@stdlib/assert/is-array' ); |
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.
Example is not correct.
| // MODULES // | ||
|
|
||
| var tape = require( 'tape' ); | ||
| var hasMatchSymbolSupport = require( '@stdlib/assert/has-has-instance-symbol-support' ); // eslint-disable-line id-length |
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.
Import path is incorrect.
kgryte
left a comment
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.
Left initial comments.
Description
Purpose of this pull request:
This PR adds a new package modeled after existing symbol utilities in the repository, including:
symbol/has-instancesymbol/iteratorsymbol/async-iteratorsymbol/is-concat-spreadableThe new package exports
Symbol.matchwhen available in the current environment.Implementation details:
(e.g.,
has-instance→match,HasInstanceSymbol→MatchSymbol).Symbol.match.Related Issues
This pull request has the following related issues:
This pull request is related to the following issue:
symbol/match#8478Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers