@agoric/marshal
Advanced tools
Comparing version 0.5.1-dev-a9895c4.0 to 0.5.1-dev-ac23367.0
10
index.js
@@ -7,2 +7,3 @@ export { mapIterable, filterIterable } from './src/helpers/iter-helpers.js'; | ||
getTag, | ||
hasOwnPropertyOf, | ||
} from './src/helpers/passStyle-helpers.js'; | ||
@@ -21,8 +22,3 @@ | ||
export { | ||
passStyleOf, | ||
assertPassable, | ||
everyPassableChild, | ||
somePassableChild, | ||
} from './src/passStyleOf.js'; | ||
export { passStyleOf, assertPassable } from './src/passStyleOf.js'; | ||
@@ -47,2 +43,2 @@ export { pureCopy, sameValueZero } from './src/pureCopy.js'; | ||
isCopyArray, | ||
} from './src/assertPassStyleOf.js'; | ||
} from './src/typeGuards.js'; |
{ | ||
"name": "@agoric/marshal", | ||
"version": "0.5.1-dev-a9895c4.0+a9895c4", | ||
"version": "0.5.1-dev-ac23367.0+ac23367", | ||
"description": "marshal", | ||
@@ -37,10 +37,10 @@ "type": "module", | ||
"dependencies": { | ||
"@agoric/assert": "0.3.16-dev-a9895c4.0+a9895c4", | ||
"@agoric/eventual-send": "0.14.1-dev-a9895c4.0+a9895c4", | ||
"@agoric/assert": "0.3.16-dev-ac23367.0+ac23367", | ||
"@agoric/eventual-send": "0.14.1-dev-ac23367.0+ac23367", | ||
"@agoric/nat": "^4.1.0", | ||
"@agoric/promise-kit": "0.2.30-dev-a9895c4.0+a9895c4" | ||
"@agoric/promise-kit": "0.2.30-dev-ac23367.0+ac23367" | ||
}, | ||
"devDependencies": { | ||
"@agoric/lockdown": "0.1.2-dev-a9895c4.0+a9895c4", | ||
"@endo/ses-ava": "^0.2.8", | ||
"@agoric/lockdown": "0.1.2-dev-ac23367.0+ac23367", | ||
"@endo/ses-ava": "^0.2.13", | ||
"ava": "^3.12.1", | ||
@@ -72,3 +72,3 @@ "c8": "^7.7.2" | ||
}, | ||
"gitHead": "a9895c41b57d5ab3543a213824e293ee304dbcaa" | ||
"gitHead": "ac23367148f7b5d5a19cf0aef312251b036acb46" | ||
} |
@@ -47,9 +47,4 @@ // @ts-check | ||
// Recursively validate that each member is passable. | ||
CopyArrayHelper.every(candidate, v => !!passStyleOfRecur(v)); | ||
candidate.every(v => !!passStyleOfRecur(v)); | ||
}, | ||
every: (passable, fn) => | ||
// Note that we explicitly call `fn` with only the arguments we want | ||
// to provide. | ||
passable.every((v, i) => fn(v, i)), | ||
}); |
@@ -21,3 +21,2 @@ // @ts-check | ||
getOwnPropertyDescriptors, | ||
entries, | ||
prototype: objectPrototype, | ||
@@ -66,9 +65,4 @@ } = Object; | ||
// Recursively validate that each member is passable. | ||
CopyRecordHelper.every(candidate, v => !!passStyleOfRecur(v)); | ||
Object.values(candidate).every(v => !!passStyleOfRecur(v)); | ||
}, | ||
every: (passable, fn) => | ||
// Note that we explicitly call `fn` with only the arguments we want | ||
// to provide. | ||
entries(passable).every(([k, v]) => fn(v, k)), | ||
}); |
@@ -98,4 +98,2 @@ // @ts-check | ||
}, | ||
every: (_passable, _fn) => true, | ||
}); | ||
@@ -102,0 +100,0 @@ |
@@ -30,8 +30,2 @@ // @ts-check | ||
* ) => void} assertValid | ||
* | ||
* @property {(passable: Passable, | ||
* fn: (passable: Passable, index: any) => boolean | ||
* ) => boolean} every | ||
* For recuring through the nested passable structure. Like | ||
* `Array.prototype.every`, return `false` to stop early. | ||
*/ |
@@ -54,6 +54,4 @@ // @ts-check | ||
// Recursively validate that each member is passable. | ||
TaggedHelper.every(candidate, v => !!passStyleOfRecur(v)); | ||
!!passStyleOfRecur(candidate.payload); | ||
}, | ||
every: (passable, fn) => fn(passable.payload, 'payload'), | ||
}); |
@@ -31,5 +31,5 @@ // @ts-check | ||
* accidents. | ||
* @returns {{passStyleOf: PassStyleOf, HelperTable: any}} | ||
* @returns {PassStyleOf} | ||
*/ | ||
const makePassStyleOfKit = passStyleHelpers => { | ||
const makePassStyleOf = passStyleHelpers => { | ||
const HelperTable = { | ||
@@ -183,6 +183,6 @@ __proto__: null, | ||
}; | ||
return harden({ passStyleOf, HelperTable }); | ||
return harden(passStyleOf); | ||
}; | ||
const { passStyleOf, HelperTable } = makePassStyleOfKit([ | ||
export const passStyleOf = makePassStyleOf([ | ||
CopyArrayHelper, | ||
@@ -194,3 +194,2 @@ CopyRecordHelper, | ||
]); | ||
export { passStyleOf }; | ||
@@ -201,17 +200,1 @@ export const assertPassable = val => { | ||
harden(assertPassable); | ||
export const everyPassableChild = (passable, fn) => { | ||
const passStyle = passStyleOf(passable); | ||
const helper = HelperTable[passStyle]; | ||
if (helper) { | ||
// everyPassable guards .every so that each helper only gets a | ||
// genuine passable of its own flavor. | ||
return helper.every(passable, fn); | ||
} | ||
return true; | ||
}; | ||
harden(everyPassableChild); | ||
export const somePassableChild = (passable, fn) => | ||
!everyPassableChild(passable, (v, i) => !fn(v, i)); | ||
harden(somePassableChild); |
@@ -101,2 +101,12 @@ // @ts-nocheck TODO Fix the recursive types to it checks. Will this | ||
/** | ||
* @template T | ||
* @typedef {T[]} CopyArray | ||
*/ | ||
/** | ||
* @template T | ||
* @typedef {Record<string, T>} CopyRecord | ||
*/ | ||
/** | ||
* @typedef {{ | ||
@@ -103,0 +113,0 @@ * [PASS_STYLE]: 'tagged', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
135247
2888