code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function resolveDefaultProps(Component, baseProps) {
if (Component && Component.defaultProps) {
var props = assign({}, baseProps);
var defaultProps = Component.defaultProps;
for (var propName in defaultProps) {
if (props[propName] === void ... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | resolveDefaultProps | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderForwardRef(request, task, type, props, ref) {
pushFunctionComponentStackInDEV(task, type.render);
var children = renderWithHooks(request, task, type.render, props, ref);
var hasId = checkDidRenderIdHook();
if (hasId) {
var prevTreeCo... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderForwardRef | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderMemo(request, task, type, props, ref) {
var innerType = type.type;
var resolvedProps = resolveDefaultProps(innerType, props);
renderElement(request, task, innerType, resolvedProps, ref);
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderMemo | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderContextConsumer(request, task, context, props) {
{
if (context._context === void 0) {
if (context !== context.Consumer) {
if (!hasWarnedAboutUsingContextAsConsumer) {
hasWarnedAboutUsingContextAsConsumer = true;
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderContextConsumer | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderContextProvider(request, task, type, props) {
var context = type._context;
var value = props.value;
var children = props.children;
var prevSnapshot;
{
prevSnapshot = task.context;
}
task.cont... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderContextProvider | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderLazyComponent(request, task, lazyComponent, props, ref) {
pushBuiltInComponentStackInDEV(task, "Lazy");
var payload = lazyComponent._payload;
var init = lazyComponent._init;
var Component = init(payload);
var resolvedProps = resolveDef... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderLazyComponent | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderElement(request, task, type, props, ref) {
if (typeof type === "function") {
if (shouldConstruct$1(type)) {
renderClassComponent(request, task, type, props);
return;
} else {
renderIndeterminateComponent(r... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderElement | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function validateIterable(iterable, iteratorFn) {
{
if (typeof Symbol === "function" && // $FlowFixMe Flow doesn't know about toStringTag
iterable[Symbol.toStringTag] === "Generator") {
if (!didWarnAboutGenerators) {
error("Using Genera... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | validateIterable | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderNodeDestructive(request, task, node) {
{
try {
return renderNodeDestructiveImpl(request, task, node);
} catch (x) {
if (typeof x === "object" && x !== null && typeof x.then === "function")
;
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderNodeDestructive | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderNodeDestructiveImpl(request, task, node) {
task.node = node;
if (typeof node === "object" && node !== null) {
switch (node.$$typeof) {
case REACT_ELEMENT_TYPE: {
var element = node;
var type = element.ty... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderNodeDestructiveImpl | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderChildrenArray(request, task, children) {
var totalChildren = children.length;
for (var i = 0; i < totalChildren; i++) {
var prevTreeContext = task.treeContext;
task.treeContext = pushTreeContext(prevTreeContext, totalChildren, i);
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderChildrenArray | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function spawnNewSuspendedTask(request, task, x) {
var segment = task.blockedSegment;
var insertionIndex = segment.chunks.length;
var newSegment = createPendingSegment(
request,
insertionIndex,
null,
segment.format... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | spawnNewSuspendedTask | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderNode(request, task, node) {
var previousFormatContext = task.blockedSegment.formatContext;
var previousLegacyContext = task.legacyContext;
var previousContext = task.context;
var previousComponentStack = null;
{
previou... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderNode | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function erroredTask(request, boundary, segment, error2) {
var errorDigest = logRecoverableError(request, error2);
if (boundary === null) {
fatalError(request, error2);
} else {
boundary.pendingTasks--;
if (!boundary.forceClientRe... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | erroredTask | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function abortTaskSoft(task) {
var request = this;
var boundary = task.blockedBoundary;
var segment = task.blockedSegment;
segment.status = ABORTED;
finishedTask(request, boundary, segment);
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | abortTaskSoft | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function abortTask(task, request, reason) {
var boundary = task.blockedBoundary;
var segment = task.blockedSegment;
segment.status = ABORTED;
if (boundary === null) {
request.allPendingTasks--;
if (request.status !== CLOSED) {
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | abortTask | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function queueCompletedSegment(boundary, segment) {
if (segment.chunks.length === 0 && segment.children.length === 1 && segment.children[0].boundary === null) {
var childSegment = segment.children[0];
childSegment.id = segment.id;
childSegment.parentFlushed ... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | queueCompletedSegment | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function finishedTask(request, boundary, segment) {
if (boundary === null) {
if (segment.parentFlushed) {
if (request.completedRootSegment !== null) {
throw new Error("There can only be one root segment. This is a bug in React.");
}
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | finishedTask | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function retryTask(request, task) {
var segment = task.blockedSegment;
if (segment.status !== PENDING) {
return;
}
switchContext(task.context);
var prevTaskInDEV = null;
{
prevTaskInDEV = currentTaskInDEV... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | retryTask | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function performWork(request) {
if (request.status === CLOSED) {
return;
}
var prevContext = getActiveContext();
var prevDispatcher = ReactCurrentDispatcher$1.current;
ReactCurrentDispatcher$1.current = Dispatcher;
var p... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | performWork | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushSubtree(request, destination, segment) {
segment.parentFlushed = true;
switch (segment.status) {
case PENDING: {
var segmentID = segment.id = request.nextSegmentId++;
segment.lastPushedText = false;
segment.t... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushSubtree | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushSegment(request, destination, segment) {
var boundary = segment.boundary;
if (boundary === null) {
return flushSubtree(request, destination, segment);
}
boundary.parentFlushed = true;
if (boundary.forceClientRender) {
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushSegment | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushClientRenderedBoundary(request, destination, boundary) {
return writeClientRenderBoundaryInstruction(destination, request.responseState, boundary.id, boundary.errorDigest, boundary.errorMessage, boundary.errorComponentStack);
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushClientRenderedBoundary | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushSegmentContainer(request, destination, segment) {
writeStartSegment(destination, request.responseState, segment.formatContext, segment.id);
flushSegment(request, destination, segment);
return writeEndSegment(destination, segment.formatContext);
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushSegmentContainer | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushCompletedBoundary(request, destination, boundary) {
var completedSegments = boundary.completedSegments;
var i = 0;
for (; i < completedSegments.length; i++) {
var segment = completedSegments[i];
flushPartiallyCompletedSegment(reques... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushCompletedBoundary | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushPartialBoundary(request, destination, boundary) {
var completedSegments = boundary.completedSegments;
var i = 0;
for (; i < completedSegments.length; i++) {
var segment = completedSegments[i];
if (!flushPartiallyCompletedSegment(req... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushPartialBoundary | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushPartiallyCompletedSegment(request, destination, boundary, segment) {
if (segment.status === FLUSHED) {
return true;
}
var segmentID = segment.id;
if (segmentID === -1) {
var rootSegmentID = segment.id = boundary.rootSe... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushPartiallyCompletedSegment | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function flushCompletedQueues(request, destination) {
beginWriting();
try {
var completedRootSegment = request.completedRootSegment;
if (completedRootSegment !== null && request.pendingRootTasks === 0) {
flushSegment(request, destination, com... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | flushCompletedQueues | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function startWork(request) {
scheduleWork(function() {
return performWork(request);
});
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | startWork | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function startFlowing(request, destination) {
if (request.status === CLOSING) {
request.status = CLOSED;
closeWithError(destination, request.fatalError);
return;
}
if (request.status === CLOSED) {
return;
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | startFlowing | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function abort(request, reason) {
try {
var abortableTasks = request.abortableTasks;
abortableTasks.forEach(function(task) {
return abortTask(task, request, reason);
});
abortableTasks.clear();
if (request.de... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | abort | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function renderToReadableStream(children, options) {
return new Promise(function(resolve, reject) {
var onFatalError;
var onAllReady;
var allReady = new Promise(function(res, rej) {
onAllReady = res;
onFatalError = rej;
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | renderToReadableStream | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function onShellReady() {
var stream = new ReadableStream(
{
type: "bytes",
pull: function(controller) {
startFlowing(request, controller);
},
cancel: function(reason) {
... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | onShellReady | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function onShellError(error2) {
allReady.catch(function() {
});
reject(error2);
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | onShellError | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
listener = function() {
abort(request, signal.reason);
signal.removeEventListener("abort", listener);
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | listener | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
constructHTML = (app) => {
return `
<!doctype html>
<html>
<body>
<div id="content">${app}</div>
</body>
</html>
`;
} | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | constructHTML | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
handleRequest = async (request) => {
const headers = { "Content-Type": "text/html; charset=utf-8" };
const app = import_server.default.renderToString(/* @__PURE__ */ import_react2.default.createElement(app_default, null));
const html = constructHTML(app);
return new Response(html, { status: 200,... | Sets a subset of the state. This only exists because _pendingState is
internal. This provides a merging strategy that is not available to deep
properties which is confusing. TODO: Expose pendingState or don't use it
during the merge.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object}... | handleRequest | javascript | wasmerio/winterjs | benchmark/complex.js | https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js | MIT |
function Buffer(arg, encodingOrOffset, length) {
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new TypeError(
'The "string" argument must be of type string. Received type number'
)
}
return allocUnsafe(arg)
}
return from(arg, enc... | The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a... | Buffer | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function from(value, encodingOrOffset, length) {
if (typeof value === 'string') {
return fromString(value, encodingOrOffset)
}
if (ArrayBuffer.isView(value)) {
return fromArrayView(value)
}
if (value == null) {
throw new TypeError(
'The first argument must be one of type string, Buffer, Ar... | The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a... | from | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function assertSize(size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be of type number')
} else if (size < 0) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
} | Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
if value is a number.
Buffer.from(str[, encoding])
Buffer.from(array)
Buffer.from(buffer)
Buffer.from(arrayBuffer[, byteOffset[, length]]) | assertSize | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function alloc(size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpreted as a start offset.
return typeof e... | Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
if value is a number.
Buffer.from(str[, encoding])
Buffer.from(array)
Buffer.from(buffer)
Buffer.from(arrayBuffer[, byteOffset[, length]]) | alloc | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function allocUnsafe(size) {
assertSize(size)
return createBuffer(size < 0 ? 0 : checked(size) | 0)
} | Creates a new filled Buffer instance.
alloc(size[, fill[, encoding]]) | allocUnsafe | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function fromString(string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
const length = byteLength(string, encoding) | 0
let buf = createBuffer(length)
const actu... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | fromString | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function fromArrayLike(array) {
const length = array.length < 0 ? 0 : checked(array.length) | 0
const buf = createBuffer(length)
for (let i = 0; i < length; i += 1) {
buf[i] = array[i] & 255
}
return buf
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | fromArrayLike | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function fromArrayView(arrayView) {
if (isInstance(arrayView, Uint8Array)) {
const copy = new Uint8Array(arrayView)
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
}
return fromArrayLike(arrayView)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | fromArrayView | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function fromArrayBuffer(array, byteOffset, length) {
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('"offset" is outside of buffer bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('"length" is outside of buffer bounds')
}
let buf
if... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | fromArrayBuffer | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function fromObject(obj) {
if (Buffer.isBuffer(obj)) {
const len = checked(obj.length) | 0
const buf = createBuffer(len)
if (buf.length === 0) {
return buf
}
obj.copy(buf, 0, 0, len)
return buf
}
if (obj.length !== undefined) {
if (typeof obj.length !== 'number' || numberIsNaN... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | fromObject | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function checked(length) {
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= K_MAX_LENGTH) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + K_MAX_LENGTH.toString(16) + ' byt... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | checked | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function SlowBuffer(length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | SlowBuffer | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function byteLength(string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
throw new TypeError(
'The "string" argument must be one of type stri... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | byteLength | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function slowToString(encoding, start, end) {
let loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is o... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | slowToString | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function swap(b, n, m) {
const i = b[n]
b[n] = b[m]
b[m] = i
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | swap | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset
byteOffset = 0
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7ffffff... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | bidirectionalIndexOf | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
let indexSize = 1
let arrLength = arr.length
let valLength = val.length
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase()
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'u... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | arrayIndexOf | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function read(buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | read | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function hexWrite(buf, string, offset, length) {
offset = Number(offset) || 0
const remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
const strLen = string.length
if (length > strLen /... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | hexWrite | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function utf8Write(buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | utf8Write | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function asciiWrite(buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | asciiWrite | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function base64Write(buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | base64Write | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function ucs2Write(buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | ucs2Write | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function base64Slice(buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | base64Slice | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function utf8Slice(buf, start, end) {
end = Math.min(buf.length, end)
const res = []
let i = start
while (i < end) {
const firstByte = buf[i]
let codePoint = null
let bytesPerSequence = (firstByte > 0xEF)
? 4
: (firstByte > 0xDF)
? 3
: (firstByte > 0xBF)
? 2
... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | utf8Slice | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function decodeCodePointsArray(codePoints) {
const len = codePoints.length
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
let res = ''
let i = 0
while (i < len) {
res += Stri... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | decodeCodePointsArray | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function asciiSlice(buf, start, end) {
let ret = ''
end = Math.min(buf.length, end)
for (let i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | asciiSlice | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function latin1Slice(buf, start, end) {
let ret = ''
end = Math.min(buf.length, end)
for (let i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | latin1Slice | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function hexSlice(buf, start, end) {
const len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
let out = ''
for (let i = start; i < end; ++i) {
out += hexSliceLookupTable[buf[i]]
}
return out
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | hexSlice | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function utf16leSlice(buf, start, end) {
const bytes = buf.slice(start, end)
let res = ''
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
for (let i = 0; i < bytes.length - 1; i += 2) {
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
}
return res
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | utf16leSlice | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function checkOffset(offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | checkOffset | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function checkInt(buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | checkInt | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function wrtBigUInt64LE(buf, value, offset, min, max) {
checkIntBI(value, min, max, buf, offset, 7)
let lo = Number(value & BigInt(0xffffffff))
buf[offset++] = lo
lo = lo >> 8
buf[offset++] = lo
lo = lo >> 8
buf[offset++] = lo
lo = lo >> 8
buf[offset++] = lo
let hi = Number(value >> BigInt(32) & Bi... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | wrtBigUInt64LE | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function wrtBigUInt64BE(buf, value, offset, min, max) {
checkIntBI(value, min, max, buf, offset, 7)
let lo = Number(value & BigInt(0xffffffff))
buf[offset + 7] = lo
lo = lo >> 8
buf[offset + 6] = lo
lo = lo >> 8
buf[offset + 5] = lo
lo = lo >> 8
buf[offset + 4] = lo
let hi = Number(value >> BigInt(... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | wrtBigUInt64BE | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function checkIEEE754(buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | checkIEEE754 | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function writeFloat(buf, value, offset, littleEndian, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | writeFloat | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function writeDouble(buf, value, offset, littleEndian, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | writeDouble | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function E(sym, getMessage, Base) {
errors[sym] = class NodeError extends Base {
constructor() {
super()
Object.defineProperty(this, 'message', {
value: getMessage.apply(this, arguments),
writable: true,
configurable: true
})
// Add the error code to the name to i... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | E | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
constructor() {
super()
Object.defineProperty(this, 'message', {
value: getMessage.apply(this, arguments),
writable: true,
configurable: true
})
// Add the error code to the name to include it in the stack trace.
this.name = `${this.name} [${sym}]`
// Access... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | constructor | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
get code() {
return sym
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | code | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
set code(value) {
Object.defineProperty(this, 'code', {
configurable: true,
enumerable: true,
value,
writable: true
})
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | code | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
toString() {
return `${this.name} [${sym}]: ${this.message}`
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | toString | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function addNumericalSeparator(val) {
let res = ''
let i = val.length
const start = val[0] === '-' ? 1 : 0
for (; i >= start + 4; i -= 3) {
res = `_${val.slice(i - 3, i)}${res}`
}
return `${val.slice(0, i)}${res}`
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | addNumericalSeparator | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function checkBounds(buf, offset, byteLength) {
validateNumber(offset, 'offset')
if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
boundsError(offset, buf.length - (byteLength + 1))
}
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | checkBounds | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function checkIntBI(value, min, max, buf, offset, byteLength) {
if (value > max || value < min) {
const n = typeof min === 'bigint' ? 'n' : ''
let range
if (byteLength > 3) {
if (min === 0 || min === BigInt(0)) {
range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
} else {
... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | checkIntBI | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function validateNumber(value, name) {
if (typeof value !== 'number') {
throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
}
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | validateNumber | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function boundsError(value, length, type) {
if (Math.floor(value) !== value) {
validateNumber(value, type)
throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
}
if (length < 0) {
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
}
throw new errors.ERR_OUT_OF_RANGE(type || 'offset'... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | boundsError | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function base64clean(str) {
// Node takes equal signs as end of the Base64 encoding
str = str.split('=')[0]
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = str.trim().replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length <... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | base64clean | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function utf8ToBytes(string, units) {
units = units || Infinity
let codePoint
const length = string.length
let leadSurrogate = null
const bytes = []
for (let i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
... | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | utf8ToBytes | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function asciiToBytes(str) {
const byteArray = []
for (let i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | asciiToBytes | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function utf16leToBytes(str, units) {
let c, hi, lo
const byteArray = []
for (let i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | utf16leToBytes | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function base64ToBytes(str) {
return base64.toByteArray(base64clean(str))
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | base64ToBytes | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function blitBuffer(src, dst, offset, length) {
let i
for (i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | blitBuffer | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function isInstance(obj, type) {
return obj instanceof type ||
(obj != null && obj.constructor != null && obj.constructor.name != null &&
obj.constructor.name === type.name)
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | isInstance | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function numberIsNaN(obj) {
// For IE11 support
return obj !== obj // eslint-disable-line no-self-compare
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | numberIsNaN | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function defineBigIntMethod(fn) {
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | defineBigIntMethod | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
function BufferBigIntNotDefined() {
throw new Error('BigInt not supported')
} | Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. | BufferBigIntNotDefined | javascript | wasmerio/winterjs | src/builtins/internal_js_modules/node/buffer.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/internal_js_modules/node/buffer.js | MIT |
set returnValue(value) {
if (!value)
this.canceledFlag = true;
} | The returnValue setter steps are to set the canceled flag with this if the given value is false; otherwise do nothing. | returnValue | javascript | wasmerio/winterjs | src/builtins/js_globals/event.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/js_globals/event.js | MIT |
preventDefault() {
this.canceledFlag = true;
} | The preventDefault() method steps are to set the canceled flag with this. | preventDefault | javascript | wasmerio/winterjs | src/builtins/js_globals/event.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/js_globals/event.js | MIT |
get defaultPrevented() {
return !!this.canceledFlag;
} | The preventDefault() method steps are to set the canceled flag with this. | defaultPrevented | javascript | wasmerio/winterjs | src/builtins/js_globals/event.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/js_globals/event.js | MIT |
get composed() {
return !!this.composedFlag;
} | The preventDefault() method steps are to set the canceled flag with this. | composed | javascript | wasmerio/winterjs | src/builtins/js_globals/event.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/js_globals/event.js | MIT |
get dispatched() {
return this.dispatchFlag;
} | The preventDefault() method steps are to set the canceled flag with this. | dispatched | javascript | wasmerio/winterjs | src/builtins/js_globals/event.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/js_globals/event.js | MIT |
set dispatched(value) {
this.dispatchFlag = value;
} | The preventDefault() method steps are to set the canceled flag with this. | dispatched | javascript | wasmerio/winterjs | src/builtins/js_globals/event.js | https://github.com/wasmerio/winterjs/blob/master/src/builtins/js_globals/event.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.