-
-
Notifications
You must be signed in to change notification settings - Fork 907
feat: add find
method to array/fixed-endian-factory
#3286
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
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. 🏃 💨
Coverage Report
The above coverage report was generated for the changes in this PR. |
* @throws {TypeError} `this` must be a typed array instance | ||
* @returns {*} The value of the first element in the array that satisfies the testing function. Otherwise, undefined. | ||
*/ | ||
setReadOnly(TypedArray.prototype, 'find', function find(predicate, thisArg) { |
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.
setReadOnly(TypedArray.prototype, 'find', function find(predicate, thisArg) { | |
setReadOnly( TypedArray.prototype, 'find', function find( predicate, thisArg ) { |
setReadOnly(TypedArray.prototype, 'find', function find(predicate, thisArg) { | ||
var value; | ||
var i; | ||
if (!isTypedArray(this)) { |
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.
if (!isTypedArray(this)) { | |
if ( !isTypedArray(this ) ) { |
throw new TypeError('invalid invocation. `this` is not a typed array instance.'); | ||
} | ||
if (typeof predicate !== 'function') { | ||
throw new TypeError(format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); | ||
} | ||
for (i = 0; i < this._length; i++) { | ||
value = this._buffer[GETTER](i * BYTES_PER_ELEMENT, this._isLE); | ||
if (predicate.call(thisArg, value, i, this)) { | ||
return 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.
throw new TypeError('invalid invocation. `this` is not a typed array instance.'); | |
} | |
if (typeof predicate !== 'function') { | |
throw new TypeError(format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); | |
} | |
for (i = 0; i < this._length; i++) { | |
value = this._buffer[GETTER](i * BYTES_PER_ELEMENT, this._isLE); | |
if (predicate.call(thisArg, value, i, this)) { | |
return value; | |
throw new TypeError( 'invalid invocation. `this` is not a typed array instance.' ); | |
} | |
if ( typeof predicate !== 'function' ) { | |
throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); | |
} | |
for ( i = 0; i < this._length; i++ ) { | |
value = this._buffer[ GETTER ]( i * BYTES_PER_ELEMENT, this._isLE ); | |
if (predicate.call( thisArg, value, i, this ) ) { | |
return value; |
please do same for all your changes
Would it be okay if I take over and complete the requested changes? |
Resolves #3141
Description
This pull request:
find
method to thearray/fixed-endian-factory
Related Issues
This pull request:
find
method toarray/fixed-endian-factory
#3141Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers