_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q54700
train
function (column, cb) { var ret = new Promise(); this.__aggregateDataset() .select(sql.min(this.stringToIdentifier(column)).as("v1"), sql.max(this.stringToIdentifier(column)).as("v2")) .first() .chain(function (r)
javascript
{ "resource": "" }
q54701
train
function (includeColumnTitles, cb) { var n = this.naked(); if (isFunction(includeColumnTitles)) { cb = includeColumnTitles; includeColumnTitles = true; } includeColumnTitles = isBoolean(includeColumnTitles) ? includeColumnTitles : true; ...
javascript
{ "resource": "" }
q54702
train
function () { var fc = this.freeCount, def, defQueue = this.__deferredQueue; while (fc-- >= 0 && defQueue.count) { def = defQueue.dequeue(); var conn = this.getObject(); if (conn) { def.callback(conn);
javascript
{ "resource": "" }
q54703
train
function () { var ret = new Promise(), conn; if (this.count > this.__maxObjects) { this.__deferredQueue.enqueue(ret); } else { //todo override getObject to make async so creating a connetion can execute setup sql conn = this.getObject()...
javascript
{ "resource": "" }
q54704
train
function (obj) { var self = this; this.validate(obj).chain(function (valid) { var index; if (self.count <= self.__maxObjects && valid && (index = self.__inUseObjects.indexOf(obj)) > -1) { self.__inUseObjects.splice(index, 1);
javascript
{ "resource": "" }
q54705
train
function () { this.__ending = true; var conn, fQueue = this.__freeObjects, count = this.count, ps = []; while ((conn = this.__freeObjects.dequeue()) !== undefined) { ps.push(this.closeConnection(conn));
javascript
{ "resource": "" }
q54706
train
function (conn) { if (!this.__validateConnectionCB) { var ret = new Promise(); ret.callback(true); return ret;
javascript
{ "resource": "" }
q54707
train
function (s) { var ret, m; if ((m = s.match(this._static.COLUMN_REF_RE1)) !== null) { ret = m.slice(1); } else if ((m = s.match(this._static.COLUMN_REF_RE2)) !== null) { ret = [null, m[1], m[2]];
javascript
{ "resource": "" }
q54708
train
function () { var model; try { model = this["__model__"] || (this["__model__"] = this.patio.getModel(this._model, this.parent.db)); } catch (e) {
javascript
{ "resource": "" }
q54709
train
function () { if (!this.__joinTableDataset) { var ds = this.__joinTableDataset = this.model.dataset.db.from(this.joinTableName), model = this.model, options = this.__opts; var identifierInputMethod = isUndefined(options.identifierInputMethod) ? model.identifierInp...
javascript
{ "resource": "" }
q54710
train
function () { this.errors = {}; return flatten(this._static.validators.map(function runValidator(validator) { var col = validator.col, val
javascript
{ "resource": "" }
q54711
train
function (name) { this.__initValidation(); var ret; if (isFunction(name)) { name.call(this, this.__getValidator.bind(this));
javascript
{ "resource": "" }
q54712
train
function(httpMethod, xhrURL){ var cookie = headers["cookie"] || ""; // Monkey patch URL onto xhr for cookie origin checking in the send method. var reqURL = url.parse(xhrURL); this.__url = reqURL; if (options.auth && cookie) { var domainIsApproved = options.auth.domains.reduce(function(prev, domain...
javascript
{ "resource": "" }
q54713
resolveUrl
train
function resolveUrl(headers, relativeURL) { var path = headers[":path"] || ""; var baseUri = headers[":scheme"] + "://" + headers[":authority"] +
javascript
{ "resource": "" }
q54714
findLastSeed
train
function findLastSeed (epoc, cb2) { if (epoc === 0) { return cb2(ethUtil.zeros(32), 0) } self.cacheDB.get(epoc, self.dbOpts, function (err, data) { if (!err) {
javascript
{ "resource": "" }
q54715
listDirectories
train
function listDirectories(dirPath) { return fs.readdirSync(dirPath).filter( /**
javascript
{ "resource": "" }
q54716
findDependencies
train
function findDependencies(startFile, class2Path, deps) { // Create a new regex object to reset the readIndex const depRegEx = /global ([a-zA-Z0-9,\s]+) \*/g; // Get global variable const contents = fs.readFileSync(startFile).toString(); /** @type {string[]} */ let fileDeps = []; let fileDep...
javascript
{ "resource": "" }
q54717
findScripts
train
function findScripts(indexPath) { const scriptRegEx = /<script.+src="(.+)".*?>/g; const contents = fs.readFileSync(indexPath).toString(); /** @type {string[]} */ const scripts = []; let scriptMatch;
javascript
{ "resource": "" }
q54718
train
function(data, eventType) { switch(eventType) { case 'progress': // Update UI loading bar break; case 'timeout': finish(new Error(data)); break; case 'result': ...
javascript
{ "resource": "" }
q54719
train
function($exercise) { var codeSolution = $exercise.find(".code-solution").text(); var codeValidation = $exercise.find(".code-validation").text(); var codeContext = $exercise.find(".code-context").text(); var editor = ace.edit($exercise.find(".editor").get(0)); editor.setTheme("a...
javascript
{ "resource": "" }
q54720
reorderFinderPatterns
train
function reorderFinderPatterns(pattern1, pattern2, pattern3) { // Find distances between pattern centers const oneTwoDistance = distance(pattern1, pattern2); const twoThreeDistance = distance(pattern2, pattern3); const oneThreeDistance = distance(pattern1, pattern3); let bottomLe...
javascript
{ "resource": "" }
q54721
countBlackWhiteRun
train
function countBlackWhiteRun(origin, end, matrix, length) { const rise = end.y - origin.y; const run = end.x - origin.x; const towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2)); const awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x ...
javascript
{ "resource": "" }
q54722
scoreBlackWhiteRun
train
function scoreBlackWhiteRun(sequence, ratios) { const averageSize = sum(sequence) / sum(ratios); let error = 0; ratios.forEach((ratio, i) => {
javascript
{ "resource": "" }
q54723
RpcTunnel
train
function RpcTunnel(url, sslSettings) { var self = this; if (! (this instanceof RpcTunnel)) { return new RpcTunnel(url, sslSettings); } this.transports = {}; if (!url) { throw new Error('Missing url parameter, which should be either a URL or client transport.') } var transport = null; if (typeo...
javascript
{ "resource": "" }
q54724
train
function () { // Call base class' constructor. PluginBase.call(this); this.pluginMetadata = { name: 'ComponentDisabler', version: '2.0.0', configStructure: [ { name: 'field', displayName: 'Field', description...
javascript
{ "resource": "" }
q54725
getLanguageProxy
train
function getLanguageProxy(options) { // Try and find if one is available const proxyScript = path.resolve(__dirname, '..', 'proxies', options.language + '.ejs'); return new Promise(function(resolve, reject) { fs.stat(proxyScript, function(err) { if (err) { return reject(err); } ejs.renderFile( p...
javascript
{ "resource": "" }
q54726
checkConfiguration
train
function checkConfiguration(conf) { let failedChecks = 0; for (const path of Object.keys(CHECKS)) { // @todo avoid try..catch try { checkProperty(path, get(conf, path), CHECKS[path]); } catch (error) {
javascript
{ "resource": "" }
q54727
extendResolvePath
train
function extendResolvePath(basedir) { // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO module.paths.push(basedir); const _basedir = basedir.split('/'), size = basedir.length; let i = 0; while (size > i++) {
javascript
{ "resource": "" }
q54728
Multihashing
train
async function Multihashing (buf, alg, length) { const digest = await Multihashing.digest(buf, alg,
javascript
{ "resource": "" }
q54729
applyAxiosDefaults
train
function applyAxiosDefaults(authenticatedAPIClient) { /* eslint-disable no-param-reassign */ authenticatedAPIClient.defaults.withCredentials = true;
javascript
{ "resource": "" }
q54730
ensureCsrfToken
train
function ensureCsrfToken(request) { const originalRequest = request; const method = request.method.toUpperCase(); const isCsrfExempt = authenticatedAPIClient.isCsrfExempt(originalRequest.url); if (!isCsrfExempt && CSRF_PROTECTED_METHODS.includes(method)) { const url = new Url(request.url); c...
javascript
{ "resource": "" }
q54731
ensureValidJWTCookie
train
function ensureValidJWTCookie(request) { const originalRequest = request; const isAuthUrl = authenticatedAPIClient.isAuthUrl(originalRequest.url); const accessToken = authenticatedAPIClient.getDecodedAccessToken(); const tokenExpired = authenticatedAPIClient.isAccessTokenExpired(accessToken); if (is...
javascript
{ "resource": "" }
q54732
handleUnauthorizedAPIResponse
train
function handleUnauthorizedAPIResponse(error) { const response = error && error.response; const errorStatus = response && response.status; const requestUrl = response && response.config && response.config.url; const requestIsTokenRefresh = requestUrl === authenticatedAPIClient.refreshAccessTokenEndpoint...
javascript
{ "resource": "" }
q54733
callServer
train
function callServer(ctx, config, callback) { const ip = ctx.ip; const fullUrl = ctx.fullUrl; const vid = ctx.vid || ''; const pxhd = ctx.pxhd || ''; const vidSource = ctx.vidSource || ''; const uuid = ctx.uuid || ''; const uri = ctx.uri || '/'; const headers = pxUtil.formatHeaders(ctx.he...
javascript
{ "resource": "" }
q54734
evalByServerCall
train
function evalByServerCall(ctx, config, callback) { if (!ctx.ip || !ctx.headers) { config.logger.error('perimeterx score evaluation failed. bad parameters.'); return callback(config.SCORE_EVALUATE_ACTION.UNEXPECTED_RESULT); } config.logger.debug(`Evaluating Risk API request, call reason: ${ct...
javascript
{ "resource": "" }
q54735
isBadRiskScore
train
function isBadRiskScore(res, ctx, config) { if (!res || !pxUtil.verifyDefined(res.score) || !res.action) { ctx.passReason = config.PASS_REASON.INVALID_RESPONSE; return -1; } const score = res.score; ctx.score = score; ctx.uuid = res.uuid; if (score >= config.BLOCKING_SCORE) { ...
javascript
{ "resource": "" }
q54736
pxCookieFactory
train
function pxCookieFactory(ctx, config) { if (ctx.cookieOrigin === 'cookie') { return (ctx.cookies['_px3'] ? new CookieV3(ctx, config, config.logger) : new CookieV1(ctx, config, config.logger)); } else {
javascript
{ "resource": "" }
q54737
prepareCustomParams
train
function prepareCustomParams(config, dict) { const customParams = { 'custom_param1': '', 'custom_param2': '', 'custom_param3': '', 'custom_param4': '', 'custom_param5': '', 'custom_param6': '', 'custom_param7': '', 'custom_param8': '', 'custom_...
javascript
{ "resource": "" }
q54738
getCaptcha
train
function getCaptcha(req, config, ip, reversePrefix, cb) { let res = {}; if (!config.FIRST_PARTY_ENABLED) { res = { status: 200, header: {key: 'Content-Type', value:'application/javascript'}, body: '' }; return cb(null, res); } else { const ...
javascript
{ "resource": "" }
q54739
getClient
train
function getClient(req, config, ip, cb) { let res = {}; if (!config.FIRST_PARTY_ENABLED) { res = { status: 200, header: {key: 'Content-Type', value:'application/javascript'}, body: '' }; return cb(null, res); } else { const clientRequestUri...
javascript
{ "resource": "" }
q54740
callServer
train
function callServer(data, headers, uri, callType, config, callback) { callback = callback || ((err) => { err && config.logger.debug(`callServer default callback. Error: ${err}`); }); const callData = { 'url': `https://${config.SERVER_HOST}${uri}`, 'data': JSON.stringify(data), 'headers':...
javascript
{ "resource": "" }
q54741
npmInstall
train
function npmInstall(settings) { const message = logger.promise('Running npm install (can take several minutes)'); const installArgs = {}; if (settings) { if (settings.path) { installArgs.cwd = settings.path; } if (settings.stdio) { installArgs.stdio = settings.stdio; } } const ...
javascript
{ "resource": "" }
q54742
mock
train
function mock(_module, _exports) { delete require.cache[require.resolve(_module)]; require(_module); _exports
javascript
{ "resource": "" }
q54743
later
train
function later (info) { process.stdin.resume(); const action = start.bind(null, info); process.on('SIGINT', action); process.on('SIGTERM', action); (function wait ()
javascript
{ "resource": "" }
q54744
start
train
async function start ({latest, message, name, version}) { if (beenthere) { return; } beenthere = true; console.log( // eslint-disable-line no-console box({ latest, message, name, version, }) ); const Confirm = require('prompt-confirm'); const confirmed = await new Confirm( `install ${name....
javascript
{ "resource": "" }
q54745
box
train
function box ({latest, message, name, version}) { const lines = [ `You are running ${name.yellow} version ${version.yellow}`,
javascript
{ "resource": "" }
q54746
getStats
train
function getStats({_: [file]} = {}) { const route = resolve(process.cwd(), file); try { return require(route); } catch (error) {
javascript
{ "resource": "" }
q54747
start
train
function start(stats, {f, format = 'human'} = {}) { try { const result = chunkalyse(stats); let output; switch (f || format) { case 'json': output = JSON.stringify(result, null, 2); break; case 'human': default:
javascript
{ "resource": "" }
q54748
create
train
async function create(sourcedir) { const target = join(sourcedir, FILENAME); const exists = await exist(target); const source = exists ? target
javascript
{ "resource": "" }
q54749
run
train
async function run() { try { await execute('./node_modules/.bin/danger ci', { pipe: true }); return false; } catch (error) { // don't throw yet } await execute('npm i danger --no-save', {
javascript
{ "resource": "" }
q54750
replace
train
function replace(haystack, needle) { const replacement = options.resolve ? notate(data, needle.trim())
javascript
{ "resource": "" }
q54751
getHelpTopic
train
function getHelpTopic(topic) { let filename = getFilename(topic); if (!fs.existsSync(filename))
javascript
{ "resource": "" }
q54752
getHelp
train
function getHelp(argv) { const version = require('./version').getVersion(); logger.info(` *********************************************************************** * SKY UX App Builder ${version} * * Usage: skyux [command] [options] * * Help: s...
javascript
{ "resource": "" }
q54753
clean
train
function clean(route) { // Resolve module location from given path const filename = _require.resolve(route); // Escape if this module is not present in cache if (!_require.cache[filename]) { return; }
javascript
{ "resource": "" }
q54754
override
train
function override(route, thing) { // Resolve module location from given path const filename = _require.resolve(route); // Load it into memory _require(filename); // Override exports with new
javascript
{ "resource": "" }
q54755
reset
train
function reset(route) { // Resolve module location from given path const filename = _require.resolve(route); // Load it into memory _require(filename); // Remove all children from memory, recursively shidu(filename); // Remove
javascript
{ "resource": "" }
q54756
shidu
train
function shidu(filename) { const parent = require.cache[filename]; if (!parent) { return; } // If there are children - iterate over them parent.children .map( ({filename}) => filename ) .forEach( child => { // Load child to memory require(child);
javascript
{ "resource": "" }
q54757
getGlobs
train
function getGlobs() { // Look globally and locally for matching glob pattern const dirs = [ `${process.cwd()}/node_modules/`, // local (where they ran the command from) `${__dirname}/..`, // global, if scoped package (where this code exists) `${__dirname}/../..`, // global, if not scoped package ]; ...
javascript
{ "resource": "" }
q54758
getModulesAnswered
train
function getModulesAnswered(command, argv, globs) { let modulesCalled = {}; let modulesAnswered = []; globs.forEach(pkg => { const dirName = path.dirname(pkg); let pkgJson = {}; let module; try { module = require(dirName); pkgJson = require(pkg); } catch (err) { logger.verb...
javascript
{ "resource": "" }
q54759
invokeCommandError
train
function invokeCommandError(command, isInternalCommand) { if (isInternalCommand) { return; } const cwd = process.cwd(); logger.error(`No modules found for ${command}`); if (cwd.indexOf('skyux-spa') === -1) { logger.error(`Are you in a
javascript
{ "resource": "" }
q54760
invokeCommand
train
function invokeCommand(command, argv, isInternalCommand) { const globs = getGlobs(); if (globs.length === 0) { return invokeCommandError(command, isInternalCommand); } const modulesAnswered = getModulesAnswered(command, argv, globs); const modulesAnsweredLength = modulesAnswered.length; if (modulesA...
javascript
{ "resource": "" }
q54761
getCommand
train
function getCommand(argv) { let command = argv._[0] || 'help'; // Allow shorthand "-v" for version if (argv.v) { command = 'version'; }
javascript
{ "resource": "" }
q54762
processArgv
train
function processArgv(argv) { let command = getCommand(argv); let isInternalCommand = true; logger.info(`SKY UX processing command ${command}`); switch (command) { case 'version': require('./lib/version').logVersion(argv); break; case 'new': require('./lib/new')(argv); break; ...
javascript
{ "resource": "" }
q54763
getSlot
train
function getSlot(name) { const main = document.querySelector('settings-ui').shadowRoot.children.container.children.main; const settings = findTag(main.shadowRoot.children, 'SETTINGS-BASIC-PAGE'); const advancedPage =
javascript
{ "resource": "" }
q54764
update
train
function update(message) { clearLine(stdout, 0); // Clear current
javascript
{ "resource": "" }
q54765
accountGuilds
train
function accountGuilds (client) { return client.account().get().then(account => { if (!account.guild_leader) { return [] } let requests = account.guild_leader.map(id => wrap(() => guildData(id))) return flow.parallel(requests) }) function guildData (id) { let requests = { data: w...
javascript
{ "resource": "" }
q54766
filterBetaCharacters
train
function filterBetaCharacters (characters) { /* istanbul ignore next */ if
javascript
{ "resource": "" }
q54767
unflatten
train
function unflatten (object) { let result = {} for (let key in object) {
javascript
{ "resource": "" }
q54768
adjustTop
train
function adjustTop(placements, containerPosition, initialHeight, currentHeight) { if (placements.indexOf('top') !== -1 && initialHeight
javascript
{ "resource": "" }
q54769
train
function (opts) { if (!(this instanceof Worker)) { return new Worker(opts); } this.opts = opts; this.port = this.opts.port || 8888; this.apps = opts.apps; if (typeof (this.apps) !== 'object') {
javascript
{ "resource": "" }
q54770
logCallback
train
function logCallback(cb, message) { var wrappedArgs = Array.prototype.slice.call(arguments); return function (err, data) { if (err) return cb(err);
javascript
{ "resource": "" }
q54771
reqToAppName
train
function reqToAppName(req) { var targetName = null; try { targetName = req.url.split('/').pop();
javascript
{ "resource": "" }
q54772
isStaleDailyData
train
async function isStaleDailyData (endpointInstance) { const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get()
javascript
{ "resource": "" }
q54773
isStaleWeeklyData
train
async function isStaleWeeklyData (endpointInstance) { const account = await new AccountEndpoint(endpointInstance).schema('2019-03-26').get()
javascript
{ "resource": "" }
q54774
createViewModel
train
function createViewModel(initialData, hasDataBinding, bindingState) { if(bindingState && bindingState.isSettingOnViewModel === true) { // If we are setting a value like `x:from="y"`, // we need to make
javascript
{ "resource": "" }
q54775
Spinner
train
function Spinner(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { className, size } = props; const mods = props.mods ? props.mods.slice() : []; mods.push(`size_${size}`); const classes = classnames(getClassNamesWithMods('ui-spinner', mods), className); /* eslint-disable max-len...
javascript
{ "resource": "" }
q54776
Button
train
function Button(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { children, className, dataAttrs = {}, disabled, href, id, onClick, onMouseUp, size, type, variation, } = props; const restProps = getDataAttributes(dataAttrs); const mods = pr...
javascript
{ "resource": "" }
q54777
getThemeFiles
train
function getThemeFiles({ brand, affiliate }) { return [ path.join(__dirname, '/themes/_default.yaml'), path.join(__dirname, `/themes/${brand}/_default.yaml`),
javascript
{ "resource": "" }
q54778
processProps
train
function processProps(props) { const { initialDates, maxDate, minDate, selectionType, multiplemode } = props; const maxLimit = maxDate ? normalizeDate(getUTCDate(maxDate), 23, 59, 59, 999) : null; let renderDate = (initialDates && initialDates.length && initialDates[0]) ? getUTCDate(initialDates[0]) : new Date()...
javascript
{ "resource": "" }
q54779
parseExpressions
train
function parseExpressions(obj, proto) { const parsedObj = Object.assign(Object.create(proto), obj); Object.keys(obj).forEach((key) => { const value = obj[key]; const fn = isObject(value) ? parseExpressions : applyTransforms; try {
javascript
{ "resource": "" }
q54780
getDataAttributes
train
function getDataAttributes(attributes) { if (!attributes) { return {}; } return
javascript
{ "resource": "" }
q54781
normalizeDate
train
function normalizeDate(dateObject, hours = 0, minutes = 0, seconds = 0, milliseconds = 0) { dateObject.setHours(hours); dateObject.setMinutes(minutes);
javascript
{ "resource": "" }
q54782
ejectOtherProps
train
function ejectOtherProps(props, propTypes) { const propTypesKeys = Object.keys(propTypes); return Object.keys(props) .filter(x => propTypesKeys.indexOf(x) === -1)
javascript
{ "resource": "" }
q54783
warnAboutDeprecatedProp
train
function warnAboutDeprecatedProp(propValue, oldPropName, newPropName) { if (propValue !== undefined) { console.warn(`[DEPRECATED] the property
javascript
{ "resource": "" }
q54784
List
train
function List(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { align, className, dataAttrs, hideBullets, items, } = props; const mods = props.mods ? props.mods.slice() : []; mods.push(`align_${align}`); if (hideBullets) { mods.push("no-bullets"); } ...
javascript
{ "resource": "" }
q54785
Checkbox
train
function Checkbox(props) { warnAboutDeprecatedProp(props.mods, 'mods', 'className'); const { checked, children, className, dataAttrs = {}, disabled, inputDataAttrs = {}, name, onChange, } = props; const dataAttributes = getDataAttributes(dataAttrs); const inputDataAttributes ...
javascript
{ "resource": "" }
q54786
parseExternalLink
train
function parseExternalLink(elem) { var path = elem.href; elem.setAttribute('data-parsed', true); var rawFile = new XMLHttpRequest(); rawFile.open('GET', path, true); rawFile.onreadystatechange = function processStylesFile() {
javascript
{ "resource": "" }
q54787
initializeRealtime
train
async function initializeRealtime({ getApp, onCreate, onDelete, url, token }) { const realtimeConfig = { token, url } try { realtime .subscribe(realtimeConfig, APPS_DOCTYPE) .onCreate(async app => { // Fetch directly the app to get attributes `related` as well. let fullApp t...
javascript
{ "resource": "" }
q54788
cozyFetchJSON
train
function cozyFetchJSON(cozy, method, path, body) { const requestOptions = Object.assign({}, fetchOptions(), { method }) requestOptions.headers['Accept'] = 'application/json' if (method !== 'GET' && method !== 'HEAD' && body !== undefined) { if (requestOptions.headers['Content-Type']) { requestOpti...
javascript
{ "resource": "" }
q54789
train
function(attrs) { if (!attrs.ssl || includes(['NONE', 'UNVALIDATED', 'IFAVAILABLE', 'SYSTEMCA'], attrs.ssl)) { return; } if (attrs.ssl === 'SERVER' && !attrs.ssl_ca) { throw new TypeError('ssl_ca is required when ssl is SERVER.'); } else if (attrs.ssl === 'ALL') { if (!attrs.ssl_ca) { ...
javascript
{ "resource": "" }
q54790
train
function(attrs) { if (attrs.authentication !== 'KERBEROS') { if (attrs.kerberos_service_name) { throw new TypeError(format( 'The kerberos_service_name field does not apply when ' + 'using %s for authentication.', attrs.authentication)); } if (attrs.kerberos_principal) {...
javascript
{ "resource": "" }
q54791
validateURL
train
function validateURL(model, done) { var url = model.driver_url; parseURL(url, {}, function(err, result) { // URL parsing errors are just generic `Error` instances // so overwrite name so mongodb-js-server will know
javascript
{ "resource": "" }
q54792
httpsRequest
train
async function httpsRequest (opts, formData) { return new Promise ((resolve, reject) => { let req = https.request (opts, (res) => {
javascript
{ "resource": "" }
q54793
makeFuncArgTree
train
function makeFuncArgTree (pt, args, makeSymbolName, forceBraces, allowNakedSymbol) { var noBraces = !forceBraces && args.length === 1 && (args[0].type === 'func' || args[0].type === 'lookup' || args[0].type ===
javascript
{ "resource": "" }
q54794
train
function (next) { // next can be a function or another thenable if (typeof(next.then) === 'function') // thenable? return next // next is a function, so call it var nextResult = next.apply (next, result) if (nextResult && typeof(nextResult.then)
javascript
{ "resource": "" }
q54795
makeRhsExpansionPromise
train
function makeRhsExpansionPromise (config) { var pt = this var rhs = config.rhs || this.sampleParseTree (config.parsedRhsText || parseRhs (config.rhsText), config) var resolve = config.sync ? syncPromiseResolve : Promise.resolve.bind(Promise) var maxLength = config.maxLength || pt.maxLength var maxNodes = conf...
javascript
{ "resource": "" }
q54796
pseudoRotateArray
train
function pseudoRotateArray (a, rng) { var halfLen = a.length / 2, insertAfter = Math.ceil(halfLen) + Math.floor (rng() * Math.floor(halfLen)) var result
javascript
{ "resource": "" }
q54797
capitalize
train
function capitalize (text) { return text .replace (/^([^A-Za-z]*)([a-z])/, function (m, g1, g2) { return g1 + g2.toUpperCase() })
javascript
{ "resource": "" }
q54798
textToWords
train
function textToWords (text) { return text.toLowerCase() .replace(/[^a-z\s]/g,'') // these are the phoneme characters we keep .replace(/\s+/g,' ').replace(/^
javascript
{ "resource": "" }
q54799
train
function(params, sep, eq) { var query = '', value, typeOf, tmpArray, i, size, key; if ( ! params) { return query; } sep || (sep = '&'); eq || (eq = '='); for (key in params) { if (hasOwnProp.call(p...
javascript
{ "resource": "" }