Skip to content

Commit

Permalink
fix: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Aug 3, 2021
1 parent 86a45be commit 3233c3c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/marshal/src/helpers/copyArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ export const CopyArrayHelper = harden({
X`Malformed array: ${candidate}`,
TypeError,
);
// Since we're already ensured candidate is an array, it should not be
// possible for the following test to fail
checkNormalProperty(candidate, 'length', 'string', false, assertChecker);
const len = candidate.length;
for (let i = 0; i < len; i += 1) {
checkNormalProperty(candidate, i, 'number', true, assertChecker);
}
assert(
// +1 for the 'length' property itself.
ownKeys(candidate).length === len + 1,
X`Arrays must not have non-indexes: ${candidate}`,
TypeError,
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/helpers/passStyleHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const PASS_STYLE = Symbol.for('passStyle');
* doing so, it's inheritance might change after the `PASS_STYLE`
* check below.
*
* @param {*} func
* @param {any} func
* @returns {boolean}
*/
export const canBeMethod = func =>
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/passStyleOf.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ export const everyPassableChild = (passable, fn) => {
}
return true;
};
harden({ everyPassable: everyPassableChild });
harden(everyPassableChild);
5 changes: 1 addition & 4 deletions packages/marshal/src/structure.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ const isStructureInternal = passable => {
const structureCache = new WeakMap();

/**
* If `passable` is not a Passable, throw. Otherwise say whether it is
* structure.
*
* @param {Passable} passable
* @returns {boolean}
*/
Expand Down Expand Up @@ -150,7 +147,7 @@ export const fulfillToStructure = passable => {
harden(fulfillToStructure);

/**
* This internal recursion may assume that `left` and `right` and
* This internal recursion may assume that `left` and `right` are
* Structures, since `sameStructure` guards that, and the guarantee is
* deep.
*
Expand Down

0 comments on commit 3233c3c

Please sign in to comment.