idx int64 0 58k | question stringlengths 46 4.3k | target stringlengths 5 845 |
|---|---|---|
58,000 | function getActiveFilters ( req , selectedFilters , data , modelName , cb ) { if ( ! req ) { throw new Error ( 'req is required.' ) ; } if ( ! selectedFilters || ! Array . isArray ( selectedFilters ) || ! selectedFilters . length ) { throw new Error ( 'selectedFilters is required and must be of type Array and cannot be... | Get active filters from form post data |
58,001 | function setTabId ( sections ) { sections . forEach ( function ( section , sectionIndex ) { if ( ! Array . isArray ( section ) ) { return ; } section . forEach ( function ( tab , tabIndex ) { tab . tabId = ( tab . label ) . replace ( / \s+ / g , '-' ) . toLowerCase ( ) + '-' + sectionIndex + '-' + tabIndex ; } ) ; } ) ... | Set unique tabId to each tab in overview . body |
58,002 | function renderCell ( record , field , model , cb ) { let fieldName = ( typeof field === 'object' ) ? field . fieldName : field , renderer = ( model . schema . tree [ fieldName ] && model . schema . tree [ fieldName ] . ref && linz . api . model . getObjectIdFromRefField ( record [ fieldName ] ) instanceof linz . mongo... | Return the rendered value of field . |
58,003 | function getOffset ( offset ) { var symbol = offset . charAt ( 0 ) ; var time = offset . substring ( 1 ) . split ( ':' ) ; var hours = Number . parseInt ( time [ 0 ] , 10 ) * 60 ; var minutes = Number . parseInt ( time [ 1 ] , 10 ) ; var total = Number . parseInt ( symbol + ( hours + minutes ) ) ; return total ; } | Get the offsets as an integer |
58,004 | function getConfig ( options ) { const profileOptions = { baseUrl : get ( 'pod.url' ) , headers : { 'user-agent' : ` ` , 'x-api-key' : get ( 'pod.secret' ) } , hooks : { beforeRequest : [ logRequest ] , afterResponse : [ parseResponseData ] } } return defaults ( options , profileOptions ) } | get client options from currentProfile or default |
58,005 | function defaultRenderer ( data , callback ) { linz . api . views . renderPartial ( 'action-record' , data , ( err , html ) => { if ( err ) { return callback ( err ) ; } return callback ( null , html ) ; } ) ; } | Default record action renderer . |
58,006 | async function getContext ( target , contextOptions ) { if ( isURL ( target ) ) { const cdef = await got ( target ) . then ( response => { const contentType = response . headers [ "content-type" ] switch ( contentType ) { case 'application/x-yaml' : case 'application/x-yml' : return yaml . load ( response . body ) case... | fetch and parse context from a file or http url |
58,007 | function form ( req , modelName , callback , formDsl ) { const formFn = ( ) => new Promise ( ( resolve , reject ) => { const formLabels = labels ( modelName ) ; const schema = get ( modelName , true ) . schema ; if ( formDsl && typeof formDsl === 'function' ) { return resolve ( pluginHelpers . formSettings ( req , sche... | Retrieve the form DSL for a model |
58,008 | function formAsPromise ( req , modelName , formDsl ) { return new Promise ( ( resolve , reject ) => { form ( req , modelName , ( err , decoratedForm ) => { if ( err ) { return reject ( err ) ; } return resolve ( decoratedForm ) ; } , formDsl ) ; } ) ; } | Promise version of form . See form . |
58,009 | function list ( req , modelName , callback ) { return get ( modelName , true ) . getList ( req , callback ) ; } | Retrieve the list DSL for a model |
58,010 | function permissions ( user , modelName , callback ) { return get ( modelName , true ) . getPermissions ( user , callback ) ; } | Retrieve the permissions DSL for a model |
58,011 | function overview ( req , modelName , callback ) { return get ( modelName , true ) . getOverview ( req , callback ) ; } | Retrieve the overview DSL for a model |
58,012 | function labels ( modelName , callback ) { if ( callback ) { return get ( modelName , true ) . getLabels ( callback ) ; } return get ( modelName , true ) . getLabels ( ) ; } | Retrieve the labels for a model |
58,013 | function titleField ( modelName , field , callback ) { if ( field !== 'title' ) { return callback ( null , field ) ; } if ( get ( modelName , true ) . schema . paths [ field ] ) { return callback ( null , field ) ; } model ( modelName , ( err , opts ) => { if ( err ) { return callback ( err ) ; } return callback ( null... | Retrieve the title field for a model |
58,014 | async function compileContext ( target , contextOptions ) { const context = await getContext ( target , contextOptions ) return async function ( data ) { return context . map ( data ) } } | fetch a conext by path or url and return an async context . map helper function |
58,015 | function getMaxPackageNameLength ( packages ) { return Object . keys ( packages ) . reduce ( ( max , name ) => Math . max ( max , name . length ) , 0 ) ; } | Returns the max package name length |
58,016 | function padding ( packageName , maxLength ) { const length = packageName . length ; return ( length < maxLength ) ? " " . repeat ( maxLength - length ) : "" ; } | Returns the padding for the given |
58,017 | function createServer ( port , f ) { f = f || noop ; http . createServer ( handler ) . listen ( port , f ) ; return statusHelper . changeStatus ; } | Create an HTTP server that always yield 200 HTTP status code |
58,018 | function runKaba ( opts , isVerbose ) { try { const logger = new Logger ( kleur . bgYellow . black ( " kaba " ) ) ; logger . log ( "kaba started" ) ; const start = process . hrtime ( ) ; const cliConfig = new CliConfig ( opts ) ; const kaba = require ( ` ${ process . cwd ( ) } ` ) ; const buildConfig = kaba . getBuildC... | Main kaba function |
58,019 | function sendRecursively ( event , currentState , isUnhandledPass ) { var log = this . enableLogging , eventName = isUnhandledPass ? 'unhandledEvent' : event , action = currentState [ eventName ] , contexts , sendRecursiveArguments , actionArguments ; contexts = [ ] . slice . call ( arguments , 3 ) ; if ( typeof action... | Sends the event to the currentState if the event is not handled this method will proceed to call the parentState recursively until it encounters an event handler or reaches the top or root of the state path hierarchy . |
58,020 | function sendEvent ( eventName , sendRecursiveArguments , isUnhandledPass ) { sendRecursiveArguments . unshift ( eventName , this . get ( 'currentState' ) , isUnhandledPass ) ; return sendRecursively . apply ( this , sendRecursiveArguments ) ; } | Send an event to the currentState . |
58,021 | function changeEntireFormValue ( { model , nextValue , prevValue } ) { return { value : immutableOnce ( recursiveClean ( nextValue , model ) ) , valueChangeSet : getChangeSet ( prevValue , nextValue ) } } | Change value of entire form |
58,022 | function changeNestedFormValue ( { bunsenId , formValue , model , value } ) { const segments = bunsenId . split ( '.' ) const lastSegment = segments . pop ( ) const isEmpty = _ . isEmpty ( value ) && ( Array . isArray ( value ) || _ . isObject ( value ) ) && ! ( value instanceof File ) formValue = immutableOnce ( formV... | Change value of form at specified path |
58,023 | function unsetProperty ( { bunsenId , formValue , value } ) { const valueChangeSet = new Map ( ) valueChangeSet . set ( bunsenId , { value , type : 'unset' } ) return { value : unset ( formValue , bunsenId ) , valueChangeSet } } | Unset a specific property in the form |
58,024 | function ( state , action ) { let normalized let view if ( state . unnormalizedModel ) { normalized = normalizeModelAndView ( { model : state . unnormalizedModel , view : action . view } ) view = evaluateViewConditions ( normalized . view , state . value ) } else { view = evaluateViewConditions ( state . baseView , sta... | Update the bunsen model |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.