Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This function can only be called with a workinprogress fiber and only during begin or complete phase. Do not call it under any other circumstances.
function getStackAddendumByWorkInProgressFiber(workInProgress) { var info = ''; var node = workInProgress; do { info += describeFiber(node); // Otherwise this return pointer might point to the wrong tree: node = node.return; } while (node); return info; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "if (\n workInProgressSuspendedReason === SuspendedOnData &&\n workInProgressRoot === root\n ) {\n // Mark the root as ready to continue rendering.\n workInProgressSuspendedReason = SuspendedAndReadyToContinue;\n }", "function g...
[ "0.6055588", "0.60392493", "0.5994331", "0.5994331", "0.5994331", "0.5880027", "0.5802061", "0.5707473", "0.56547225", "0.56361365", "0.5588393", "0.5560857", "0.5516873", "0.55146945", "0.551263", "0.5482989", "0.5476365", "0.5440091", "0.5440091", "0.5440091", "0.5440091", ...
0.53892773
75
Get the value for a property on a node. Only used in DEV for SSR validation. The "expected" argument is used as a hint of what the expected value is. Some properties have multiple equivalent values.
function getValueForProperty(node, name, expected, propertyInfo) { { if (propertyInfo.mustUseProperty) { var propertyName = propertyInfo.propertyName; return node[propertyName]; } else { var attributeName = propertyInfo.attributeName; var stringValue = null; if (propertyInfo.type === OVERLOADED_BOOLEAN) { if (node.hasAttribute(attributeName)) { var value = node.getAttribute(attributeName); if (value === '') { return true; } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return value; } if (value === '' + expected) { return expected; } return value; } } else if (node.hasAttribute(attributeName)) { if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { // We had an attribute but shouldn't have had one, so read it // for the error message. return node.getAttribute(attributeName); } if (propertyInfo.type === BOOLEAN) { // If this was a boolean, it doesn't matter what the value is // the fact that we have it is the same as the expected. return expected; } // Even if this property uses a namespace we use getAttribute // because we assume its namespaced name is the same as our config. // To use getAttributeNS we need the local name which we don't have // in our config atm. stringValue = node.getAttribute(attributeName); } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return stringValue === null ? expected : stringValue; } else if (stringValue === '' + expected) { return expected; } else { return stringValue; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getValueForProperty(node,name,expected){{var propertyInfo=getPropertyInfo(name);if(propertyInfo){var mutationMethod=propertyInfo.mutationMethod;if(mutationMethod||propertyInfo.mustUseProperty){return node[propertyInfo.propertyName];}else{var attributeName=propertyInfo.attributeName;var stringValue=null;if...
[ "0.8159204", "0.8159204", "0.8144193", "0.80684555", "0.80684555", "0.80646384", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", "0.806019", ...
0.0
-1
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
function getValueForAttribute(node, name, expected) { { if (!isAttributeNameSafe(name)) { return; } if (!node.hasAttribute(name)) { return expected === undefined ? undefined : null; } var value = node.getAttribute(name); if (value === '' + expected) { return expected; } return value; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getValueForAttribute(node,name,expected){{if(!isAttributeNameSafe(name)){return;}if(!node.hasAttribute(name)){return expected===undefined?undefined:null;}var value=node.getAttribute(name);if(value===''+expected){return expected;}return value;}}", "function getValueForAttribute(node,name,expected){{if(!i...
[ "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.74267244", "0.73298305", "0.73298305", "0.7326827", "0.73233503", "0.73233503", "0.73233503", "0.73233503", "0.73233503", "0.73233503", "0.73233503",...
0.0
-1
Implements an host component that allows setting these optional props: `checked`, `value`, `defaultChecked`, and `defaultValue`. If `checked` or `value` are not supplied (or null/undefined), user actions that affect the checked state or value will trigger updates to the element. If they are supplied (and not null/undefined), the rendered element will not trigger updates to the element. Instead, the props must change in order for the rendered element to be updated. The rendered element will be initialized as unchecked (or `defaultChecked`) with an empty value (or `defaultValue`). See
function getHostProps(element, props) { var node = element; var checked = props.checked; var hostProps = _assign({}, props, { defaultChecked: undefined, defaultValue: undefined, value: undefined, checked: checked != null ? checked : node._wrapperState.initialChecked }); return hostProps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(props) {\n super(props);\n this.value = props.value;\n this.id = RadioButton.idGenerator(this.value);\n this.groupName = props.groupName;\n this.optional = {};\n if (typeof props.onChangeCallback === 'function') {\n this.optional.onChangeCallback =\n...
[ "0.6890268", "0.67855096", "0.67855096", "0.67855096", "0.67855096", "0.67855096", "0.67855096", "0.67855096", "0.67855096", "0.67855096", "0.6388342", "0.62572324", "0.62100875", "0.6130889", "0.6130585", "0.6130585", "0.6130585", "0.6130585", "0.6130585", "0.6130585", "0.61...
0.0
-1
In Chrome, assigning defaultValue to certain input types triggers input validation. For number inputs, the display value loses trailing decimal points. For email inputs, Chrome raises "The specified value is not a valid email address". Here we check to see if the defaultValue has actually changed, avoiding these problems when the user is inputting text
function setDefaultValue(node, type, value) { if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js type !== 'number' || node.ownerDocument.activeElement !== node) { if (value == null) { node.defaultValue = '' + node._wrapperState.initialValue; } else if (node.defaultValue !== '' + value) { node.defaultValue = '' + value; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shouldSetInputTextToDefaultValue (props) {\n let result = (this.previousDefaultValue != props.defaultValue) || (this.previousChangeIndicator != props.changeIndicator)\n return result\n }", "function checkValue(value, defaultValue) {\n return (value ? value : defaultValue)\n }", "function setDe...
[ "0.70027524", "0.66452426", "0.6549024", "0.6549024", "0.65101707", "0.65101707", "0.6501496", "0.6501496", "0.6501496", "0.6501496", "0.6501496", "0.63815045", "0.63815045", "0.63815045", "0.63815045", "0.63815045", "0.63815045", "0.63815045", "0.63815045", "0.63815045", "0....
0.0
-1
SECTION: handle `change` event
function shouldUseChangeEvent(elem) { var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "change(/*event*/) {\n this._super(...arguments);\n this._parse();\n }", "handleChange(event) {\n this.dispatchEvent(new CustomEvent('change', {detail: event.target.value}));\n }", "onchange() {}", "function onChange() {\n\t\t__debug_452( 'Received a change event.' );\n\t\tself.render();\n\t}...
[ "0.78536415", "0.77069587", "0.7598006", "0.75212336", "0.7510656", "0.7503609", "0.7448818", "0.7420897", "0.74019486", "0.73864216", "0.73662615", "0.73555803", "0.7351097", "0.7349635", "0.73438704", "0.7339734", "0.733801", "0.73354226", "0.73326415", "0.73283374", "0.732...
0.0
-1
(For IE <=9) Starts tracking propertychange events on the passedin element and override the value property so that we can distinguish user events from value changes in JS.
function startWatchingForValueChange(target, targetInst) { activeElement = target; activeElementInst = targetInst; activeElement.attachEvent('onpropertychange', handlePropertyChange); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startWatchingForValueChange(target,targetInst){activeElement=target;activeElementInst=targetInst;activeElement.attachEvent('onpropertychange',handlePropertyChange);}", "function startWatchingForValueChange(target,targetInst){activeElement=target;activeElementInst=targetInst;activeElement.attachEvent('on...
[ "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.74984235", "0.7280834", "0.7193587", "0.7193587", "0.704501", "0.70323575", "0.7023257", "0.69341207", "0.69341207", "0...
0.0
-1
(For IE <=9) Removes the event listeners from the currentlytracked element, if any exists.
function stopWatchingForValueChange() { if (!activeElement) { return; } activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementInst = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_removeEventListeners() {\n this.currentEventListeners.forEach(listener => {\n this.domElement.removeEventListener(listener.event, listener.callBack);\n });\n this.currentEventListeners = null;\n }", "function removeListeners(useCapturing) {\r\r\n // get all div in list\r\r\...
[ "0.7511157", "0.7134657", "0.7104534", "0.70863074", "0.70863074", "0.70760804", "0.70558333", "0.70454526", "0.7040501", "0.70146626", "0.70063", "0.69850737", "0.69768685", "0.6942995", "0.69234794", "0.6918382", "0.6914762", "0.6900439", "0.68650395", "0.68642944", "0.6862...
0.0
-1
(For IE <=9) Handles a propertychange event, sending a `change` event if the value of the active element has changed.
function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; } if (getInstIfValueChanged(activeElementInst)) { manualDispatchChangeEvent(nativeEvent); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startWatchingForValueChange(target,targetInst){activeElement=target;activeElementInst=targetInst;activeElement.attachEvent('onpropertychange',handlePropertyChange);}", "function startWatchingForValueChange(target,targetInst){activeElement=target;activeElementInst=targetInst;activeElement.attachEvent('on...
[ "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.71692085", "0.69451064", "0.6840506", "0.68319553", "0.6743934", "0.66957945", "0.66957945", "0.66957945", "0.66957945", ...
0.0
-1
For IE8 and IE9.
function getTargetInstForInputEventPolyfill(topLevelType, targetInst) { if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) { // On the selectionchange event, the target is just document which isn't // helpful for us so just check activeElement instead. // // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire // propertychange on the first input event after setting `value` from a // script and fires only keydown, keypress, keyup. Catching keyup usually // gets it and catching keydown lets us fire an event for the first // keystroke if user does a key repeat (it'll be a little delayed: right // before the second keystroke). Other input methods (e.g., paste) seem to // fire selectionchange normally. return getInstIfValueChanged(activeElementInst); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLowIE9() {\r\n var e = window.navigator.userAgent.toString().toUpperCase();\r\n var flag = false;\r\n if (e.indexOf(\"MSIE\") >= 0) {\r\n\r\n if (e.indexOf(\"MSIE 6.0\") > 0) flag = true;\r\n if (e.indexOf(\"MSIE 7.0\") > 0) flag = true;\r\n if (e.in...
[ "0.71892583", "0.7018611", "0.6990977", "0.6990977", "0.67857254", "0.6689359", "0.65084034", "0.64540815", "0.64540815", "0.6431494", "0.6362608", "0.63479495", "0.62849253", "0.6247649", "0.6229919", "0.6197086", "0.61709774", "0.6158672", "0.61451566", "0.61313784", "0.611...
0.0
-1
SECTION: handle `click` event
function shouldUseClickEvent(elem) { // Use the `click` event to detect changes to checkbox and radio inputs. // This approach works across all browsers, whereas `change` does not fire // until `blur` in IE8. var nodeName = elem.nodeName; return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleClick( event ){ }", "handleClick() {}", "function handleClick(){\n console.log(\"clicked\");\n}", "function handleClick(event)\n{\n}", "click() { }", "function clickHandler(){\n console.log('I am clicked');\n}", "function clickHandler(event) {\n\tindexChangeSections(event);\n\ttabChangeSect...
[ "0.8124236", "0.78792703", "0.7531666", "0.7501165", "0.7473819", "0.7401734", "0.739119", "0.7379254", "0.7379254", "0.73300016", "0.7328879", "0.7245047", "0.7238538", "0.7212335", "0.71150935", "0.7083005", "0.7062222", "0.7056662", "0.7017632", "0.70069724", "0.69829756",...
0.0
-1
IE8 does not implement getModifierState so we simply map it to the only modifier keys exposed by the event itself, does not support Lockkeys. Currently, all major browsers except Chrome seems to support Lockkeys.
function modifierStateGetter(keyArg) { var syntheticEvent = this; var nativeEvent = syntheticEvent.nativeEvent; if (nativeEvent.getModifierState) { return nativeEvent.getModifierState(keyArg); } var keyProp = modifierKeyToProp[keyArg]; return keyProp ? !!nativeEvent[keyProp] : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function modifierStateGetter(keyArg){var syntheticEvent=this;var nativeEvent=syntheticEvent.nativeEvent;if(nativeEvent.getModifierState){return nativeEvent.getModifierState(keyArg);}var keyProp=modifierKeyToProp[keyArg];return keyProp?!!nativeEvent[keyProp]:false;}", "function modifierStateGetter(keyArg){var syn...
[ "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7308765", "0.7273113", "0.72153", "0.7185745", "0.7185745", "0.7106114", "0.70852816", "0...
0.0
-1
`ReactInstanceMap` maintains a mapping from a public facing stateful instance (key) and the internal representation (value). This allows public methods to accept the user facing instance as an argument and map them back to internal methods. Note that this module is currently shared and assumed to be stateless. If this becomes an actual Map, that will break. This API should be called `delete` but we'd have to make sure to always transform these to strings for IE support. When this transform is fully supported we can rename it.
function get(key) { return key._reactInternalFiber; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapWrapper(key)\n{\n\tthis.key = key;\n}", "function Map() {\n this.container = new Object();\n}", "function Map() {\r\n this.keys = [];\r\n this.values = [];\r\n}", "function Map() {\n\tthis.keys = [];\n\tthis.values = [];\n\n\t// add a key / value pair to map\n\tthis.add = function(key, v...
[ "0.5623249", "0.54417914", "0.5437446", "0.5428657", "0.5292151", "0.52272433", "0.5220775", "0.5151025", "0.5148145", "0.51442593", "0.5122616", "0.51154083", "0.51114726", "0.5110734", "0.50548315", "0.5044667", "0.50236446", "0.50236446", "0.49966064", "0.49966064", "0.499...
0.0
-1
Find the deepest React component completely containing the root of the passedin instance (for use when entire React trees are nested within each other). If React trees are not nested, returns null.
function findRootContainerNode(inst) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. while (inst.return) { inst = inst.return; } if (inst.tag !== HostRoot) { // This can happen if we're in a detached tree. return null; } return inst.stateNode.containerInfo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findFirstReactDOMImpl(node) {\n // This node might be from another React instance, so we make sure not to\n // examine the node cache here\n for (; node && node.parentNode !== node; node = node.parentNode) {\n if (node.nodeType !== 1) {\n // Not a DOMElement, therefore not a React component\n ...
[ "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6874498", "0.6796067", "0.6796067", "0.6796067", "0.6796067", "0.6796067", "0.6796067", "0.6796067", "...
0.0
-1
Used to store ancestor hierarchy in top level callback
function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { if (callbackBookkeepingPool.length) { var instance = callbackBookkeepingPool.pop(); instance.topLevelType = topLevelType; instance.nativeEvent = nativeEvent; instance.targetInst = targetInst; return instance; } return { topLevelType: topLevelType, nativeEvent: nativeEvent, targetInst: targetInst, ancestors: [] }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fullAncestor(node, callback, baseVisitor, state) {\n if (!baseVisitor) { baseVisitor = base; }\n var ancestors = []\n ;(function c(node, st, override) {\n var type = override || node.type;\n var isNew = node !== ancestors[ancestors.length - 1];\n if (isNew) { ancestors.push(node); ...
[ "0.6365681", "0.6365681", "0.6350171", "0.6195417", "0.60652924", "0.59938246", "0.59328604", "0.59285367", "0.5797761", "0.574521", "0.57323587", "0.56560516", "0.5634453", "0.56326807", "0.5620803", "0.55987376", "0.55953383", "0.5583639", "0.55776316", "0.5566399", "0.5566...
0.0
-1
Implements an host component that warns when `selected` is set.
function validateProps(element, props) { // TODO (yungsters): Remove support for `selected` in <option>. { if (props.selected != null && !didWarnSelectedSetOnOption) { warning(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.'); didWarnSelectedSetOnOption = true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get _shouldUpdateSelection(){return this.selected!=null;}", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { ...
[ "0.5835138", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.5717058", "0.56534386", "0.55851144", "0.5576835", "0.5574898", "0.55625105", "0.55625105", "0.5542894", "0.55244917"...
0.5188785
85
Validation function for `value` and `defaultValue`.
function checkSelectPropTypes(props) { ReactControlledValuePropTypes.checkPropTypes('select', props, getCurrentFiberStackAddendum$3); for (var i = 0; i < valuePropNames.length; i++) { var propName = valuePropNames[i]; if (props[propName] == null) { continue; } var isArray = Array.isArray(props[propName]); if (props.multiple && !isArray) { warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum()); } else if (!props.multiple && isArray) { warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum()); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "'validateValue'(value) {}", "function checkValue(value, defaultValue) {\n return (value ? value : defaultValue)\n }", "function validateInput(\n value,\n { float, canBeNegative, canBeEmpty, defaultValue }\n) {\n if (`${value}`.length > 0) {\n const valueAsNumber = float ? parseFloat(value) : pa...
[ "0.7436162", "0.6856192", "0.65868", "0.6431272", "0.64279246", "0.64279246", "0.6416799", "0.6416799", "0.6416799", "0.6316331", "0.6230596", "0.6195563", "0.616348", "0.61238676", "0.6050824", "0.6044303", "0.6036909", "0.59743184", "0.59359854", "0.58691984", "0.58653325",...
0.0
-1
Implements a host component that allows optionally setting the props `value` and `defaultValue`. If `multiple` is false, the prop must be a stringable. If `multiple` is true, the prop must be an array of stringables. If `value` is not supplied (or null/undefined), user actions that change the selected option will trigger updates to the rendered options. If it is supplied (and not null/undefined), the rendered options will not update in response to user actions. Instead, the `value` prop must change in order for the rendered options to update. If `defaultValue` is provided, any options with the supplied values will be selected.
function getHostProps$2(element, props) { return _assign({}, props, { value: undefined }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectValueType(props,propName,componentName){if(props[propName]==null){return null;}if(props.multiple){if(!Array.isArray(props[propName])){return new Error(\"The `\"+propName+\"` prop supplied to <select> must be an array if \"+\"`multiple` is true.\");}}else {if(Array.isArray(props[propName])){return ne...
[ "0.60982233", "0.6063126", "0.58237755", "0.58237755", "0.57349205", "0.5712575", "0.57051134", "0.57051134", "0.57051134", "0.57051134", "0.57051134", "0.56849426", "0.5681489", "0.5642498", "0.56320775", "0.56320775", "0.56320775", "0.56320775", "0.56320775", "0.56320775", ...
0.0
-1
Implements a host component that allows setting `value`, and `defaultValue`. This differs from the traditional DOM API because value is usually set as PCDATA children. If `value` is not supplied (or null/undefined), user actions that affect the value will trigger updates to the element. If `value` is supplied (and not null/undefined), the rendered element will not trigger updates to the element. Instead, the `value` prop must change in order for the rendered element to be updated. The rendered element will be initialized with an empty value, the prop `defaultValue` if specified, or the children content (deprecated).
function getHostProps$3(element, props) { var node = element; !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0; // Always set children to the same thing. In IE9, the selection range will // get reset if `textContent` is mutated. We could add a check in setTextContent // to only set the value if/when the value differs from the node value (which would // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this // solution. The value can be a boolean or object so that's why it's forced // to be a string. var hostProps = _assign({}, props, { value: undefined, defaultValue: undefined, children: '' + node._wrapperState.initialValue }); return hostProps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set value(val) {\n if (this.#el) this.#el.value = val;\n else this.#value = val;\n }", "setValue(value){\n const thisWidget = this;\n const newValue = thisWidget.parseValue(value);\n \n /* TODO: Add validation */\n if(newValue !=thisWidget.value && thisWidget.isValid(newValue)){\n this...
[ "0.6419651", "0.59932727", "0.5976699", "0.5976699", "0.5976699", "0.5976699", "0.5976699", "0.5976699", "0.5976699", "0.5953133", "0.59285825", "0.5902208", "0.5879116", "0.5879116", "0.5879116", "0.5879116", "0.5879116", "0.5879116", "0.5879116", "0.5823836", "0.5766562", ...
0.0
-1
Assumes there is no parent namespace.
function getIntrinsicNamespace(type) { switch (type) { case 'svg': return SVG_NAMESPACE; case 'math': return MATH_NAMESPACE; default: return HTML_NAMESPACE$1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getParentObject(){\r\n var obj = parent;\r\n if (namespace !== \"\") {\r\n for (var i = 0, ii = namespace.split(\".\"); i < ii.length; i++) {\r\n obj = obj[ii[i]];\r\n }\r\n }\r\n return obj.easyXDM;\r\n}", "function namespaceHTMLInternal() {\n instructionState.lF...
[ "0.59294087", "0.5788852", "0.5788852", "0.5788852", "0.5788852", "0.5788852", "0.5788852", "0.57438385", "0.56890935", "0.5673484", "0.56610936", "0.5640146", "0.5580239", "0.544239", "0.5442175", "0.5410278", "0.5397606", "0.53690296", "0.53592485", "0.5327534", "0.532705",...
0.0
-1
Operations for dealing with CSS properties. This creates a string that is expected to be equivalent to the style attribute generated by serverside rendering. It bypasses warnings and security checks so it's not safe to use this value for anything other than comparison. It is only used in DEV for SSR validation.
function createDangerousStringForStyles(styles) { { var serialized = ''; var delimiter = ''; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } var styleValue = styles[styleName]; if (styleValue != null) { var isCustomProperty = styleName.indexOf('--') === 0; serialized += delimiter + hyphenateStyleName(styleName) + ':'; serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty); delimiter = ';'; } } return serialized || null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get styles () {\n return css`${unsafeCSS(style)}`\n }", "get cssText() {\n var properties = [];\n for (var i = 0, length = this.length; i < length; ++i) {\n var name = this[i];\n var value = this.getPropertyValue(name);\n var priority = this.getPropertyPriority(name);\n if (p...
[ "0.6744591", "0.66127884", "0.66016066", "0.65233845", "0.65233845", "0.6436199", "0.64057034", "0.63650787", "0.6297055", "0.6197627", "0.6181622", "0.6170583", "0.61681503", "0.61681503", "0.6164184", "0.61129713", "0.6074594", "0.6074594", "0.6074594", "0.6074594", "0.6074...
0.0
-1
Calculate the diff between the two objects.
function diffProperties$1(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { { validatePropertiesInDevelopment(tag, nextRawProps); } var updatePayload = null; var lastProps = void 0; var nextProps = void 0; switch (tag) { case 'input': lastProps = getHostProps(domElement, lastRawProps); nextProps = getHostProps(domElement, nextRawProps); updatePayload = []; break; case 'option': lastProps = getHostProps$1(domElement, lastRawProps); nextProps = getHostProps$1(domElement, nextRawProps); updatePayload = []; break; case 'select': lastProps = getHostProps$2(domElement, lastRawProps); nextProps = getHostProps$2(domElement, nextRawProps); updatePayload = []; break; case 'textarea': lastProps = getHostProps$3(domElement, lastRawProps); nextProps = getHostProps$3(domElement, nextRawProps); updatePayload = []; break; default: lastProps = lastRawProps; nextProps = nextRawProps; if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') { // TODO: This cast may not be sound for SVG, MathML or custom elements. trapClickOnNonInteractiveElement(domElement); } break; } assertValidProps(tag, nextProps, getStack); var propKey = void 0; var styleName = void 0; var styleUpdates = null; for (propKey in lastProps) { if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { continue; } if (propKey === STYLE) { var lastStyle = lastProps[propKey]; for (styleName in lastStyle) { if (lastStyle.hasOwnProperty(styleName)) { if (!styleUpdates) { styleUpdates = {}; } styleUpdates[styleName] = ''; } } } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) { // Noop. This is handled by the clear text mechanism. } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) { // Noop } else if (propKey === AUTOFOCUS) { // Noop. It doesn't work on updates anyway. } else if (registrationNameModules.hasOwnProperty(propKey)) { // This is a special case. If any listener updates we need to ensure // that the "current" fiber pointer gets updated so we need a commit // to update this element. if (!updatePayload) { updatePayload = []; } } else { // For all other deleted properties we add it to the queue. We use // the whitelist in the commit phase instead. (updatePayload = updatePayload || []).push(propKey, null); } } for (propKey in nextProps) { var nextProp = nextProps[propKey]; var lastProp = lastProps != null ? lastProps[propKey] : undefined; if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { continue; } if (propKey === STYLE) { { if (nextProp) { // Freeze the next style object so that we can assume it won't be // mutated. We have already warned for this in the past. Object.freeze(nextProp); } } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. for (styleName in lastProp) { if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { if (!styleUpdates) { styleUpdates = {}; } styleUpdates[styleName] = ''; } } // Update styles that changed since `lastProp`. for (styleName in nextProp) { if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { if (!styleUpdates) { styleUpdates = {}; } styleUpdates[styleName] = nextProp[styleName]; } } } else { // Relies on `updateStylesByID` not mutating `styleUpdates`. if (!styleUpdates) { if (!updatePayload) { updatePayload = []; } updatePayload.push(propKey, styleUpdates); } styleUpdates = nextProp; } } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { var nextHtml = nextProp ? nextProp[HTML] : undefined; var lastHtml = lastProp ? lastProp[HTML] : undefined; if (nextHtml != null) { if (lastHtml !== nextHtml) { (updatePayload = updatePayload || []).push(propKey, '' + nextHtml); } } else { // TODO: It might be too late to clear this if we have children // inserted already. } } else if (propKey === CHILDREN) { if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) { (updatePayload = updatePayload || []).push(propKey, '' + nextProp); } } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) { // Noop } else if (registrationNameModules.hasOwnProperty(propKey)) { if (nextProp != null) { // We eagerly listen to this even though we haven't committed yet. if ( true && typeof nextProp !== 'function') { warnForInvalidEventListener(propKey, nextProp); } ensureListeningTo(rootContainerElement, propKey); } if (!updatePayload && lastProp !== nextProp) { // This is a special case. If any listener updates we need to ensure // that the "current" props pointer gets updated so we need a commit // to update this element. updatePayload = []; } } else { // For any other property we always add it to the queue and then we // filter it out using the whitelist during the commit. (updatePayload = updatePayload || []).push(propKey, nextProp); } } if (styleUpdates) { (updatePayload = updatePayload || []).push(STYLE, styleUpdates); } return updatePayload; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function diff(v1, v2) {\n return {\n x: v1.x - v2.x,\n y: v1.y - v2.y\n };\n}", "function diff(a, b) {\n totalDifference += Math.abs(a - b);\n }", "getDifference(other) {\n return {\n xDiff: other.x - this.x,\n yDiff: other.y - this.y,\n };\n }", "functi...
[ "0.7357562", "0.7009791", "0.6960505", "0.68648994", "0.68648994", "0.68648994", "0.68648994", "0.68648994", "0.68648994", "0.66712385", "0.6599254", "0.65697217", "0.65627253", "0.65573925", "0.65102893", "0.64931816", "0.6444567", "0.6444105", "0.64130205", "0.6396601", "0....
0.0
-1
Renderers that don't support persistence can reexport everything from this module.
function shim() { invariant(false, 'The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shim(){invariant(false,'The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.');}// Persistence (when unsupported)", "function shim(){invariant(false,'The current renderer does not support persistence. This error is likely caused by a bug...
[ "0.62685335", "0.62685335", "0.62685335", "0.62685335", "0.60529494", "0.60529494", "0.60529494", "0.60171443", "0.60171443", "0.60171443", "0.60171443", "0.5887977", "0.5829999", "0.5825935", "0.57073486", "0.57073486", "0.5660173", "0.54269683", "0.54269683", "0.54199094", ...
0.5582005
56
1 unit of expiration time represents 10ms.
function msToExpirationTime(ms) { // Always add an offset so that we don't clash with the magic number for NoWork. return (ms / UNIT_SIZE | 0) + MAGIC_NUMBER_OFFSET; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function msToExpirationTime(ms){// Always add an offset so that we don't clash with the magic number for NoWork.\nreturn(ms/UNIT_SIZE|0)+MAGIC_NUMBER_OFFSET;}", "function msToExpirationTime(ms){// Always add an offset so that we don't clash with the magic number for NoWork.\nreturn(ms/UNIT_SIZE|0)+MAGIC_NUMBER_O...
[ "0.69083685", "0.69083685", "0.69083685", "0.69083685", "0.68177795", "0.68177795", "0.68177795", "0.6728504", "0.66832036", "0.66832036", "0.66832036", "0.6663674", "0.66431606", "0.66385615", "0.65983444", "0.65983444", "0.65983444", "0.6567885", "0.65556103", "0.65173113", ...
0.6494671
78
This is used to create an alternate fiber to do work on.
function createWorkInProgress(current, pendingProps, expirationTime) { var workInProgress = current.alternate; if (workInProgress === null) { // We use a double buffering pooling technique because we know that we'll // only ever need at most two versions of a tree. We pool the "other" unused // node that we're free to reuse. This is lazily created to avoid allocating // extra objects for things that are never updated. It also allow us to // reclaim the extra memory if needed. workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); workInProgress.type = current.type; workInProgress.stateNode = current.stateNode; { // DEV-only fields workInProgress._debugID = current._debugID; workInProgress._debugSource = current._debugSource; workInProgress._debugOwner = current._debugOwner; } workInProgress.alternate = current; current.alternate = workInProgress; } else { workInProgress.pendingProps = pendingProps; // We already have an alternate. // Reset the effect tag. workInProgress.effectTag = NoEffect; // The effect list is no longer valid. workInProgress.nextEffect = null; workInProgress.firstEffect = null; workInProgress.lastEffect = null; } workInProgress.expirationTime = expirationTime; workInProgress.child = current.child; workInProgress.memoizedProps = current.memoizedProps; workInProgress.memoizedState = current.memoizedState; workInProgress.updateQueue = current.updateQueue; // These will be overridden during the parent's reconciliation workInProgress.sibling = current.sibling; workInProgress.index = current.index; workInProgress.ref = current.ref; if (enableProfilerTimer) { workInProgress.selfBaseTime = current.selfBaseTime; workInProgress.treeBaseTime = current.treeBaseTime; } return workInProgress; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createFiber(func) {\n return this.createLaxFiber.apply(this, __arguments.withContext(this.LAX_EMPTY_CONTEXT, arguments));\n }", "function createWorkInProgress(current, pendingProps, expirationTime) {\n var workInProgress = current.alternate;\n if (workInProgress === null) {\n // We use a double bu...
[ "0.6190356", "0.5820447", "0.5820447", "0.5820447", "0.5820447", "0.5820447", "0.5820447", "0.5820447", "0.5779212", "0.5731988", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "0.5643045", "...
0.5604123
53
Used for stashing WIP properties to replay failed work in DEV.
function assignFiberPropertiesInDEV(target, source) { if (target === null) { // This Fiber's initial properties will always be overwritten. // We only use a Fiber to ensure the same hidden class so DEV isn't slow. target = createFiber(IndeterminateComponent, null, null, NoContext); } // This is intentionally written as a list of all properties. // We tried to use Object.assign() instead but this is called in // the hottest path, and Object.assign() was too slow: // https://github.com/facebook/react/issues/12502 // This code is DEV-only so size is not a concern. target.tag = source.tag; target.key = source.key; target.type = source.type; target.stateNode = source.stateNode; target.return = source.return; target.child = source.child; target.sibling = source.sibling; target.index = source.index; target.ref = source.ref; target.pendingProps = source.pendingProps; target.memoizedProps = source.memoizedProps; target.updateQueue = source.updateQueue; target.memoizedState = source.memoizedState; target.mode = source.mode; target.effectTag = source.effectTag; target.nextEffect = source.nextEffect; target.firstEffect = source.firstEffect; target.lastEffect = source.lastEffect; target.expirationTime = source.expirationTime; target.alternate = source.alternate; if (enableProfilerTimer) { target.selfBaseTime = source.selfBaseTime; target.treeBaseTime = source.treeBaseTime; } target._debugID = source._debugID; target._debugSource = source._debugSource; target._debugOwner = source._debugOwner; target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; return target; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);\n\n if (enableProfilerTimer && unitOfWork.mode & ProfileMode) {\n // Reset the profiler timer.\n startProfilerTimer(unitOfWork);\n }", "function InternalBreakpointState() { }", "function InternalBreakpointState() {}", ...
[ "0.6012318", "0.5403361", "0.5396721", "0.5396721", "0.5262843", "0.52391803", "0.5218998", "0.5172469", "0.5112942", "0.50888544", "0.5083547", "0.5077279", "0.50727296", "0.5068563", "0.50527227", "0.50212246", "0.4968902", "0.4958831", "0.4943624", "0.49150303", "0.4910145...
0.0
-1
TODO: This should be lifted into the renderer.
function createFiberRoot(containerInfo, isAsync, hydrate) { // Cyclic construction. This cheats the type system right now because // stateNode is any. var uninitializedFiber = createHostRootFiber(isAsync); var root = { current: uninitializedFiber, containerInfo: containerInfo, pendingChildren: null, earliestPendingTime: NoWork, latestPendingTime: NoWork, earliestSuspendedTime: NoWork, latestSuspendedTime: NoWork, latestPingedTime: NoWork, pendingCommitExpirationTime: NoWork, finishedWork: null, context: null, pendingContext: null, hydrate: hydrate, remainingExpirationTime: NoWork, firstBatch: null, nextScheduledRoot: null }; uninitializedFiber.stateNode = root; return root; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static rendered () {}", "static rendered () {}", "render() {\n // Subclasses should override\n }", "render() {\n\n\t}", "render() {\n\n\t}", "function render() {\n\n\t\t\t}", "_render() {}", "_firstRendered() { }", "function TextRenderer(){}// no need for block level renderers", "function ren...
[ "0.70456946", "0.70456946", "0.69009185", "0.6737335", "0.6737335", "0.6670562", "0.66189414", "0.6587394", "0.6581374", "0.6540784", "0.6519645", "0.64747703", "0.6472744", "0.6472744", "0.6472744", "0.6429283", "0.64223343", "0.6365858", "0.6365858", "0.6341282", "0.6320911...
0.0
-1
Invokes the mount lifecycles on a previously never rendered instance.
function mountClassInstance(workInProgress, renderExpirationTime) { var ctor = workInProgress.type; { checkClassInstance(workInProgress); } var instance = workInProgress.stateNode; var props = workInProgress.pendingProps; var unmaskedContext = getUnmaskedContext(workInProgress); instance.props = props; instance.state = workInProgress.memoizedState; instance.refs = emptyObject; instance.context = getMaskedContext(workInProgress, unmaskedContext); { if (workInProgress.mode & StrictMode) { ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); } if (warnAboutDeprecatedLifecycles) { ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance); } } var updateQueue = workInProgress.updateQueue; if (updateQueue !== null) { processUpdateQueue(workInProgress, updateQueue, props, instance, renderExpirationTime); instance.state = workInProgress.memoizedState; } var getDerivedStateFromProps = workInProgress.type.getDerivedStateFromProps; if (typeof getDerivedStateFromProps === 'function') { applyDerivedStateFromProps(workInProgress, getDerivedStateFromProps, props); instance.state = workInProgress.memoizedState; } // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's // process them now. updateQueue = workInProgress.updateQueue; if (updateQueue !== null) { processUpdateQueue(workInProgress, updateQueue, props, instance, renderExpirationTime); instance.state = workInProgress.memoizedState; } } if (typeof instance.componentDidMount === 'function') { workInProgress.effectTag |= Update; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mount() {\n this.willMount();\n this.render();\n this.didMount();\n }", "componenetWillMount() { }", "function runMountCallback() {\n if (!hasMountCallbackRun && currentMountCallback) {\n hasMountCallbackRun = true;\n reflow(popper);\n currentMountCallback();\n...
[ "0.69563764", "0.676621", "0.6732734", "0.6719309", "0.649951", "0.6378189", "0.6375986", "0.6356537", "0.6339795", "0.6286211", "0.62473047", "0.6208389", "0.6208389", "0.6208389", "0.6208389", "0.6208389", "0.6208389", "0.61906123", "0.61906123", "0.6090201", "0.6086474", ...
0.0
-1
Invokes the update lifecycles and returns false if it shouldn't rerender.
function updateClassInstance(current, workInProgress, renderExpirationTime) { var ctor = workInProgress.type; var instance = workInProgress.stateNode; var oldProps = workInProgress.memoizedProps; var newProps = workInProgress.pendingProps; instance.props = oldProps; var oldContext = instance.context; var newUnmaskedContext = getUnmaskedContext(workInProgress); var newContext = getMaskedContext(workInProgress, newUnmaskedContext); var getDerivedStateFromProps = ctor.getDerivedStateFromProps; var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what // ever the previously attempted to render - not the "current". However, // during componentDidUpdate we pass the "current" props. // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { if (oldProps !== newProps || oldContext !== newContext) { callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); } } resetHasForceUpdateBeforeProcessing(); var oldState = workInProgress.memoizedState; var newState = instance.state = oldState; var updateQueue = workInProgress.updateQueue; if (updateQueue !== null) { processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime); newState = workInProgress.memoizedState; } if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. if (typeof instance.componentDidUpdate === 'function') { if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.effectTag |= Update; } } if (typeof instance.getSnapshotBeforeUpdate === 'function') { if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.effectTag |= Snapshot; } } return false; } if (typeof getDerivedStateFromProps === 'function') { if (fireGetDerivedStateFromPropsOnStateUpdates || oldProps !== newProps) { applyDerivedStateFromProps(workInProgress, getDerivedStateFromProps, newProps); newState = workInProgress.memoizedState; } } var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext); if (shouldUpdate) { // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { startPhaseTimer(workInProgress, 'componentWillUpdate'); if (typeof instance.componentWillUpdate === 'function') { instance.componentWillUpdate(newProps, newState, newContext); } if (typeof instance.UNSAFE_componentWillUpdate === 'function') { instance.UNSAFE_componentWillUpdate(newProps, newState, newContext); } stopPhaseTimer(); } if (typeof instance.componentDidUpdate === 'function') { workInProgress.effectTag |= Update; } if (typeof instance.getSnapshotBeforeUpdate === 'function') { workInProgress.effectTag |= Snapshot; } } else { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. if (typeof instance.componentDidUpdate === 'function') { if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.effectTag |= Update; } } if (typeof instance.getSnapshotBeforeUpdate === 'function') { if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.effectTag |= Snapshot; } } // If shouldComponentUpdate returned false, we should still update the // memoized props/state to indicate that this work can be reused. workInProgress.memoizedProps = newProps; workInProgress.memoizedState = newState; } // Update the existing instance's state, props, and context pointers even // if shouldComponentUpdate returns false. instance.props = newProps; instance.state = newState; instance.context = newContext; return shouldUpdate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "needsUpdate() {\n // Call subclass lifecycle method\n return (\n this.internalState.needsUpdate ||\n this.hasUniformTransition() ||\n this.shouldUpdateState(this._getUpdateParams())\n );\n // End lifecycle method\n }", "shouldComponentUpdate(next_props){\n if (!next_props.update){\...
[ "0.7417848", "0.73684907", "0.73239565", "0.7296705", "0.7289543", "0.7108138", "0.7067573", "0.70314443", "0.702017", "0.69990176", "0.69611555", "0.69611555", "0.69410723", "0.69229597", "0.68923277", "0.68425786", "0.6839337", "0.683208", "0.6773803", "0.67644703", "0.6764...
0.0
-1
This wrapper function exists because I expect to clone the code in each path to be able to optimize each path individually by branching early. This needs a compiler or we can do it manually. Helpers that don't need this branching live outside of this function.
function ChildReconciler(shouldTrackSideEffects) { function deleteChild(returnFiber, childToDelete) { if (!shouldTrackSideEffects) { // Noop. return; } // Deletions are added in reversed order so we add it to the front. // At this point, the return fiber's effect list is empty except for // deletions, so we can just append the deletion to the list. The remaining // effects aren't added until the complete phase. Once we implement // resuming, this may not be true. var last = returnFiber.lastEffect; if (last !== null) { last.nextEffect = childToDelete; returnFiber.lastEffect = childToDelete; } else { returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; } childToDelete.nextEffect = null; childToDelete.effectTag = Deletion; } function deleteRemainingChildren(returnFiber, currentFirstChild) { if (!shouldTrackSideEffects) { // Noop. return null; } // TODO: For the shouldClone case, this could be micro-optimized a bit by // assuming that after the first child we've already added everything. var childToDelete = currentFirstChild; while (childToDelete !== null) { deleteChild(returnFiber, childToDelete); childToDelete = childToDelete.sibling; } return null; } function mapRemainingChildren(returnFiber, currentFirstChild) { // Add the remaining children to a temporary map so that we can find them by // keys quickly. Implicit (null) keys get added to this set with their index var existingChildren = new Map(); var existingChild = currentFirstChild; while (existingChild !== null) { if (existingChild.key !== null) { existingChildren.set(existingChild.key, existingChild); } else { existingChildren.set(existingChild.index, existingChild); } existingChild = existingChild.sibling; } return existingChildren; } function useFiber(fiber, pendingProps, expirationTime) { // We currently set sibling to null and index to 0 here because it is easy // to forget to do before returning it. E.g. for the single child case. var clone = createWorkInProgress(fiber, pendingProps, expirationTime); clone.index = 0; clone.sibling = null; return clone; } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; if (!shouldTrackSideEffects) { // Noop. return lastPlacedIndex; } var current = newFiber.alternate; if (current !== null) { var oldIndex = current.index; if (oldIndex < lastPlacedIndex) { // This is a move. newFiber.effectTag = Placement; return lastPlacedIndex; } else { // This item can stay in place. return oldIndex; } } else { // This is an insertion. newFiber.effectTag = Placement; return lastPlacedIndex; } } function placeSingleChild(newFiber) { // This is simpler for the single child case. We only need to do a // placement for inserting new children. if (shouldTrackSideEffects && newFiber.alternate === null) { newFiber.effectTag = Placement; } return newFiber; } function updateTextNode(returnFiber, current, textContent, expirationTime) { if (current === null || current.tag !== HostText) { // Insert var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); created.return = returnFiber; return created; } else { // Update var existing = useFiber(current, textContent, expirationTime); existing.return = returnFiber; return existing; } } function updateElement(returnFiber, current, element, expirationTime) { if (current !== null && current.type === element.type) { // Move based on index var existing = useFiber(current, element.props, expirationTime); existing.ref = coerceRef(returnFiber, current, element); existing.return = returnFiber; { existing._debugSource = element._source; existing._debugOwner = element._owner; } return existing; } else { // Insert var created = createFiberFromElement(element, returnFiber.mode, expirationTime); created.ref = coerceRef(returnFiber, current, element); created.return = returnFiber; return created; } } function updatePortal(returnFiber, current, portal, expirationTime) { if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { // Insert var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); created.return = returnFiber; return created; } else { // Update var existing = useFiber(current, portal.children || [], expirationTime); existing.return = returnFiber; return existing; } } function updateFragment(returnFiber, current, fragment, expirationTime, key) { if (current === null || current.tag !== Fragment) { // Insert var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key); created.return = returnFiber; return created; } else { // Update var existing = useFiber(current, fragment, expirationTime); existing.return = returnFiber; return existing; } } function createChild(returnFiber, newChild, expirationTime) { if (typeof newChild === 'string' || typeof newChild === 'number') { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime); created.return = returnFiber; return created; } if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: { var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime); _created.ref = coerceRef(returnFiber, null, newChild); _created.return = returnFiber; return _created; } case REACT_PORTAL_TYPE: { var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime); _created2.return = returnFiber; return _created2; } } if (isArray$1(newChild) || getIteratorFn(newChild)) { var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null); _created3.return = returnFiber; return _created3; } throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(); } } return null; } function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { // Update the fiber if the keys match, otherwise return null. var key = oldFiber !== null ? oldFiber.key : null; if (typeof newChild === 'string' || typeof newChild === 'number') { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. if (key !== null) { return null; } return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); } if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: { if (newChild.key === key) { if (newChild.type === REACT_FRAGMENT_TYPE) { return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); } return updateElement(returnFiber, oldFiber, newChild, expirationTime); } else { return null; } } case REACT_PORTAL_TYPE: { if (newChild.key === key) { return updatePortal(returnFiber, oldFiber, newChild, expirationTime); } else { return null; } } } if (isArray$1(newChild) || getIteratorFn(newChild)) { if (key !== null) { return null; } return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); } throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(); } } return null; } function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) { if (typeof newChild === 'string' || typeof newChild === 'number') { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime); } if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: { var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; if (newChild.type === REACT_FRAGMENT_TYPE) { return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key); } return updateElement(returnFiber, _matchedFiber, newChild, expirationTime); } case REACT_PORTAL_TYPE: { var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime); } } if (isArray$1(newChild) || getIteratorFn(newChild)) { var _matchedFiber3 = existingChildren.get(newIdx) || null; return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null); } throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(); } } return null; } /** * Warns if there is a duplicate or missing key */ function warnOnInvalidKey(child, knownKeys) { { if (typeof child !== 'object' || child === null) { return knownKeys; } switch (child.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: warnForMissingKey(child); var key = child.key; if (typeof key !== 'string') { break; } if (knownKeys === null) { knownKeys = new Set(); knownKeys.add(key); break; } if (!knownKeys.has(key)) { knownKeys.add(key); break; } warning(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.%s', key, getCurrentFiberStackAddendum$7()); break; default: break; } } return knownKeys; } function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) { // This algorithm can't optimize by searching from boths ends since we // don't have backpointers on fibers. I'm trying to see how far we can get // with that model. If it ends up not being worth the tradeoffs, we can // add it later. // Even with a two ended optimization, we'd want to optimize for the case // where there are few changes and brute force the comparison instead of // going for the Map. It'd like to explore hitting that path first in // forward-only mode and only go for the Map once we notice that we need // lots of look ahead. This doesn't handle reversal as well as two ended // search but that's unusual. Besides, for the two ended optimization to // work on Iterables, we'd need to copy the whole set. // In this first iteration, we'll just live with hitting the bad case // (adding everything to a Map) in for every insert/move. // If you change this code, also update reconcileChildrenIterator() which // uses the same algorithm. { // First, validate keys. var knownKeys = null; for (var i = 0; i < newChildren.length; i++) { var child = newChildren[i]; knownKeys = warnOnInvalidKey(child, knownKeys); } } var resultingFirstChild = null; var previousNewFiber = null; var oldFiber = currentFirstChild; var lastPlacedIndex = 0; var newIdx = 0; var nextOldFiber = null; for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { if (oldFiber.index > newIdx) { nextOldFiber = oldFiber; oldFiber = null; } else { nextOldFiber = oldFiber.sibling; } var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime); if (newFiber === null) { // TODO: This breaks on empty slots like null children. That's // unfortunate because it triggers the slow path all the time. We need // a better way to communicate whether this was a miss or null, // boolean, undefined, etc. if (oldFiber === null) { oldFiber = nextOldFiber; } break; } if (shouldTrackSideEffects) { if (oldFiber && newFiber.alternate === null) { // We matched the slot, but we didn't reuse the existing fiber, so we // need to delete the existing child. deleteChild(returnFiber, oldFiber); } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { // TODO: Defer siblings if we're not at the right index for this slot. // I.e. if we had null values before, then we want to defer this // for each null value. However, we also don't want to call updateSlot // with the previous one. previousNewFiber.sibling = newFiber; } previousNewFiber = newFiber; oldFiber = nextOldFiber; } if (newIdx === newChildren.length) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); return resultingFirstChild; } if (oldFiber === null) { // If we don't have any more existing children we can choose a fast path // since the rest will all be insertions. for (; newIdx < newChildren.length; newIdx++) { var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime); if (!_newFiber) { continue; } lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = _newFiber; } else { previousNewFiber.sibling = _newFiber; } previousNewFiber = _newFiber; } return resultingFirstChild; } // Add all children to a key map for quick lookups. var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. for (; newIdx < newChildren.length; newIdx++) { var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime); if (_newFiber2) { if (shouldTrackSideEffects) { if (_newFiber2.alternate !== null) { // The new fiber is a work in progress, but if there exists a // current, that means that we reused the fiber. We need to delete // it from the child list so that we don't add it to the deletion // list. existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); } } lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); if (previousNewFiber === null) { resultingFirstChild = _newFiber2; } else { previousNewFiber.sibling = _newFiber2; } previousNewFiber = _newFiber2; } } if (shouldTrackSideEffects) { // Any existing children that weren't consumed above were deleted. We need // to add them to the deletion list. existingChildren.forEach(function (child) { return deleteChild(returnFiber, child); }); } return resultingFirstChild; } function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) { // This is the same implementation as reconcileChildrenArray(), // but using the iterator instead. var iteratorFn = getIteratorFn(newChildrenIterable); !(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0; { // Warn about using Maps as children if (newChildrenIterable.entries === iteratorFn) { !didWarnAboutMaps ? warning(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentFiberStackAddendum$7()) : void 0; didWarnAboutMaps = true; } // First, validate keys. // We'll get a different iterator later for the main pass. var _newChildren = iteratorFn.call(newChildrenIterable); if (_newChildren) { var knownKeys = null; var _step = _newChildren.next(); for (; !_step.done; _step = _newChildren.next()) { var child = _step.value; knownKeys = warnOnInvalidKey(child, knownKeys); } } } var newChildren = iteratorFn.call(newChildrenIterable); !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0; var resultingFirstChild = null; var previousNewFiber = null; var oldFiber = currentFirstChild; var lastPlacedIndex = 0; var newIdx = 0; var nextOldFiber = null; var step = newChildren.next(); for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { if (oldFiber.index > newIdx) { nextOldFiber = oldFiber; oldFiber = null; } else { nextOldFiber = oldFiber.sibling; } var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime); if (newFiber === null) { // TODO: This breaks on empty slots like null children. That's // unfortunate because it triggers the slow path all the time. We need // a better way to communicate whether this was a miss or null, // boolean, undefined, etc. if (!oldFiber) { oldFiber = nextOldFiber; } break; } if (shouldTrackSideEffects) { if (oldFiber && newFiber.alternate === null) { // We matched the slot, but we didn't reuse the existing fiber, so we // need to delete the existing child. deleteChild(returnFiber, oldFiber); } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { // TODO: Defer siblings if we're not at the right index for this slot. // I.e. if we had null values before, then we want to defer this // for each null value. However, we also don't want to call updateSlot // with the previous one. previousNewFiber.sibling = newFiber; } previousNewFiber = newFiber; oldFiber = nextOldFiber; } if (step.done) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); return resultingFirstChild; } if (oldFiber === null) { // If we don't have any more existing children we can choose a fast path // since the rest will all be insertions. for (; !step.done; newIdx++, step = newChildren.next()) { var _newFiber3 = createChild(returnFiber, step.value, expirationTime); if (_newFiber3 === null) { continue; } lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = _newFiber3; } else { previousNewFiber.sibling = _newFiber3; } previousNewFiber = _newFiber3; } return resultingFirstChild; } // Add all children to a key map for quick lookups. var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. for (; !step.done; newIdx++, step = newChildren.next()) { var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime); if (_newFiber4 !== null) { if (shouldTrackSideEffects) { if (_newFiber4.alternate !== null) { // The new fiber is a work in progress, but if there exists a // current, that means that we reused the fiber. We need to delete // it from the child list so that we don't add it to the deletion // list. existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); } } lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); if (previousNewFiber === null) { resultingFirstChild = _newFiber4; } else { previousNewFiber.sibling = _newFiber4; } previousNewFiber = _newFiber4; } } if (shouldTrackSideEffects) { // Any existing children that weren't consumed above were deleted. We need // to add them to the deletion list. existingChildren.forEach(function (child) { return deleteChild(returnFiber, child); }); } return resultingFirstChild; } function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) { // There's no need to check for keys on text nodes since we don't have a // way to define them. if (currentFirstChild !== null && currentFirstChild.tag === HostText) { // We already have an existing node so let's just update it and delete // the rest. deleteRemainingChildren(returnFiber, currentFirstChild.sibling); var existing = useFiber(currentFirstChild, textContent, expirationTime); existing.return = returnFiber; return existing; } // The existing first child is not a text node so we need to create one // and delete the existing ones. deleteRemainingChildren(returnFiber, currentFirstChild); var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); created.return = returnFiber; return created; } function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) { var key = element.key; var child = currentFirstChild; while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) { deleteRemainingChildren(returnFiber, child.sibling); var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime); existing.ref = coerceRef(returnFiber, child, element); existing.return = returnFiber; { existing._debugSource = element._source; existing._debugOwner = element._owner; } return existing; } else { deleteRemainingChildren(returnFiber, child); break; } } else { deleteChild(returnFiber, child); } child = child.sibling; } if (element.type === REACT_FRAGMENT_TYPE) { var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key); created.return = returnFiber; return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime); _created4.ref = coerceRef(returnFiber, currentFirstChild, element); _created4.return = returnFiber; return _created4; } } function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) { var key = portal.key; var child = currentFirstChild; while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { deleteRemainingChildren(returnFiber, child.sibling); var existing = useFiber(child, portal.children || [], expirationTime); existing.return = returnFiber; return existing; } else { deleteRemainingChildren(returnFiber, child); break; } } else { deleteChild(returnFiber, child); } child = child.sibling; } var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); created.return = returnFiber; return created; } // This API will tag the children with the side-effect of the reconciliation // itself. They will be added to the side-effect list as we pass through the // children and the parent. function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) { // This function is not recursive. // If the top level item is an array, we treat it as a set of children, // not as a fragment. Nested arrays on the other hand will be treated as // fragment nodes. Recursion happens at the normal flow. // Handle top level unkeyed fragments as if they were arrays. // This leads to an ambiguity between <>{[...]}</> and <>...</>. // We treat the ambiguous cases above the same. if (typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null) { newChild = newChild.props.children; } // Handle object types var isObject = typeof newChild === 'object' && newChild !== null; if (isObject) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime)); case REACT_PORTAL_TYPE: return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime)); } } if (typeof newChild === 'string' || typeof newChild === 'number') { return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime)); } if (isArray$1(newChild)) { return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime); } if (getIteratorFn(newChild)) { return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime); } if (isObject) { throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(); } } if (typeof newChild === 'undefined') { // If the new child is undefined, and the return fiber is a composite // component, throw an error. If Fiber return types are disabled, // we already threw above. switch (returnFiber.tag) { case ClassComponent: { { var instance = returnFiber.stateNode; if (instance.render._isMockFunction) { // We allow auto-mocks to proceed as if they're returning null. break; } } } // Intentionally fall through to the next case, which handles both // functions and classes // eslint-disable-next-lined no-fallthrough case FunctionalComponent: { var Component = returnFiber.type; invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component'); } } } // Remaining cases are all treated as empty. return deleteRemainingChildren(returnFiber, currentFirstChild); } return reconcileChildFibers; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function o0(o1)\n{\n var o2 = -1;\n try {\nfor (var o259 = 0; o3 < o1.length; function (o502, name, o38, o781, o782, o837, o585, o838, o549) {\n try {\no839.o468();\n}catch(e){}\n // TODO we should allow people to just pass in a complete filename instead\n // of parent and name being tha...
[ "0.55662465", "0.5321176", "0.5182529", "0.5181482", "0.51724356", "0.5154244", "0.5129703", "0.51081574", "0.5090919", "0.5080184", "0.49809292", "0.49445218", "0.49326673", "0.49042782", "0.484472", "0.48310763", "0.48164058", "0.4806649", "0.4796564", "0.47963667", "0.4788...
0.0
-1
Warns if there is a duplicate or missing key
function warnOnInvalidKey(child, knownKeys) { { if (typeof child !== 'object' || child === null) { return knownKeys; } switch (child.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: warnForMissingKey(child); var key = child.key; if (typeof key !== 'string') { break; } if (knownKeys === null) { knownKeys = new Set(); knownKeys.add(key); break; } if (!knownKeys.has(key)) { knownKeys.add(key); break; } warning(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.%s', key, getCurrentFiberStackAddendum$7()); break; default: break; } } return knownKeys; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkDuplicates(error) {\n if (error.name === \"MongoError\" && error.code === 11000) {\n // check if the error from Mongodb is duplication error\n // eslint-disable-next-line no-useless-escape\n const regex = /index\\:\\ (?:.*\\.)?\\$?(?:([_a-z0-9]*)(?:_\\d*)|([_a-z0-9]*))\\s*dup key/i;\n c...
[ "0.6458614", "0.6372852", "0.62755775", "0.61564714", "0.6147988", "0.61425847", "0.61374426", "0.6125191", "0.6125191", "0.61222005", "0.61141974", "0.61141974", "0.61141974", "0.611335", "0.61059684", "0.6096539", "0.6091483", "0.6082614", "0.59902287", "0.5978289", "0.5978...
0.0
-1
This API will tag the children with the sideeffect of the reconciliation itself. They will be added to the sideeffect list as we pass through the children and the parent.
function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) { // This function is not recursive. // If the top level item is an array, we treat it as a set of children, // not as a fragment. Nested arrays on the other hand will be treated as // fragment nodes. Recursion happens at the normal flow. // Handle top level unkeyed fragments as if they were arrays. // This leads to an ambiguity between <>{[...]}</> and <>...</>. // We treat the ambiguous cases above the same. if (typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null) { newChild = newChild.props.children; } // Handle object types var isObject = typeof newChild === 'object' && newChild !== null; if (isObject) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime)); case REACT_PORTAL_TYPE: return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime)); } } if (typeof newChild === 'string' || typeof newChild === 'number') { return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime)); } if (isArray$1(newChild)) { return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime); } if (getIteratorFn(newChild)) { return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime); } if (isObject) { throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(); } } if (typeof newChild === 'undefined') { // If the new child is undefined, and the return fiber is a composite // component, throw an error. If Fiber return types are disabled, // we already threw above. switch (returnFiber.tag) { case ClassComponent: { { var instance = returnFiber.stateNode; if (instance.render._isMockFunction) { // We allow auto-mocks to proceed as if they're returning null. break; } } } // Intentionally fall through to the next case, which handles both // functions and classes // eslint-disable-next-lined no-fallthrough case FunctionalComponent: { var Component = returnFiber.type; invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component'); } } } // Remaining cases are all treated as empty. return deleteRemainingChildren(returnFiber, currentFirstChild); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ChildReconciler(shouldTrackSideEffects) {\n function deleteChild(returnFiber, childToDelete) {\n if (!shouldTrackSideEffects) // Noop.\n return;\n // Deletions are added in reversed order so we add it to the front.\n // At this point, the return fiber's ...
[ "0.6968536", "0.6940015", "0.6940015", "0.6940015", "0.6940015", "0.6933136", "0.6933136", "0.6933136", "0.6933136", "0.6933136", "0.6933136", "0.6927283", "0.6927283", "0.6927283", "0.692717", "0.692717", "0.692717", "0.6923086", "0.6921206", "0.6913083", "0.6899645", "0.6...
0.0
-1
TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
function reconcileChildren(current, workInProgress, nextChildren) { reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInProgress.expirationTime);}", "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInPro...
[ "0.82389414", "0.82389414", "0.82389414", "0.82389414", "0.82389414", "0.7821474", "0.77387625", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751", "0.7716751...
0.7480407
59
TODO: Delete memoizeProps/State and move to reconcile/bailout instead
function memoizeProps(workInProgress, nextProps) { workInProgress.memoizedProps = nextProps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function memoizeProps(workInProgress, nextProps) {\n\t workInProgress.memoizedProps = nextProps;\n\t }", "function memoizeProps(workInProgress, nextProps) {\n workInProgress.memoizedProps = nextProps;\n }", "function memoizeProps(workInProgress, nextProps) {\n workInProgress.memoizedProps = ...
[ "0.6762883", "0.6754626", "0.67469776", "0.67469776", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", "0.6716131", ...
0.6669606
66
This module is forked in different environments. By default, return `true` to log errors to the console. Forks can return `false` if this isn't desirable.
function showErrorDialog(capturedError) { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static runningOnNode ()\n\t\t{ let ud = \"undefined\";\n\n\t\t\tif (typeof process === ud)\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! process )\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! process.versions )\n\t\t\t{ return false;\n\t\t\t}\n\t\t\tif (! process.versions.node )\n\t\t\t{ return false;\n\t\t\t}\n\t\...
[ "0.6476858", "0.5951904", "0.5840481", "0.55877614", "0.55820787", "0.5468524", "0.5439477", "0.5429089", "0.5409245", "0.5409245", "0.5398143", "0.53773975", "0.5376483", "0.5358958", "0.5358958", "0.5335065", "0.52276266", "0.52006626", "0.5185505", "0.5121165", "0.5117097"...
0.0
-1
Capture errors so they don't interrupt unmounting.
function safelyCallComponentWillUnmount(current, instance) { { invokeGuardedCallback$3(null, callComponentWillUnmountWithTimer, null, current, instance); if (hasCaughtError$1()) { var unmountError = clearCaughtError$1(); captureCommitPhaseError(current, unmountError); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "simulateUnmount() {\n this.volumeUnmountListener(this.volumeInfo_.volumeId);\n }", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)errorOrDestroy(dest,er);}// Make sure our error handler is attached before userland ones.", "functi...
[ "0.6385105", "0.5921357", "0.5853079", "0.5853079", "0.5853079", "0.58470565", "0.58197415", "0.58197415", "0.58197415", "0.57672554", "0.5742686", "0.5742686", "0.5742686", "0.5742686", "0.5742686", "0.57321393", "0.57321393", "0.57321393", "0.5689659", "0.5689659", "0.56572...
0.0
-1
Useroriginating errors (lifecycles and refs) should not interrupt deletion, so don't let them throw. Hostoriginating errors should interrupt deletion, so it's okay
function commitUnmount(current) { if (typeof onCommitUnmount === 'function') { onCommitUnmount(current); } switch (current.tag) { case ClassComponent: { safelyDetachRef(current); var instance = current.stateNode; if (typeof instance.componentWillUnmount === 'function') { safelyCallComponentWillUnmount(current, instance); } return; } case HostComponent: { safelyDetachRef(current); return; } case HostPortal: { // TODO: this is recursive. // We are also not using this parent because // the portal will get pushed immediately. if (supportsMutation) { unmountHostComponents(current); } else if (supportsPersistence) { emptyPortalContainer(current); } return; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "detach() {\n throw new Error('Not Implemented');\n }", "detach() {\n throw new Error('Not Implemented');\n }", "function deleteErrHandler(error, result) {\n\tif (error) {\n\t\tlog(\"cannot delete data\")\n\t\tthrow error\n\t} else {\n\t\tlog(\"Delete Success\") \n\t}\n}", "componentWillUnmount() {\n ...
[ "0.6073508", "0.6073508", "0.59134835", "0.5904139", "0.5881432", "0.5826239", "0.5804769", "0.578999", "0.5755662", "0.5708174", "0.5680008", "0.56713545", "0.5633036", "0.5633036", "0.5631826", "0.56044114", "0.5545005", "0.55360377", "0.55360377", "0.55360377", "0.55177367...
0.0
-1
Creates a unique async expiration time.
function computeUniqueAsyncExpiration() { var currentTime = recalculateCurrentTime(); var result = computeAsyncExpiration(currentTime); if (result <= lastUniqueAsyncExpiration) { // Since we assume the current time monotonically increases, we only hit // this branch when computeUniqueAsyncExpiration is fired multiple times // within a 200ms window (or whatever the async bucket size is). result = lastUniqueAsyncExpiration + 1; } lastUniqueAsyncExpiration = result; return lastUniqueAsyncExpiration; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeUniqueAsyncExpiration() {\n var currentTime = requestCurrentTime();\n var result = computeAsyncExpiration(currentTime);\n if (result <= lastUniqueAsyncExpiration) {\n // Since we assume the current time monotonically increases, we only hit\n // this branch when computeUniqueAsyncExpiration...
[ "0.68019056", "0.68019056", "0.68019056", "0.68019056", "0.68019056", "0.68019056", "0.68019056", "0.68019056", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587", "0.67918587"...
0.67636746
41
TODO: Rename this to scheduleTimeout or something
function suspendRoot(root, thenable, timeoutMs, suspendedTime) { // Schedule the timeout. if (timeoutMs >= 0 && nextLatestTimeoutMs < timeoutMs) { nextLatestTimeoutMs = timeoutMs; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "schedule(delay = this.timeout) {\r\n this.cancel();\r\n this.timeoutToken = setTimeout(this.timeoutHandler, delay);\r\n }", "function setupTimeoutTimer() {\n updateTimeoutInfo(undefined);\n }", "onTimeout() {}", "async setTimeout() {\n const TimeoutRequestsWindowTime = 5*60*1000;\n ...
[ "0.71883744", "0.69048095", "0.67240846", "0.6426878", "0.64236104", "0.6382963", "0.62626487", "0.62611955", "0.6229805", "0.6225475", "0.6200153", "0.6200153", "0.6172682", "0.6155372", "0.61088985", "0.6096295", "0.60934234", "0.6087903", "0.6087903", "0.6076975", "0.60657...
0.0
-1
requestWork is called by the scheduler whenever a root receives an update. It's up to the renderer to call renderRoot at some point in the future.
function requestWork(root, expirationTime) { addRootToSchedule(root, expirationTime); if (isRendering) { // Prevent reentrancy. Remaining work will be scheduled at the end of // the currently rendering batch. return; } if (isBatchingUpdates) { // Flush work at the end of the batch. if (isUnbatchingUpdates) { // ...unless we're inside unbatchedUpdates, in which case we should // flush it now. nextFlushedRoot = root; nextFlushedExpirationTime = Sync; performWorkOnRoot(root, Sync, false); } return; } // TODO: Get rid of Sync and use current time? if (expirationTime === Sync) { performSyncWork(); } else { scheduleCallbackWithExpiration(expirationTime); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function requestWork(root,expirationTime){addRootToSchedule(root,expirationTime);if(isRendering){// Prevent reentrancy. Remaining work will be scheduled at the end of\n// the currently rendering batch.\nreturn;}if(isBatchingUpdates){// Flush work at the end of the batch.\nif(isUnbatchingUpdates){// ...unless we're...
[ "0.76551515", "0.76551515", "0.76334465", "0.76334465", "0.76334465", "0.71456784", "0.71456784", "0.71456784", "0.71019405", "0.7083186", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076524", "0.7076...
0.7051454
32
When working on async work, the reconciler asks the renderer if it should yield execution. For DOM, we implement this with requestIdleCallback.
function shouldYield() { if (deadline === null) { return false; } if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) { // Disregard deadline.didTimeout. Only expired work should be flushed // during a timeout. This path is only hit for non-expired work. return false; } deadlineDidExpire = true; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onIdle (callback) {\n\t\tif (Object.keys (this.taskMap).length <= 0) {\n\t\t\tsetImmediate (callback);\n\t\t\treturn;\n\t\t}\n\t\tthis.statusEventEmitter.once (IdleEvent, callback);\n\t}", "function requestWork(root,expirationTime){addRootToSchedule(root,expirationTime);if(isRendering){// Prevent reentrancy. Rem...
[ "0.55909777", "0.558309", "0.558309", "0.5554942", "0.5554942", "0.5554942", "0.55450976", "0.5500691", "0.5457481", "0.545722", "0.54455143", "0.54455143", "0.54388463", "0.5431872", "0.54171467", "0.540121", "0.53965545", "0.53921384", "0.53773165", "0.5372673", "0.537124",...
0.0
-1
TODO: Batching should be implemented at the renderer level, not inside the reconciler.
function batchedUpdates$1(fn, a) { var previousIsBatchingUpdates = isBatchingUpdates; isBatchingUpdates = true; try { return fn(a); } finally { isBatchingUpdates = previousIsBatchingUpdates; if (!isBatchingUpdates && !isRendering) { performSyncWork(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateBatches() {\n if (this.dirty === this.cacheDirty) {\n return;\n }\n if (this.graphicsData.length === 0) {\n return;\n }\n if (this.dirty !== this.cacheDirty) {\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data ...
[ "0.6612359", "0.65732634", "0.6552813", "0.6538101", "0.6538101", "0.6135624", "0.6086937", "0.6049374", "0.60242605", "0.5976686", "0.59277886", "0.59277886", "0.59277886", "0.59277886", "0.59277886", "0.59277886", "0.59277886", "0.59277886", "0.59277886", "0.5880311", "0.58...
0.0
-1
TODO: Batching should be implemented at the renderer level, not inside the reconciler.
function unbatchedUpdates(fn, a) { if (isBatchingUpdates && !isUnbatchingUpdates) { isUnbatchingUpdates = true; try { return fn(a); } finally { isUnbatchingUpdates = false; } } return fn(a); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateBatches() {\n if (this.dirty === this.cacheDirty) {\n return;\n }\n if (this.graphicsData.length === 0) {\n return;\n }\n if (this.dirty !== this.cacheDirty) {\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data ...
[ "0.66132087", "0.657445", "0.65534955", "0.65382004", "0.65382004", "0.6135669", "0.6086718", "0.60504633", "0.60258555", "0.5976142", "0.5927382", "0.5927382", "0.5927382", "0.5927382", "0.5927382", "0.5927382", "0.5927382", "0.5927382", "0.5927382", "0.58799106", "0.5858339...
0.0
-1
TODO: Batching should be implemented at the renderer level, not within the reconciler.
function flushSync(fn, a) { !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0; var previousIsBatchingUpdates = isBatchingUpdates; isBatchingUpdates = true; try { return syncUpdates(fn, a); } finally { isBatchingUpdates = previousIsBatchingUpdates; performSyncWork(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateBatches() {\n if (this.dirty === this.cacheDirty) {\n return;\n }\n if (this.graphicsData.length === 0) {\n return;\n }\n if (this.dirty !== this.cacheDirty) {\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data ...
[ "0.6657303", "0.6613845", "0.6612785", "0.65445775", "0.65445775", "0.612318", "0.61036456", "0.60438234", "0.60351276", "0.5958418", "0.5915346", "0.5915346", "0.5915346", "0.5915346", "0.5915346", "0.5915346", "0.5915346", "0.5915346", "0.5915346", "0.58719826", "0.5863909"...
0.0
-1
Copyright 2015, Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
function addLocaleData() { var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var locales = Array.isArray(data) ? data : [data]; locales.forEach(function (localeData) { if (localeData && localeData.locale) { intl_messageformat__WEBPACK_IMPORTED_MODULE_1___default.a.__addLocaleData(localeData); intl_relativeformat__WEBPACK_IMPORTED_MODULE_2___default.a.__addLocaleData(localeData); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "protected internal function m252() {}", "transient final protected i...
[ "0.6377186", "0.6271533", "0.5864289", "0.58490723", "0.5847677", "0.57779276", "0.5614154", "0.5590317", "0.5485001", "0.5454564", "0.545351", "0.5427332", "0.5384727", "0.5354061", "0.5352202", "0.53506595", "0.5301245", "0.5301245", "0.5301245", "0.5301245", "0.5301245", ...
0.0
-1
Copyright 2015, Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. Inspired by reactredux's `connect()` HOC factory function implementation:
function getDisplayName(Component$$1) { return Component$$1.displayName || Component$$1.name || 'Component'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createConnect() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$connectHOC = _ref.connectHOC,\n connectHOC = _ref$connectHOC === undefined ? connectAdvanced : _ref$connectHOC,\n _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,\n mapS...
[ "0.8082577", "0.80761415", "0.8074473", "0.8074473", "0.8074473", "0.8074473", "0.8074473", "0.8074473", "0.8074473", "0.8060908", "0.8060908", "0.8060908", "0.8060908", "0.8060908", "0.8060908", "0.8060908", "0.8048516", "0.8037224", "0.8035343", "0.8035343", "0.8035343", ...
0.0
-1
Copyright 2015, Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
function defineMessages(messageDescriptors) { // This simply returns what's passed-in because it's meant to be a hook for // babel-plugin-react-intl. return messageDescriptors; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "protected internal function m252() {}", "transient final protected i...
[ "0.6376084", "0.62706244", "0.58636177", "0.58482903", "0.5847544", "0.5777374", "0.56141454", "0.5589258", "0.5484195", "0.5455097", "0.5452246", "0.54265475", "0.53839713", "0.5354016", "0.53509074", "0.53497547", "0.53007287", "0.53007287", "0.53007287", "0.53007287", "0.5...
0.0
-1
Copyright 2015, Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. This is a "hack" until a proper `intlpluralformat` package is created.
function resolveLocale(locales) { // IntlMessageFormat#_resolveLocale() does not depend on `this`. return intl_messageformat__WEBPACK_IMPORTED_MODULE_1___default.a.prototype._resolveLocale(locales); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formatPlural(num,str){return num+\" \"+str+(num===1?'':'s');}/**\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * ...
[ "0.77356875", "0.7058907", "0.7030382", "0.7019028", "0.7019028", "0.7019028", "0.6985141", "0.6985141", "0.6985141", "0.6966321", "0.6966321", "0.6966321", "0.6966321", "0.6966321", "0.6966321", "0.6961492", "0.69475496", "0.68934774", "0.68300265", "0.682934", "0.67429066",...
0.0
-1
AsyncMode should be deprecated
function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); } } return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setAsync(){\n this.async = true;\n }", "function isAsyncMode(object){{if(!hasWarnedAboutDeprecatedIsAsyncMode){hasWarnedAboutDeprecatedIsAsyncMode=true;lowPriorityWarning$1(false,'The ReactIs.isAsyncMode() alias has been deprecated, '+'and will be removed in React 17+. Update your code to use '+'ReactI...
[ "0.71772456", "0.71477026", "0.71477026", "0.71477026", "0.707457", "0.6901749", "0.6824169", "0.6809441", "0.6809441", "0.6793582", "0.6785743", "0.67846984", "0.6757779", "0.6750946", "0.6745032", "0.6745032", "0.67303115", "0.67276573", "0.67276573", "0.67276573", "0.67276...
0.0
-1
connect is a facade over connectAdvanced. It turns its args into a compatible selectorFactory, which has the signature: (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps connect passes its args to connectAdvanced as options, which will in turn pass them to selectorFactory each time a Connect component instance is instantiated or hot reloaded. selectorFactory returns a final props selector from its mapStateToProps, mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps, mergePropsFactories, and pure args. The resulting final props selector is called by the Connect component instance whenever it receives new props or store state.
function match(arg, factories, name) { for (var i = factories.length - 1; i >= 0; i--) { var result = factories[i](arg); if (result) return result; } return function (dispatch, options) { throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + "."); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createConnect() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$connectHOC = _ref.connectHOC,\n connectHOC = _ref$connectHOC === undefined ? connectAdvanced : _ref$connectHOC,\n _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,\n mapS...
[ "0.75024915", "0.7500725", "0.7420009", "0.7420009", "0.7417194", "0.7414589", "0.7373876", "0.7373876", "0.7373876", "0.7373876", "0.7373876", "0.7373876", "0.7373876", "0.73716056", "0.73716056", "0.73716056", "0.73716056", "0.73290783", "0.73290783", "0.73290783", "0.73290...
0.0
-1
different options opens up some testing and extensibility scenarios
function createConnect(_temp) { var _ref = _temp === void 0 ? {} : _temp, _ref$connectHOC = _ref.connectHOC, connectHOC = _ref$connectHOC === void 0 ? _components_connectAdvanced__WEBPACK_IMPORTED_MODULE_2__["default"] : _ref$connectHOC, _ref$mapStateToPropsF = _ref.mapStateToPropsFactories, mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? _mapStateToProps__WEBPACK_IMPORTED_MODULE_5__["default"] : _ref$mapStateToPropsF, _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories, mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? _mapDispatchToProps__WEBPACK_IMPORTED_MODULE_4__["default"] : _ref$mapDispatchToPro, _ref$mergePropsFactor = _ref.mergePropsFactories, mergePropsFactories = _ref$mergePropsFactor === void 0 ? _mergeProps__WEBPACK_IMPORTED_MODULE_6__["default"] : _ref$mergePropsFactor, _ref$selectorFactory = _ref.selectorFactory, selectorFactory = _ref$selectorFactory === void 0 ? _selectorFactory__WEBPACK_IMPORTED_MODULE_7__["default"] : _ref$selectorFactory; return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) { if (_ref2 === void 0) { _ref2 = {}; } var _ref3 = _ref2, _ref3$pure = _ref3.pure, pure = _ref3$pure === void 0 ? true : _ref3$pure, _ref3$areStatesEqual = _ref3.areStatesEqual, areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual, _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual, areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__["default"] : _ref3$areOwnPropsEqua, _ref3$areStatePropsEq = _ref3.areStatePropsEqual, areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__["default"] : _ref3$areStatePropsEq, _ref3$areMergedPropsE = _ref3.areMergedPropsEqual, areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__["default"] : _ref3$areMergedPropsE, extraOptions = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]); var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps'); var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps'); var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps'); return connectHOC(selectorFactory, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ // used in error messages methodName: 'connect', // used to compute Connect's displayName from the wrapped component's displayName. getDisplayName: function getDisplayName(name) { return "Connect(" + name + ")"; }, // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes shouldHandleStateChanges: Boolean(mapStateToProps), // passed through to selectorFactory initMapStateToProps: initMapStateToProps, initMapDispatchToProps: initMapDispatchToProps, initMergeProps: initMergeProps, pure: pure, areStatesEqual: areStatesEqual, areOwnPropsEqual: areOwnPropsEqual, areStatePropsEqual: areStatePropsEqual, areMergedPropsEqual: areMergedPropsEqual }, extraOptions)); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testOptions ( options ) {\n\n\t\t// To prove a fix for #537, freeze options here.\n\t\t// If the object is modified, an error will be thrown.\n\t\t// Object.freeze(options);\n\n\t\tvar parsed = {\n\t\t\tmargin: 0,\n\t\t\tlimit: 0,\n\t\t\tpadding: 0,\n\t\t\tanimate: true,\n\t\t\tanimationDuration: 300,\n\t...
[ "0.6038046", "0.6032396", "0.6032396", "0.6000212", "0.59554785", "0.59554785", "0.59554785", "0.59451085", "0.5915849", "0.59067327", "0.5874142", "0.5874142", "0.5858558", "0.5855062", "0.5855062", "0.5834565", "0.5834565", "0.5827782", "0.5820266", "0.5819525", "0.58025575...
0.0
-1
If pure is true, the selector returned by selectorFactory will memoize its results, allowing connectAdvanced's shouldComponentUpdate to return false if final props have not changed. If false, the selector will always return a new object and shouldComponentUpdate will always return true.
function finalPropsSelectorFactory(dispatch, _ref2) { var initMapStateToProps = _ref2.initMapStateToProps, initMapDispatchToProps = _ref2.initMapDispatchToProps, initMergeProps = _ref2.initMergeProps, options = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]); var mapStateToProps = initMapStateToProps(dispatch, options); var mapDispatchToProps = initMapDispatchToProps(dispatch, options); var mergeProps = initMergeProps(dispatch, options); if (true) { Object(_verifySubselectors__WEBPACK_IMPORTED_MODULE_1__["default"])(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName); } var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory; return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function finalPropsSelectorFactory(dispatch, _ref2) {\n\t var initMapStateToProps = _ref2.initMapStateToProps,\n\t initMapDispatchToProps = _ref2.initMapDispatchToProps,\n\t initMergeProps = _ref2.initMergeProps,\n\t options = _objectWithoutProperties(_ref2, ['initMapStateToProps', 'initMapDispatch...
[ "0.5797119", "0.5797119", "0.5783517", "0.5783517", "0.5783517", "0.5783129", "0.5783129", "0.5783129", "0.5783129", "0.5768795", "0.5768795", "0.5765673", "0.57628924", "0.57622963", "0.57622963", "0.57622963", "0.57622963", "0.57622963", "0.57622963", "0.57622963", "0.57622...
0.56663
89
to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine whether mapToProps needs to be invoked when props have changed. A length of one signals that mapToProps does not depend on props from the parent component. A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and therefore not reporting its length accurately..
function getDependsOnOwnProps(mapToProps) { return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1; } // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapToProps() {\n return {};\n}", "function mapToProps() {\n return {};\n}", "function wrapMapToPropsFunc(mapToProps,methodName){return function initProxySelector(dispatch,_ref){var displayName=_ref.displayName;var proxy=function mapToPropsProxy(stateOrDispatch,ownProps){return proxy.dependsOnOwn...
[ "0.64887166", "0.64887166", "0.62169665", "0.6062001", "0.590732", "0.58162886", "0.58031344", "0.5798494", "0.5766989", "0.5766989", "0.5766989", "0.5766989", "0.5766989", "0.5761552", "0.5761552", "0.5761552", "0.5761552", "0.5745488", "0.57390016", "0.57330906", "0.5733090...
0.0
-1
this function wraps mapToProps in a proxy function which does several things: Detects whether the mapToProps function being called depends on props, which is used by selectorFactory to decide if it should reinvoke on props changes. On first call, handles mapToProps if returns another function, and treats that new function as the true mapToProps for subsequent calls. On first call, verifies the first result is a plain object, in order to warn the developer that their mapToProps function is not returning a valid result.
function wrapMapToPropsFunc(mapToProps, methodName) { return function initProxySelector(dispatch, _ref) { var displayName = _ref.displayName; var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) { return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch); }; // allow detectFactoryAndVerify to get ownProps proxy.dependsOnOwnProps = true; proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) { proxy.mapToProps = mapToProps; proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps); var props = proxy(stateOrDispatch, ownProps); if (typeof props === 'function') { proxy.mapToProps = props; proxy.dependsOnOwnProps = getDependsOnOwnProps(props); props = proxy(stateOrDispatch, ownProps); } if (true) Object(_utils_verifyPlainObject__WEBPACK_IMPORTED_MODULE_0__["default"])(props, displayName, methodName); return props; }; return proxy; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrapMapToPropsFunc(mapToProps, methodName) {\n return function initProxySelector(dispatch, _ref) {\n var displayName = _ref.displayName;\n\n var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {\n return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy....
[ "0.7835368", "0.7835368", "0.7835368", "0.7835368", "0.7835368", "0.78094435", "0.77915895", "0.77791655", "0.77717596", "0.77691317", "0.7764148", "0.7764148", "0.7764148", "0.7764148", "0.7764148", "0.7764148", "0.7764148", "0.7735827", "0.7735266", "0.7729478", "0.7728332"...
0.76695675
68
Base class helpers for the updating state of a component.
function Component(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n BaseState.update.call(this);\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "func...
[ "0.72174495", "0.6760336", "0.6674498", "0.6611827", "0.6539205", "0.65264326", "0.6489361", "0.6470911", "0.64590335", "0.63847995", "0.63539994", "0.6335737", "0.63053733", "0.6304823", "0.6271708", "0.6266727", "0.62187904", "0.6214442", "0.61935455", "0.6188449", "0.61573...
0.0
-1
Base class helpers for the updating state of a component.
function PureComponent(props, context, updater) { // Duplicated from Component. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n BaseState.update.call(this);\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "func...
[ "0.7217204", "0.67610246", "0.66769236", "0.66106635", "0.6540022", "0.65259355", "0.6489663", "0.64705694", "0.645821", "0.63847154", "0.6354757", "0.63347685", "0.63053316", "0.6304944", "0.62717897", "0.6266675", "0.621649", "0.6214279", "0.6194085", "0.6189877", "0.615812...
0.0
-1
Create and return a new ReactElement of the given type. See
function createElement(type, config, children) { var propName; // Reserved names are extracted var props = {}; var key = null; var ref = null; var self = null; var source = null; if (config != null) { if (hasValidRef(config)) { ref = config.ref; } if (hasValidKey(config)) { key = '' + config.key; } self = config.__self === undefined ? null : config.__self; source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } // Resolve default props if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === undefined) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } } return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createElement(type,config,children){var propName;// Reserved names are extracted\nvar props={};var key=null;var ref=null;var self=null;var source=null;if(config!=null){if(hasValidRef(config)){ref=config.ref;{warnIfStringRefCannotBeAutoConverted(config);}}if(hasValidKey(config)){key=''+config.key;}self=con...
[ "0.68920434", "0.6835192", "0.6767826", "0.6757532", "0.6745889", "0.6745889", "0.6745889", "0.6745889", "0.6745889", "0.6745889", "0.6745889", "0.6745889", "0.6745889", "0.65640503", "0.65581757", "0.6406998", "0.6406998", "0.6406998", "0.6406998", "0.6406998", "0.63805515",...
0.637205
44
Return a function that produces ReactElements of a given type. See
function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getElementConstructor(type) {\n return JSXElement;\n }", "wrap(type = this.type, props) {\n if (props) {\n if (typeof props === \"string\") props = { className: props };\n else props = this.normalizeProps(props);\n }\n this.elements = [ React.createElement(type, props, ...this.elements) ];...
[ "0.6882577", "0.6599971", "0.65013385", "0.65013385", "0.65013385", "0.65013385", "0.65013385", "0.65013385", "0.65013385", "0.65013385", "0.65013385", "0.6265683", "0.6180459", "0.594761", "0.5920264", "0.5884003", "0.5865715", "0.5779805", "0.5639892", "0.5633744", "0.56215...
0.0
-1
Clone and return a new ReactElement using element as the starting point. See
function cloneElement(element, config, children) { var propName; // Original props are copied var props = _assign({}, element.props); // Reserved names are extracted var key = element.key; var ref = element.ref; // Self is preserved since the owner is preserved. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a // transpiler, and the original source is probably a better indicator of the // true owner. var source = element._source; // Owner will be preserved, unless ref is overridden var owner = element._owner; if (config != null) { if (hasValidRef(config)) { // Silently steal the ref from the parent. ref = config.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { key = '' + config.key; } // Remaining properties override existing props var defaultProps; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config[propName] === undefined && defaultProps !== undefined) { // Resolve default props props[propName] = defaultProps[propName]; } else { props[propName] = config[propName]; } } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self, source, owner, props); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cloneElement(element,config,children){if(!!(element===null||element===undefined)){{throw Error(\"React.cloneElement(...): The argument must be a React element, but you passed \"+element+\".\");}}var propName;// Original props are copied\nvar props=_assign({},element.props);// Reserved names are extracted\...
[ "0.6915557", "0.6893059", "0.66959214", "0.66959214", "0.66947424", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.66482466", "0.6635265", "0.66155624", ...
0.0
-1
Flatten a children object (typically specified as `props.children`) and return an array with appropriately rekeyed children. See
function toArray(children) { var result = []; mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toArrayChildren(children) {\n var ret = [];\n React__default.Children.forEach(children, function (child) {\n ret.push(child);\n });\n return ret;\n }", "function toArray(children){var result=[];mapIntoWithKeyPrefixInternal(children,result,null,function(child){return child;}...
[ "0.775594", "0.7520282", "0.74348474", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.7408082", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74014795", "0.74...
0.0
-1
This is a dummy function to check if the function name has been altered by minification. If the function has been minified and NODE_ENV !== 'production', warn the user.
function isCrushed() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function uglify(name) {\n console.log(\"Hello \" + name);\n}", "function keepNonMinified(file) {\n\tvar keep = true;\n\tif(file.path.match('.js$')) {\n\t\tvar minPath = file.path.replace('.js', '.min.js');\n\t\tkeep = !exists(minPath);\n\t}\n\treturn keep;\n}", "function markFuncFreeze(fun, opt_name) {\n /...
[ "0.602566", "0.5777989", "0.57169867", "0.56800693", "0.56800693", "0.5636262", "0.5636262", "0.56205446", "0.55760926", "0.55489725", "0.552758", "0.5519853", "0.5519853", "0.5519853", "0.5519853", "0.5519853", "0.5508173", "0.5493446", "0.5486299", "0.54790825", "0.54787135...
0.0
-1
Returns a canvas with the resized image
resize (image, newWidth, newHeight) { // Resize in a 2 step process, matching width first, then height, in order // to preserve nearest-neighbor sampling. const stretchWidthCanvas = this._makeCanvas(); stretchWidthCanvas.width = newWidth; stretchWidthCanvas.height = image.height; let context = stretchWidthCanvas.getContext('2d'); context.imageSmoothingEnabled = false; context.drawImage(image, 0, 0, stretchWidthCanvas.width, stretchWidthCanvas.height); const stretchHeightCanvas = this._makeCanvas(); stretchHeightCanvas.width = newWidth; stretchHeightCanvas.height = newHeight; context = stretchHeightCanvas.getContext('2d'); context.imageSmoothingEnabled = false; context.drawImage(stretchWidthCanvas, 0, 0, stretchHeightCanvas.width, stretchHeightCanvas.height); return stretchHeightCanvas; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static _getScaledCanvas(image,maxDimension){const thumbCanvas=document.createElement('canvas');if(image.width>maxDimension||image.height>maxDimension){if(image.width>image.height){thumbCanvas.width=maxDimension;thumbCanvas.height=maxDimension*image.height/image.width}else{thumbCanvas.width=maxDimension*image.width...
[ "0.730445", "0.7299781", "0.7059216", "0.6924135", "0.68889546", "0.68780965", "0.67863494", "0.6751586", "0.6665853", "0.6658321", "0.6645548", "0.6626456", "0.65524596", "0.65464574", "0.65426457", "0.652669", "0.65259796", "0.65104705", "0.6489413", "0.6486319", "0.6485485...
0.6710879
8
TODO consolidate with scratchvm/src/util/base64util.js From
convertDataURIToBinary (dataURI) { const BASE64_MARKER = ';base64,'; const base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length; const base64 = dataURI.substring(base64Index); const raw = window.atob(base64); const rawLength = raw.length; const array = new Uint8Array(new ArrayBuffer(rawLength)); for (let i = 0; i < rawLength; i++) { array[i] = raw.charCodeAt(i); } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Magic(r){if(!/^[a-z0-9+/]+={0,2}$/i.test(r)||r.length%4!=0)throw Error(\"Not base64 string\");for(var t,e,n,o,i,a,f=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",h=[],d=0;d<r.length;d+=4)t=(a=f.indexOf(r.charAt(d))<<18|f.indexOf(r.charAt(d+1))<<12|(o=f.indexOf(r.charAt(d+2)))<<6|(i...
[ "0.72834396", "0.7264216", "0.7222409", "0.71991026", "0.71887475", "0.7186382", "0.7169624", "0.7166873", "0.71188885", "0.7114991", "0.7108907", "0.7108907", "0.7096829", "0.7084061", "0.7073534", "0.70716816", "0.70711565", "0.705599", "0.7034924", "0.7029243", "0.7004515"...
0.0
-1
Mapping of attribute names to required namespaces:
static attributeNamespace () { return { 'href': SvgElement.xlink, 'xlink': SvgElement.xmlns, // Only the xmlns attribute needs the trailing slash. See #984 'xmlns': `${SvgElement.xmlns}/`, // IE needs the xmlns namespace when setting 'xmlns:xlink'. See #984 'xmlns:xlink': `${SvgElement.xmlns}/` }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAttributeNameLiterals(name) {\n var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])(splitNsName(name), 2), attributeNamespace = _a[0], attributeName = _a[1];\n var nameLiteral = literal(attributeName);\n if (attributeNamespace) {\n return [\n literal(0 /* Namespac...
[ "0.5795568", "0.56367296", "0.5584496", "0.55693793", "0.55393827", "0.55342424", "0.5508028", "0.5508028", "0.5508028", "0.54698807", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297", "0.5396297"...
0.6586446
0
Transforms an SVG's text elements for Scratch 2.0 quirks. These quirks include: 1. `x` and `y` properties are removed/ignored. 2. Alignment is set to `textbeforeedge`. 3. Linebreaks are converted to explicit elements. 4. Any required fonts are injected.
_transformText () { // Collect all text elements into a list. const textElements = []; const collectText = domElement => { if (domElement.localName === 'text') { textElements.push(domElement); } for (let i = 0; i < domElement.childNodes.length; i++) { collectText(domElement.childNodes[i]); } }; collectText(this._svgTag); convertFonts(this._svgTag); // For each text element, apply quirks. for (const textElement of textElements) { // Remove x and y attributes - they are not used in Scratch. textElement.removeAttribute('x'); textElement.removeAttribute('y'); // Set text-before-edge alignment: // Scratch renders all text like this. textElement.setAttribute('alignment-baseline', 'text-before-edge'); textElement.setAttribute('xml:space', 'preserve'); // If there's no font size provided, provide one. if (!textElement.getAttribute('font-size')) { textElement.setAttribute('font-size', '18'); } let text = textElement.textContent; // Fix line breaks in text, which are not natively supported by SVG. // Only fix if text does not have child tspans. // @todo this will not work for font sizes with units such as em, percent // However, text made in scratch 2 should only ever export size 22 font. const fontSize = parseFloat(textElement.getAttribute('font-size')); const tx = 2; let ty = 0; let spacing = 1.2; // Try to match the position and spacing of Scratch 2.0's fonts. // Different fonts seem to use different line spacing. // Scratch 2 always uses alignment-baseline=text-before-edge // However, most SVG readers don't support this attribute // or don't support it alongside use of tspan, so the translations // here are to make up for that. if (textElement.getAttribute('font-family') === 'Handwriting') { spacing = 2; ty = -11 * fontSize / 22; } else if (textElement.getAttribute('font-family') === 'Scratch') { spacing = 0.89; ty = -3 * fontSize / 22; } else if (textElement.getAttribute('font-family') === 'Curly') { spacing = 1.38; ty = -6 * fontSize / 22; } else if (textElement.getAttribute('font-family') === 'Marker') { spacing = 1.45; ty = -6 * fontSize / 22; } else if (textElement.getAttribute('font-family') === 'Sans Serif') { spacing = 1.13; ty = -3 * fontSize / 22; } else if (textElement.getAttribute('font-family') === 'Serif') { spacing = 1.25; ty = -4 * fontSize / 22; } if (textElement.transform.baseVal.numberOfItems === 0) { const transform = this._svgTag.createSVGTransform(); textElement.transform.baseVal.appendItem(transform); } // Right multiply matrix by a translation of (tx, ty) const mtx = textElement.transform.baseVal.getItem(0).matrix; mtx.e += (mtx.a * tx) + (mtx.c * ty); mtx.f += (mtx.b * tx) + (mtx.d * ty); if (text && textElement.childElementCount === 0) { textElement.textContent = ''; const lines = text.split('\n'); text = ''; for (const line of lines) { const tspanNode = SvgElement.create('tspan'); tspanNode.setAttribute('x', '0'); tspanNode.setAttribute('style', 'white-space: pre'); tspanNode.setAttribute('dy', `${spacing}em`); tspanNode.textContent = line ? line : ' '; textElement.appendChild(tspanNode); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeText() {\n let outputText = \n ['g', getText().map(textData => ['g', {'attrs': {'transform': 'translate(-0.5 -0.5)'}},\n ['switch',\n ['foreignObject', {'attrs': {'style': 'overflow: visible; text-align: left;', 'pointer-events': 'none', 'width': '100%', 'height': '100%', 'req...
[ "0.65613633", "0.6255379", "0.6177869", "0.6120506", "0.6082242", "0.60769737", "0.6054335", "0.60504067", "0.5913869", "0.58896947", "0.5856599", "0.5788221", "0.5758591", "0.5705453", "0.57027066", "0.56555647", "0.56520665", "0.5604754", "0.55543876", "0.553504", "0.552698...
0.8477336
0
Fix SVGs to comply with SVG spec. Scratch 2 defaults to x2 = 0 when x2 is missing, but SVG defaults to x2 = 1 when missing.
_transformGradients () { const linearGradientElements = this._collectElements('linearGradient'); // For each gradient element, supply x2 if necessary. for (const gradientElement of linearGradientElements) { if (!gradientElement.getAttribute('x2')) { gradientElement.setAttribute('x2', '0'); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fix_IE_SVGs() {\n var SVGs = $j('.pays__svg, .ships__svg, .socials__svg');\n if (SVGs.length) {\n SVGs.each(function (i, el) {\n\n var svg_class = $j(el).attr('class').replace(/light|dark|onecolor|pays__svg|\\s/g, '');\n var svgHTML = $j(el).parent().html();\n var regex =...
[ "0.63539404", "0.5781691", "0.5473102", "0.52418256", "0.52354056", "0.5203125", "0.5192704", "0.51734763", "0.5166024", "0.5154241", "0.51197046", "0.51162255", "0.51156425", "0.50855356", "0.5053058", "0.503601", "0.50203943", "0.49964273", "0.49774435", "0.49629587", "0.49...
0.5075095
14
Fix SVGs to match appearance in Scratch 2, which used nearest neighbor scaling for bitmaps within SVGs.
_transformImages () { const imageElements = this._collectElements('image'); // For each image element, set image rendering to pixelated const pixelatedImages = 'image-rendering: optimizespeed; image-rendering: pixelated;'; for (const elt of imageElements) { if (elt.getAttribute('style')) { elt.setAttribute('style', `${pixelatedImages} ${elt.getAttribute('style')}`); } else { elt.setAttribute('style', pixelatedImages); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fix_IE_SVGs() {\n var SVGs = $j('.pays__svg, .ships__svg, .socials__svg');\n if (SVGs.length) {\n SVGs.each(function (i, el) {\n\n var svg_class = $j(el).attr('class').replace(/light|dark|onecolor|pays__svg|\\s/g, '');\n var svgHTML = $j(el).parent().html();\n var regex =...
[ "0.7343137", "0.6557281", "0.59905255", "0.5923819", "0.59049356", "0.5851998", "0.5829526", "0.5818749", "0.5698383", "0.5598313", "0.5586575", "0.5584239", "0.5566456", "0.55572927", "0.55514234", "0.55480266", "0.54547167", "0.5421039", "0.5384684", "0.5378771", "0.5374003...
0.0
-1
Find all instances of a URLreferenced `stroke` in the svg. In 2.0, all gradient strokes have a round `strokelinejoin` and `strokelinecap`... for some reason.
_setGradientStrokeRoundedness () { const elements = this._collectElements(); for (const elt of elements) { if (!elt.style) continue; const stroke = elt.style.stroke || elt.getAttribute('stroke'); if (stroke && stroke.match(/^url\(#.*\)$/)) { elt.style['stroke-linejoin'] = 'round'; elt.style['stroke-linecap'] = 'round'; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSVGinfo() {\n console.log(this);\n S = document.getElementById(\"DYOSVG\").contentDocument;\n var STYLESVG = []\n , NUMCOLS = [];\n var i;\n\n for (var j = 0; j < S.styleSheets.length; j++) {\n var rules = S.styleSheets[j].rules || S.styleSheets[j].cssRules;\n // This ...
[ "0.5622581", "0.5492178", "0.54490256", "0.5263722", "0.5213205", "0.50928223", "0.50467056", "0.50287175", "0.49485436", "0.49410874", "0.49347863", "0.4934419", "0.49174204", "0.4898862", "0.48703974", "0.4863733", "0.48160085", "0.48147413", "0.4801173", "0.4800635", "0.47...
0.5831229
0
Transform the measurements of the SVG. In Scratch 2.0, SVGs are drawn without respect to the width, height, and viewBox attribute on the tag. The exporter does output these properties but they appear to be incorrect often. To address the incorrect measurements, we append the DOM to the document, and then use SVG's native `getBBox` to find the real drawn dimensions. This ensures things drawn in negative dimensions, outside the given viewBox, etc., are all eventually drawn to the canvas. I tried to do this several other ways: stripping the width/height/viewBox attributes and then drawing (Firefox won't draw anything), or inflating them and then measuring a canvas. But this seems to be a natural and performant way.
_transformMeasurements () { // Append the SVG dom to the document. // This allows us to use `getBBox` on the page, // which returns the full bounding-box of all drawn SVG // elements, similar to how Scratch 2.0 did measurement. const svgSpot = document.createElement('span'); // Since we're adding user-provided SVG to document.body, // sanitizing is required. This should not affect bounding box calculation. // outerHTML is attribute of Element (and not HTMLElement), so use it instead of // calling serializer or toString() // NOTE: this._svgTag remains untouched! const rawValue = this._svgTag.outerHTML; const sanitizedValue = DOMPurify.sanitize(rawValue, { // Use SVG profile (no HTML elements) USE_PROFILES: {svg: true}, // Remove some tags that Scratch does not use. FORBID_TAGS: ['a', 'audio', 'canvas', 'video'], // Allow data URI in image tags (e.g. SVGs converted from bitmap) ADD_DATA_URI_TAGS: ['image'] }); let bbox; try { // Insert sanitized value. svgSpot.innerHTML = sanitizedValue; document.body.appendChild(svgSpot); // Take the bounding box. We have to get elements via svgSpot // because we added it via innerHTML. bbox = svgSpot.children[0].getBBox(); } finally { // Always destroy the element, even if, for example, getBBox throws. document.body.removeChild(svgSpot); } // Enlarge the bbox from the largest found stroke width // This may have false-positives, but at least the bbox will always // contain the full graphic including strokes. // If the width or height is zero however, don't enlarge since // they won't have a stroke width that needs to be enlarged. let halfStrokeWidth; if (bbox.width === 0 || bbox.height === 0) { halfStrokeWidth = 0; } else { halfStrokeWidth = this._findLargestStrokeWidth(this._svgTag) / 2; } const width = bbox.width + (halfStrokeWidth * 2); const height = bbox.height + (halfStrokeWidth * 2); const x = bbox.x - halfStrokeWidth; const y = bbox.y - halfStrokeWidth; // Set the correct measurements on the SVG tag this._svgTag.setAttribute('width', width); this._svgTag.setAttribute('height', height); this._svgTag.setAttribute('viewBox', `${x} ${y} ${width} ${height}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static svgViewport(svg, xOffset,yOffset,width, height, scale) {\n\t\tsvg.setAttributeNS('', 'width', '' + width);\n\t\tsvg.setAttributeNS('', 'height', '' + height);\n\t\tsvg.setAttributeNS('', 'viewBox', ''+xOffset + ' ' + yOffset + ' ' + Math.round(width / scale) + ' ' +\n\t\t\tMath.round(height / scale));\n\t}"...
[ "0.6146703", "0.5983174", "0.5976927", "0.5976927", "0.5976927", "0.59703046", "0.5969637", "0.5929096", "0.5929096", "0.5924449", "0.58707035", "0.5866641", "0.5779386", "0.57606715", "0.57393914", "0.5731254", "0.56820667", "0.5635515", "0.5629723", "0.56217253", "0.5568057...
0.7769499
0
Funzioni funzione per generare numeri casuali del pc
function getRandomIntInclusive(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateNumCommande() {\n var random = Math.floor(100000000 + Math.random() * 900000000);\n num_commande = 'NH'+random\n }", "computerGeneratedCardinal(cgc){\n var size = cgc & 0xf;\n var n = [];\n var mask = 0xf;\n for(var i = 0; i < size;...
[ "0.7073922", "0.66159457", "0.6524541", "0.63536006", "0.6284837", "0.62524986", "0.617205", "0.6072526", "0.6048668", "0.60283214", "0.5999136", "0.59688324", "0.5968473", "0.5930131", "0.5907478", "0.5897416", "0.58957505", "0.5884402", "0.5882333", "0.5860285", "0.5847414"...
0.0
-1
funzione per controllare numeri in un array non siano uguali
function isInArray(array, element) { var i = 0; var risultato = false; while (i < array.length && risultato == false) { if (array[i] == element) { risultato = true; } i++; } return risultato; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pintarGuiones(num) {\r\n for (var i = 0; i < num; i++) {\r\n oculta[i] = \"_\";\r\n }\r\n hueco.innerHTML = oculta.join(\"\");//join() une todos los elementos de un array formando una cadena y separándolos con aquel argumento que definamos\r\n}", "function controllo(numeri, tentativi){\n // confr...
[ "0.62814313", "0.6171037", "0.61228573", "0.60402066", "0.5967102", "0.5962719", "0.5943229", "0.5891723", "0.588859", "0.58730066", "0.5859933", "0.58490133", "0.58436453", "0.5812462", "0.5812462", "0.57998055", "0.5770013", "0.575403", "0.57352555", "0.572582", "0.57223", ...
0.0
-1
BOOL WINAPI GetFileVersionInfoA( _In_ LPCSTR lptstrFilename , DWORD dwHandle , _In_ DWORD dwLen , _Out_ LPVOID lpData);
function ffi_cleanDeclare( arg_declareText ) { var declareText = ''; declareText = arg_declareText.trim( ); declareText = declareText.replaceAll( '\t' , ' ' ); declareText = declareText.replaceAll( '\r' , ' ' ); declareText = declareText.replaceAll( '\n' , ' ' ); var tempArray1 = declareText.split( "(" ); tempArray1 = _.map( tempArray1, function ( item ) { return item.trim( ); } ); if ( ( tempArray1.length != 2 ) ) { throw new Error( "invalid declare4" ); } // tempArray1 now is // 0 => "BOOL WINAPI GetFileVersionInfoA" , // 1 => "_In_ LPCSTR lptstrFilename , DWORD dwHandle , _In_ DWORD dwLen , _Out_ LPVOID lpData);" var declareHeadArray = tempArray1[0].split( " " ); declareHeadArray = _.map( declareHeadArray, function ( item ) { return item.trim( ); } ); declareHeadArray = _.filter( declareHeadArray, function ( item ) { return ( item.length != 0 ); } ); // declareHeadArray is // 0 => "BOOL" , // 1 => "WINAPI" , // 2 => "GetFileVersionInfoA" // arg declare and ; array var tempArray4 = tempArray1[1].split( ")" ); // tempArray4 is // 0 => "_In_ LPCSTR lptstrFilename , DWORD dwHandle , _In_ DWORD dwLen , _Out_ LPVOID lpData" , // 1 => ";" if ( ( tempArray4.length != 2 ) ) { throw new Error(sprintf("invalid declare5 %s " , tempArray4 ) ); } // argText var rawArgvDeclares = tempArray4[0].split( "," ); rawArgvDeclares = _.map( rawArgvDeclares, function ( item ) { return item.trim( ); } ); rawArgvDeclares = _.filter( rawArgvDeclares, function ( item ) { return ( item.length != 0 ); } ); // remove empty marcos rawArgvDeclares = _.map( rawArgvDeclares, function ( item ) { return _lex_removeEmptryBlank( item ); } ); // rawArgvDeclares // 0 => "_In_ LPCSTR lptstrFilename" , // 1 => "DWORD dwHandle" , // 2 => "_In_ DWORD dwLen" , // 3 => "_Out_ LPVOID lpData" // rewrite declareText = ""; if ( 3 == declareHeadArray.length ) { declareText += sprintf( "%s %s %s" , declareHeadArray[0] , declareHeadArray[1] , declareHeadArray[2] ); } else if ( 2 == declareHeadArray.length ) { declareText += sprintf( "%s %s" , declareHeadArray[0] , declareHeadArray[1] ); } else { throw new Error( sprintf( "invalid declare head array length , %s" , declareHeadArray ) ); } if ( 0 == rawArgvDeclares.length ) { declareText += "( );"; } else { var index = 0; declareText += "( "; for ( index = 0; index < rawArgvDeclares.length; index++ ) { if ( index == rawArgvDeclares.length - 1 ) { declareText += sprintf( "%s" , rawArgvDeclares[index] ); } else { declareText += sprintf( "%s , " , rawArgvDeclares[index] ); } } declareText += " );"; } // BOOL WINAPI GetFileVersionInfoA( _In_ LPCSTR lptstrFilename , DWORD dwHandle , _In_ DWORD dwLen , _Out_ LPVOID lpData ); return declareText; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFileVersion(fileGuid, fileObj, versionObj, tempFile) {\n var versionGuid = jive.util.guid();\n if (fileObj.versionsList) {\n fileObj.versionsList.push(versionGuid);\n } else {\n fileObj.versionsList = [versionGuid];\n } // end if\n\n var firstStep = q.fcall(function () {...
[ "0.57358634", "0.5707284", "0.54441744", "0.52108884", "0.52050745", "0.5178513", "0.5131007", "0.5131007", "0.5131007", "0.5131007", "0.51267004", "0.5121452", "0.51155245", "0.5104126", "0.50850695", "0.50834566", "0.50733244", "0.50603515", "0.50603515", "0.50603515", "0.5...
0.49402386
42
quoteData is a var! so it has to be above a function call arguments: 1: array of stocks (with one or more elements), 2: index for the specific stock in an array
async function quoteJSON(arrayOfSymbols, el) { try { const quoteData = await iex.quote(arrayOfSymbols[el]); let myPromise = new Promise((resolve, reject) => { Stock.countDocuments( { //toUpperCase to make it work with API stock: arrayOfSymbols[el].toUpperCase() }, function(err, count) { if (err) console.error(err); //if there is a stock in a db if (count > 0) { //if there were no likes, or if there was no "true" in proper position if (likeAll !== "true") { Stock.findOne({ stock: arrayOfSymbols[el].toUpperCase() }).exec((err, data) => { if (err) console.error(err); //price is get from API, the rest form DB let toAddToFinalArray = { stock: data.stock, price: quoteData.latestPrice.toString(), likes: data.likes }; // this will be what the function quoteData returns resolve(toAddToFinalArray); }); // if the like is 'true' } else { Stock.findOne({ stock: arrayOfSymbols[el].toUpperCase() }).exec((err, data) => { if (err) console.error(err); //checking if the Ips array includes ip if (data.Ips.includes(ip)) { let toAddToFinalArray = { stock: data.stock, price: quoteData.latestPrice.toString(), likes: data.likes }; resolve(toAddToFinalArray); //if there is no ip in Ips array } else { Stock.findOneAndUpdate( { stock: arrayOfSymbols[el].toUpperCase() }, { $inc: { likes: 1 }, $push: { Ips: ip } }, { useFindAndModify: false, new: true } ).exec((err, data) => { //if (err) console.error(err); // !! for some reason findOneandUpdate doesn't return anything, even //though it is updating, so .findOne() is chained to return data !! Stock.findOne({ stock: arrayOfSymbols[el].toUpperCase() }).exec((err, data) => { // if (err) console.error(err); let toAddToFinalArray = { stock: data.stock, price: quoteData.latestPrice.toString(), likes: data.likes }; //finalArrayOfResJSON.push(toAddToFinalArray); resolve(toAddToFinalArray); }); }); } }); } } else { // if there is no stock in a db //if there are no likes if (likeAll !== "true") { let newStock = new Stock({ stock: quoteData.symbol, price: quoteData.latestPrice.toString() }); newStock.save(err => { if (err) console.error(err); }); let toAddToFinalArray = { stock: quoteData.symbol, price: quoteData.latestPrice.toString(), likes: 0 }; resolve(toAddToFinalArray); //if there is a like & no stock in db } else { let newStock = new Stock({ stock: quoteData.symbol, price: quoteData.latestPrice.toString(), likes: 1, ////new line for IP handling Ips: [ip] }); newStock.save(err => { if (err) console.error(err); }); let toAddToFinalArray = { stock: quoteData.symbol, price: quoteData.latestPrice.toString(), likes: 1 }; resolve(toAddToFinalArray); } } } ); }); let myReturn = await myPromise; return myReturn; } catch (err) { console.error(err); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stockData(arr) {\n\n }", "stockData(arr) {\n\n }", "function stock_data(cur_exch, stockData){\n\t//console.log(stockData);\n\tswitch(cur_exch){\n\t\tcase 'NASDAQ':\n\t\t\tvar price = stockData.exchange_stock_data[0].csi_price;\n\t\t\tvar priceChng = stockData.exchange_stock_data[0].graph_data.price_chang...
[ "0.7175157", "0.7175157", "0.617733", "0.59703493", "0.5948382", "0.5912099", "0.5840953", "0.57789314", "0.5774364", "0.5748066", "0.569414", "0.5686457", "0.5562492", "0.55262727", "0.55225444", "0.55185986", "0.5483161", "0.54612327", "0.5459563", "0.54484165", "0.54304963...
0.58387923
7
test files names TODO: move to helpers
function createDir(name) { if(!fs.existsSync(name)){ fs.mkdirSync(name, 0766, function(err){ if(err){ console.log(err); response.send("ERROR! Can't make the directory! \n"); // echo the result back } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testAllFilesInDir() {\n\tfs.readdirSync(__dirname).forEach(file => {\n\t\tif (file.startsWith('test_')) {\n\t\t\ttestFile(__dirname + '/' + file);\n\t\t}\n\t});\n\t\n}", "function testFilePath(funcName) {\n return path.join(testFolder, `${funcName.replace(/.*\\//g, '')}.js`);\n }", "async functi...
[ "0.70677406", "0.6604679", "0.6561319", "0.6462425", "0.64556164", "0.63436115", "0.63418853", "0.6135902", "0.6132796", "0.611852", "0.60906315", "0.6029782", "0.6009458", "0.59877163", "0.58669317", "0.5829814", "0.57553154", "0.5750345", "0.5735164", "0.57347244", "0.56926...
0.0
-1
TODO: move to helpers
function copyFiles(dirname) { var srcDir = dirName + "template/"; createDir(dirName); if (dirname != undefined) { srcDir += dirname + "/"; } for (var i in files) { fs.createReadStream(srcDir + files[i]).pipe(fs.createWriteStream(dirName + files[i])); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "obtain(){}", "transient protected internal function m189() {}", "static final p...
[ "0.61280596", "0.6068674", "0.59467775", "0.5602644", "0.54522926", "0.5332756", "0.5307657", "0.5300574", "0.52752507", "0.5253474", "0.5174232", "0.50839937", "0.5033187", "0.49935612", "0.49870005", "0.49870005", "0.4986851", "0.49490127", "0.49319753", "0.48793572", "0.48...
0.0
-1
Returns a function, that, as long as it continues to be invoked, will not be triggered. The function will be called after it stops being called for N milliseconds. If `immediate` is passed, trigger the function on the leading edge, instead of the trailing.
function debounce(func, wait, immediate) { var timeout; return function () { var context = this, args = arguments; clearTimeout(timeout); timeout = setTimeout(function () { timeout = null; if (!immediate) func.apply(context, args); }, wait); if (immediate && !timeout) func.apply(context, args); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var args = arguments,\n callNow = immediate && !timeout,\n later = function () {\n timeout = null;\n if (!immediate) {\n ...
[ "0.6004564", "0.60006154", "0.5987088", "0.59632564", "0.5929661", "0.5929661", "0.5926392", "0.5920413", "0.59126645", "0.59119254", "0.59006953", "0.5889793", "0.58886176", "0.5887382", "0.5880147", "0.5877762", "0.58760935", "0.58760935", "0.58760935", "0.58760935", "0.587...
0.58370227
49
MAYBE CHANGE WAV TO MP3 ?????????????????? / DESCRIPTION: Every noise have four parameters > the name of noise (some of them was created for this program) > the sign of noise (some of them was created for this program too) > audio is JavaScript element with path in "wav" folder > folder is important to match noise to folders in view
function Noise(name, sign, audio, folder) { this.name = name; this.sign = sign; this.audio = audio; this.folder = folder; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function speakVO(){\n var audio = new Audio('../../asset/VOfiles/PerspectivesVO_minigameoverview.wav');\n audio.volume = 1;\n audio.play()\n}", "_defineAudioFileExtention() {\n const a = document.createElement('audio');\n // http://diveintohtml5.info/everything.html\n if (!!(a.canPlayType && a....
[ "0.64845544", "0.6463555", "0.6451415", "0.6451415", "0.6384706", "0.63448817", "0.6343348", "0.63323855", "0.6296042", "0.6279886", "0.62513405", "0.6211291", "0.62066984", "0.6174558", "0.61734456", "0.6113219", "0.6107086", "0.60817814", "0.60721153", "0.6060187", "0.60424...
0.5753851
65
On start click, the queryURL will be constructed using user inputs
function createButtons (){ $("#btnHolder").empty(); // Looping through the GIF topics for (var i=0; i<topics.length; i++) { // Using jQuery to create a button for string in the "topics" array var $gifBtn = $('<button>'); // Adding class "topic" to each button $gifBtn.attr("class", "topic btn btn-primary"); // Adding attribute to distinguish one button from another $gifBtn.attr("topic-name", topics[i]) // Putting "topic[i]" text inside the generated button $gifBtn.text(topics[i]) // Add the button to the page within the "btnHolder" $("#btnHolder").append($gifBtn); // Debugging console.log($gifBtn, "gif button"); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function querystring () {\n setFormFields();\n setBookmarkURL();\n form.bookmark.on(\"click focus mouseenter\", setBookmarkURL);\n}", "function buildQueryURL() {\n // if(queryParams != '') {\n // queryURL is the url we'll use to query the API\n var queryParams = $(\"#countryInput\").val()...
[ "0.69895315", "0.6640543", "0.628289", "0.6261672", "0.6214995", "0.61122507", "0.6052079", "0.60448146", "0.60017306", "0.5939718", "0.5928961", "0.5922557", "0.5898466", "0.5891717", "0.5843399", "0.58273613", "0.5827122", "0.5814679", "0.5804956", "0.5804338", "0.57958734"...
0.0
-1
check if the input currency is in the list of supported conversion currencies of coingecko
function checkCurrency(currencyInput) { let currenciesListQuery = 'https://api.coingecko.com/api/v3/simple/supported_vs_currencies' let response = UrlFetchApp.fetch(currenciesListQuery, {'muteHttpExceptions': true}); var listJsonText = response.getContentText(); var listJsonData = JSON.parse(listJsonText); return listJsonData.includes(currencyInput); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateTargetCurrency() {\n let existRates = Object.keys(fx.rates);\n if (!existRates.includes(this.state.targetCurrency.code))\n {\n alert(\"Error: No rate conversion from \" + this.state.baseCurrency.name + \" to \" + this.state.targetCurrency.name);\n this.invalidOutp...
[ "0.68969053", "0.66220856", "0.64626473", "0.6120484", "0.6033369", "0.59233576", "0.58354944", "0.5768413", "0.5758993", "0.57397044", "0.5703347", "0.56970227", "0.56761676", "0.56708217", "0.5619387", "0.5611052", "0.55966955", "0.55900717", "0.5577107", "0.55591494", "0.5...
0.7973825
0
fim da fase ou do jogo
function end() { currentLevel++; resetLevel(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FimJogo(){\n\t\tswitch(_vitoria){\n\t\t\tcase 1:AnunciarVitoria(1);p1.Vencer();break;\n\t\t\tcase 2:AnunciarVitoria(2);p2.Vencer();break;\n\t\t\tcase 4:AnunciarVitoria(3);p3.Vencer();break;\n\t\t\tcase 8:AnunciarVitoria(4);p4.Vencer();break;\n\t\t\tcase 0:AnunciarVitoria(0);AnimacaoEmpate();break;\n\t\t\t...
[ "0.72560877", "0.6245774", "0.6052659", "0.60166633", "0.6015394", "0.601499", "0.6010298", "0.5994349", "0.5991144", "0.59789306", "0.59313095", "0.5922741", "0.58754325", "0.58391565", "0.583208", "0.58243096", "0.5817615", "0.58089954", "0.5807574", "0.58044463", "0.578899...
0.0
-1
define a linha de caminho
function makePath() { var obj = new Graphics(); obj.lineStyle(2, 0xffffff, 1); obj.moveTo(0, 0); obj.lineTo(pathProp.pathLenght, 0); obj.pivot.set(pathProp.pathLenght / 2, 0); obj.x = app.renderer.view.width / 2; obj.y = pathProp.pathY; return obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(linha, coluna) {\n\t\tthis.linha = linha;\n\t\tthis.coluna = coluna;\n\t}", "function dibujarLinea(color,x_inicial,y_inicial,x_final,y_final) \n{\n lienzo.beginPath(); // Comienza el dibujo\n lienzo.strokeStyle = color; // Escoger el color de la línea\n lienzo.lineWidth = 3;\n lienzo.move...
[ "0.6756363", "0.6375945", "0.63174564", "0.6279122", "0.62335193", "0.62103325", "0.61787087", "0.61718106", "0.6166916", "0.61245835", "0.609672", "0.60933787", "0.6079934", "0.60714245", "0.60543925", "0.60514224", "0.6044597", "0.6027566", "0.6004941", "0.59919554", "0.598...
0.0
-1
carrega imagens para sprites
function loadSprites() { Loader.add("assets/imgs/resize1.png") .add("assets/imgs/resize2.png") .add("assets/imgs/colorize.png") .add("assets/imgs/rotate.png") .add("assets/imgs/select.png") .add("assets/imgs/win.png") .add("assets/imgs/logo.png") .add("assets/imgs/logo2.png") .add("assets/imgs/introFinal.png") .add("assets/imgs/btPlay.png") .add("assets/imgs/btAgain.png") .load(setup); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function load_media()\n{\n bg_sprite = new Image();\n bg_sprite.src = \"images/Background-stadt_lang.png\";\n box_sprite = new Image();\n box_sprite.src = \"images/Stift.png\";\n main_sprite = new Image();\n main_sprite.src = \"images/IMG_2210_Mini.png\";\n}", "function loadSprites(src, col, li...
[ "0.7027458", "0.69117796", "0.6746696", "0.67363185", "0.6679601", "0.6647176", "0.6626122", "0.6617081", "0.6604311", "0.66041195", "0.6576859", "0.6541838", "0.65409887", "0.65406305", "0.6536314", "0.6535161", "0.6534833", "0.65319234", "0.6528226", "0.6519146", "0.6519146...
0.70714915
0
define modificadores e suas acoes
function setModifier(count, index) { var obj, modifierName, modifFunc; var objLayerModifs = levels[currentLevel].modifiers[index]; modifierName = objLayerModifs.type; if (modifierName == 'resize') { modifierName = objLayerModifs.type + objLayerModifs[Object.keys(objLayerModifs)[1]].toString(); } obj = new Sprite( Loader.resources['assets/imgs/' + modifierName + '.png'].texture ); obj.anchor.set(0.5, 0.5); //define funcoes de modificacao switch (modifierName) { //reduz tamanho case 'resize1': obj.modFunc = new sizeDown(obj); break; //aumenta tamanho case 'resize2': obj.modFunc = new sizeUp(obj); break; //muda cor case 'colorize': obj.modFunc = new colorizeIt(obj); break; case 'select': obj.modFunc = new nope(obj); break; } switch (count) { case 1: obj.x = app.view.width * 0.5; obj.y = pathProp.pathY; break; case 2: obj.x = app.view.width * (0.25 * (index + 1.5)); obj.y = pathProp.pathY; break; } //tratamento para modificador select if (modifierName == 'select') { obj.interactive = true; obj.buttonMode = true; obj.on("pointerdown", function () { selectModifier(obj); }); } return obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _AtualizaModificadoresAtributos() {\n // busca a raca e seus modificadores.\n var modificadores_raca = tabelas_raca[gPersonagem.raca].atributos;\n\n // Busca cada elemento das estatisticas e atualiza modificadores.\n var atributos = [\n 'forca', 'destreza', 'constituicao', 'inteligencia', 'sabedo...
[ "0.704987", "0.5998706", "0.5998121", "0.5960021", "0.592312", "0.5921964", "0.5918479", "0.58636755", "0.58547455", "0.58445764", "0.58269095", "0.57685685", "0.57685685", "0.5760118", "0.57242745", "0.5700396", "0.5696993", "0.56848466", "0.56080997", "0.55472326", "0.55103...
0.0
-1
define modificadores quando select
function setModifierSelect(obj, index) { var modifierName, modifFunc; if (index == 2) { modifierName = "resize2"; } else { if (index == 3) { index = 2 }; var objLayerModifs = levels[currentLevel].modifiers[0].options[index]; modifierName = objLayerModifs.type; if (modifierName == "resize") { modifierName = objLayerModifs.type + objLayerModifs[Object.keys(objLayerModifs)[1]].toString(); }; }; var texture = Texture.fromImage( "assets/imgs/" + modifierName + ".png" ); obj.setTexture(texture); switch (modifierName) { case 'resize1': obj.modFunc = new sizeDown(obj); break; case 'resize2': obj.modFunc = new sizeUp(obj); break; case 'colorize': obj.modFunc = new colorizeIt(obj); break; case 'rotate': obj.modFunc = new rotateIt(obj); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static updatePedidoSelector(data) {\n let select = document.getElementById(\"editPedidoSelect\");\n select.innerHTML = \"\";\n\n for (let i=0; i<data.length; i++) {\n var option = document.createElement(\"option\");\n option.text = data[i].id;\n option.setAttri...
[ "0.6615989", "0.65549976", "0.6467718", "0.63361585", "0.6289542", "0.6273071", "0.62236184", "0.6218206", "0.6213371", "0.61819494", "0.6133448", "0.6122947", "0.60858995", "0.60212034", "0.59877527", "0.5957456", "0.5947831", "0.59323454", "0.5899461", "0.5893932", "0.58913...
0.0
-1
posiciona e insere objetos na cena
function setLevel() { //titulo fase var title = makeText(levels[currentLevel].name, 100, 42, 8, '#ffffff'); var instructions; //instruções if (currentLevel < 4) { instructions = makeText('Click on the glowing block.', 160, 12, 0, '#cccccc'); } else { instructions = makeText('Choose the modifiers and click on the glowing block.', 160, 12, 0, '#cccccc'); } var author = makeText('Author: Alessandro Siqueira - alessandro.state@gmail.com', app.view.height - 20, 11, 0, '#aaaaaa'); //bloco inicial playerBlock = new defBlock( levels[currentLevel].initial.size, levels[currentLevel].initial.color, 1, 1 ); //bloco final finalBlock = new defBlock( levels[currentLevel].final.size, levels[currentLevel].final.color, .3, -1, levels[currentLevel].final.rotation ); finalBlock.loopBol = false; //bloco transformado em azul playerBlockMod = new defBlock(1, '#0000ff', 1, 0); playerBlockMod.loopBol = false; playerBlockMod.x = -100; scnCurrent.addChild(makePath()); scnCurrent.addChild(title); scnCurrent.addChild(instructions); scnCurrent.addChild(author); //modificadores for (var n = 0; n < levels[currentLevel].modifiers.length; n++) { activeModifiers.push(setModifier(levels[currentLevel].modifiers.length, n)); scnCurrent.addChild(activeModifiers[n]); } scnCurrent.addChild(finalBlock); scnCurrent.addChild(playerBlockMod); scnCurrent.addChild(playerBlock); app.stage.addChild(scnCurrent); app.renderer.render(stage); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createObject() {\n var className= $.trim($className.val());\n var dbName = $.trim($dbName.val());\n if (className == null || className.length == 0 || dbName == null || dbName.length == 0) {\n alert(\"ERROR:\\nPlease list a Class Name and a Database Name\");\n return;\n }\...
[ "0.64564085", "0.6231468", "0.6154808", "0.608627", "0.60333014", "0.60310274", "0.6017594", "0.5909227", "0.5908473", "0.58905196", "0.58895254", "0.58637756", "0.5857292", "0.5798194", "0.5791184", "0.5790135", "0.5777695", "0.5770919", "0.57665014", "0.57452464", "0.572662...
0.0
-1
define proxima acao para playerBlock
function setAction(obj) { if (actionCounter < activeModifiers.length) { moveToTarget(obj, activeModifiers[actionCounter]); actionCounter++; } else { moveToTarget(obj, finalBlock); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "placeBlock () {\r\n this.mouseFocus.updateFocus(this.player.getCamera(), this.currentMeshes)\r\n const newBlockPosition = this.mouseFocus.getNewBlockPosition()\r\n if (newBlockPosition) this.world.placeBlock(newBlockPosition)\r\n }", "baseAmount() {return player.b.points}", "moveBlock(block) {\n b...
[ "0.5976193", "0.5772059", "0.57373434", "0.5723324", "0.57182014", "0.57182014", "0.57182014", "0.5702633", "0.56834054", "0.5664615", "0.56060624", "0.55687445", "0.5568133", "0.5565248", "0.55588347", "0.55528903", "0.5533111", "0.55274737", "0.55190367", "0.55132353", "0.5...
0.0
-1
erro no fim de fase
function missIt() { scnCurrent.addChild(makeText('Sorry, try again.', 230, 20, 6, '#ffffff')); setTimeout(function () { resetLevel(); }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deuErro() {\n toastr.error(\"Algo deu errado. Tente novamente.\");\n }", "function msgFalhaBaixarArquivo() {\n $scope.showErrorMessage(\"Falha ao fazer o download do arquivo.\");\n }", "function fallo() {\n return error(\"Reportar fallo\");\n}", "function muestraError(...
[ "0.6610646", "0.6477291", "0.6456701", "0.63715607", "0.6218629", "0.61420417", "0.61097324", "0.6090615", "0.6009743", "0.60054827", "0.5989904", "0.5982631", "0.5981689", "0.5963369", "0.5941398", "0.59408283", "0.59156936", "0.5877774", "0.5867463", "0.58555335", "0.582787...
0.0
-1
sets up the User status variable, to be modifed
function initPage() { initGlobalVars(); initDOM(); initEvents(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setUserStatus(status) {\n\t// Set our status in the list of online users.\n\tcurrentStatus = status;\n\tif (presname != undefined && status != undefined){\n\t\tmyUserRef.set({ name: presname, status: status });\n\t}\n}", "function setUserStatus(status) {\n // Set our status in the list of online user...
[ "0.77516264", "0.755074", "0.755074", "0.7432176", "0.7359027", "0.70023096", "0.687852", "0.6848534", "0.6811365", "0.6798794", "0.6717461", "0.6713198", "0.6696282", "0.66479814", "0.6638442", "0.6635674", "0.65940326", "0.6557834", "0.65013224", "0.6398614", "0.63791573", ...
0.0
-1
Users A class to contain all of the User functions
function Users(me) { this.me = me; this.usrs = []; if( arguments[1] !== undefined ) this.update( arguments[1] ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Users(){}", "function Users(){\n\tthis.getUsers = function (dataReturn) {\n\t\t$.ajax({\n\t\t\turl: '../app/data/jira_users.json',\n\t\t\tasync: false,\n\t\t\tdataType: 'json',\n\t\t\tsuccess: function(data) {\n\t\t\t\tdataReturn(data);\n\t\t\t}\n\t\t});\n\t};\n\n\tthis.SingleUser = function (name) {\n\...
[ "0.82999784", "0.76735806", "0.75863653", "0.75705236", "0.74598026", "0.7101091", "0.70785403", "0.69095415", "0.6866957", "0.68276083", "0.6788385", "0.67682266", "0.6748654", "0.67473686", "0.6713285", "0.6693575", "0.66838336", "0.66701144", "0.6660392", "0.6647916", "0.6...
0.686517
9
Messages for managing all of the messages back and fourth
function Messages() { this.msgs = []; if( arguments[0] !== undefined ) this.update( arguments[0] ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function manageMessages(messages){\n\n //if the index size is the array length=>i=0\n i=(messages.length==i)? 0 : i ;\n\n if (displayMsg(messages[i]) && checkScreenId(messages[i])) {\n loadMsgWithTemplate(messages[i]);\n timeoutForMsg(messages[i]);\n\n }\n\n else\n {\n i++;\n...
[ "0.66767377", "0.6567661", "0.637201", "0.636367", "0.63248026", "0.62660426", "0.6193576", "0.61810446", "0.61440426", "0.6110198", "0.6057745", "0.6033688", "0.6025593", "0.60229605", "0.5995312", "0.59772885", "0.5956373", "0.5948146", "0.5934874", "0.5929487", "0.592162",...
0.625683
6
PART 1: SHOW A FORTUNE
function replaceFortuneText(fortune) { $('#fortune-text').html(fortune); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showFiltersTop2(odsLenght) {\n\tfor (var i=6; i<parseInt(odsLenght);i++) {\n\t\tvar li = \"liOds\"+(i);\n\t\tdocument.getElementById(li).style.display = 'block';\n\t\tdocument.getElementById('f_vermas2').style.display = 'none';\n\t}\n}", "function festivalKantonFilter (){\n\tconsole.log('Festivals nach ...
[ "0.53187877", "0.50238127", "0.5004045", "0.4990911", "0.49881625", "0.49788353", "0.49711356", "0.49222085", "0.49209243", "0.49201047", "0.491127", "0.49109748", "0.49098074", "0.4892162", "0.48725975", "0.4861589", "0.48596632", "0.4853307", "0.48345205", "0.47638106", "0....
0.0
-1
PART 2: SHOW WEATHER
function replaceWeatherText(weather) { var weather = weather['forecast']; $('#weather-info').html(weather); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getStatistics () {\n return instance.get(base.dev + '/statistics')\n }", "function getTrendingShows() {\n\trequestTVInfo('shows/trending', function (error, response, body) {\n\t\tif (error) {\n\t\t\tconsole.log(error);\n\t\t} else {\n\t\t\tconsole.log(body);\n\t\t}\n\t});\n}", "function get_words_stats()\n...
[ "0.5508682", "0.5434847", "0.5310192", "0.5304697", "0.5241614", "0.52358854", "0.52358204", "0.5216267", "0.521505", "0.519483", "0.518183", "0.51650345", "0.51389056", "0.5123484", "0.51218957", "0.51045763", "0.5100942", "0.5090627", "0.50874025", "0.50765973", "0.5073933"...
0.0
-1
PART 3: ORDER MELONS
function replaceOrderText(order) { var message = order.msg; var code = order.code; $('#order-status').html(message); if (code === 'ERROR') { $('#order-status').addClass('order-error'); } else { $('#order-status').removeClass('order-error'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set order(value) {}", "set order(value) {}", "order (prm) {\n try {\n\t return this.confmng(\"order\", prm);\n\t} catch (e) {\n console.error(e.stack);\n throw e;\n }\n }", "get order() {}", "get order() {}", "function NextOrder() {\r\n\treturn 1;\r\n}", "funct...
[ "0.65615153", "0.65615153", "0.64031714", "0.638573", "0.638573", "0.6113449", "0.6093271", "0.604664", "0.5976432", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59377104", "0.59...
0.0
-1
simulation base de donnees avec localStorage et json
function ajoutInfo() { var nom=$( "#nom option:selected" ).val(); //var fimage=$( "#image option:selected" ).val(); var cap=$("#cap option:selected").val(); var acc=$('input[name="acc"]:first').val(); var env=$('input[name="env"]:first').val(); var date=$('input[name="date"]:first').val(); lireBdJson(); var descJsonObjects=bd.descriptions; var jsonObject={ //creation de json "nom":nom, //"image":fimage, "capacite":cap, "acces":acc, "environemment":env, "date":date, }; descJsonObjects.push(jsonObject);//ajout dans le tableau des description bd.descriptions=descJsonObjects; localStorage.setItem('bdjson', JSON.stringify(bd)); return(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getJsonData() {\n //Store JSON Object into Local Storage.\n for (var n in json) {\n var id = Math.floor(Math.random()*10000001);\n localStorage.setItem(id, JSON.stringify(json[n]));\n }\n }", "function getLocalStorge() {\n\n // khi lấy localStorage lên để...
[ "0.7207925", "0.71680045", "0.6874499", "0.6860906", "0.6848477", "0.6830731", "0.676789", "0.6731498", "0.6714319", "0.66845566", "0.66327554", "0.66317266", "0.66292167", "0.6597347", "0.6591715", "0.65909016", "0.65810466", "0.65793264", "0.6562722", "0.6550085", "0.654817...
0.0
-1
Remaps the source `.map` file for the given `sourceFile`. This keeps source maps intact over a series of transpilations!
function remapSourceMap(sourceFile) { return __awaiter(this, void 0, void 0, function* () { log_1.debug(`re-mapping sources for ${sourceFile}`); const opts = { inline: false, includeContent: true, }; // Once sorcery loads the chain of sourcemaps, the new sourcemap will be written asynchronously. const chain = yield sorcery.load(sourceFile); if (!chain) { throw new Error('Failed to load sourceMap chain for ' + sourceFile); } yield chain.write(opts); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function applySourceMap(sourceMap) {\n /*jshint validthis:true */\n try {\n if (typeof sourceMap === 'string' || sourceMap instanceof String) {\n sourceMap = JSON.parse(sourceMap);\n }\n var generator = SourceMapGenerator.fromSourceMap(new SourceMapConsumer(sourceMap));\n generator.applySourceMa...
[ "0.6327593", "0.62686896", "0.6081818", "0.6040088", "0.5927114", "0.57838446", "0.5767014", "0.5766346", "0.568154", "0.5546148", "0.5538732", "0.5538732", "0.5515136", "0.540978", "0.5397459", "0.52674454", "0.5256631", "0.525338", "0.52303994", "0.5214421", "0.52133304", ...
0.8245835
0
Relocates pathes of the `sources` file array in `.js.map` files. Simply said, because `sourcesContent` are inlined in the source maps, it's possible to pass an arbitrary file name and path in the `sources` property. By setting the value to a common prefix,
function relocateSourceMapSources({ artefacts, entryPoint }) { return __awaiter(this, void 0, void 0, function* () { yield json_1.modifyJsonFiles(`${artefacts.stageDir}/+(bundles|esm2015|esm5)/**/*.js.map`, (sourceMap) => { sourceMap.sources = sourceMap.sources .map((path) => { let trimmedPath = path; // Trim leading '../' path separators while (trimmedPath.startsWith('../')) { trimmedPath = trimmedPath.substring(3); } return `ng://${entryPoint.moduleId}/${trimmedPath}`; }); return sourceMap; }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setSourceContent(aSourceFile, aSourceContent) {\n let source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesConte...
[ "0.6674757", "0.6560075", "0.6501174", "0.6379424", "0.62797403", "0.6207948", "0.6202458", "0.5929406", "0.5842189", "0.5768242", "0.5759253", "0.5736241", "0.5676568", "0.5665704", "0.5663854", "0.5630267", "0.5578024", "0.55744135", "0.5562687", "0.55013067", "0.5491451", ...
0.68686146
0
function make responsieve to window size
function resizeCanvas() { // clear original chart in case window size update var svg = d3.select("#scatter").select("svg") if (!svg.empty()){svg.remove();}; svgHeight = window.innerHeight * 0.65; svgWidth = window.innerWidth * 0.8; margin = { left: 100, top: 100, right: 150, bottom: 100 }; chartHeight = svgHeight - margin.top - margin.bottom chartWidth = svgWidth - margin.left - margin.right svg = d3.select("#scatter").append("svg") .attr("height", svgHeight) .attr("width", svgWidth) // create new canvas, shifting the origin to center canvas var chartGroup = svg.append("g") .attr("transform", `translate(${margin.left}, ${margin.top})`) return chartGroup; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function windowsize(){\n$(window).height(); // New height // New width \n$(\"#frame\").css(\"max-width\",$(window).width());\n$(\"#frame\").css(\"height\",$(window).height()-60);\n}", "function windowSize() {\n mediaQuery();\n}", "function adjustWindow() {\n // get window size\n winW = $(window).width()...
[ "0.7492434", "0.7475859", "0.7420053", "0.7299762", "0.72667366", "0.7260732", "0.72408444", "0.72099745", "0.71932274", "0.71712446", "0.7166111", "0.7114978", "0.710452", "0.70848167", "0.70781964", "0.7058912", "0.70425755", "0.7017493", "0.7007628", "0.7006276", "0.699306...
0.0
-1
MAIN FUNCTION to make plot
function makeScatter(data, chartGroup){ // defalt chosenX,Y value var chosenX = "poverty"; var chosenY = "healthcare" var xScale = make_xScale(data, chosenX, chartWidth); var yScale = make_yScale(data, chosenY, chartHeight); var BottomAxis = d3.axisBottom(xScale) var LeftAxis = d3.axisLeft(yScale) // create the actual axis & ticks var xAxis = chartGroup.append("g") .attr("transform", `translate(0, ${chartHeight})`) .call(BottomAxis) var yAxis = chartGroup.append("g") .call(LeftAxis) // add circle-text Group var elementGroup = chartGroup.selectAll("#circleTextGroup") if (!elementGroup.empty) {elementGroup.remove()} elementGroup = chartGroup.selectAll("#circleTextGroup") .data(data) .enter() .append("g") .attr("id", "circleTextGroup") var circles = elementGroup .append("circle") .attr("cx", d => xScale(d[chosenX])) .attr("cy", d => yScale(d[chosenY])) .attr("r", 15) .attr("fill", "powderblue") .attr("opacity", "0.5"); var texts = elementGroup .append("text") .text(d => d.abbr) .attr("text-anchor", "middle") .attr("transform", d => `translate(${xScale(d[chosenX])} , ${yScale(d[chosenY])})`) .attr("font-size", "11") .attr("font-weight", "bold") .attr("dy", "3"); // add labels var xlabelGroup = chartGroup.append("g") var ylabelGroup = chartGroup.append("g") // xlabels var povertyLabel = xlabelGroup.append("text") .attr("x", chartWidth / 2) .attr("y", chartHeight + 50) .attr("class", "active") .attr("value","poverty_label") .text("In Poverty (%)") var ageLabel = xlabelGroup.append("text") .attr("x", chartWidth / 2) .attr("y", chartHeight + 70) .attr("class", "inactive") .attr("value","age_label") .text("Age (Median)") var HHIncomeLabel = xlabelGroup.append("text") .attr("x", chartWidth / 2) .attr("y", chartHeight + 90) .attr("class", "inactive") .attr("value","income_label") .text("Household Income (Median)") // ylables var healthcareLabel = ylabelGroup.append("text") .attr("transform", "rotate(-90)") .attr("x", - chartHeight / 2) .attr("y", - 40 ) .attr("class", "active") .attr("value","healthcare_label") .text("Lack Healthcare (%)") var obesityLabel = ylabelGroup.append("text") .attr("transform", "rotate(-90)") .attr("x", - chartHeight / 2) .attr("y", - 60 ) .attr("class", "inactive") .attr("value","obesity_label") .text("Obesity (%)") var smokesLabel = ylabelGroup.append("text") .attr("transform", "rotate(-90)") .attr("x", - chartHeight / 2) .attr("y", - 80 ) .attr("class", "inactive") .attr("value","smokes_label") .text("Smokes (%)") var circles = updateToolTip(chosenX,chosenY,circles); var title = chartGroup.append("text") .attr("id", "plot-title") .attr("transform", `translate(${chartWidth / 2}, -20)`) .attr("font-size", 36) .attr("text-anchor", "middle") .attr("font-weight","bold") .text(`${chosenX.replace(chosenX[0], chosenX[0].toUpperCase())} vs. ${chosenY.replace(chosenY[0], chosenY[0].toUpperCase())}`) // add text var key = chosenX.concat("-", chosenY) d3.select("#article") .html(`<br><hr><h4>Correlation between <em><b>${chosenX}</b></em> and <em><b>${chosenY}</b></em></h4>` + `<br>A <em><b>${p_desc[key]["pm"]}</b></em> correlation is found between ${p_desc[key]["text"]}<br><br><br><br>`) // create on-click listening events function xlabelGroup.selectAll("text").on("click", function(){ // get current label var value = d3.select(this).attr("value") if (value != `${chosenX}_label`){ // console.log(value.slice(0, -6), `${chosenX}_label`) chosenX = value.slice(0, -6); // update x,y Scales xScale = make_xScale(data, chosenX, chartWidth); xAxis = renderXAxis(xScale, xAxis); // update circle location and text renderCircles(circles, texts, xScale, chosenX, yScale, chosenY) // update toolTip circles = updateToolTip(chosenX,chosenY,circles); // update labels' active & inactive class xlabelGroup.selectAll("text") .classed("active", false) .classed("inactive", true) d3.select(this).classed("inactive", false) .classed("active", true) // update title d3.select("#plot-title").text(`${chosenX.replace(chosenX[0], chosenX[0].toUpperCase())} vs. ${chosenY.replace(chosenY[0], chosenY[0].toUpperCase())}`) // update text description var key = chosenX.concat("-", chosenY) d3.select("#article") .html(`<br><hr><h4>Correlation between <em><b>${chosenX}</b></em> and <em><b>${chosenY}</b></em></h4>` + `<br>A <em><b>${p_desc[key]["pm"]}</b></em> correlation is found between ${p_desc[key]["text"]}<br><br><br><br>`) } }) ylabelGroup.selectAll("text").on("click", function(){ // get current y-label var value = d3.select(this).attr("value"); if (value != `${chosenY}_label`){ // console.log(value.slice(0, -6), `${chosenY}_label`) chosenY = value.slice(0, -6); // update x,y Scales yScale = make_yScale(data, chosenY, chartHeight); yAxis = renderYAxis(yScale, yAxis); // update circle location and text renderCircles(circles, texts, xScale, chosenX, yScale, chosenY) // update toolTip circles = updateToolTip(chosenX,chosenY,circles); // update labels' active & inactive class ylabelGroup.selectAll("text") .classed("active", false) .classed("inactive", true) d3.select(this).classed("inactive", false) .classed("active", true) // update title d3.select("#plot-title") .html(`${chosenX.replace(chosenX[0], chosenX[0].toUpperCase())} vs. ${chosenY.replace(chosenY[0], chosenY[0].toUpperCase())}`) // update text description var key = chosenX.concat("-", chosenY) d3.select("#article") .html(`<br><hr><h4>Correlation between <em><b>${chosenX}</b></em> and <em><b>${chosenY}</b></em></h4>` + `<br>A <em><b>${p_desc[key]["pm"]}</b></em> correlation is found between ${p_desc[key]["text"]}`) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function plot() {\n \n }", "function plot() {\n\n}", "function initPlot() {\n var Us = calculateUs();\n if (deltaHapproach==\"briggs\"){\n var hprime = calculateSTdownwash();\n }\n else{\n var hprime = h;\n }\n //var deltaH = calculateDeltaH(Us);\n //var H = h + deltaH;\n...
[ "0.7723056", "0.75435096", "0.6862599", "0.67845917", "0.6578987", "0.65763", "0.65581876", "0.65131295", "0.64887834", "0.6453281", "0.6447796", "0.64342815", "0.639532", "0.63708407", "0.6368841", "0.6360163", "0.6344205", "0.6300614", "0.62913066", "0.6286553", "0.6281404"...
0.0
-1
function to update xScale
function make_xScale(data, chosenX, chartWidth){ var xScale = d3.scaleLinear() .domain([d3.min(data, d => d[chosenX]) * 0.9, d3.max(data, d => d[chosenX]) * 1.05]) .range([0, +chartWidth]); return xScale; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateXScale(xData,curXAxis){\n var xLineraScale = d3.scaleLinear()\n .domain([d3.min(xData, d=> d[curXAxis]),d3.max(xData, d=> d[curXAxis])])\n .range([0,chartWidth]);\n return xLineraScale; \n\n}", "function updateXscale(data, chosen_x_axis) {\n var x_scale = d3.scaleLinear...
[ "0.7997964", "0.77594423", "0.76257735", "0.7555104", "0.74504614", "0.73994774", "0.73316544", "0.73260087", "0.73124844", "0.7307168", "0.72852063", "0.72852063", "0.7250201", "0.7250201", "0.7221877", "0.7207311", "0.7073969", "0.70364356", "0.7019429", "0.6982343", "0.697...
0.0
-1
function to update yScale
function make_yScale(data, chosenY, chartHeight){ var yScale = d3.scaleLinear() .domain([d3.min(data, d => d[chosenY]) * 0.75, d3.max(data, d => d[chosenY]) * 1.05]) .range([chartHeight, 0]); return yScale; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateYScale(yData,curYaxis){\n var yLinearScale = d3.scaleLinear()\n .domain([d3.min(yData, d=> d[curYaxis]),d3.max(yData, d=> d[curYaxis])])\n .range([chartHeight,0]);\n\n // var yLinearScale = d3.scaleLinear()\n // .domain([d3.min(yData, d=> d[curYaxis]),d3.max(yData, d=> d[c...
[ "0.8070325", "0.78316516", "0.77692944", "0.7733586", "0.7517054", "0.74816465", "0.7463892", "0.7449283", "0.74182", "0.7336386", "0.73130727", "0.73106486", "0.72685754", "0.72308606", "0.7229374", "0.721915", "0.7195053", "0.713515", "0.71286905", "0.7122265", "0.7108821",...
0.6973258
31