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 useRef(initialValue) { var dispatcher = resolveDispatcher(); return dispatcher.useRef(initialValue); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useRef
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useEffect(create, deps); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useEffect
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useInsertionEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useInsertionEffect(create, deps); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useInsertionEffect
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useLayoutEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useLayoutEffect(create, deps); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useLayoutEffect
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useCallback(callback, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useCallback(callback, deps); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useCallback
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useMemo(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useMemo(create, deps); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useMemo
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useImperativeHandle(ref, create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useImperativeHandle(ref, create, deps); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useImperativeHandle
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useDebugValue(value, formatterFn) { { var dispatcher = resolveDispatcher(); return dispatcher.useDebugValue(value, formatterFn); } }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useDebugValue
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useTransition() { var dispatcher = resolveDispatcher(); return dispatcher.useTransition(); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useTransition
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useDeferredValue(value) { var dispatcher = resolveDispatcher(); return dispatcher.useDeferredValue(value); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useDeferredValue
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useId() { var dispatcher = resolveDispatcher(); return dispatcher.useId(); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useId
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var dispatcher = resolveDispatcher(); return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
useSyncExternalStore
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function disableLogs() { { if (disabledDepth === 0) { /* eslint-disable react-internal/no-production-logging */ prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollap...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
disableLogs
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { /* eslint-disable react-internal/no-production-logging */ var props = { configurable: true, enumerable: true, writable: true }; // $FlowFixMe Flow thinks console is immutable. ...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
reenableLogs
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function describeBuiltInComponentFrame(name, source, ownerFn) { { if (prefix === undefined) { // Extract the VM specific prefix used by each line. try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = match && match[...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
describeBuiltInComponentFrame
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function describeNativeComponentFrame(fn, construct) { // If something asked for a stack inside a fake render, it should get ignored. if ( !fn || reentry) { return ''; } { var frame = componentFrameCache.get(fn); if (frame !== undefined) { return frame; } } var...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
describeNativeComponentFrame
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
Fake = function () { throw Error(); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
Fake
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
describeFunctionComponentFrame
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
shouldConstruct
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ''; } if (typeof type === 'function') { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === 'string') { return describeBuiltInC...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
describeUnknownElementTypeFrameInDEV
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDeb...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
setCurrentlyValidatingElement
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function checkPropTypes(typeSpecs, values, location, componentName, element) { { // $FlowFixMe This is okay but Flow doesn't know it. var has = Function.call.bind(hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; // ...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
checkPropTypes
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function setCurrentlyValidatingElement$1(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); setExtraStackFrame(stack); } else { setExtraStackFrame(null); ...
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
setCurrentlyValidatingElement$1
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = getComponentNameFromType(ReactCurrentOwner.current.type); if (name) { return '\n\nCheck the render method of `' + name + '`.'; } } return ''; }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
getDeclarationErrorAddendum
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function getSourceInfoErrorAddendum(source) { if (source !== undefined) { var fileName = source.fileName.replace(/^.*[\\\/]/, ''); var lineNumber = source.lineNumber; return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; } return ''; }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
getSourceInfoErrorAddendum
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function getSourceInfoErrorAddendumForProps(elementProps) { if (elementProps !== null && elementProps !== undefined) { return getSourceInfoErrorAddendum(elementProps.__source); } return ''; }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://reactjs.org/docs/react-api.html#reactchildrenonly The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this helper function ...
getSourceInfoErrorAddendumForProps
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { info = "\n\nCheck the top-level render call using <" + pare...
Warn if there's no key explicitly set on dynamic arrays of children or object keys are not valid. This allows us to keep track of children between updates.
getCurrentComponentErrorInfo
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorIn...
Warn if the element doesn't have an explicit key assigned to it. This element is in an array. The array could grow and shrink or be reordered. All children that haven't already been validated are required to have a "key" property assigned to it. Error statuses are cached so a warning will only be shown once. @internal...
validateExplicitKey
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function validateChildKeys(node, parentType) { if (typeof node !== 'object') { return; } if (isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else...
Ensure that every element either is passed in a static location, in an array with an explicit keys property defined, or in an object literal with valid key property. @internal @param {ReactNode} node Statically passed child of any type. @param {*} parentType node's parent's type.
validateChildKeys
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function validatePropTypes(element) { { var type = element.type; if (type === null || type === undefined || typeof type === 'string') { return; } var propTypes; if (typeof type === 'function') { propTypes = type.propTypes; } else if (typeof type === 'object' &&...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
validatePropTypes
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function validateFragmentProps(fragment) { { var keys = Object.keys(fragment.props); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key !== 'children' && key !== 'key') { setCurrentlyValidatingElement$1(fragment); error('Invalid prop `%s` supplied t...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
validateFragmentProps
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. if (!validType) { var info = ''; if (type === undefined || ty...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
createElementWithValidation
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function createFactoryWithValidation(type) { var validatedFactory = createElementWithValidation.bind(null, type); validatedFactory.type = type; { if (!didWarnAboutDeprecatedCreateFactory) { didWarnAboutDeprecatedCreateFactory = true; warn('React.createFactory() is deprecated and will...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
createFactoryWithValidation
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function cloneElementWithValidation(element, props, children) { var newElement = cloneElement.apply(this, arguments); for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], newElement.type); } validatePropTypes(newElement); return newElement; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
cloneElementWithValidation
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function push(heap, node) { var index = heap.length; heap.push(node); siftUp(heap, node, index); }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
push
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function peek(heap) { return heap.length === 0 ? null : heap[0]; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
peek
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function pop(heap) { if (heap.length === 0) { return null; } var first = heap[0]; var last = heap.pop(); if (last !== first) { heap[0] = last; siftDown(heap, last, 0); } return first; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
pop
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function siftUp(heap, node, i) { var index = i; while (index > 0) { var parentIndex = index - 1 >>> 1; var parent = heap[parentIndex]; if (compare(parent, node) > 0) { // The parent is larger. Swap positions. heap[parentIndex] = node; heap[index] = parent; ind...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
siftUp
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function siftDown(heap, node, i) { var index = i; var length = heap.length; var halfLength = length >>> 1; while (index < halfLength) { var leftIndex = (index + 1) * 2 - 1; var left = heap[leftIndex]; var rightIndex = leftIndex + 1; var right = heap[rightIndex]; // If the left o...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
siftDown
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function compare(a, b) { // Compare sort index first, then task id. var diff = a.sortIndex - b.sortIndex; return diff !== 0 ? diff : a.id - b.id; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
compare
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function advanceTimers(currentTime) { // Check for tasks that are no longer delayed and add them to the queue. var timer = peek(timerQueue); while (timer !== null) { if (timer.callback === null) { // Timer was cancelled. pop(timerQueue); } else if (timer.startTime <= currentTime...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
advanceTimers
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function handleTimeout(currentTime) { isHostTimeoutScheduled = false; advanceTimers(currentTime); if (!isHostCallbackScheduled) { if (peek(taskQueue) !== null) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } else { var firstTimer = peek(timerQueue); ...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
handleTimeout
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function flushWork(hasTimeRemaining, initialTime) { isHostCallbackScheduled = false; if (isHostTimeoutScheduled) { // We scheduled a timeout but it's no longer needed. Cancel it. isHostTimeoutScheduled = false; cancelHostTimeout(); } isPerformingWork = true; var previousPriorit...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
flushWork
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function workLoop(hasTimeRemaining, initialTime) { var currentTime = initialTime; advanceTimers(currentTime); currentTask = peek(taskQueue); while (currentTask !== null && !(enableSchedulerDebugging )) { if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
workLoop
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_runWithPriority(priorityLevel, eventHandler) { switch (priorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: case LowPriority: case IdlePriority: break; default: priorityLevel = NormalPriority; } var p...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_runWithPriority
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_next(eventHandler) { var priorityLevel; switch (currentPriorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: // Shift down to normal priority priorityLevel = NormalPriority; break; default: // Anything...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_next
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_wrapCallback(callback) { var parentPriorityLevel = currentPriorityLevel; return function () { // This is a fork of runWithPriority, inlined for performance. var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = parentPriorityLevel; try { retu...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_wrapCallback
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_scheduleCallback(priorityLevel, callback, options) { var currentTime = getCurrentTime(); var startTime; if (typeof options === 'object' && options !== null) { var delay = options.delay; if (typeof delay === 'number' && delay > 0) { startTime = currentTime + delay; ...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_scheduleCallback
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_continueExecution() { if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_continueExecution
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_getFirstCallbackNode() { return peek(taskQueue); }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_getFirstCallbackNode
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_cancelCallback(task) { // remove from the queue because you can't remove arbitrary nodes from an // array based heap, only the first one.) task.callback = null; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_cancelCallback
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function unstable_getCurrentPriorityLevel() { return currentPriorityLevel; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
unstable_getCurrentPriorityLevel
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function shouldYieldToHost() { var timeElapsed = getCurrentTime() - startTime; if (timeElapsed < frameInterval) { // The main thread has only been blocked for a really short amount of time; // smaller than a single frame. Don't yield yet. return false; } // The main thread has been blocke...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
shouldYieldToHost
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function forceFrameRate(fps) { if (fps < 0 || fps > 125) { // Using console['error'] to evade Babel and ESLint console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); return; } if (fps > 0) { frameInte...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
forceFrameRate
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
performWorkUntilDeadline = function () { if (scheduledHostCallback !== null) { var currentTime = getCurrentTime(); // Keep track of the start time so we can measure how long the main thread // has been blocked. startTime = currentTime; var hasTimeRemaining = true; // If a scheduler task thr...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
performWorkUntilDeadline
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function requestHostCallback(callback) { scheduledHostCallback = callback; if (!isMessageLoopRunning) { isMessageLoopRunning = true; schedulePerformWorkUntilDeadline(); } }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
requestHostCallback
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function requestHostTimeout(callback, ms) { taskTimeoutID = localSetTimeout(function () { callback(getCurrentTime()); }, ms); }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
requestHostTimeout
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function cancelHostTimeout() { localClearTimeout(taskTimeoutID); taskTimeoutID = -1; }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
cancelHostTimeout
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function startTransition(scope, options) { var prevTransition = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = {}; var currentTransition = ReactCurrentBatchConfig.transition; { ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { scope();...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
startTransition
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function enqueueTask(task) { if (enqueueTaskImpl === null) { try { // read require off the module object to get around the bundlers. // we don't want them to detect a require and bundle a Node polyfill. var requireString = ('require' + Math.random()).slice(0, 7); var nodeRequir...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
enqueueTask
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function act(callback) { { // `act` calls can be nested, so we track the depth. This represents the // number of `act` scopes on the stack. var prevActScopeDepth = actScopeDepth; actScopeDepth++; if (ReactCurrentActQueue.current === null) { // This is the outermost `act` scope...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
act
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function popActScope(prevActScopeDepth) { { if (prevActScopeDepth !== actScopeDepth - 1) { error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); } actScopeDepth = prevActScopeDepth; } }
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
popActScope
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { { var queue = ReactCurrentActQueue.current; if (queue !== null) { try { flushActQueue(queue); enqueueTask(function () { if (queue.length === 0) { // No additional work was schedul...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
recursivelyFlushAsyncActWork
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function flushActQueue(queue) { { if (!isFlushing) { // Prevent re-entrance. isFlushing = true; var i = 0; try { for (; i < queue.length; i++) { var callback = queue[i]; do { callback = callback(true); } while (callb...
Given a fragment, validate that it can only be provided with fragment props @param {ReactElement} fragment
flushActQueue
javascript
facebook/memlab
packages/lens/src/tests/lib/react-v18.dev.js
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-v18.dev.js
MIT
function initialise() { if (window.innerWidth >= 996) { createRenderer(); createScene(); createMesh(); createLights(); addEventListeners(); resize(container.offsetWidth, container.offsetHeight); animate(); container.style.background = 'transparent'; ...
@class SVG Renderer @author Matthew Wagerfield
initialise
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function createRenderer() { canvasRenderer = new FSS.CanvasRenderer(); setRenderer(RENDER.renderer); }
@class SVG Renderer @author Matthew Wagerfield
createRenderer
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function setRenderer(index) { if (renderer) { output.removeChild(renderer.element); } renderer = canvasRenderer; renderer.setSize(container.offsetWidth, container.offsetHeight); output.appendChild(renderer.element); }
@class SVG Renderer @author Matthew Wagerfield
setRenderer
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function createScene() { scene = new FSS.Scene(); }
@class SVG Renderer @author Matthew Wagerfield
createScene
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function createMesh() { scene.remove(mesh); renderer.clear(); geometry = new FSS.Plane( MESH.width * renderer.width, MESH.height * renderer.height, MESH.segments, MESH.slices, ); material = new FSS.Material(MESH.ambient, MESH.diffuse); mesh = new FSS.M...
@class SVG Renderer @author Matthew Wagerfield
createMesh
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function createLights() { let l, light; for (l = scene.lights.length - 1; l >= 0; l--) { light = scene.lights[l]; scene.remove(light); } renderer.clear(); for (l = 0; l < LIGHT.count; l++) { light = new FSS.Light(LIGHT.ambient, LIGHT.diffuse); light.ambientH...
@class SVG Renderer @author Matthew Wagerfield
createLights
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function resize(width, height) { renderer.setSize(width, height); FSS.Vector3.set(center, renderer.halfWidth, renderer.halfHeight); createMesh(); }
@class SVG Renderer @author Matthew Wagerfield
resize
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function animate() { now = Date.now() - start; update(); render(); setTimeout(() => requestAnimationFrame(animate), 160); }
@class SVG Renderer @author Matthew Wagerfield
animate
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function update() { let ox, oy, oz, l, light, v, vertex, offset = MESH.depth / 2; // Update Bounds FSS.Vector3.copy(LIGHT.bounds, center); FSS.Vector3.multiplyScalar(LIGHT.bounds, LIGHT.xyScalar); // Update Attractor FSS.Vecto...
@class SVG Renderer @author Matthew Wagerfield
update
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function render() { renderer.render(scene); // Draw Lights if (LIGHT.draw) { let l, lx, ly, light; for (l = scene.lights.length - 1; l >= 0; l--) { light = scene.lights[l]; lx = light.position[0]; ly = light.position[1]; renderer.context.lineWid...
@class SVG Renderer @author Matthew Wagerfield
render
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function addEventListeners() { window.addEventListener('resize', onWindowResize); //container.addEventListener('mousemove', onMouseMove); }
@class SVG Renderer @author Matthew Wagerfield
addEventListeners
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function onMouseMove(event) { FSS.Vector3.set(attractor, event.x, renderer.height - event.y); FSS.Vector3.subtract(attractor, center); }
@class SVG Renderer @author Matthew Wagerfield
onMouseMove
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
function onWindowResize(event) { resize(container.offsetWidth, container.offsetHeight); render(); }
@class SVG Renderer @author Matthew Wagerfield
onWindowResize
javascript
facebook/memlab
website/src/lib/ContainerAnimation.js
https://github.com/facebook/memlab/blob/master/website/src/lib/ContainerAnimation.js
MIT
constructor(config) { super(); const cwd = config.cwd; const registry = config.registry; const packageManager = config.use === undefined ? USE_OPTIONS[0] : config.use; const updateTo = config.updateTo === undefined ? UPDATE_TO_OPTIONS[0] : ...
The config passed-in here should look identically to the CLI config. Dash-cased properties should be renamed to camelCased. The goal is to replicate the API of the CLI as close as possible so users don't have to guess the options. @param {UpdtrConfig} config
constructor
javascript
peerigon/updtr
src/Updtr.js
https://github.com/peerigon/updtr/blob/master/src/Updtr.js
Unlicense
async canAccessPackageJson() { let result = true; try { await fs.access( path.join(this.config.cwd, "package.json"), FS_CONSTANTS.R_OK | FS_CONSTANTS.W_OK // eslint-disable-line no-bitwise ); } catch (err) { result = false; ...
The config passed-in here should look identically to the CLI config. Dash-cased properties should be renamed to camelCased. The goal is to replicate the API of the CLI as close as possible so users don't have to guess the options. @param {UpdtrConfig} config
canAccessPackageJson
javascript
peerigon/updtr
src/Updtr.js
https://github.com/peerigon/updtr/blob/master/src/Updtr.js
Unlicense
exec(cmd) { return exec(this.config.cwd, cmd); }
The config passed-in here should look identically to the CLI config. Dash-cased properties should be renamed to camelCased. The goal is to replicate the API of the CLI as close as possible so users don't have to guess the options. @param {UpdtrConfig} config
exec
javascript
peerigon/updtr
src/Updtr.js
https://github.com/peerigon/updtr/blob/master/src/Updtr.js
Unlicense
readFile(filenameInCwd) { return fs.readFile(path.join(this.config.cwd, filenameInCwd), "utf8"); }
The config passed-in here should look identically to the CLI config. Dash-cased properties should be renamed to camelCased. The goal is to replicate the API of the CLI as close as possible so users don't have to guess the options. @param {UpdtrConfig} config
readFile
javascript
peerigon/updtr
src/Updtr.js
https://github.com/peerigon/updtr/blob/master/src/Updtr.js
Unlicense
writeFile(filenameInCwd, contents) { return fs.writeFile( path.join(this.config.cwd, filenameInCwd), contents ); }
The config passed-in here should look identically to the CLI config. Dash-cased properties should be renamed to camelCased. The goal is to replicate the API of the CLI as close as possible so users don't have to guess the options. @param {UpdtrConfig} config
writeFile
javascript
peerigon/updtr
src/Updtr.js
https://github.com/peerigon/updtr/blob/master/src/Updtr.js
Unlicense
function updateVersionRange(oldRange, newVersion) { const parsedOldRange = parse(oldRange.trim()); if (parsedOldRange !== null) { if (isPinned(parsedOldRange) === true) { // The old version was pinned, so the new should also be pinned return newVersion; } const ...
Tries to apply the newVersion while maintaining the range (see https://github.com/peerigon/updtr/issues/47) This is kind of risky because there are tons of semver possibilities. That's why this function is very conservative in accepting semver ranges. If the range is not easily updatable, we opt-out to npm's default ca...
updateVersionRange
javascript
peerigon/updtr
src/tasks/util/updateVersionRange.js
https://github.com/peerigon/updtr/blob/master/src/tasks/util/updateVersionRange.js
Unlicense
cleanReposUrl = reposUrl => reposUrl .replace('\n', '') .replace('git+', '') .replace('.git', '')
Clean repository url by removing '.git' and 'git+' @param {string} reposUrl
cleanReposUrl
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
cleanReposUrl = reposUrl => reposUrl .replace('\n', '') .replace('git+', '') .replace('.git', '')
Clean repository url by removing '.git' and 'git+' @param {string} reposUrl
cleanReposUrl
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getReposUrlFromPackageJson = async packageJson => { const reposUrl = get(packageJson, 'repository.url', undefined) return isNil(reposUrl) ? undefined : cleanReposUrl(reposUrl) }
Get repository url from pakage json @param {Object} reposUrl
getReposUrlFromPackageJson
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getReposUrlFromPackageJson = async packageJson => { const reposUrl = get(packageJson, 'repository.url', undefined) return isNil(reposUrl) ? undefined : cleanReposUrl(reposUrl) }
Get repository url from pakage json @param {Object} reposUrl
getReposUrlFromPackageJson
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getReposUrl = async packageJson => (await getReposUrlFromPackageJson(packageJson)) || getReposUrlFromGit()
Get repository url from package.json or git @param {Object} packageJson
getReposUrl
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getReposUrl = async packageJson => (await getReposUrlFromPackageJson(packageJson)) || getReposUrlFromGit()
Get repository url from package.json or git @param {Object} packageJson
getReposUrl
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getReposIssuesUrl = async packageJson => { let reposIssuesUrl = get(packageJson, 'bugs.url', undefined) if (isNil(reposIssuesUrl)) { const reposUrl = await getReposUrl() if (!isNil(reposUrl)) { reposIssuesUrl = `${reposUrl}/issues` } } return reposIssuesUrl }
Get repository issues url from package.json or git @param {Object} packageJson
getReposIssuesUrl
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getReposIssuesUrl = async packageJson => { let reposIssuesUrl = get(packageJson, 'bugs.url', undefined) if (isNil(reposIssuesUrl)) { const reposUrl = await getReposUrl() if (!isNil(reposUrl)) { reposIssuesUrl = `${reposUrl}/issues` } } return reposIssuesUrl }
Get repository issues url from package.json or git @param {Object} packageJson
getReposIssuesUrl
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
isGithubRepository = repositoryUrl => !isNil(repositoryUrl) && repositoryUrl.includes(GITHUB_URL)
Check if repository is a Github repository @param {string} repositoryUrl
isGithubRepository
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
isGithubRepository = repositoryUrl => !isNil(repositoryUrl) && repositoryUrl.includes(GITHUB_URL)
Check if repository is a Github repository @param {string} repositoryUrl
isGithubRepository
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getAuthorName = packageJson => { if (has(packageJson, 'author.name')) { return get(packageJson, 'author.name', undefined) } if (has(packageJson, 'author') && typeof packageJson.author === 'string') { return get(packageJson, 'author', undefined) } return undefined }
Get project author name from package.json @param packageJson @returns {string} authorName
getAuthorName
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getAuthorName = packageJson => { if (has(packageJson, 'author.name')) { return get(packageJson, 'author.name', undefined) } if (has(packageJson, 'author') && typeof packageJson.author === 'string') { return get(packageJson, 'author', undefined) } return undefined }
Get project author name from package.json @param packageJson @returns {string} authorName
getAuthorName
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getProjectInfos = async () => { const spinner = ora('Gathering project infos').start() const packageJson = await getPackageJson() const isJSProject = !!packageJson const packageManager = isJSProject ? getPackageManagerFromLockFile() : undefined const name = getProjectName(packageJson) const descrip...
Get project informations from git and package.json
getProjectInfos
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
getProjectInfos = async () => { const spinner = ora('Gathering project infos').start() const packageJson = await getPackageJson() const isJSProject = !!packageJson const packageManager = isJSProject ? getPackageManagerFromLockFile() : undefined const name = getProjectName(packageJson) const descrip...
Get project informations from git and package.json
getProjectInfos
javascript
kefranabg/readme-md-generator
src/project-infos.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/project-infos.js
MIT
writeReadme = async readmeContent => { const spinner = ora('Creating README').start() try { await promisify(fs.writeFile)(README_PATH, unescape(readmeContent)) spinner.succeed('README created') } catch (err) { spinner.fail('README creation fail') throw err } }
Create readme file from the given readmeContent @param {string} readmeContent
writeReadme
javascript
kefranabg/readme-md-generator
src/readme.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/readme.js
MIT
writeReadme = async readmeContent => { const spinner = ora('Creating README').start() try { await promisify(fs.writeFile)(README_PATH, unescape(readmeContent)) spinner.succeed('README created') } catch (err) { spinner.fail('README creation fail') throw err } }
Create readme file from the given readmeContent @param {string} readmeContent
writeReadme
javascript
kefranabg/readme-md-generator
src/readme.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/readme.js
MIT
getReadmeTemplate = async templatePath => { const spinner = ora('Loading README template').start() try { const template = await promisify(fs.readFile)(templatePath, 'utf8') spinner.succeed('README template loaded') return template } catch (err) { spinner.fail('README template loading fail') t...
Get README template content from the given templatePath @param {string} templatePath
getReadmeTemplate
javascript
kefranabg/readme-md-generator
src/readme.js
https://github.com/kefranabg/readme-md-generator/blob/master/src/readme.js
MIT