API documentation of Agoric SDK / Exports / @agoric/swingset-liveslots / vatDataTypes / PickFacet
Interface: PickFacet
@agoric/swingset-liveslots.vatDataTypes.PickFacet
Callable
PickFacet
▸ PickFacet<M
, F
>(maker
, facetName
): (...args
: Parameters
<M
>) => ReturnType
<M
>[F
]
When making a multi-facet kind, it's common to pick one facet to expose. E.g.,
const makeFoo = (a, b, c, d) => makeFooBase(a, b, c, d).self;
This helper reduces the duplication:
const makeFoo = pickFacet(makeFooBase, 'self');
Type parameters
Name | Type |
---|---|
M | extends (...args : any []) => any |
F | extends string | number | symbol |
Parameters
Name | Type |
---|---|
maker | M |
facetName | F |
Returns
fn
▸ (...args
): ReturnType
<M
>[F
]
Parameters
Name | Type |
---|---|
...args | Parameters <M > |
Returns
ReturnType
<M
>[F
]