Skip to content

Commit

Permalink
src-runtime/validateType.js: Test IArguments and ArrayBufferView (#…
Browse files Browse the repository at this point in the history
…166)

* src-runtime/validateType.js: Test `IArguments` and `ArrayBufferView`

* Fix validateType, add comments
  • Loading branch information
kungfooman authored Jun 14, 2024
1 parent d347867 commit 580ef1d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src-runtime/validateType.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ function validateType(value, expect, loc, name, critical = true, warn, depth) {
}
warn(`${loc}> validateType> class> expected object, not '${value}'`);
return false;
case 'IArguments':
// Used in playcanvas-engine/src/core/tags.js
// Testable via physics/offset-collision example.
/** @todo unit tests */
return value[Symbol.iterator] instanceof Function;
case 'ArrayBufferView':
/**
* @todo unit tests + TS Lib object like customObjects...
* for e.g. different TS versions or environments
*/
return ArrayBuffer.isView(value);
}
//if (value === null) {
// /** @todo Add unit-tests/asserts tests to make sure this never happens */
Expand Down

0 comments on commit 580ef1d

Please sign in to comment.