_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q10700
populate
train
function populate(schemas) { var resolver = new Resolver(schemas); // Reduce force sequential execution.
javascript
{ "resource": "" }
q10701
populateSchema
train
function populateSchema(result, schema) { var knex = this.knex; return knex.schema.hasTable(schema.tableName) .then(function (exists) { if (! exists || ! schema.populate) return result;
javascript
{ "resource": "" }
q10702
train
function () { var oGrid = this.dom.grid; var iWidth = $(oGrid.wrapper).width(); var iBodyHeight = $(this.s.dt.nTable.parentNode).outerHeight(); var iFullHeight = $(this.s.dt.nTable.parentNode.parentNode).outerHeight(); var oOverflow = this._fnDTOverflow(); var iLeftWidth = this.s.iLeftWidth, iRightWi...
javascript
{ "resource": "" }
q10703
train
function () { var nTable = this.s.dt.nTable; var nTableScrollBody = nTable.parentNode; var out = { "x": false, "y": false, "bar": this.s.dt.oScroll.iBarWidth }; if ( nTable.offsetWidth > nTableScrollBody.clientWidth ) {
javascript
{ "resource": "" }
q10704
train
function ( bAll ) { this._fnGridLayout(); this._fnCloneLeft( bAll ); this._fnCloneRight( bAll ); /* Draw callback function */ if ( this.s.fnDrawCallback !== null ) { this.s.fnDrawCallback.call( this, this.dom.clone.left, this.dom.clone.right ); }
javascript
{ "resource": "" }
q10705
train
function ( bAll ) { if ( this.s.iRightColumns <= 0 ) { return; } var that = this, i, jq, aiColumns = []; for ( i=this.s.iTableColumns-this.s.iRightColumns ; i<this.s.iTableColumns ; i++ ) { if ( this.s.dt.aoColumns[i].bVisible ) {
javascript
{ "resource": "" }
q10706
train
function ( bAll ) { if ( this.s.iLeftColumns <= 0 ) { return; } var that = this, i, jq, aiColumns = []; for ( i=0 ; i<this.s.iLeftColumns ; i++ ) { if ( this.s.dt.aoColumns[i].bVisible ) {
javascript
{ "resource": "" }
q10707
train
function ( aoOriginal, aiColumns ) { var aReturn = []; var aClones = []; var aCloned = []; for ( var i=0, iLen=aoOriginal.length ; i<iLen ; i++ ) { var aRow = []; aRow.nTr = $(aoOriginal[i].nTr).clone(true, true)[0]; for ( var j=0, jLen=this.s.iTableColumns ; j<jLen ; j++ ) { if ( $.inArray...
javascript
{ "resource": "" }
q10708
train
function ( nodeName, original, clone ) { if ( this.s.sHeightMatch == 'none' && nodeName !== 'thead' && nodeName !== 'tfoot' ) { return; } var that = this, i, iLen, iHeight, iHeight2, iHeightOriginal, iHeightClone, rootOriginal = original.getElementsByTagName(nodeName)[0], rootClone = clone.getE...
javascript
{ "resource": "" }
q10709
train
function(r, g, b, a) { var rgb = [r, g, b].map(function (c) { return number(c); });
javascript
{ "resource": "" }
q10710
train
function(h, s, l, a) { h = (number(h) % 360) / 360; s = number(s); l = number(l); a = number(a); if ([h, s, l, a].some(isNaN)) return null; var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s, m1 = l * 2 - m2; return this.rgba(hue(h + 1 / 3) * 255, hue(h) * 255, hue(h - 1 / 3) * 255, ...
javascript
{ "resource": "" }
q10711
train
function(color, amount) { var hsl = this.toHSL(color);
javascript
{ "resource": "" }
q10712
train
function(color, amount) { var hsl = this.toHSL(color);
javascript
{ "resource": "" }
q10713
train
function(color1, color2, amount) { var p = amount / 100.0; var w = p * 2 - 1; var hsl1 = this.toHSL(color1); var hsl2 = this.toHSL(color2); var a = hsl1.a - hsl2.a; var w1 = (((w * a == -1) ? w
javascript
{ "resource": "" }
q10714
reportResult
train
function reportResult(devRes, scriptRes, method) { debug('in performRetry', devRes, scriptRes, method); var returnData = { 'numAttempts': context.currentAttempt, 'maxAttempts': context.maxAttempts, // 'startTime': new Date(), // 'finishTime': new Date(), 'scriptRes': scrip...
javascript
{ "resource": "" }
q10715
performRetry
train
function performRetry(devRes, scriptRes) { var currentAttempt = context.currentAttempt; var maxAttempts = context.maxAttempts; var delay = context.delay; debug('in performRetry', currentAttempt, maxAttempts, delay); if(currentAttempt < maxAttempts) { context.currentAttempt += 1; setTi...
javascript
{ "resource": "" }
q10716
urlMatch
train
function urlMatch (asset, pattern) { var multi = pattern.split(',') var re if (multi.length > 1) { for (var i = 0, len = multi.length; i < len; i++) { re = new RegExp(multi[i].replace(/([.?+^$[\]\\(){}|/-])/g, '\\$1').replace(/\*/g, '.*'))
javascript
{ "resource": "" }
q10717
isDuplicate
train
function isDuplicate (assetToCheck, isHost) { if (parsedAssets.length <= 0) { return false } return ~parsedAssets.findIndex(function (asset) {
javascript
{ "resource": "" }
q10718
logger
train
function logger (message, warn) { if (appOptions.silent) {
javascript
{ "resource": "" }
q10719
hasInsertionPoint
train
function hasInsertionPoint (file) { var token = appOptions.pageToken if (token !== '' && String(file.contents).indexOf(token) > -1) { insertionPoint = 'token' return true } else if (token !== '' && token !== defaults.pageToken) { logger('Token not found in ' + file.relative) } var soup = new Sou...
javascript
{ "resource": "" }
q10720
buildResourceHint
train
function buildResourceHint (hint, asset, glob) { var as = '' if (hint === 'dns-prefetch' || hint === 'preconnect') { if (!urlMatch(asset, glob)) { return '' } asset = urlParse(asset) if (isDuplicate(asset, true)) { return '' } } else { if (!minimatch(asset, glob) || isDuplica...
javascript
{ "resource": "" }
q10721
options
train
function options (userOpts) { if (appLoaded && typeof userOpts === 'undefined') { return appOptions } userOpts = typeof userOpts ===
javascript
{ "resource": "" }
q10722
writeDataToFile
train
function writeDataToFile (file, data, token) { // insertionPoint was set in hasInsertionPoint(), so we can assume it is safe to write to file var selectors = [ 'head > meta:last-of-type', 'head > link:first-of-type', 'head' ] var selectorIndex = 0 switch (insertionPoint) { case 'meta': ...
javascript
{ "resource": "" }
q10723
train
function() { this.numTrainingExamples = 0; this.groupFrequencyCount = new Object(); this.numWords = 0; this.wordFrequencyCount = new Object();
javascript
{ "resource": "" }
q10724
incrementOrCreateGroup
train
function incrementOrCreateGroup(object, group, value) { if(!object[group]) object[group] = new Object(); var myGroup =
javascript
{ "resource": "" }
q10725
isValid
train
function isValid(app) { if (isValidApp(app, 'base-helpers', ['app', 'views', 'collection'])) { debug('initializing <%s>, from <%s>',
javascript
{ "resource": "" }
q10726
repeat
train
function repeat(ch, count) { var s = ''; for(var i = 0; i
javascript
{ "resource": "" }
q10727
fitWidth
train
function fitWidth(s, len) { s = s.trim(); if(s.length <= len) return [s]; var result = []; while(s.length > len) { var i = len for(; s[i] != ' ' && i >= 0; i--) /* empty loop */ ; if(i == -1) { for(i = len + 1; s[i] != ' ' && i < s.length; i...
javascript
{ "resource": "" }
q10728
forEach
train
function forEach(obj, cb, ctx) { for(var key in obj)
javascript
{ "resource": "" }
q10729
map
train
function map(obj, cb, ctx) { var result = {}; forEach(obj, function(key, val){
javascript
{ "resource": "" }
q10730
unique
train
function unique(list) { return Object.keys(list.reduce((obj, key) =>
javascript
{ "resource": "" }
q10731
find
train
function find(list, predicate) { // eslint-disable-line consistent-return for (var i =
javascript
{ "resource": "" }
q10732
setSortingLevels
train
function setSortingLevels(packages, type) { function setLevel(initial, pkg) { var level = Math.max(pkg.sortingLevel || 0, initial); var deps = Object.keys(pkg.dependencies); // console.log('setLevel', pkg.name, level); pkg.sortingLevel = level; deps.forEach(depName => { depName = sanitizeRep...
javascript
{ "resource": "" }
q10733
sortPackages
train
function sortPackages(packages, type) { return setSortingLevels(packages,
javascript
{ "resource": "" }
q10734
createStore
train
function createStore(ClonedVue, rawModules, state) { let Vuex = require('vuex'); if (typeof Vuex.default !== 'undefined') { Vuex = Vuex.default; } ClonedVue.use(Vuex); // create a normalized
javascript
{ "resource": "" }
q10735
mungeNonPixel
train
function mungeNonPixel( elem, value ) { // IE8 and has percent value if ( window.getComputedStyle || value.indexOf('%') === -1 ) { return value; } var style = elem.style; // Remember the original values var left = style.left; var rs = elem.runtimeStyle; var rsLeft = rs && rs.left; // Put in the n...
javascript
{ "resource": "" }
q10736
onReady
train
function onReady( event ) { // bail if already triggered or IE8 document is not ready just yet var isIE8NotReady
javascript
{ "resource": "" }
q10737
query
train
function query( elem, selector ) { // append to fragment if no parent checkParent( elem ); // match elem with all selected elems of parent var elems = elem.parentNode.querySelectorAll( selector ); for ( var i=0, len = elems.length; i < len; i++
javascript
{ "resource": "" }
q10738
train
function (notation) { var tokens = this.notationRe.exec(notation); this.rolls = tokens[1] === undefined ? this.defaultRolls : parseInt(tokens[1]); // default if omitted this.sides = tokens[2] === undefined ? this.defaultSides : parseInt(tokens[2]); // default if omitted ...
javascript
{ "resource": "" }
q10739
train
function( oDTSettings, oInit ) { /* Santiy check that we are a new instance */ if ( !this.CLASS || this.CLASS != "ColVis" ) { alert( "Warning: ColVis must be initialised with the keyword 'new'" ); } if ( typeof oInit == 'undefined' ) { oInit = {}; } var camelToHungarian = $.fn.dataTable.camelToHungarian; ...
javascript
{ "resource": "" }
q10740
train
function ( init ) { $.extend( true, this.s, ColVis.defaults, init ); // Slightly messy overlap for the camelCase notation if ( ! this.s.showAll && this.s.bShowAll ) { this.s.showAll = this.s.sShowAll; } if ( ! this.s.restore && this.s.bRestore ) { this.s.restore = this.s.sRestore; } // CamelCase...
javascript
{ "resource": "" }
q10741
train
function () { var columns = this.s.dt.aoColumns; var buttons = this.dom.buttons; var groups = this.s.aoGroups; var button; for ( var i=0, ien=buttons.length ; i<ien ; i++ ) { button = buttons[i]; if ( button.__columnIdx !== undefined ) { $('input', button).prop( 'checked', columns[ button.__colum...
javascript
{ "resource": "" }
q10742
train
function () { var nButton, columns = this.s.dt.aoColumns; if ( $.inArray( 'all', this.s.aiExclude ) === -1 ) { for ( var i=0, iLen=columns.length ; i<iLen ; i++ ) { if ( $.inArray( i, this.s.aiExclude ) === -1 ) { nButton = this._fnDomColumnButton( i ); nButton.__columnIdx = i; ...
javascript
{ "resource": "" }
q10743
train
function () { var that = this, dt = this.s.dt; return $( '<li class="ColVis_Special '+(dt.bJUI ? 'ui-button ui-state-default' : '')+'">'+ this.s.restore+ '</li>' ) .click( function (e) { for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
javascript
{ "resource": "" }
q10744
train
function () { for ( var i=0, iLen=this.s.dt.oInstance.length ; i<iLen ; i++ ) {
javascript
{ "resource": "" }
q10745
train
function () { var that = this, nCatcher = document.createElement('div'); nCatcher.className = "ColVis_catcher"; $(nCatcher).click( function () {
javascript
{ "resource": "" }
q10746
train
function () { var aoOpen = this.s.dt.aoOpenRows; var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt
javascript
{ "resource": "" }
q10747
train
function(match, value, len, step) { var num = '' + value; if (doubled(match, step)) { while (num.length
javascript
{ "resource": "" }
q10748
train
function(match, value, shortNames, longNames) { return
javascript
{ "resource": "" }
q10749
train
function(date, useLongName) { if (useLongName) { return (typeof monthNames === 'function') ? monthNames.call(calendar, date) : monthNames[date.month() - calendar.minMonth]; } else { return (typeof monthNamesShort ===
javascript
{ "resource": "" }
q10750
train
function(match, step) { var isDoubled = doubled(match, step); var size = [2, 3, isDoubled ? 4 : 2, isDoubled ? 4 : 2, 10, 11, 20]['oyYJ@!'.indexOf(match) + 1]; var digits = new RegExp('^-?\\d{1,' + size + '}'); var num = value.substring(iValue).match(digits); if (!num)
javascript
{ "resource": "" }
q10751
train
function() { if (typeof monthNames === 'function') { var month = doubled('M') ? monthNames.call(calendar, value.substring(iValue)) :
javascript
{ "resource": "" }
q10752
wrap
train
function wrap(fn, args, key) { const self = this; if (key === undefined && typeof(args) === 'string') { key = args; args = []; } if (!args) args = []; return function wrapper(context, cb) { const copyArgs = args.slice(args); copyArgs.unshift(self); copyArgs.push(onWra...
javascript
{ "resource": "" }
q10753
each
train
function each(items, numParralel, fn, done) { if (done === undefined) { done = fn; fn = numParralel; numParralel = 3; } if (numParralel <= 0) numParralel = 1; let doing = 0; let numProcessing = 0; let numDone = 0; const numTotal = items.length; const results = []; retur...
javascript
{ "resource": "" }
q10754
make
train
function make() { // create a map of all flow functions wrapped by _make const makeFnMap = {}; Object.keys(fnMap).forEach(function (key) { makeFnMap[key] = _make(fnMap[key]); }); return makeFnMap; // takes a function and wraps it so that execution is 'postponed' function _make(fn) { ...
javascript
{ "resource": "" }
q10755
_make
train
function _make(fn) { // the user calls this function, e.g. flw.make.series(...) return function madeFunction(fns, context, returnKey) { if (typeof context === 'string') { returnKey = context; context = {}; } // this function is consumed by flw return function flowFu...
javascript
{ "resource": "" }
q10756
_checkContext
train
function _checkContext(c) { if (c.hasOwnProperty('_stopped')) return; // Already done? c._stopped = null; // Indicate that we gracefully stop // if set, stops the flow until we are back to the main callback function _flw_stop(reason, cb) { if (!cb && typeof reason === 'function') { ...
javascript
{ "resource": "" }
q10757
_flw_stop
train
function _flw_stop(reason, cb) { if (!cb && typeof reason === 'function') { cb = reason;
javascript
{ "resource": "" }
q10758
_flw_store
train
function _flw_store(key, cb) { const self = this; const fn = function (err, data) { if (err) return cb(err);
javascript
{ "resource": "" }
q10759
_flw_clean
train
function _flw_clean() { const self = this; const contextCopy = {}; Object.keys(this).forEach(function (k) {
javascript
{ "resource": "" }
q10760
getNullLogger
train
function getNullLogger() { return new Proxy( {}, { get: function(target, propKey) { // not proxy for Timer if (propKey === 'Timer') { return _.bind(InnerTimer, {}, undefined) }
javascript
{ "resource": "" }
q10761
getModuleCode
train
function getModuleCode(mocks) { var filename = path.join(__dirname, './mock-angular.js');
javascript
{ "resource": "" }
q10762
getModuleConfig
train
function getModuleConfig(mocks) { // Functions cannot be transferred directly // Convert to string for (var i = 0; i < mocks.length; ++i) { var mock = mocks[i]; if (typeof mock[0] === 'function') { mock[0] = mock[0].toString();
javascript
{ "resource": "" }
q10763
rollup
train
function rollup(imbuff) { var roll = new Buffer(0); Object.keys(imbuff).sort().forEach(function(id){ roll = crypto.createHash('sha256').update(Buffer.concat([roll,new
javascript
{ "resource": "" }
q10764
connectStore
train
function connectStore(component, keys) { var shouldReturnAFunction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // function that maps store state to component props var mapStateToProps = function mapStateToProps(state) { // initialize return object var mappedState = {...
javascript
{ "resource": "" }
q10765
mapStateToProps
train
function mapStateToProps(state) { // initialize return object var mappedState = {}; // populate return object keys.forEach(function (key) { // add selector connection if (key.split(':').length === 2 && selectors[key.split(':')[1]]) {
javascript
{ "resource": "" }
q10766
applyTransform
train
function applyTransform(data, headers, status, fns) { if (typeof fns === 'function') { data = fns(data, headers, status); } else { for (var i = 0; i < fns.length;
javascript
{ "resource": "" }
q10767
isMatch
train
function isMatch(config, mock) { if (angular.isFunction(mock)) { return !!mock(config.method, config.url, config.params, config.data, config.headers); } mock = mock || {}; var fail = false; if (mock.method) { fail = fail || (config.method ? config.method.toLowerCase() : 'get') != mock.method.toLowerCase...
javascript
{ "resource": "" }
q10768
applyRequestInterceptors
train
function applyRequestInterceptors(config) { for (var i = 0; i < interceptors.length; i++) { var interceptor = getInterceptor(interceptors[i]); if (interceptor.request) {
javascript
{ "resource": "" }
q10769
applyResponseInterceptors
train
function applyResponseInterceptors(response) { if (response.config.transformResponse) { response.data = applyTransform(response.data, response.headers, response.status, response.config.transformResponse); } for (var i = interceptors.length - 1; i >=
javascript
{ "resource": "" }
q10770
getMock
train
function getMock(config) { for (var i = 0; i < mocks.length; i++) {
javascript
{ "resource": "" }
q10771
delay
train
function delay(mock, response) { if (!mock || !mock.delay) { return response;
javascript
{ "resource": "" }
q10772
responsePromise
train
function responsePromise(response) { response.status = response.status || 200; return $q(function(resolve, reject) { (response.status
javascript
{ "resource": "" }
q10773
makeIter
train
function makeIter(iterable) { if (typeof iterable[iterSymbol] === 'function') { // passed argument can create iterators - create new one. return iterable[iterSymbol](); } if (!_isSubscriptable(iterable)) { throw Error('Unsupported argument type'); } // passed argument can b...
javascript
{ "resource": "" }
q10774
toArray
train
function toArray(iterable) { // kinda optimisations if (isArray(iterable)) { return iterable.slice(); } if (typeof iterable === 'string') { return iterable.split(''); } var iter = ensureIter(iterable); var result = [];
javascript
{ "resource": "" }
q10775
getOBAuth
train
function getOBAuth(config) { // debugger; // Encoding as per API Specification. const combinedCredential = `${config.clientId}:${config.clientSecret}`; // var base64Credential = window.btoa(combinedCredential);
javascript
{ "resource": "" }
q10776
getNotifications
train
async function getNotifications(config) { try { const options = { method: "GET", uri: `${config.obServer}:${config.obPort}/ob/notifications`, json: true, // Automatically stringifies the body to JSON headers: { Authorization: config.apiCredentials, }, // resolveWithFull...
javascript
{ "resource": "" }
q10777
createListing
train
function createListing(config, listingData) { const options = { method: "POST", uri: `${config.obServer}:${config.obPort}/ob/listing/`, body: listingData, json: true, // Automatically stringifies the body to
javascript
{ "resource": "" }
q10778
createProfile
train
function createProfile(config, profileData) { const options = { method: "POST", uri: `${config.obServer}:${config.obPort}/ob/profile/`,
javascript
{ "resource": "" }
q10779
getExchangeRate
train
function getExchangeRate(config) { const options = { method: "GET", uri: `${config.obServer}:${config.obPort}/ob/exchangerate`, json: true, // Automatically stringifies the body to JSON headers:
javascript
{ "resource": "" }
q10780
cut
train
function cut(c, i) { var a = adj[i][c[i]]
javascript
{ "resource": "" }
q10781
next
train
function next(a, b, noCut) { var nextCell, nextVertex, nextDir for(var i=0; i<2; ++i) { if(adj[i][b].length > 0) { nextCell = adj[i][b][0] nextDir = i break } } nextVertex = nextCell[nextDir^1] for(var dir=0; dir<2; ++dir) { var nbhd = adj[dir][b] for...
javascript
{ "resource": "" }
q10782
handlerFor
train
function handlerFor( scope ) { const { axVisibility } = widgetServices( scope ); axVisibility.onChange( updateState ); scope.$on( '$destroy', () => { axVisibility.unsubscribe( updateState ); } ); let lastState = axVisibility.isVisible(); /** * A scope bound visibi...
javascript
{ "resource": "" }
q10783
updateState
train
function updateState( targetState ) { const state = axVisibility.isVisible(); if( state === lastState ) { return; } lastState = state; heartbeat.onAfterNext( () => {
javascript
{ "resource": "" }
q10784
train
function( oDT, oConfig ) { /* Sanity check that we are a new instance */ if ( ! (this instanceof AutoFill) ) { throw( "Warning: AutoFill must be initialised with the keyword 'new'" ); } if ( ! $.fn.dataTableExt.fnVersionCheck('1.7.0') ) { throw( "Warning: AutoFill requires DataTables 1.7 or greater"); } /*...
javascript
{ "resource": "" }
q10785
train
function ( nTd ) { var nTr = $(nTd).parents('tr')[0]; var position = this.s.dt.oInstance.fnGetPosition( nTd ); return { "x": $('td', nTr).index(nTd),
javascript
{ "resource": "" }
q10786
train
function (e) { if ( e.target && e.target.nodeName.toUpperCase() == "TD" && e.target != this.s.drag.endTd ) { var coords = this._fnTargetCoords( e.target ); if ( this.c.mode == "y" && coords.x != this.s.drag.startX ) { e.target = $('tbody>tr:eq('+coords.y+')>td:eq('+this.s.drag.startX+')', this.do...
javascript
{ "resource": "" }
q10787
train
function (e) { var filler = this.dom.filler; /* Don't display automatically when dragging */ if ( this.s.drag.dragging) { return; } /* Check that we are allowed to AutoFill this column or not */ var nTd = (e.target.nodeName.toLowerCase() == 'td') ? e.target : $(e.target).parents('td')[0]; var iX =...
javascript
{ "resource": "" }
q10788
train
function ( nTd ) { var offset = $(nTd).offset(); var filler = this.dom.filler; filler.style.top = (offset.top
javascript
{ "resource": "" }
q10789
train
function ( cell, val ) { var table = $(cell).parents('table'); if ( DataTable.Api ) { // 1.10 table.DataTable().cell( cell ).data(
javascript
{ "resource": "" }
q10790
train
function ( cell, read, last, i, x, y ) { // Increment a number if it is found var re = /(\-?\d+)/; var match = this.increment && last ? last.match(re) : null; if ( match ) {
javascript
{ "resource": "" }
q10791
fulfillName
train
function fulfillName (name, ext, mask, lang) { var shortname; var params; // support hash with params as first function param if (isPlainObject(name)) { params = name; name = params.name; ext = params.ext; mask = params.mask; lang = params.lang; } short...
javascript
{ "resource": "" }
q10792
unmaskName
train
function unmaskName (name, mask, lang) { return mask
javascript
{ "resource": "" }
q10793
createReaddirBundle
train
function createReaddirBundle(options) { return { 'changeDir': false, 'pathProvided': options.pathProvided, 'path': options.path, 'readdirPath': options.path, 'cwd': '', 'startingDir': '', 'fileNames': [],
javascript
{ "resource": "" }
q10794
forEachFilename
train
function forEachFilename( files, callback ) { files.forEach( function ( file ) { file.src.forEach( function ( src ) { if ( ! grunt.file.exists( src ) ) { grunt.verbose.writeln( 'source file "' + src + '" not found' );
javascript
{ "resource": "" }
q10795
password
train
function password(req, res, test) { var options = { grant_type: "password", client_id: process.env.SALESFORCE_CLIENT_ID, client_secret: process.env.SALESFORCE_CLIENT_SECRET, username: req.query.username || req.body.username || process.env.SALESFORCE_USERNAME, password: req.query.password || req.b...
javascript
{ "resource": "" }
q10796
login
train
function login(req, res, test) { var protocol = "https://"; if(test === true || req.test) protocol = "http://"; //for testing var loginServer = req.query.login_server || "login.salesforce.com"; var url = protocol + loginServer + "/services/oauth2/authorize"; var state = JSON.stringify({ loginServer: ...
javascript
{ "resource": "" }
q10797
loginCallback
train
function loginCallback(req, res, test) { var state = JSON.parse(req.query.state); console.dir( state ); var protocol = "https://"; if(test === true || req.test) protocol = "http://"; //for testing var url = protocol + state.loginServer + "/services/oauth2/token"; var options = { code: req.query.code,...
javascript
{ "resource": "" }
q10798
toElem
train
function toElem(shapes, callback) { var typeofShape; var txt = null; var k = 0; for (var i = 0; i < shapes.length; i++) { typeofShape = shapes[i].type; if (typeofShape == "text") { txt = shapes[i].txt; delete shapes[i].txt;
javascript
{ "resource": "" }
q10799
unEquip
train
function unEquip (attributes, slotName) { if (!(slotName in attributes.equipped)) { throw new SlotNameError(slotName); } if (attributes.equipped[slotName]) {
javascript
{ "resource": "" }