MCPcopy Create free account
hub / github.com/nodejs/node / fromSync

Function fromSync

lib/internal/streams/iter/share.js:731–745  ·  view source on GitHub ↗
(input, options)

Source from the content-addressed store, hash-verified

729const SyncShare = {
730 __proto__: null,
731 fromSync(input, options) {
732 if (isSyncShareable(input)) {
733 const result = input[shareSyncProtocol](options);
734 if (result === null || typeof result !== 'object') {
735 throw new ERR_INVALID_RETURN_VALUE(
736 'an object', '[Symbol.for(\'Stream.shareSyncProtocol\')]', result);
737 }
738 return result;
739 }
740 if (isSyncIterable(input)) {
741 return shareSync(input, options);
742 }
743 throw new ERR_INVALID_ARG_TYPE(
744 'input', ['SyncShareable', 'Iterable'], input);
745 },
746};
747
748module.exports = {

Callers 1

shareSyncFunction · 0.70

Calls 3

isSyncShareableFunction · 0.85
shareSyncFunction · 0.85
isSyncIterableFunction · 0.70

Tested by

no test coverage detected