_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q28100 | binl2rstr | train | function binl2rstr(input) {
var i, output = '',
l = input.length * 32;
for (i = 0; i < l; i += 8) {
| javascript | {
"resource": ""
} |
q28101 | binl | train | function binl(x, len) {
var T, j, i, l,
h0 = 0x67452301,
h1 = 0xefcdab89,
h2 = 0x98badcfe,
h3 = 0x10325476,
h4 = 0xc3d2e1f0,
A1, B1, C1, D1, E1,
A2, B2, C2, D2, E2;
/* append padding */
x[len >> 5] |= 0x80 << (len % 32);
... | javascript | {
"resource": ""
} |
q28102 | rmd160_f | train | function rmd160_f(j, x, y, z) {
return (0 <= j && j <= 15) ? (x ^ y ^ z) :
(16 <= j && j <= 31) ? (x & y) | (~x & z) :
(32 <= j && j <= 47) ? (x | ~y) ^ z :
(48 | javascript | {
"resource": ""
} |
q28103 | purgeADQueue | train | function purgeADQueue (channel, connectionName, options, messages) {
const name = options.uniqueName || options.name;
return new Promise(function (resolve, reject) {
const messageCount = messages.messages.length;
if (messageCount > 0) {
log.info(`Purge operation for queue '${options.name}' on '${conne... | javascript | {
"resource": ""
} |
q28104 | replaceDecls | train | function replaceDecls(originalRules, criticalRule){
// find all the rules in the original CSS that have the same selectors and
// then create an array of all the associated declarations. Note that this
// works with mutiple duplicate selectors on the original CSS
var originalDecls = _.flatten(
originalRules
... | javascript | {
"resource": ""
} |
q28105 | inferColumns | train | function inferColumns(rows) {
var columnSet = Object.create(null),
columns = [];
rows.forEach(function(row) {
for (var column in row) {
if | javascript | {
"resource": ""
} |
q28106 | filterJsDocComments | train | function filterJsDocComments(jsDocComments) {
const swaggerJsDocComments = [];
for (let i = 0; i < jsDocComments.length; i += 1) {
const jsDocComment = jsDocComments[i];
| javascript | {
"resource": ""
} |
q28107 | convertGlobPaths | train | function convertGlobPaths(globs) {
return globs
.map(globString => glob.sync(globString))
| javascript | {
"resource": ""
} |
q28108 | createSpecification | train | function createSpecification(swaggerDefinition, apis, fileName) {
// Options for the swagger docs
const options = {
// Import swaggerDefinitions
swaggerDefinition,
// Path to the API docs
apis,
};
// Initialize swagger-jsdoc -> returns validated JSON or YAML swagger spec
let swaggerSpec;
co... | javascript | {
"resource": ""
} |
q28109 | loadSpecification | train | function loadSpecification(defPath, data) {
const resolvedPath = path.resolve(defPath);
const extName = path.extname(resolvedPath);
const loader = LOADERS[extName];
// Check whether the definition file is actually a usable file
if (loader === undefined) | javascript | {
"resource": ""
} |
q28110 | hasEmptyProperty | train | function hasEmptyProperty(obj) {
return Object.keys(obj)
.map(key => obj[key])
.every(
keyObject =>
typeof keyObject | javascript | {
"resource": ""
} |
q28111 | parseApiFile | train | function parseApiFile(file) {
const jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm;
const fileContent = fs.readFileSync(file, { encoding: 'utf8' });
const ext = path.extname(file);
const yaml = [];
const jsDocComments = [];
if (ext === '.yaml' || ext === '.yml') {
yaml.push(jsYaml.safeLoad(fileContent));
} el... | javascript | {
"resource": ""
} |
q28112 | _monkeypatch | train | function _monkeypatch(filePath, monkeyPatched, processor, complete) {
async.waterfall(
[
function read(next) {
fs.readFile(filePath, 'utf8', next);
},
// TODO - need to parse gyp file - this is a bit hacker
function monkeypatch(content, next) {
if (monkeyPatched(content)) ... | javascript | {
"resource": ""
} |
q28113 | _log | train | function _log() {
var args = Array.prototype.slice.call(arguments, 0),
level = args.shift();
if (!~['log', 'error', 'warn'].indexOf(level)) {
args.unshift(level);
level = 'log';
}
if (level == 'log') {
args[0] = '----> ' + args[0];
} else if (level == 'error') {
args[0] = '....> | javascript | {
"resource": ""
} |
q28114 | embed | train | function embed(resourceFiles, resourceRoot) {
if (resourceFiles.length > 0) {
let buffer = 'var embeddedFiles = {\n';
for (let i = 0; i < resourceFiles.length; ++i) {
buffer +=
JSON.stringify(path.relative(resourceRoot, resourceFiles[i])) + | javascript | {
"resource": ""
} |
q28115 | checkOpts | train | function checkOpts(next) {
/* failsafe */
if (options === undefined) {
_log('error', 'no options given to .compile()');
process.exit();
}
/**
* Have we been given a custom flag for python executable?
**/
if (
options.python !== 'py... | javascript | {
"resource": ""
} |
q28116 | downloadNode | train | function downloadNode(next) {
_downloadNode(
version,
options.nodeTempDir,
options.nodeConfigureArgs,
| javascript | {
"resource": ""
} |
q28117 | embedResources | train | function embedResources(nc, next) {
nodeCompiler = nc;
options.resourceFiles = options.resourceFiles || [];
options.resourceRoot = options.resourceRoot || '';
if (!Array.isArray(options.resourceFiles)) {
throw new Error('Bad Argument: resourceFiles is not an array');
... | javascript | {
"resource": ""
} |
q28118 | combineProject | train | function combineProject(next) {
if (options.noBundle) {
_log(
'using provided bundle %s since noBundle is true',
options.input,
);
const source = fs.readFileSync(options.input, 'utf8');
const thirdPartyMain = `
if (!process.send) {
console.log('t... | javascript | {
"resource": ""
} |
q28119 | cleanUpOldExecutable | train | function cleanUpOldExecutable(next) {
fs.unlink(nodeCompiler.releasePath, function(err) {
if (err) {
if (err.code === 'ENOENT') {
next();
| javascript | {
"resource": ""
} |
q28120 | checkThatExecutableExists | train | function checkThatExecutableExists(next) {
fs.exists(nodeCompiler.releasePath, function(exists) {
if (!exists) {
_log(
'error',
'The release executable has not been generated. ' +
'This indicates a failure in the build process. ' +
| javascript | {
"resource": ""
} |
q28121 | copyBinaryToOutput | train | function copyBinaryToOutput(next) {
_log('cp %s %s', nodeCompiler.releasePath, options.output);
ncp(nodeCompiler.releasePath, options.output, function(err) {
if (err) {
_log('error', "Couldn't copy binary.");
| javascript | {
"resource": ""
} |
q28122 | downloadNode | train | function downloadNode(next) {
if (fs.existsSync(nodeFilePath)) return next();
var uri = framework;
if (framework === 'node') {
uri = 'nodejs'; // if node, use nodejs uri
} else if (framework === 'nodejs') {
framework = 'node'; // support nodejs, and node, as framewo... | javascript | {
"resource": ""
} |
q28123 | unzipNodeTarball | train | function unzipNodeTarball(next) {
var onError = function(err) {
console.log(err.stack);
_log('error', 'failed to extract the node source');
process.exit(1);
};
if (isWin) {
_log('extracting the node source [node-tar.gz]');
// tar-stream method ... | javascript | {
"resource": ""
} |
q28124 | _loop | train | function _loop(dir) {
/* eventually try every python file */
var pdir = fs.readdirSync(dir);
pdir.forEach(function(v, i) {
var stat = fs.statSync(dir + '/' + v);
if (stat.isFile()) {
// only process Makefiles and .mk targets.
... | javascript | {
"resource": ""
} |
q28125 | _monkeyPatchGyp | train | function _monkeyPatchGyp(compiler, options, complete) {
const hasNexeres = options.resourceFiles.length > 0;
const gypPath = path.join(compiler.dir, 'node.gyp');
let replacementString = "'lib/fs.js', 'lib/_third_party_main.js', ";
if (hasNexeres) {
replacementString += "'lib/nexeres.js', ";
}
_monkeyp... | javascript | {
"resource": ""
} |
q28126 | _monkeyPatchConfigure | train | function _monkeyPatchConfigure(compiler, complete, options) {
var configurePath = path.join(compiler.dir, 'configure.py');
var snapshotPath = options.startupSnapshot;
if (snapshotPath != null) {
_log('monkey patching configure file');
snapshotPath = path.join(process.cwd(), snapshotPath);
return _mon... | javascript | {
"resource": ""
} |
q28127 | _monkeyPatchMainCc | train | function _monkeyPatchMainCc(compiler, complete) {
let finalContents;
let mainPath = path.join(compiler.dir, 'src', 'node.cc');
let mainC = fs.readFileSync(mainPath, {
encoding: 'utf8',
});
// content split, and original start/end
let constant_loc = 1;
let lines = mainC.split('\n');
let startLine =... | javascript | {
"resource": ""
} |
q28128 | _getFirstDirectory | train | function _getFirstDirectory(dir) {
var files = glob.sync(dir + '/*');
for (var i = files.length; i--; ) {
var file = files[i];
if | javascript | {
"resource": ""
} |
q28129 | _logProgress | train | function _logProgress(req) {
req.on('response', function(resp) {
var len = parseInt(resp.headers['content-length'], 10),
bar = new ProgressBar('[:bar]', {
complete: '=',
incomplete: ' ',
total: len,
width: 100, // just use 100
});
| javascript | {
"resource": ""
} |
q28130 | train | function (packageName) {
let result;
try {
result = require.resolve(packageName, { basedir: process.cwd() });
| javascript | {
"resource": ""
} | |
q28131 | getExamples | train | function getExamples(dirName, callback) {
const example_files = fs.readdirSync(dirName);
const entries = {};
// iterate through the list of files in the directory.
for (const filename of example_files) { | javascript | {
"resource": ""
} |
q28132 | getEntries | train | function getEntries(dirName) {
const entries = {};
getExamples(dirName, | javascript | {
"resource": ""
} |
q28133 | getHtmlTemplates | train | function getHtmlTemplates(dirName) {
const html_conf = [];
// create the array of HTML plugins.
const template = path.join(dirName, '_template.html');
getExamples(dirName, (entryName, filename) => {
html_conf.push(
new HtmlWebpackPlugin({
title: entryName,
// ensure each output has a u... | javascript | {
"resource": ""
} |
q28134 | train | function() {
return {
title: this.input.val().trim(),
| javascript | {
"resource": ""
} | |
q28135 | train | function() {
_.each(window.app.Todos.completed(), | javascript | {
"resource": ""
} | |
q28136 | train | function(feature, minTime, maxTime) {
var featureStringTimes = this._getFeatureTimes(feature);
if (featureStringTimes.length == 0) {
return feature;
}
var featureTimes = [];
for (var i = 0, l = featureStringTimes.length; i < l; i++) | javascript | {
"resource": ""
} | |
q28137 | generateOptionsResponder | train | function generateOptionsResponder(res, methods) {
return function onDone(fn, err) {
if (err || methods.length === 0) {
| javascript | {
"resource": ""
} |
q28138 | mergeParams | train | function mergeParams(params, parent) {
if (typeof parent !== 'object' || !parent) {
return params
}
// make copy of parent for base
var obj = mixin({}, parent)
// simple non-numeric merging
if (!(0 in params) || !(0 in parent)) {
return mixin(obj, params)
}
| javascript | {
"resource": ""
} |
q28139 | restore | train | function restore(fn, obj) {
var props = new Array(arguments.length - 2)
var vals = new Array(arguments.length - 2)
for (var i = 0; i < props.length; i++) {
props[i] = arguments[i + 2]
vals[i] = obj[props[i]]
}
return function(){
// restore vals
| javascript | {
"resource": ""
} |
q28140 | sendOptionsResponse | train | function sendOptionsResponse(res, methods) {
var options = Object.create(null)
// build unique method map
for (var i = 0; i < methods.length; i++) {
options[methods[i]] = true
}
// construct the allow list
var allow = Object.keys(options).sort().join(', ')
// send response
| javascript | {
"resource": ""
} |
q28141 | trySendOptionsResponse | train | function trySendOptionsResponse(res, methods, next) {
| javascript | {
"resource": ""
} |
q28142 | reduceModifiers | train | function reduceModifiers (previousValue, currentValue) {
return previousValue + | javascript | {
"resource": ""
} |
q28143 | jsonSections | train | function jsonSections(sections, block) {
return sections.map(function(section) {
// Temporary inserting of partial
var partial = section;
if (partial.markup() && partial.markup().toString().match(/^[^\n]+\.(html|hbs|pug)$/)) {
partial.file = partial.markup().toString();
partial.name = path.ba... | javascript | {
"resource": ""
} |
q28144 | jsonModifiers | train | function jsonModifiers(modifiers) {
return modifiers.map(function(modifier, id) {
return {
id: id + 1,
name: modifier.name(), | javascript | {
"resource": ""
} |
q28145 | intersect_line_line | train | function intersect_line_line(p1, p2, p3, p4) {
var denom = ((p4.y - p3.y)*(p2.x - p1.x) - (p4.x - p3.x)*(p2.y - p1.y));
// lines are parallel
if (denom === 0) {
return false;
}
var ua = ((p4.x - p3.x)*(p1.y | javascript | {
"resource": ""
} |
q28146 | emptyBucket | train | function emptyBucket(aws, bucketName, keyPrefix) {
return listObjectsInBucket(aws, bucketName).then(resp => {
const contents = resp.Contents;
let testPrefix = false,
prefixRegexp;
if (!contents[0]) {
return Promise.resolve();
} else {
if (keyPrefix) {
| javascript | {
"resource": ""
} |
q28147 | configureBucket | train | function configureBucket(
aws,
bucketName,
indexDocument,
errorDocument,
redirectAllRequestsTo,
routingRules
) {
const params = {
Bucket: bucketName,
WebsiteConfiguration: {}
};
if (redirectAllRequestsTo) {
params.WebsiteConfiguration.RedirectAllRequestsTo = {};
params.WebsiteConfigur... | javascript | {
"resource": ""
} |
q28148 | configurePolicyForBucket | train | function configurePolicyForBucket(aws, bucketName, customPolicy) {
const policy = customPolicy || {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
AWS: '*'
},
Action: 's3:GetObject',
| javascript | {
"resource": ""
} |
q28149 | configureCorsForBucket | train | function configureCorsForBucket(aws, bucketName) {
const params = {
Bucket: bucketName,
| javascript | {
"resource": ""
} |
q28150 | uploadDirectory | train | function uploadDirectory(aws, bucketName, clientRoot, headerSpec, orderSpec, keyPrefix) {
const allFiles = getFileList(clientRoot);
const filesGroupedByOrder = groupFilesByOrder(allFiles, orderSpec);
return filesGroupedByOrder.reduce((existingUploads, files) => {
return existingUploads.then(existingResults ... | javascript | {
"resource": ""
} |
q28151 | uploadFile | train | function uploadFile(aws, bucketName, filePath, fileKey, headers) {
const baseHeaderKeys = [
'Cache-Control',
'Content-Disposition',
'Content-Encoding',
'Content-Language',
'Content-Type',
'Expires',
'Website-Redirect-Location'
];
const fileBuffer = fs.readFileSync(filePath);
const ... | javascript | {
"resource": ""
} |
q28152 | makeKeyIndexAndFree | train | function makeKeyIndexAndFree (list, key) {
var keyIndex = {}
var free = []
for (var i = 0, len = list.length; i < len; i++) {
var item = list[i]
var itemKey = getItemKey(item, key)
if (itemKey) | javascript | {
"resource": ""
} |
q28153 | setIndexesForSegments | train | function setIndexesForSegments(
segmentsObject = null,
serviceSegmentsObject = null
) {
const segments = segmentsObject
? Object.keys(segmentsObject).map(k => segmentsObject[k])
: null;
const serviceSegments = serviceSegmentsObject
? Object.keys(serviceSegmentsObject).map(k => serviceSegmentsObject... | javascript | {
"resource": ""
} |
q28154 | cookieParser | train | function cookieParser (secret, options) {
var secrets = !secret || Array.isArray(secret)
? (secret || [])
: [secret]
return function cookieParser (req, res, next) {
if (req.cookies) {
return next()
}
var cookies = req.headers.cookie
req.secret = secrets[0]
req.cookies = Object.c... | javascript | {
"resource": ""
} |
q28155 | JSONCookie | train | function JSONCookie (str) {
if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') {
return undefined
}
try {
| javascript | {
"resource": ""
} |
q28156 | JSONCookies | train | function JSONCookies (obj) {
var cookies = Object.keys(obj)
var key
var val
for (var i = 0; i < cookies.length; i++) {
key = cookies[i]
val | javascript | {
"resource": ""
} |
q28157 | train | function () {
try {
return new TextDecoder().decode(new TextEncoder().encode("test"), {stream: true}) === "test";
} | javascript | {
"resource": ""
} | |
q28158 | train | function (searchQuery) {
var selector = page.googleSearch.elements.searchInput;
// return a promise so the calling function knows the task has completed
| javascript | {
"resource": ""
} | |
q28159 | getDriverInstance | train | function getDriverInstance() {
var driver;
switch (browserName || '') {
case 'firefox': {
driver = new FireFoxDriver();
}
break;
case 'phantomjs': {
driver = new PhantomJSDriver();
}
break;
case 'electron': {
... | javascript | {
"resource": ""
} |
q28160 | getEyesInstance | train | function getEyesInstance() {
if (global.eyesKey) {
var eyes = new Eyes();
// retrieve eyes api key from config file in the project root as defined by the user
| javascript | {
"resource": ""
} |
q28161 | createWorld | train | function createWorld() {
var runtime = {
driver: null, // the browser object
eyes: null,
selenium: selenium, // the raw nodejs selenium driver
By: selenium.By, // in keeping with Java expose selenium By
by: selenium.By, // provide ... | javascript | {
"resource": ""
} |
q28162 | importSupportObjects | train | function importSupportObjects() {
// import shared objects from multiple paths (after global vars have been created)
if (global.sharedObjectPaths && Array.isArray(global.sharedObjectPaths) && global.sharedObjectPaths.length > 0) {
var allDirs = {};
// first require directories into objects by... | javascript | {
"resource": ""
} |
q28163 | train | function(url, waitInSeconds) {
// use either passed in timeout or global default
var timeout = (waitInSeconds) ? (waitInSeconds * 1000) : DEFAULT_TIMEOUT;
// load the url and wait for it to complete
return driver.get(url).then(function() {
| javascript | {
"resource": ""
} | |
q28164 | train | function (htmlCssSelector, attributeName) {
// get the element from the page
return driver.findElement(by.css(htmlCssSelector)).then(function(el) | javascript | {
"resource": ""
} | |
q28165 | train | function(elementSelector, attributeName, waitInMilliseconds) {
// use either passed in timeout or global default
var timeout = waitInMilliseconds || DEFAULT_TIMEOUT;
// readable error message
var timeoutMessage = attributeName + ' does not exists after ' + waitInMilliseconds + ' millis... | javascript | {
"resource": ""
} | |
q28166 | train | function () {
if (!els.length) return
els.map(function (el) {
| javascript | {
"resource": ""
} | |
q28167 | train | function (obj, el) {
var self = this
Object.keys(obj).map(function (prop) {
var sh = self.shorthand[prop] || prop
if (sh.match(/(body|undo|replace)/g)) return
if (sh === 'inner') {
| javascript | {
"resource": ""
} | |
q28168 | train | function (obj) {
if (!obj) return
diffTitle.before = opt.complement
var title = obj.inner + ' ' + (obj.separator || opt.separator) +
' ' | javascript | {
"resource": ""
} | |
q28169 | train | function (arr, tag, place, update) {
var self = this
if (!arr) return
arr.map(function (obj) {
var parent = (obj.body) ? self.getPlace('body') : self.getPlace(place)
var el = window.document.getElementById(obj.id) || window.document.createElement(tag)
// Elements that will subs... | javascript | {
"resource": ""
} | |
q28170 | VueHead | train | function VueHead (Vue, options) {
if (installed) return
installed = true
if (options) {
Vue.util.extend(opt, options)
}
/**
* Initializes and updates the elements in the head
* @param {Boolean} update
*/
function init (update) {
var self = this
var head = (ty... | javascript | {
"resource": ""
} |
q28171 | init | train | function init (update) {
var self = this
var head = (typeof self.$options.head === 'function') ? self.$options.head.bind(self)() : self.$options.head
if (!head) return
Object.keys(head).map(function (key) {
var prop = head[key]
if (!prop) return
var obj = | javascript | {
"resource": ""
} |
q28172 | gatherHeaders | train | function gatherHeaders(item) {
var ret, i, l;
if (isHashArray(item)) {
//lets assume a multidimesional array with item 0 bing the title
i = -1;
l = item.length;
ret = [];
while | javascript | {
"resource": ""
} |
q28173 | transformHashData | train | function transformHashData(stream, item) {
var vals = [], row = [], headers = stream.headers, i = -1, headersLength = stream.headersLength;
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
| javascript | {
"resource": ""
} |
q28174 | transformArrayData | train | function transformArrayData(stream, item, cb) {
var row = [];
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
| javascript | {
"resource": ""
} |
q28175 | transformHashArrayData | train | function transformHashArrayData(stream, item) {
var vals = [], row = [], i = -1, headersLength = stream.headersLength;
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
| javascript | {
"resource": ""
} |
q28176 | transformItem | train | function transformItem(stream, item) {
var ret;
if (isArray(item)) {
if (isHashArray(item)) {
ret = transformHashArrayData(stream, item);
} else {
| javascript | {
"resource": ""
} |
q28177 | bundleJavaScript | train | async function bundleJavaScript() {
const bundle = await rollup.rollup({
input: `${__dirname}/src/beedle.js`,
plugins: [
uglify()
]
});
await bundle.write({ | javascript | {
"resource": ""
} |
q28178 | _next | train | function _next (res) {
if (res && !options.skipParse) {
res = [].concat(res)
| javascript | {
"resource": ""
} |
q28179 | lazyResult | train | function lazyResult (render, tree) {
return {
get html () {
| javascript | {
"resource": ""
} |
q28180 | match | train | function match (expression, cb) {
return Array.isArray(expression)
? traverse(this, function (node) {
for (var i = 0; i < expression.length; i++) {
if (compare(expression[i], node)) return cb(node)
}
return node
}) | javascript | {
"resource": ""
} |
q28181 | executeCreate | train | function executeCreate(node) {
let element;
let children = [];
if (node.type === types.text) {
// Create a text node using the text content from the default key.
element = document.createTextNode(node.data[""]);
} else {
const nodeData = node.data;
// Create a DOM element.
element = document.createEleme... | javascript | {
"resource": ""
} |
q28182 | executeView | train | function executeView(nodes, parents, indexes) {
while (true) {
let node = nodes.pop();
const parent = parents.pop();
const index = indexes.pop();
if (node.type === types.component) {
// Execute the component to get the component view.
node = components[node.name](node.data);
// Set the root view or ... | javascript | {
"resource": ""
} |
q28183 | executeDiff | train | function executeDiff(nodesOld, nodesNew, patches) {
while (true) {
const nodeOld = nodesOld.pop();
const nodeOldNode = nodeOld.node;
const nodeNew = nodesNew.pop();
// If they have the same reference (hoisted) then skip diffing.
if (nodeOldNode !== nodeNew) {
if (nodeOldNode.name !== nodeNew.name) {
... | javascript | {
"resource": ""
} |
q28184 | executePatch | train | function executePatch(patches) {
for (let i = 0; i < patches.length; i++) {
const patch = patches[i];
switch (patch.type) {
case patchTypes.updateText: {
// Update text of a node with new text.
const nodeOld = patch.nodeOld;
const nodeNew = patch.nodeNew;
nodeOld.element.textContent = nodeNew.... | javascript | {
"resource": ""
} |
q28185 | executeNext | train | function executeNext() {
// Get the next data update.
const dataNew = executeQueue[0];
// Merge new data into current data.
for (let key in dataNew) {
data[key] = dataNew[key];
}
// Begin | javascript | {
"resource": ""
} |
q28186 | scopeExpression | train | function scopeExpression(expression) {
return expression.replace(expressionRE, (match, name) =>
(
name === undefined ||
name[0] === "$" || | javascript | {
"resource": ""
} |
q28187 | lexError | train | function lexError(message, input, index) {
let lexMessage = message + "\n\n";
// Show input characters surrounding the source of the error.
for (
let i = Math.max(0, index - 16);
| javascript | {
"resource": ""
} |
q28188 | ParseError | train | function ParseError(message, start, end, next) {
this.message = message;
this.start | javascript | {
"resource": ""
} |
q28189 | currency | train | function currency(value, opts) {
let that = this;
if(!(that instanceof currency)) {
return new currency(value, opts);
}
let settings = Object.assign({}, defaults, opts)
, precision = pow(settings.precision)
, v = parse(value, settings);
that.intValue = v;
that.value = v / precision; | javascript | {
"resource": ""
} |
q28190 | alphabetSort | train | function alphabetSort(nodes) {
// use toLowerCase to keep `case insensitive`
return | javascript | {
"resource": ""
} |
q28191 | parseType | train | function parseType (type) {
var size
var ret
if (isArray(type)) {
size = parseTypeArray(type)
var subArray = type.slice(0, type.lastIndexOf('['))
subArray = parseType(subArray)
ret = {
isArray: true,
name: type,
size: size,
memoryUsage: size === 'dynamic' ? 32 : subArray.me... | javascript | {
"resource": ""
} |
q28192 | train | function(name, value, expires, path, domain, httponly) {
if (!name) {
throw new Error("A name is required to create a cookie.");
}
// Parse date to timestamp - consider it never expiring if timestamp is not
// passed to the function
if (expires) {
if (typeof expires !== "number") {... | javascript | {
"resource": ""
} | |
q28193 | Cache | train | function Cache(cacheLoadParameter, cacheBackend) {
// Ensure parameters are how we want them...
cacheBackend = typeof cacheBackend === "function" ? cacheBackend : FilesystemBackend;
cacheLoadParameter = cacheLoadParameter instanceof Array ? cacheLoadParameter : [cacheLoadParameter];
// Now | javascript | {
"resource": ""
} |
q28194 | compare | train | function compare(a, b) {
for (var key in a) {
if (a.hasOwnProperty(key)) {
if (typeof a[key] !== typeof b[key]) {
return false;
}
| javascript | {
"resource": ""
} |
q28195 | deepAssign | train | function deepAssign(object, source) {
for (var key in source) {
if (source.hasOwnProperty(key)) {
if (typeof object[key] === "object" && | javascript | {
"resource": ""
} |
q28196 | train | function() {
Array.call(this);
/**
* Speeds up {@link FetchQueue.oldestUnfetchedItem} by storing the index at
* which the latest oldest unfetched queue item was found.
* @name FetchQueue._oldestUnfetchedIndex
* @private
* @type {Number}
*/
Object.defineProperty(this, "_oldestU... | javascript | {
"resource": ""
} | |
q28197 | FSBackend | train | function FSBackend(loadParameter) {
this.loaded = false;
this.index = [];
this.location = typeof loadParameter === "string" && | javascript | {
"resource": ""
} |
q28198 | train | function(string) {
var result = /\ssrcset\s*=\s*("|')(.*?)\1/.exec(string);
return | javascript | {
"resource": ""
} | |
q28199 | isSubdomainOf | train | function isSubdomainOf(subdomain, host) {
// Comparisons must be case-insensitive
subdomain = subdomain.toLowerCase();
host = host.toLowerCase();
// If we're ignoring www, remove it from both
// (if www is the first domain component...)
if (crawler.ignoreWWWDom... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.