idx int64 0 58k | question stringlengths 46 4.3k | target stringlengths 5 845 |
|---|---|---|
0 | function ( state , action ) { return _ . defaults ( { isValidating : action . isValidating , lastAction : IS_VALIDATING } , state ) } | Update is validating result |
1 | function addWidgetForFilter ( view , filter , editModeHint ) { var gridster = view . _widgetsGridster ; var row = filter . row || 1 ; var col = filter . col || 1 ; var sizeX = filter . size_x || 3 ; var sizeY = filter . size_y || 3 ; var el = gridster . add_widget ( '<div class="widgetOuterFrame"></div>' , sizeX , size... | Add a widget to the analyze page for the given filter |
2 | function inRange ( value , min , max ) { const int = parseInt ( value , 10 ) return ( ` ${ int } ` === ` ${ value . replace ( / ^0 / , '' ) } ` && int >= min && int <= max ) } | Determine if value is within a numeric range |
3 | function markdown ( options ) { return new Remarkable ( extend ( { breaks : false , html : true , langPrefix : 'lang-' , linkify : true , typographer : false , xhtmlOut : false } , options ) ) ; } | Shared settings for remarkable |
4 | function partitionValueToIndex ( partition , value ) { var group ; if ( ! partition ) { return 0 ; } group = partition . groups . get ( value , 'value' ) ; if ( group ) { return group . groupIndex ; } else { return - 1 ; } } | Get the index in chartjs datastructures from the group value with proper fallbacks |
5 | function _validateArray ( path , model , validateModelType ) { const results = [ ] let subPath = ` ${ path } ` if ( _ . isPlainObject ( model . items ) ) { if ( model . items . type === 'object' ) { results . push ( validateSubModel ( subPath , model . items , validateModelType ) ) } } else if ( Array . isArray ( model... | Validate the array definition |
6 | function getDefaults ( value , path , model , resolveRef ) { const schema = findSchema ( model , path , resolveRef ) const schemaDefault = _ . clone ( schema . default ) if ( model . type === 'object' ) { const subSchemaDefaults = { } _ . forIn ( schema . properties , function ( subSchema , propName ) { const defaults ... | Returns the value with defaults provided by the schema |
7 | function getDefaultedValue ( { inputValue , previousValue , bunsenId , renderModel , mergeDefaults } ) { const isInputValueEmpty = isEmptyValue ( inputValue ) if ( previousValue !== undefined ) { return inputValue } const resolveRef = schemaFromRef ( renderModel . definitions ) const defaultValue = getDefaults ( inputV... | Returns the default value for the given model |
8 | function fieldValidation ( dispatch , getState , fieldValidators , formValue , initialFormValue , all ) { let fieldsBeingValidated = [ ] const allValidationPromises = [ ] fieldValidators . forEach ( validator => { const { field , fields , validator : validatorFunc , validators : validatorFuncs } = validator const field... | Field validation . Only validate if field has changed . Meant for expensive validations like server side validation |
9 | function _guardPromiseAll ( promises , all , callback ) { if ( promises . length === 0 ) { callback ( ) } else { all ( promises ) . then ( ( ) => { callback ( ) } ) } } | Simple function to guard Promise . all |
10 | function getPropertyOrder ( properties ) { const primitiveProps = [ ] const complexProps = [ ] _ . forIn ( properties , ( prop , propName ) => { if ( prop . type === 'object' || prop . type === 'array' ) { complexProps . push ( propName ) } else { primitiveProps . push ( propName ) } } ) return primitiveProps . concat ... | Take the properties of an object and put primitive types above non - primitive types |
11 | function addModelCell ( propertyName , model , cellDefinitions ) { const cell = { } var defName = propertyName var counter = 1 while ( defName in cellDefinitions ) { defName = ` ${ propertyName } ${ counter } ` counter ++ } cellDefinitions [ defName ] = cell const props = getPropertyOrder ( model . properties ) const c... | Add a model cell for the given model |
12 | async function run ( ) { const records = await BB . all ( process . argv . slice ( 2 ) . map ( f => readAsync ( f ) ) ) return BB . map ( records , record => kinesis . putRecord ( { Data : JSON . stringify ( yaml . safeLoad ( record ) ) , PartitionKey : '0' , StreamName : process . env . LAMBDA_KINESIS_STREAM_NAME } ) ... | Load the record |
13 | function appendModelPath ( modelPath , id , internal ) { const addedModelPath = getModelPath ( id ) if ( internal ) { if ( modelPath === '' ) { return ` ${ addedModelPath } ` } return ` ${ modelPath } ${ addedModelPath } ` } if ( modelPath === '' ) { return addedModelPath } return ` ${ modelPath } ${ addedModelPath } `... | Create a path to add within a model |
14 | function extendCell ( cell , cellDefinitions ) { cell = _ . clone ( cell ) while ( cell . extends ) { const extendedCell = cellDefinitions [ cell . extends ] if ( ! _ . isObject ( extendedCell ) ) { throw new Error ( ` ${ cell . extends } ` ) } delete cell . extends cell = _ . defaults ( cell , extendedCell ) } return ... | Copies a cell . If the cell extends cell definions properties from teh extended cell are copied into the new cell . |
15 | function normalizeArrayOptions ( cell , cellDefinitions ) { const arrayOptions = _ . clone ( cell . arrayOptions ) if ( arrayOptions . itemCell ) { if ( Array . isArray ( arrayOptions . itemCell ) ) { arrayOptions . itemCell = arrayOptions . itemCell . map ( cell => normalizeCell ( cell , cellDefinitions ) ) } else { a... | Normalizes cells within arrayOptions |
16 | function pluckFromArrayOptions ( cell , modelPath , models , cellDefinitions ) { if ( cell . arrayOptions . tupleCells ) { cell . arrayOptions . tupleCells . forEach ( function ( cell , index ) { pluckModels ( cell , modelPath . concat ( index ) , models , cellDefinitions ) } ) } if ( cell . arrayOptions . itemCell ) {... | Collects schemas from a cell s array options to add to the model in a hash . |
17 | function pluckModels ( cell , modelPath , models , cellDefinitions ) { cell = extendCell ( cell , cellDefinitions ) if ( _ . isObject ( cell . model ) ) { const addedPath = appendModelPath ( modelPath . modelPath ( ) , cell . id , cell . internal ) models [ addedPath ] = cell . model } else if ( cell . children ) { cel... | Collects schemas from a cell to add to the model in a hash . Keys in the hash are the schema s path withinthe bunsen model . |
18 | function aggregateModels ( view , modelPath ) { const models = { } view . cells . forEach ( function ( cell ) { const newPath = typeof cell . model === 'string' ? modelPath . concat ( cell . model ) : modelPath pluckModels ( cell , newPath , models , view . cellDefinitions ) } ) return models } | Collects schemas from a cell to add to the model in a hash . |
19 | function expandModel ( model , view ) { const modelPath = new BunsenModelPath ( model ) const modelExpansions = aggregateModels ( view , modelPath ) let newModel = model _ . forEach ( modelExpansions , ( propertyModel , path ) => { newModel = addBunsenModelProperty ( newModel , propertyModel , path ) } ) return newMode... | Adds to an existing bunsen model with schemas defined in the view |
20 | function svgs ( req , res ) { const bundle = new Bundle ( req . url . slice ( 1 , - 5 ) . split ( '-' ) . map ( function map ( name ) { return assets [ name ] ; } ) ) ; bundle . run ( function ( err , output ) { if ( err ) throw err ; res . setHeader ( 'Content-Length' , Buffer ( output ) . length ) ; res . writeHead (... | Serve the bundle . svgs . |
21 | function html ( req , res ) { fs . readFile ( path . join ( __dirname , 'index.html' ) , function read ( err , file ) { if ( err ) throw err ; res . setHeader ( 'Content-Length' , file . length ) ; res . writeHead ( 200 , { 'Content-Type' : 'text/html' } ) ; res . end ( file ) ; } ) ; } | Serve the index . html |
22 | function client ( req , res ) { const compiler = webpack ( config ) ; compiler . outputFileSystem = fsys ; compiler . run ( ( err , stats ) => { const file = fsys . readFileSync ( path . join ( __dirname , 'dist' , 'client.js' ) ) ; res . setHeader ( 'Content-Length' , file . length ) ; res . writeHead ( 200 , { 'Conte... | Serve the index . js client bundle . |
23 | function convertObjectCell ( cell ) { return _ . chain ( cell . rows ) . map ( rowsToCells ) . assign ( _ . pick ( cell , CARRY_OVER_PROPERTIES ) ) . value ( ) } | Converts an complex container cell for an object into a v2 cell |
24 | function convertArrayCell ( cell ) { const { item } = cell const arrayOptions = _ . chain ( item ) . pick ( ARRAY_CELL_PROPERTIES ) . assign ( { itemCell : convertCell ( item ) } ) . value ( ) return { arrayOptions , model : cell . model } } | Converts a container cell that displays an array into a v2 cell |
25 | function convertRenderer ( cell ) { const { renderer } = cell if ( renderer === undefined ) { return } const basicRenderers = [ 'boolean' , 'string' , 'number' ] if ( basicRenderers . indexOf ( renderer ) >= 0 ) { return { name : renderer } } return customRenderer ( renderer , cell . properties ) } | Converts v1 renderer information to v2 for a cell |
26 | function grabClassNames ( cell ) { const classNames = _ . pickBy ( { cell : cell . className , value : cell . inputClassName , label : cell . labelClassName } ) if ( _ . size ( classNames ) > 0 ) { return classNames } } | Creates class name block for v2 cell |
27 | function rowsToCells ( rows ) { if ( ! rows ) { return { } } const children = rows . map ( ( row ) => { return { children : _ . map ( row , convertCell ) } } ) return { children } } | Converts rows of v1 cells to v2 cells . Simplifies the row structure when possible . |
28 | function warning ( lines ) { lines . unshift ( '' ) ; lines . push ( '' ) ; lines . forEach ( function each ( line ) { console . error ( 'asset-bundle:warning' , line ) ; } ) ; } | Really stupid simple warning output . |
29 | function viewBox ( details ) { svg . viewBox = ` ${ details . x || 0 } ${ details . y || 0 } ${ details . width } ${ details . height } ` ; fn ( null , svg ) ; } | Compile a viewBox from the given . |
30 | function ( ) { var filter = this . collection . parent . filter ; if ( ! filter || ! this . isFilled ) { return false ; } filter . releaseDataFilter ( ) ; if ( this . type === 'partition' ) { var partition = filter . partitions . get ( this . rank , 'rank' ) ; filter . partitions . remove ( partition ) ; } else if ( th... | Remove facet from the slot |
31 | function getWebpackRunnableLambda ( slsWebpack , stats , functionName ) { const handler = slsWebpack . loadHandler ( stats , functionName , true ) const context = slsWebpack . getContext ( functionName ) return wrapHandler ( handler , context ) } | Based on ServerlessWebpack . run |
32 | function onClick ( ev , elements ) { var model = this . _Ampersandview . model ; var partition = model . filter . partitions . get ( 1 , 'rank' ) ; if ( elements . length > 0 ) { partition . updateSelection ( partition . groups . models [ elements [ 0 ] . _index ] ) ; model . filter . updateDataFilter ( ) ; app . me . ... | Called by Chartjs this - > chart instance |
33 | function getColor ( i ) { i = parseInt ( i ) ; if ( i < 0 || i >= colors . length ) { return scale ( ( ( i - colors . length ) * ( 211 / 971 ) ) % 1 ) ; } else { return chroma ( colors [ i ] ) ; } } | Get i - th color |
34 | function init ( loader ) { var loaderConfig = loaderUtils . getLoaderConfig ( loader , 'web3Loader' ) ; web3 = require ( './lib/web3' ) ( loaderConfig . provider ) ; config = mergeConfig ( loaderConfig ) ; isDebug = loader . debug ; } | Initialize the loader with web3 and config |
35 | function mergeConfig ( loaderConfig ) { var defaultConfig = { provider : 'http://localhost:8545' , from : web3 . eth . accounts [ 0 ] , gasLimit : web3 . eth . getBlock ( web3 . eth . defaultBlock ) . gasLimit , constructorParams : { } , deployedContracts : { } } ; var mergedConfig = loaderConfig ; for ( var key in def... | Merge loaderConfig and default configurations |
36 | function deploy ( contract , callback , contractMap ) { if ( config . deployedContracts . hasOwnProperty ( contract . name ) ) { contract . address = config . deployedContracts [ contract . name ] ; return callback ( null , contract ) ; } linkBytecode ( contract , contractMap ) ; var params = resolveConstructorParams (... | Deploy contracts if it is not already deployed |
37 | function _validateRootAttributes ( view , model , cellValidator ) { const results = [ _validateCells ( view , model , cellValidator ) ] const knownAttributes = [ 'version' , 'type' , 'cells' , 'cellDefinitions' ] const unknownAttributes = _ . difference ( Object . keys ( view ) , knownAttributes ) results . push ( { er... | Validate the root attributes of the view |
38 | function ( ) { this . mainView = new MainView ( { model : this . me , el : document . body } ) ; this . router . history . start ( { root : '/' , pushState : true } ) ; } | This is where it all starts |
39 | function ( i ) { if ( i >= columns . length ) { insertIntoDB ( ) ; return ; } var dbField = columns [ i ] ; var field = dbField . Field ; if ( dbField . Null === 'NO' && dbField . Default === '' && dbField . Extra !== 'auto_increment' && dbField . Extra . search ( 'on update' ) === - 1 ) { if ( undefOrEmpty ( req . bod... | Forced sync iterator |
40 | function insertIntoDB ( ) { lastQry = connection . query ( 'INSERT INTO ?? SET ?' , [ req . params . table , insertJson ] , function ( err , rows ) { if ( err ) { console . error ( err ) ; res . statusCode = 500 ; res . send ( { result : 'error' , err : err . code } ) ; } else { sendSuccessAnswer ( req . params . table... | start the async for loop When the loop is finished write everything in the database |
41 | function updateIntoDB ( ) { lastQry = connection . query ( 'UPDATE ?? SET ? WHERE ?? = ?' , [ req . params . table , updateJson , updateSelector . field , updateSelector . value ] , function ( err ) { if ( err ) return sendError ( res , err . code ) ; sendSuccessAnswer ( req . params . table , res , req . params . id ,... | start the async for loop |
42 | function sendSuccessAnswer ( table , res , id , field ) { if ( typeof field === "undefined" ) { if ( id === 0 ) { res . send ( { result : 'success' , table : table } ) ; return ; } else { field = "id" ; } } lastQry = connection . query ( 'SELECT * FROM ?? WHERE ?? = ?' , [ table , field , id ] , function ( err , rows )... | Send the edited element to the requester |
43 | function checkIfSentvaluesAreSufficient ( req , dbField ) { if ( dbField . Default == 'FILE' ) { if ( req . files . hasOwnProperty ( dbField . Field ) ) { var file = req . files [ dbField . Field ] . hasOwnProperty ( 'name' ) ? req . files [ dbField . Field ] : req . files [ dbField . Field ] [ 0 ] ; if ( settings . ma... | Check roughly if the provided value is sufficient for the database field |
44 | function sendError ( res , err ) { console . error ( err ) ; console . error ( lastQry . sql ) ; res . statusCode = 500 ; res . send ( { result : 'error' , err : err } ) ; } | Send error messsage to the user |
45 | function findPrim ( columns , field ) { var primary_keys = columns . filter ( function ( r ) { return r . Key === 'PRI' ; } ) ; if ( primary_keys . length > 0 ) { return primary_keys [ 0 ] . Field ; } if ( typeof field === "string" ) { if ( checkIfFieldsExist ( field , columns ) ) { return escape ( field ) ; } } return... | Get primary key or if specified |
46 | function checkRateRange ( num ) { var numString = num . substring ( 0 , num . length - 1 ) ; var parseNum = parseInt ( numString ) ; if ( parseNum < 20 ) { throw new Error ( "The minimum rate is twenty percentage. Received: " + parseNum ) ; } } | This method ensures that the value of the rate must be equal or great than 20% |
47 | function isInList ( value , listOfValues , msg ) { value = value . toLowerCase ( ) . trim ( ) ; if ( listOfValues . indexOf ( value ) === - 1 ) { throw new Error ( msg ) ; } } | This method validates if the value exists in the list of values |
48 | function equals ( x , y ) { var a = isFunction ( x ) ? x ( ) : x ; var b = isFunction ( y ) ? y ( ) : y ; var aKeys ; if ( a == b ) return true ; else if ( a == _null || b == _null ) return false ; else if ( isValue ( a ) || isValue ( b ) ) return isDate ( a ) && isDate ( b ) && + a == + b ; else if ( isList ( a ) ) { ... | equals if a and b have the same elements and all are equal . Supports getters . |
49 | function parseDate ( fmt , date ) { var indexMap = { } ; var reIndex = 1 ; var timezoneOffsetMatch ; var timezoneIndex ; var match ; var format = replace ( fmt , / ^\? / ) ; if ( format != fmt && ! trim ( date ) ) return _null ; if ( match = / ^\[([+-])(\d\d)(\d\d)\]\s*(.*) / . exec ( format ) ) { timezoneOffsetMatch =... | returns date ; null if optional and not set ; undefined if parsing failed |
50 | function collectUniqNodes ( list , func ) { var result = [ ] ; var nodeIds = { } ; var currentNodeId ; flexiEach ( list , function ( value ) { flexiEach ( func ( value ) , function ( node ) { if ( ! nodeIds [ currentNodeId = getNodeId ( node ) ] ) { result . push ( node ) ; nodeIds [ currentNodeId ] = true ; } } ) ; } ... | collect variant that filters out duplicate nodes from the given list returns a new array |
51 | function triggerHandler ( eventName , event , target ) { var match = ! bubbleSelector ; var el = bubbleSelector ? target : registeredOn ; if ( bubbleSelector ) { var selectorFilter = getFilterFunc ( bubbleSelector , registeredOn ) ; while ( el && el != registeredOn && ! ( match = selectorFilter ( el ) ) ) el = el [ 'pa... | returns true if processing should be continued |
52 | function enrichMethodNode ( methodNode , method ) { method . description && ( methodNode . description = method . description ) if ( method . tags . route ) { let httpPath = method . tags . route let httpMethod = 'GET' const sepPos = httpPath . indexOf ( ' ' ) if ( sepPos !== - 1 ) { httpMethod = httpPath . substr ( 0 ... | Enriches service method node by adding method route and description attributes . |
53 | function refract ( value ) { if ( value instanceof Element ) { return value ; } if ( typeof value === 'string' ) { return new StringElement ( value ) ; } if ( typeof value === 'number' ) { return new NumberElement ( value ) ; } if ( typeof value === 'boolean' ) { return new BooleanElement ( value ) ; } if ( value === n... | Refracts a JSON type to minim elements |
54 | function statusLog ( file , data , time ) { var msg = '' ; var diff = ( process . hrtime ( time ) [ 1 ] / 1000000000 ) . toFixed ( 2 ) ; var adapters = Object . keys ( data . _adapterData ) . join ( ', ' ) ; msg += format ( 'Supercollider: processed %s in %s' , chalk . cyan ( file ) , chalk . magenta ( diff + ' s' ) ) ... | Logs the completion of a page being processed to the console . |
55 | function CodeMirror ( place , options ) { if ( ! ( this instanceof CodeMirror ) ) return new CodeMirror ( place , options ) ; this . options = options = options ? copyObj ( options ) : { } ; copyObj ( defaults , options , false ) ; setGuttersForLineNumbers ( options ) ; var doc = options . value ; if ( typeof doc == "s... | A CodeMirror instance represents an editor . This is the object that user code is usually dealing with . |
56 | function updateWidgetHeight ( line ) { if ( line . widgets ) for ( var i = 0 ; i < line . widgets . length ; ++ i ) line . widgets [ i ] . height = line . widgets [ i ] . node . offsetHeight ; } | Read and store the height of line widgets associated with the given line . |
57 | function ensureLineWrapped ( lineView ) { if ( lineView . node == lineView . text ) { lineView . node = elt ( "div" , null , null , "position: relative" ) ; if ( lineView . text . parentNode ) lineView . text . parentNode . replaceChild ( lineView . node , lineView . text ) ; lineView . node . appendChild ( lineView . ... | Lines with gutter elements widgets or a background class need to be wrapped and have the extra elements added to the wrapper div |
58 | function extendSelection ( doc , head , other , options ) { setSelection ( doc , new Selection ( [ extendRange ( doc , doc . sel . primary ( ) , head , other ) ] , 0 ) , options ) ; } | Extend the primary selection range discard the rest . |
59 | function skipAtomic ( doc , pos , bias , mayClear ) { var flipped = false , curPos = pos ; var dir = bias || 1 ; doc . cantEdit = false ; search : for ( ; ; ) { var line = getLine ( doc , curPos . line ) ; if ( line . markedSpans ) { for ( var i = 0 ; i < line . markedSpans . length ; ++ i ) { var sp = line . markedSpa... | Ensure a given position is not inside an atomic range . |
60 | function drawSelectionCursor ( cm , range , output ) { var pos = cursorCoords ( cm , range . head , "div" , null , null , ! cm . options . singleCursorHeightPerLine ) ; var cursor = output . appendChild ( elt ( "div" , "\u00a0" , \u00a0 ) ) ; "CodeMirror-cursor" cursor . style . left = pos . left + "px" ; cursor . styl... | Draws a cursor for the given range |
61 | function findViewForLine ( cm , lineN ) { if ( lineN >= cm . display . viewFrom && lineN < cm . display . viewTo ) return cm . display . view [ findViewIndex ( cm , lineN ) ] ; var ext = cm . display . externalMeasured ; if ( ext && lineN >= ext . lineN && lineN < ext . lineN + ext . size ) return ext ; } | Find a line view that corresponds to the given line number . |
62 | function prepareMeasureForLine ( cm , line ) { var lineN = lineNo ( line ) ; var view = findViewForLine ( cm , lineN ) ; if ( view && ! view . text ) view = null ; else if ( view && view . changes ) updateLineForChanges ( cm , view , lineN , getDimensions ( cm ) ) ; if ( ! view ) view = updateExternalMeasurement ( cm ,... | Measurement can be split in two steps the set - up work that applies to the whole line and the measurement of the actual character . Functions like coordsChar that need to do a lot of measurements in a row can thus ensure that the set - up work is only done once . |
63 | function charWidth ( display ) { if ( display . cachedCharWidth != null ) return display . cachedCharWidth ; var anchor = elt ( "span" , "xxxxxxxxxx" ) ; var pre = elt ( "pre" , [ anchor ] ) ; removeChildrenAndAdd ( display . measure , pre ) ; var rect = anchor . getBoundingClientRect ( ) , width = ( rect . right - rec... | Compute the default character width . |
64 | function endOperation ( cm ) { var op = cm . curOp , group = op . ownsGroup ; if ( ! group ) return ; try { fireCallbacksForOps ( group ) ; } finally { operationGroup = null ; for ( var i = 0 ; i < group . ops . length ; i ++ ) group . ops [ i ] . cm . curOp = null ; endOperations ( group ) ; } } | Finish an operation updating the display and signalling delayed events |
65 | function setScrollTop ( cm , val ) { if ( Math . abs ( cm . doc . scrollTop - val ) < 2 ) return ; cm . doc . scrollTop = val ; if ( ! gecko ) updateDisplaySimple ( cm , { top : val } ) ; if ( cm . display . scroller . scrollTop != val ) cm . display . scroller . scrollTop = val ; cm . display . scrollbars . setScrollT... | Sync the scrollable area and scrollbars ensure the viewport covers the visible area . |
66 | function ensureCursorVisible ( cm ) { resolveScrollToPos ( cm ) ; var cur = cm . getCursor ( ) , from = cur , to = cur ; if ( ! cm . options . lineWrapping ) { from = cur . ch ? Pos ( cur . line , cur . ch - 1 ) : cur ; to = Pos ( cur . line , cur . ch + 1 ) ; } cm . curOp . scrollToPos = { from : from , to : to , marg... | Make sure that at the end of the operation the current cursor is shown . |
67 | function takeToken ( cm , pos , precise , asArray ) { function getObj ( copy ) { return { start : stream . start , end : stream . pos , string : stream . current ( ) , type : style || null , state : copy ? copyState ( doc . mode , state ) : state } ; } var doc = cm . doc , mode = doc . mode , style ; pos = clipPos ( do... | Utility for getTokenAt and getLineTokens |
68 | function buildLineContent ( cm , lineView ) { var content = elt ( "span" , null , null , webkit ? "padding-right: .1px" : null ) ; var builder = { pre : elt ( "pre" , [ content ] ) , content : content , col : 0 , pos : 0 , cm : cm } ; lineView . measure = { } ; for ( var i = 0 ; i <= ( lineView . rest ? lineView . rest... | Render the DOM representation of the text of a line . Also builds up a line map which points at the DOM nodes that represent specific stretches of text and is used by the measuring code . The returned object contains the DOM node this map and information about line - wide styles that were set by the mode . |
69 | function buildToken ( builder , text , style , startStyle , endStyle , title , css ) { if ( ! text ) return ; var special = builder . cm . options . specialChars , mustWrap = false ; if ( ! special . test ( text ) ) { builder . col += text . length ; var content = document . createTextNode ( text ) ; builder . map . pu... | Build up the DOM representation for a single token and add it to the line map . Takes care to render special characters separately . |
70 | function ( at , lines , height ) { this . height += height ; this . lines = this . lines . slice ( 0 , at ) . concat ( lines ) . concat ( this . lines . slice ( at ) ) ; for ( var i = 0 ; i < lines . length ; ++ i ) lines [ i ] . parent = this ; } | Insert the given array of lines at offset at count them as having the given height . |
71 | function clearSelectionEvents ( array ) { while ( array . length ) { var last = lst ( array ) ; if ( last . ranges ) array . pop ( ) ; else break ; } } | Pop all selection events off the end of a history array . Stop at a change event . |
72 | function ( ) { if ( blob_changed || ! object_url ) { object_url = get_URL ( ) . createObjectURL ( blob ) ; } if ( target_view ) { target_view . location . href = object_url ; } else { var new_tab = view . open ( object_url , "_blank" ) ; if ( new_tab == undefined && typeof safari !== "undefined" ) { view . location . h... | First try a . download then web filesystem then object URLs |
73 | function DOMMouseMoveTracker ( onMove , onMoveEnd , domNode ) { this . $DOMMouseMoveTracker_isDragging = false ; this . $DOMMouseMoveTracker_animationFrameID = null ; this . $DOMMouseMoveTracker_domNode = domNode ; this . $DOMMouseMoveTracker_onMove = onMove ; this . $DOMMouseMoveTracker_onMoveEnd = onMoveEnd ; this . ... | onMove is the callback that will be called on every mouse move . onMoveEnd is called on mouse up when movement has ended . |
74 | function ( target , eventType , callback ) { if ( target . addEventListener ) { target . addEventListener ( eventType , callback , false ) ; return { remove : function ( ) { target . removeEventListener ( eventType , callback , false ) ; } } ; } else if ( target . attachEvent ) { target . attachEvent ( 'on' + eventType... | Listen to DOM events during the bubble phase . |
75 | function ( combinedWidth , leftOffset , cellWidth , cellMinWidth , cellMaxWidth , columnKey , event ) { if ( Locale . isRTL ( ) ) { leftOffset = - leftOffset ; } this . setState ( { isColumnResizing : true , columnResizingData : { left : leftOffset + combinedWidth - cellWidth , width : cellWidth , minWidth : cellMinWid... | This is called when a cell that is in the header of a column has its resizer knob clicked on . It displays the resizer and puts in the correct location on the table . |
76 | function forEachColumn ( children , callback ) { React . Children . forEach ( children , function ( child ) { if ( child . type === FixedDataTableColumnGroup . type ) { forEachColumn ( child . props . children , callback ) ; } else if ( child . type === FixedDataTableColumn . type ) { callback ( child ) ; } } ) ; } | Helper method to execute a callback against all columns given the children of a table . |
77 | function mapColumns ( children , callback ) { var newChildren = [ ] ; React . Children . forEach ( children , function ( originalChild ) { var newChild = originalChild ; if ( originalChild . type === FixedDataTableColumnGroup . type ) { var haveColumnsChanged = false ; var newColumns = [ ] ; forEachColumn ( originalChi... | Helper method to map columns to new columns . This takes into account column groups and will generate a new column group if its columns change . |
78 | function FixedDataTableRowBuffer ( rowsCount , defaultRowHeight , viewportHeight , rowHeightGetter ) { invariant ( defaultRowHeight !== 0 , "defaultRowHeight musn't be equal 0 in FixedDataTableRowBuffer" ) ; this . $FixedDataTableRowBuffer_bufferSet = new IntegerBufferSet ( ) ; this . $FixedDataTableRowBuffer_defaultRo... | FixedDataTableRowBuffer is a helper class that executes row buffering logic for FixedDataTable . It figures out which rows should be rendered and in which positions . |
79 | function cx ( classNames ) { var classNamesArray ; if ( typeof classNames == 'object' ) { classNamesArray = Object . keys ( classNames ) . filter ( function ( className ) { return classNames [ className ] ; } ) ; } else { classNamesArray = Array . prototype . slice . call ( arguments ) ; } return classNamesArray . map ... | This function is used to mark string literals representing CSS class names so that they can be transformed statically . This allows for modularization and minification of CSS class names . |
80 | function ( obj ) { var ret = { } ; var key ; invariant ( obj instanceof Object && ! Array . isArray ( obj ) , 'keyMirror(...): Argument must be an object.' ) ; for ( key in obj ) { if ( ! obj . hasOwnProperty ( key ) ) { continue ; } ret [ key ] = key ; } return ret ; } | Constructs an enumeration with keys equal to their value . |
81 | function shallowEqual ( objA , objB ) { if ( objA === objB ) { return true ; } var key ; for ( key in objA ) { if ( objA . hasOwnProperty ( key ) && ( ! objB . hasOwnProperty ( key ) || objA [ key ] !== objB [ key ] ) ) { return false ; } } for ( key in objB ) { if ( objB . hasOwnProperty ( key ) && ! objA . hasOwnProp... | Performs equality by iterating through keys on an object and returning false when any key has values which are not strictly equal between objA and objB . Returns true when the values of all keys are strictly equal . |
82 | function ( a ) { var b ; if ( arguments . length < 7 ) throw new Error ( "markup() must be called from String.prototype.replace()" ) ; return b = e . apply ( null , arguments ) , '<span class="' + d [ b ] + '">' + a + "</span>" } | cache some regular expressions |
83 | function FakeEvent ( type , bubbles , cancelable , target ) { this . initEvent ( type , bubbles , cancelable , target ) ; } | A naive implementation for simulating upload events |
84 | function padcomments ( str , num ) { var nl = _str . repeat ( '\n' , \n ) ; ( num || 1 ) } | fix multiline Bootstrap - style comments |
85 | function ( obj , cache ) { cache [ obj . cid ] = obj ; this . listenToOnce ( obj , 'before-dispose' , function ( ) { delete cache [ obj . cid ] ; } ) ; } | Initialize the given object in the given cache . |
86 | function hotswap ( currentNode , newNode , ignoreElements ) { var newNodeType = newNode . nodeType , currentNodeType = currentNode . nodeType , swapMethod ; if ( newNodeType !== currentNodeType ) { $ ( currentNode ) . replaceWith ( newNode ) ; } else { swapMethod = swapMethods [ newNodeType ] || swapMethods [ 'default'... | Changes DOM Nodes that are different and leaves others untouched . |
87 | function cleanupStickitData ( node ) { var $node = $ ( node ) ; var stickitValue = $node . data ( 'stickit-bind-val' ) ; if ( node . tagName === 'OPTION' && node . value !== undefined && stickitValue !== node . value ) { $node . removeData ( 'stickit-bind-val' ) ; } } | Stickit will rely on the stickit - bind - val jQuery data attribute to determine the value to use for a given option . If the value DOM attribute is not the same as the stickit - bind - val then this will clear the jquery data attribute so that stickit will use the value DOM attribute of the option . This happens when ... |
88 | function ( $el , template , context , opts ) { var newDOM , newHTML , el = $el . get ( 0 ) ; opts = opts || { } ; newHTML = opts . newHTML || template ( context ) ; if ( opts . force ) { $el . html ( newHTML ) ; } else { newDOM = this . copyTopElement ( el ) ; $ ( newDOM ) . html ( newHTML ) ; this . hotswapKeepCaret (... | Performs efficient re - rendering of a template . |
89 | function ( currentNode , newNode , ignoreElements ) { var currentCaret , activeElement , currentNodeContainsActiveElement = false ; try { activeElement = document . activeElement ; } catch ( error ) { activeElement = null ; } if ( activeElement && currentNode && $ . contains ( activeElement , currentNode ) ) { currentN... | Call this . hotswap but also keeps the caret position the same |
90 | function ( el ) { var newDOM = document . createElement ( el . tagName ) ; _ . each ( el . attributes , function ( attrib ) { newDOM . setAttribute ( attrib . name , attrib . value ) ; } ) ; return newDOM ; } | Produces a copy of the element tag with attributes but with no contents |
91 | function ( options ) { options = options || { } ; options . idsToFetch = options . idsToFetch || this . trackedIds ; options . setOptions = options . setOptions || { remove : false } ; return this . __loadWrapper ( function ( ) { if ( options . idsToFetch && options . idsToFetch . length ) { return parentInstance . fet... | Will force the cache to fetch just the registered ids of this collection |
92 | function ( ids , options ) { options = options || { } ; options . idsToFetch = _ . intersection ( ids , this . getTrackedIds ( ) ) ; return this . fetch ( options ) ; } | Will force the cache to fetch a subset of this collection s tracked ids |
93 | function ( ids ) { this . remove ( _ . difference ( this . trackedIds , ids ) ) ; parentInstance . registerIds ( ids , ownerKey ) ; this . trackedIds = ids ; } | Pass a list of ids to begin tracking . This will reset any previous list of ids being tracked . Overrides the Id registration system to route via the parent collection |
94 | function ( options ) { options = options || { } ; var idsNotInCache = _ . difference ( this . getTrackedIds ( ) , _ . pluck ( parentInstance . models , 'id' ) ) ; var idsWithPromises = _ . pick ( parentInstance . idPromises , idsNotInCache ) ; options . idsToFetch = _ . difference ( idsNotInCache , _ . uniq ( _ . flatt... | Will force the cache to fetch any of this collection s tracked models that are not in the cache while not fetching models that are already in the cache . Useful when you want the effeciency of pulling models from the cache and don t need all the models to be up - to - date . |
95 | function ( modelIdentifier ) { var model = this . get ( modelIdentifier ) ; parentClass . remove . apply ( this , arguments ) ; if ( model ) { var trackedIdsWithoutModel = this . getTrackedIds ( ) ; trackedIdsWithoutModel = _ . without ( trackedIdsWithoutModel , model . id ) ; this . trackIds ( trackedIdsWithoutModel )... | In addition to removing the model from the collection also remove it from the list of tracked ids . |
96 | function ( args ) { base . call ( this , args ) ; this . loadedOnceDeferred = new $ . Deferred ( ) ; this . loadedOnce = false ; this . loadingCount = 0 ; this . loading = false ; } | Adds the loading mixin |
97 | function ( fetchMethod , options ) { var object = this ; this . loadingCount ++ ; this . loading = true ; this . trigger ( 'load-begin' ) ; return $ . when ( fetchMethod . call ( object , options ) ) . always ( function ( ) { if ( ! object . loadedOnce ) { object . loadedOnce = true ; object . loadedOnceDeferred . reso... | Base load function that will trigger a load - begin and a load - complete as the fetch happens . Use this method to wrap any method that returns a promise in loading events |
98 | function ( viewPrepare ) { var viewContext = viewPrepare ( ) || { } ; var behaviorContext = _ . omit ( this . toJSON ( ) , 'view' ) ; _ . extend ( behaviorContext , this . prepare ( ) ) ; viewContext [ this . alias ] = behaviorContext ; return viewContext ; } | Wraps the view s prepare such that it returns the combination of the view and behavior s prepare results . |
99 | function ( ) { this . listenTo ( this . view , 'initialize:complete' , this . __augmentViewPrepare ) ; this . listenTo ( this . view , 'before-dispose-callback' , this . __dispose ) ; _ . each ( eventMap , function ( callback , event ) { this . listenTo ( this . view , event , this [ callback ] ) ; } , this ) ; } | Registers defined lifecycle methods to be called at appropriate time in view s lifecycle |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.