_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q48000 | customizer | train | function customizer(objValue, srcValue) {
if (isUndefined(objValue) && !isUndefined(srcValue)) return srcValue
if (isArray(objValue) && isArray(srcValue)) return srcValue
if (isRegExp(objValue) || isRegExp(srcValue)) | javascript | {
"resource": ""
} |
q48001 | buildMidiNumberAttributes | train | function buildMidiNumberAttributes(midiNumber) {
const pitchIndex = (midiNumber - MIDI_NUMBER_C0) % NOTES_IN_OCTAVE;
const octave = Math.floor((midiNumber - MIDI_NUMBER_C0) / NOTES_IN_OCTAVE);
const pitchName = SORTED_PITCHES[pitchIndex];
return {
note: | javascript | {
"resource": ""
} |
q48002 | getCompiledChildModuleDocsPath | train | function getCompiledChildModuleDocsPath(moduleName) {
let rootPath = c.rootPath;
if (process.cwd() !== c.rootPath) {
rootPath = path.join(process.cwd(), c.rootPath);
}
const childModuleRootPath = path.join(rootPath, c.dependenciesPath, moduleName),
| javascript | {
"resource": ""
} |
q48003 | parseSimpleNumbers | train | function parseSimpleNumbers (parser) {
const length = parser.buffer.length - 1
var offset = parser.offset
var number = 0
var sign = 1
if (parser.buffer[offset] === 45) {
sign = -1
offset++
}
while (offset < length) {
const c1 = parser.buffer[offset++]
| javascript | {
"resource": ""
} |
q48004 | parseStringNumbers | train | function parseStringNumbers (parser) {
const length = parser.buffer.length - 1
var offset = parser.offset
var number = 0
var res = ''
if (parser.buffer[offset] === 45) {
res += '-'
offset++
}
while (offset < length) {
var c1 = parser.buffer[offset++]
| javascript | {
"resource": ""
} |
q48005 | parseSimpleString | train | function parseSimpleString (parser) {
const start = parser.offset
const buffer = parser.buffer
const length = buffer.length - 1
var offset = start
while (offset < length) {
if (buffer[offset++] === 13) { // \r\n
parser.offset = offset + 1
if (parser.optionReturnBuffers === true) {
| javascript | {
"resource": ""
} |
q48006 | parseLength | train | function parseLength (parser) {
const length = parser.buffer.length - 1
var offset = parser.offset
var number = 0
while (offset < length) {
const c1 = parser.buffer[offset++]
if (c1 | javascript | {
"resource": ""
} |
q48007 | parseError | train | function parseError (parser) {
var string = parseSimpleString(parser)
if (string !== undefined) { | javascript | {
"resource": ""
} |
q48008 | handleError | train | function handleError (parser, type) {
const err = new ParserError(
'Protocol error, got ' + JSON.stringify(String.fromCharCode(type)) + ' as reply type byte',
| javascript | {
"resource": ""
} |
q48009 | pushArrayCache | train | function pushArrayCache (parser, array, pos) | javascript | {
"resource": ""
} |
q48010 | parseArrayChunks | train | function parseArrayChunks (parser) {
var arr = parser.arrayCache.pop()
var pos = parser.arrayPos.pop()
if (parser.arrayCache.length) {
const res = parseArrayChunks(parser)
if (res === undefined) { | javascript | {
"resource": ""
} |
q48011 | parseArrayElements | train | function parseArrayElements (parser, responses, i) {
const bufferLength = parser.buffer.length
while (i < responses.length) {
const offset = parser.offset
if (parser.offset >= bufferLength) {
pushArrayCache(parser, responses, i)
return
}
const response = parseType(parser, parser.buffer[p... | javascript | {
"resource": ""
} |
q48012 | decreaseBufferPool | train | function decreaseBufferPool () {
if (bufferPool.length > 50 * 1024) {
if (counter === 1 || notDecreased > counter * 2) {
const minSliceLen = Math.floor(bufferPool.length / 10)
const sliceLength = minSliceLen < bufferOffset
? bufferOffset
: minSliceLen
bufferOffset = 0
| javascript | {
"resource": ""
} |
q48013 | resizeBuffer | train | function resizeBuffer (length) {
if (bufferPool.length < length + bufferOffset) {
const multiplier = length > 1024 * 1024 * 75 ? 2 : 3
if (bufferOffset > 1024 * 1024 * 111) | javascript | {
"resource": ""
} |
q48014 | concatBulkString | train | function concatBulkString (parser) {
const list = parser.bufferCache
const oldOffset = parser.offset
var chunks = list.length
var offset = parser.bigStrSize - parser.totalChunkSize
parser.offset = offset
if (offset <= 2) {
if (chunks === 2) {
return list[0].toString('utf8', oldOffset, list[0].leng... | javascript | {
"resource": ""
} |
q48015 | concatBulkBuffer | train | function concatBulkBuffer (parser) {
const list = parser.bufferCache
const oldOffset = parser.offset
const length = parser.bigStrSize - oldOffset - 2
var chunks = list.length
var offset = parser.bigStrSize - parser.totalChunkSize
parser.offset = offset
if (offset <= 2) {
if (chunks === 2) {
retu... | javascript | {
"resource": ""
} |
q48016 | train | function (options, callback) {
var licenseSrc = path.join(options.src, 'LICENSE')
try {
fs.accessSync(licenseSrc)
} catch (err) {
try {
licenseSrc = path.join(options.src, 'LICENSE.txt')
fs.accessSync(licenseSrc)
} catch (err) {
| javascript | {
"resource": ""
} | |
q48017 | train | function (data, callback) {
async.parallel([
async.apply(readMeta, data)
], function (err, results) {
var pkg = results[0] || {}
var defaults = {
id: getAppId(pkg.name, pkg.homepage),
productName: pkg.productName || pkg.name,
genericName: pkg.genericName || pkg.productName || pkg.name... | javascript | {
"resource": ""
} | |
q48018 | train | function (data, defaults, callback) {
// Flatten everything for ease of use.
var options = _.defaults({}, data, | javascript | {
"resource": ""
} | |
q48019 | train | function (options, file, callback) {
options.logger('Generating template from ' + file)
async.waterfall([
async.apply(fs.readFile, file),
function (template, callback) {
var result = _.template(template)(options) | javascript | {
"resource": ""
} | |
q48020 | train | function (options, dir, callback) {
var desktopSrc = path.resolve(__dirname, '../resources/desktop.ejs')
var desktopDest = path.join(dir, 'share/applications', options.id + '.desktop')
options.logger('Creating desktop file at ' + desktopDest)
async.waterfall([
async.apply(generateTemplate, options, desktop... | javascript | {
"resource": ""
} | |
q48021 | train | function (options, dir, callback) {
var iconFile = path.join(dir, getPixmapPath(options))
options.logger('Creating icon file at ' + iconFile)
fs.copy(options.icon, iconFile, function (err) {
| javascript | {
"resource": ""
} | |
q48022 | train | function (options, dir, callback) {
async.forEachOf(options.icon, function (icon, resolution, callback) {
var iconFile = path.join(dir, 'share/icons/hicolor', resolution, 'apps', options.id + '.png')
options.logger('Creating icon file at ' + iconFile)
| javascript | {
"resource": ""
} | |
q48023 | train | function (options, dir, callback) {
if (_.isObject(options.icon)) {
createHicolorIcon(options, dir, callback)
} else if (options.icon) { | javascript | {
"resource": ""
} | |
q48024 | train | function (options, dir, callback) {
var copyrightFile = path.join(dir, 'share/doc', options.id, 'copyright')
options.logger('Creating copyright file at ' + copyrightFile) | javascript | {
"resource": ""
} | |
q48025 | train | function (options, dir, callback) {
var applicationDir = path.join(dir, 'lib', options.id)
options.logger('Copying application to ' + applicationDir)
async.waterfall([
| javascript | {
"resource": ""
} | |
q48026 | train | function (options, callback) {
options.logger('Creating temporary directory')
async.waterfall([
async.apply(temp.mkdir, 'electron-'),
function (dir, callback) {
| javascript | {
"resource": ""
} | |
q48027 | train | function (options, dir, callback) {
options.logger('Creating contents of package')
async.parallel([
async.apply(createDesktop, options, dir),
async.apply(createIcon, options, dir),
| javascript | {
"resource": ""
} | |
q48028 | train | function (options, dir, callback) {
var name = _.template('<%= id %>_<%= branch %>_<%= arch %>.flatpak')(options)
var dest = options.rename(options.dest, name)
options.logger('Creating package at ' + dest)
var extraExports = []
if (options.icon && !_.isObject(options.icon)) extraExports.push(getPixmapPath(opt... | javascript | {
"resource": ""
} | |
q48029 | makeShapeAstForShapeIntersectRuntime | train | function makeShapeAstForShapeIntersectRuntime(propTypeData) {
const runtimeMerge = makeObjectMergeAstForShapeIntersectRuntime(propTypeData);
| javascript | {
"resource": ""
} |
q48030 | findByHash | train | function findByHash(config, hash) {
const re = new RegExp(injectHashIntoPath(config.sourceMapPath, hash));
return glob
.sync('./**')
.filter(file => re.test(file))
.map(sourceMapPath => {
// strip relative path characters
const sourceMapPathMatch = sourceMapPath.match(re);
if (source... | javascript | {
"resource": ""
} |
q48031 | parseurl | train | function parseurl (req) {
var url = req.url
if (url === undefined) {
// URL is undefined
return undefined
}
var parsed = req._parsedUrl
if (fresh(url, parsed)) {
// Return cached URL parse | javascript | {
"resource": ""
} |
q48032 | originalurl | train | function originalurl (req) {
var url = req.originalUrl
if (typeof url !== 'string') {
// Fallback
return parseurl(req)
}
var parsed = req._parsedOriginalUrl
if (fresh(url, parsed)) {
// Return cached URL parse | javascript | {
"resource": ""
} |
q48033 | fastparse | train | function fastparse (str) {
if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) {
return parse(str)
}
var pathname = str
var query = null
var search = null
// This takes the regexp from https://github.com/joyent/node/pull/7878
// Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/
// And unrolls i... | javascript | {
"resource": ""
} |
q48034 | fresh | train | function fresh (url, parsedUrl) {
return typeof parsedUrl === 'object' &&
| javascript | {
"resource": ""
} |
q48035 | customUnique | train | function customUnique(array) {
const unique = uniqBy(array, 'fname');
// we construct unique portlets array will all linked categories (reversing category and portlets child)
unique.forEach((elem) => {
const dupl = array.filter((e) => e.fname === elem.fname); | javascript | {
"resource": ""
} |
q48036 | train | function( buffer, enFamilyName, noMerge) {
//cancelling in browser merge
clearTimeout(this.mergeTimeout);
if ( !enFamilyName ) {
enFamilyName = this.ot.getEnglishName('fontFamily');
}
if ( this.fontMap[ enFamilyName ] ) {
document.fonts.delete( this.fontMap[ enFamilyName ] );
}
var fontf... | javascript | {
"resource": ""
} | |
q48037 | train | function(target, source) {
target = cloneJSON(target);
for (var key in source) {
if (source.hasOwnProperty(key)) {
if (isObject(target[key]) | javascript | {
"resource": ""
} | |
q48038 | train | function(path, definitions) {
path = path.replace(/^#\/definitions\//, '').split('/');
var find = function(path, root) {
var key = path.shift();
if (!root[key]) {
return {};
} else if (!path.length) {
return root[key];
} | javascript | {
"resource": ""
} | |
q48039 | train | function(schema, definitions) {
if (typeof schema['default'] !== 'undefined') {
return schema['default'];
} else if (typeof schema.allOf !== 'undefined') {
var mergedItem = mergeAllOf(schema.allOf, definitions);
return defaults(mergedItem, definitions);
} else if (typeof schema.$ref !... | javascript | {
"resource": ""
} | |
q48040 | highlight | train | function highlight(language, value, options) {
var settings = options || {}
var prefix = settings.prefix
if (prefix === null || prefix === undefined) {
prefix = | javascript | {
"resource": ""
} |
q48041 | registerLanguage | train | function registerLanguage(name, syntax) {
var lang = syntax(low)
languages[name] = lang
languageNames.push(name)
| javascript | {
"resource": ""
} |
q48042 | registerAlias | train | function registerAlias(name, alias) {
var map = name
var key
var list
var length
var index
if (alias) {
map = {}
map[name] = alias
}
for (key in map) {
list = map[key]
list = typeof list === 'string' ? [list] : list
| javascript | {
"resource": ""
} |
q48043 | processLexeme | train | function processLexeme(buffer, lexeme) {
var newMode
var endMode
var origin
modeBuffer += buffer
if (lexeme === undefined) {
addSiblings(processBuffer(), currentChildren)
return 0
}
newMode = subMode(lexeme, top)
if (newMode) {
addSiblings(processBuffer(), currentC... | javascript | {
"resource": ""
} |
q48044 | startNewMode | train | function startNewMode(mode, lexeme) {
var node
if (mode.className) {
node = build(mode.className, [])
}
if (mode.returnBegin) {
modeBuffer = ''
} else if (mode.excludeBegin) {
addText(lexeme, currentChildren)
modeBuffer = ''
} else {
modeBuffer = lexeme
| javascript | {
"resource": ""
} |
q48045 | processKeywords | train | function processKeywords() {
var nodes = []
var lastIndex
var keyword
var node
var submatch
if (!top.keywords) {
return addText(modeBuffer, nodes)
}
lastIndex = 0
top.lexemesRe.lastIndex = 0
keyword = top.lexemesRe.exec(modeBuffer)
while (keyword) {
addText(m... | javascript | {
"resource": ""
} |
q48046 | addSiblings | train | function addSiblings(siblings, nodes) {
var length = siblings.length
var index = -1
var sibling
while (++index < length) {
sibling = siblings[index]
| javascript | {
"resource": ""
} |
q48047 | addText | train | function addText(value, nodes) {
var tail
if (value) {
tail = nodes[nodes.length - 1]
if (tail && tail.type === 'text') {
| javascript | {
"resource": ""
} |
q48048 | build | train | function build(name, contents, noPrefix) {
return {
type: 'element',
tagName: 'span',
properties: {
className: | javascript | {
"resource": ""
} |
q48049 | keywordMatch | train | function keywordMatch(mode, keywords) {
var keyword = keywords[0]
if (language[keyInsensitive]) {
keyword = keyword.toLowerCase()
}
| javascript | {
"resource": ""
} |
q48050 | endOfMode | train | function endOfMode(mode, lexeme) {
if (test(mode.endRe, lexeme)) {
while (mode.endsParent && mode.parent) {
mode = mode.parent
}
return mode
}
| javascript | {
"resource": ""
} |
q48051 | subMode | train | function subMode(lexeme, mode) {
var values = mode.contains
var length = values.length
var index = -1
while (++index < length) {
| javascript | {
"resource": ""
} |
q48052 | compileLanguage | train | function compileLanguage(language) {
compileMode(language)
// Compile a language mode, optionally with a parent.
function compileMode(mode, parent) {
var compiledKeywords = {}
var terminators
if (mode.compiled) {
return
}
mode.compiled = true
mode.keywords = mode.keywords || mode... | javascript | {
"resource": ""
} |
q48053 | flatten | train | function flatten(className, value) {
var pairs
var pair
var index
var length
if (language[keyInsensitive]) {
value = value.toLowerCase()
}
pairs = value.split(space)
length = pairs.length
index = -1
| javascript | {
"resource": ""
} |
q48054 | normalize | train | function normalize(result) {
return {
relevance: result.relevance | javascript | {
"resource": ""
} |
q48055 | train | function(cache) {
var tips = cache[""].tips;
// Sort labels: metadata, then branch tips by first add,
// then user entries by first add, then last run
// Then return without metadata
return Object.keys(cache)
.sort(function(a, b) {
var keys = Object.keys(cache);
ret... | javascript | {
"resource": ""
} | |
q48056 | train | function(delta) {
var color = "green";
if (delta > 0) {
delta = "+" + delta;
color = "red";
} else if (!delta) {
| javascript | {
"resource": ""
} | |
q48057 | train | function(src) {
var cache;
try {
cache = fs.existsSync(src) ? file.readJSON(src) : undefined;
} catch (e) {
debug(e);
}
// Progressively upgrade `cache`, which is one of:
// empty
// {}
// { file: size [,...] }
// { "": { tips: { label: SHA1, ... } }, label... | javascript | {
"resource": ""
} | |
q48058 | train | function(task, compressors) {
var sizes = {},
files = processPatterns(task.files, function(pattern) {
// Find all matching files for this pattern.
return glob.sync(pattern, { filter: "isFile" });
});
files.forEach(function(src) {
var contents = file.read(src),
... | javascript | {
"resource": ""
} | |
q48059 | train | function(done) {
debug("Running `git branch` command...");
exec(
"git branch --no-color --verbose --no-abbrev --contains HEAD",
function(err, stdout) {
var status = {},
matches = /^\* (.+?)\s+([0-9a-f]{8,})/im.exec(stdout);
if (err || !matches) {
done(er... | javascript | {
"resource": ""
} | |
q48060 | compareSizes | train | function compareSizes(task) {
var compressors = task.options.compress,
newsizes = helpers.sizes(task, compressors),
files = Object.keys(newsizes),
sizecache = defaultCache,
cache = helpers.get_cache(sizecache),
tips = cache[""].tips,
labels = helpers.sorted_labels(cache);
// Obtain... | javascript | {
"resource": ""
} |
q48061 | train | function ( functionCodeBuilder, parserName, libLocations, libPath, runnerImpl ) {
if ( THREE.LoaderSupport.Validator.isValid( this.loaderWorker.worker ) ) return;
if ( this.logging.enabled ) {
console.info( 'WorkerSupport: Building worker code...' );
console.time( 'buildWebWorkerCode' );
}
if ( THREE.L... | javascript | {
"resource": ""
} | |
q48062 | train | function ( e ) {
var payload = e.data;
switch ( payload.cmd ) {
case 'meshData':
case 'materialData':
case 'imageData':
this.runtimeRef.callbacks.meshBuilder( payload );
break;
case 'complete':
this.runtimeRef.queuedMessage = null;
this.started = false;
this.runtimeRef.callbacks.onL... | javascript | {
"resource": ""
} | |
q48063 | train | function ( parser, params ) {
var property, funcName, values;
for ( property in params ) {
funcName = 'set' + property.substring( 0, 1 ).toLocaleUpperCase() + property.substring( 1 );
values = params[ property ];
if ( typeof | javascript | {
"resource": ""
} | |
q48064 | train | function ( payload ) {
if ( payload.cmd === 'run' ) {
var self = this.getParentScope();
var callbacks = {
callbackOnAssetAvailable: function ( payload ) {
self.postMessage( payload );
},
callbackOnProgress: function ( text ) {
if ( payload.logging.enabled && payload.logging.debug ) consol... | javascript | {
"resource": ""
} | |
q48065 | train | function ( url, onLoad, onProgress, onError, onMeshAlter, useAsync ) {
var resource = new THREE.LoaderSupport.ResourceDescriptor( url, 'OBJ' ); | javascript | {
"resource": ""
} | |
q48066 | train | function ( prepData, workerSupportExternal ) {
this._applyPrepData( prepData );
var available = prepData.checkResourceDescriptorFiles( prepData.resources,
[
{ ext: "obj", type: "ArrayBuffer", ignore: false },
{ ext: "mtl", type: "String", ignore: false },
{ ext: "zip", type: "String", ignore: true }
... | javascript | {
"resource": ""
} | |
q48067 | train | function ( content ) {
// fast-fail in case of illegal data
if ( content === null || content === undefined ) {
throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';
}
if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName );
this.meshBuilder.i... | javascript | {
"resource": ""
} | |
q48068 | train | function ( content, onLoad ) {
var scope = this;
var measureTime = false;
var scopedOnLoad = function () {
onLoad(
{
detail: {
loaderRootNode: scope.loaderRootNode,
modelName: scope.modelName,
instanceNo: scope.instanceNo
}
}
);
if ( measureTime && scope.logging.enable... | javascript | {
"resource": ""
} | |
q48069 | train | function ( url, content, onLoad, onProgress, onError, crossOrigin, materialOptions ) {
var resource = new THREE.LoaderSupport.ResourceDescriptor( url, 'MTL' );
resource.setContent( content );
| javascript | {
"resource": ""
} | |
q48070 | train | function ( arrayBuffer ) {
if ( this.logging.enabled ) console.time( 'OBJLoader2.Parser.parse' );
this.configure();
var arrayBufferView = new Uint8Array( arrayBuffer );
this.contentRef = arrayBufferView;
var length = arrayBufferView.byteLength;
this.globalCounts.totalBytes = length;
var buffer = new Arra... | javascript | {
"resource": ""
} | |
q48071 | train | function ( text ) {
if ( this.logging.enabled ) console.time( 'OBJLoader2.Parser.parseText' );
this.configure();
this.legacyMode = true;
this.contentRef = text;
var length = text.length;
this.globalCounts.totalBytes = length;
var buffer = new Array( 128 );
for ( var char, word = '', bufferPointer = 0,... | javascript | {
"resource": ""
} | |
q48072 | train | function () {
var meshOutputGroupTemp = [];
var meshOutputGroup;
var absoluteVertexCount = 0;
var absoluteIndexMappingsCount = 0;
var absoluteIndexCount = 0;
var absoluteColorCount = 0;
var absoluteNormalCount = 0;
var absoluteUvCount = 0;
var indices;
for ( var name in this.rawMesh.subGroups ) {
... | javascript | {
"resource": ""
} | |
q48073 | train | function () {
var materialsJSON = {};
var material;
for ( var materialName in this.materials ) {
material = this.materials[ | javascript | {
"resource": ""
} | |
q48074 | train | function ( globalCallbacks, maxQueueSize, maxWebWorkers ) {
if ( THREE.LoaderSupport.Validator.isValid( globalCallbacks ) ) this.workerDescription.globalCallbacks = globalCallbacks;
this.maxQueueSize = Math.min( maxQueueSize, THREE.LoaderSupport.WorkerDirector.MAX_QUEUE_SIZE );
this.maxWebWorkers = Math.min( maxW... | javascript | {
"resource": ""
} | |
q48075 | train | function () {
var wsKeys = Object.keys( this.workerDescription.workerSupports );
return ( ( this.instructionQueue.length > | javascript | {
"resource": ""
} | |
q48076 | train | function () {
var prepData, supportDesc;
for ( var instanceNo in this.workerDescription.workerSupports ) {
supportDesc = this.workerDescription.workerSupports[ instanceNo ];
if ( ! supportDesc.inUse ) {
if ( this.instructionQueuePointer < this.instructionQueue.length ) {
prepData = this.instructio... | javascript | {
"resource": ""
} | |
q48077 | train | function ( callbackOnFinishedProcessing ) {
if ( this.logging.enabled ) console.info( 'WorkerDirector received the deregister call. Terminating all workers!' );
this.instructionQueuePointer = this.instructionQueue.length; | javascript | {
"resource": ""
} | |
q48078 | train | function ( item ) { // function to obtain the URL of the thumbnail image
var href;
if (item.element) {
href = $(item.element).find('img').attr('src');
}
| javascript | {
"resource": ""
} | |
q48079 | train | function( url, rez, params ) {
params = params || '';
if ( $.type( params ) === "object" ) {
params = $.param(params, true);
} | javascript | {
"resource": ""
} | |
q48080 | createMongoosePromise | train | function createMongoosePromise(resolver) {
var promise
// mongoose 5 and up
if (parseInt(mongoose.version) >= 5) {
promise = new mongoose.Promise(resolver)
}
// mongoose 4.1 and up
else if (mongoose.Promise.ES6) {
promise = new mongoose.Promise.ES6(resolver)
}
// backward co... | javascript | {
"resource": ""
} |
q48081 | deepPopulatePlugin | train | function deepPopulatePlugin(schema, defaultOptions) {
schema._defaultDeepPopulateOptions = defaultOptions = defaultOptions || {}
/**
* Populates this document with the specified paths.
* @param paths the paths to be populated.
* @param options (optional) the population options.
* @param cb ... | javascript | {
"resource": ""
} |
q48082 | findPossibleIndexes | train | function findPossibleIndexes(code, identifiers, filter) {
const possibleIndexes = [];
if (identifiers.length === 0) {
return possibleIndexes;
}
const pattern = new RegExp(
| javascript | {
"resource": ""
} |
q48083 | moduleExport | train | function moduleExport(getters, constant) {
utils.setESModule(this.exports);
var entry = Entry.getOrCreate(this.id, this);
entry.addGetters(getters, constant);
if (this.loaded) {
// If the module has already been evaluated, then | javascript | {
"resource": ""
} |
q48084 | nodeModules | train | function nodeModules() {
return fs.readdirSync('node_modules')
.filter(dir => ['.bin'].indexOf(dir) === -1)
.reduce((modules, m) => {
| javascript | {
"resource": ""
} |
q48085 | train | function (seq, begin, end) {
var sliced = seq.reduce(
function (state, chunk) {
var index = state.index;
if (chunk instanceof Token) {
var code = sgr.extractCode(chunk.token);
if (index <= begin) {
if (code in sgr.openers) {
sgr.openStyle(state.preOpeners, code);
}
if (code in sg... | javascript | {
"resource": ""
} | |
q48086 | transform | train | function transform({ babel, filename, documentFilename }) {
if (!filename) {
throw new Error(
`You must pass a filename to importMDX(). Please see the mdx.macro documentation`,
)
}
let documentPath = path.join(filename, '..', documentFilename);
let imports = `import React from 'react'\nimport { MD... | javascript | {
"resource": ""
} |
q48087 | parseJSXContent | train | function parseJSXContent(state, start, type) {
var text,
result,
max = state.posMax,
prevPos,
oldPos = state.pos;
state.pos = start;
while (state.pos < max) {
text = state.src.slice(state.pos)
result = JSX_INLINE_CLOSE_TAG_PARSER.parse(text)
prevPos = state.pos;
state.md... | javascript | {
"resource": ""
} |
q48088 | checkLinks | train | function checkLinks (transaction, record, fields, links, meta) {
var Promise = promise.Promise
var enforceLinks = this.options.settings.enforceLinks
return Promise.all(map(links, function (field) {
var ids = Array.isArray(record[field]) ? record[field] :
!record.hasOwnProperty(field) || record[field] =... | javascript | {
"resource": ""
} |
q48089 | validateUpdates | train | function validateUpdates (updates, meta) {
var language = meta.language
var i, j, update
if (!updates || !updates.length)
throw new BadRequestError(
message('UpdateRecordsInvalid', language))
for (i = 0, j = updates.length; i | javascript | {
"resource": ""
} |
q48090 | AdapterSingleton | train | function AdapterSingleton (properties) {
var CustomAdapter, input
input = Array.isArray(properties.adapter) ?
properties.adapter : [ properties.adapter ]
if (typeof input[0] !== 'function')
throw new TypeError('The adapter must be a function.')
CustomAdapter = Adapter.prototype
.isPrototypeOf(inp... | javascript | {
"resource": ""
} |
q48091 | validateField | train | function validateField (fields, key) {
var value = fields[key] = castShorthand(fields[key])
if (typeof value !== 'object')
throw new TypeError('The definition of "' + key + '" must be an object.')
if (key === primaryKey)
throw new Error('Can not define primary key "' + primaryKey + '".')
if (key in p... | javascript | {
"resource": ""
} |
q48092 | castShorthand | train | function castShorthand (value) {
var obj
if (typeof value === 'string') obj = { link: value }
else if (typeof value === 'function') obj = { type: value }
else if (Array.isArray(value)) {
obj = {}
if (value[1]) obj.inverse = value[1]
else obj.isArray = true
// Extract type or link.
if (Arr... | javascript | {
"resource": ""
} |
q48093 | message | train | function message (id, language, data) {
var genericMessage = 'GenericError'
var self = this || message
var str, key, subtag
if (!self.hasOwnProperty(language)) {
subtag = language && language.match(/.+?(?=-)/)
if (subtag) subtag = subtag[0]
if (self.hasOwnProperty(subtag)) language = | javascript | {
"resource": ""
} |
q48094 | deepEqual | train | function deepEqual (a, b) {
var key, value, compare, aLength = 0, bLength = 0
// If they are the same object, don't need to go further.
if (a === b) return true
// Both objects must be defined.
if (!a || !b) return false
// Objects must be of the same type.
if (a.prototype !== b.prototype) return false... | javascript | {
"resource": ""
} |
q48095 | createIndices | train | function createIndices(callback) {
const q = queue();
geojson_files.forEach((gj) => {
q.defer(createIndex, gj);
});
| javascript | {
"resource": ""
} |
q48096 | archiveOriginal | train | function archiveOriginal(callback) {
const archivedOriginal = path.join(outdirectory, '/archived.kml');
const infileContents = fs.readFileSync(infile);
| javascript | {
"resource": ""
} |
q48097 | applicable | train | function applicable(filepath, info, callback) {
const q = queue();
preprocessors.forEach((preprocessor) => {
q.defer(preprocessor.criteria, filepath, info);
});
q.awaitAll((err, results) => {
if (err) | javascript | {
"resource": ""
} |
q48098 | descriptions | train | function descriptions(filepath, info, callback) {
applicable(filepath, info, (err, preprocessors) => {
if (err) return callback(err); | javascript | {
"resource": ""
} |
q48099 | newfile | train | function newfile(filepath) {
let dir = path.dirname(filepath);
if (path.extname(filepath) === '.shp') dir = path.resolve(dir, '..');
const | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.