_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q38900 | common | train | function common(words) {
return _.map(words, function(o) {
return o.word.toLowerCase();
}).sort();
} | javascript | {
"resource": ""
} |
q38901 | filter | train | function filter(unparsed) {
var cmds = this.commands()
, alias = this.finder.getCommandByName;
var i, l = unparsed.length;
for(i = 0;i < l;i++) {
//console.log('unparsed filter %s', unparsed[i]);
if(alias(unparsed[i], cmds)) {
unparsed.splice(i, 1);
i--;
l--;
}
}
//console.lo... | javascript | {
"resource": ""
} |
q38902 | startUp | train | function startUp(dir) {
var config = {
jcr_root: dir,
servers: [{
host: commander.host || "http://localhost:4502",
username: commander.username || "admin",
password: commander.password || "admin"
}]
};
//create a new instance
va... | javascript | {
"resource": ""
} |
q38903 | crudable | train | function crudable(flowthingsWs) {
return {
create: function(obj, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
baseWs(flowthingsWs, this.objectType, 'crea... | javascript | {
"resource": ""
} |
q38904 | dropCreate | train | function dropCreate(flowthingsWs) {
return {
create: function(drop, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
if (this.flowId.charAt(0) === '/') {
... | javascript | {
"resource": ""
} |
q38905 | train | function(req, res, next) {
/**
* If you want to redirect to another controller, uncomment
*/
var controllers = [];
fs.readdir(__dirname + '/', function(err, files) {
if (err) {
throw err;
}
files.forEach(function(file) {
... | javascript | {
"resource": ""
} | |
q38906 | _mkdirp | train | function _mkdirp (directory, mode, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | javascript | {
"resource": ""
} |
q38907 | diff | train | function diff(req, res) {
// defined and loaded commands
var cmds = this.execs
// map of all standard top-level commands
, map = Constants.MAP
// output multi bulk reply list
, list = []
, k;
for(k in map) {
if(!cmds[k]) list.push(k);
}
res.send(null, list);
} | javascript | {
"resource": ""
} |
q38908 | reload | train | function reload(req, res) {
var log = this.log;
if(Persistence.loading) {
return res.send(new Error('database load in progress'));
}
Persistence.load(this.state.store, this.state.conf,
function onLoad(err, time, diff, version) {
if(err) return log.warning('db reload error: %s', err.message);
... | javascript | {
"resource": ""
} |
q38909 | Ellipse | train | function Ellipse(x, y, width, height)
{
/**
* @member {number}
* @default 0
*/
this.x = x || 0;
/**
* @member {number}
* @default 0
*/
this.y = y || 0;
/**
* @member {number}
* @default 0
*/
this.width = width || 0;
/**
* @member {number}
... | javascript | {
"resource": ""
} |
q38910 | apiError | train | function apiError(err) {
var f = testProbe ? testProbe : anomaly.anomaly
f.apply(this, Array.prototype.slice.call(arguments))
} | javascript | {
"resource": ""
} |
q38911 | train | function (done) {
var root = node_path.join(__dirname, 'templates', template);
fs.exists(root, function(exists){
if(exists){
template_root = root;
}else{
template_root = node_path.join(DIR_CUSTOM_TEMPLATES, template)
}
done(null);
});
} | javascript | {
"resource": ""
} | |
q38912 | train | function (done) {
var p = clone(pkg);
delete p.devDependencies;
var content = JSON.stringify(p, null, 2);
write_if_not_exists('package.json', content, done);
} | javascript | {
"resource": ""
} | |
q38913 | extensionMatches | train | function extensionMatches (filename) {
var extname = path.extname(filename);
if (extname) {
return extname === extension;
}
return true;
} | javascript | {
"resource": ""
} |
q38914 | handleDirectoryOrFile | train | function handleDirectoryOrFile (filename) {
var absolutePath = path.join(dir, recursePath, filename),
relativePath = path.join(recursePath, filename);
if (fs.statSync(absolutePath).isDirectory()) {
find(dir, extension, relativePath).forEach(addFileToOutput);
} else {
addFileToOutput(new File(relativePat... | javascript | {
"resource": ""
} |
q38915 | listClassMethods | train | function listClassMethods (Model) {
var classMethods = Object.keys(Model.schema.statics);
for (var method in Model) {
if (!isPrivateMethod(method) && isFunction(Model[method])) {
classMethods.push(method);
}
}
return classMethods;
} | javascript | {
"resource": ""
} |
q38916 | clone | train | function clone(obj) {
if (typeof obj !== 'object') {
return obj;
}
var ret;
if (util.isArray(obj)) {
ret = [];
obj.forEach(function (val) {
ret.push(clone(val));
});
return ret;
}
ret = {};
Object.keys(obj).forEach(function (key) {
... | javascript | {
"resource": ""
} |
q38917 | extend | train | function extend(a, b, noClone) { // A extends B
a = a || {};
if (typeof a !== 'object') {
return noClone ? b : clone(b);
}
if (typeof b !== 'object') {
return b;
}
if (!noClone) {
a = clone(a);
}
Object.keys(b).forEach(function (key) {
if (!a.hasOwnPro... | javascript | {
"resource": ""
} |
q38918 | readCertsSync | train | function readCertsSync(paths) {
var opts = {};
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
switch (paths.length) {
case 1:
opts.pfx = fs.readFileSync(paths[0]);
break;
case 2:
opts.cert = fs.readFil... | javascript | {
"resource": ""
} |
q38919 | readCerts | train | function readCerts(paths, done) {
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
async.map(paths, fs.readFile, function(err, files) {
var opts = {};
if (err) done(err);
else switch (files.length) {
case 1:
... | javascript | {
"resource": ""
} |
q38920 | expressResponseError_silent | train | function expressResponseError_silent(response, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
} | javascript | {
"resource": ""
} |
q38921 | expressResponseError | train | function expressResponseError(response, error, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
console.error(error);
} | javascript | {
"resource": ""
} |
q38922 | properize | train | function properize(word, options) {
options = _.extend({inflect: false}, options);
if (!/\./.test(word)) {
word = changeCase(word);
if (options.inflect === false) {
return word;
}
return inflection.singularize(word);
}
return word;
} | javascript | {
"resource": ""
} |
q38923 | chop | train | function chop(keywords) {
return keywords.slice(0)
.reduce(function(acc, ele) {
acc = acc.concat(ele.split('-'));
return acc;
}, []);
} | javascript | {
"resource": ""
} |
q38924 | changeCase | train | function changeCase(str) {
if (str == null) return '';
str = String(str);
str = str.replace(/\./g, 'zzz')
str = str.replace(/_/g, '-')
str = str.replace(/([A-Z]+)/g, function (_, $1) {
return '-' + $1.toLowerCase();
});
str = str.replace(/[^a-z-]+/g, '-')
str = str.replace(/^[-\s]+|[-\s]+$/g, '');
... | javascript | {
"resource": ""
} |
q38925 | sanitize | train | function sanitize(arr, opts) {
return _.reduce(arr, function (acc, keywords) {
keywords = keywords.split(' ').filter(Boolean);
return acc.concat(keywords).map(function (keyword, i) {
if (opts && opts.sanitize) {
return opts.sanitize(keyword, i, keywords);
}
return keyword.toLowerCase... | javascript | {
"resource": ""
} |
q38926 | uniq | train | function uniq(arr) {
if (arr == null || arr.length === 0) {
return [];
}
return _.reduce(arr, function(acc, ele) {
var letter = exclusions.singleLetters;
if (acc.indexOf(ele) === -1 && letter.indexOf(ele) === -1) {
acc.push(ele);
}
return acc;
}, []);
} | javascript | {
"resource": ""
} |
q38927 | copy | train | function copy (from, to) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided simple pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
patte... | javascript | {
"resource": ""
} |
q38928 | copyPattern | train | function copyPattern (pattern) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided advanced pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
... | javascript | {
"resource": ""
} |
q38929 | copyOptions | train | function copyOptions (options) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {}
// Merge the provided copy plugin config into the context
context.copyPlugin = _extends({}, context.copyPlugin, {
option... | javascript | {
"resource": ""
} |
q38930 | postConfig | train | function postConfig (context, _ref) {
var merge = _ref.merge
return function (prevConfig) {
var _context$copyPlugin = context.copyPlugin,
patterns = _context$copyPlugin.patterns,
options = _context$copyPlugin.options
var plugin = new _copyWebpackPlugin2.default(patterns, options)
return me... | javascript | {
"resource": ""
} |
q38931 | train | function( mElement, aArray ) {
for( var i=0; i<aArray.length; i++ )
if( aArray[i]==mElement )
return i;
return -1;
} | javascript | {
"resource": ""
} | |
q38932 | train | function() {
var v = [];
for( var i in this )
if( typeof this[i]=="function" && this[i].__virtual )
v.push( i );
if( v.length )
createClass.log( 'error', 'INCOMPLETE CLASS '+this.__className+' HAS AT LEAST ONE PURE VIRTUAL FUNCTION: '+v.join(", ") );
} | javascript | {
"resource": ""
} | |
q38933 | stringReduce | train | function stringReduce (string, reducerCallback, initialValue) {
if (string.length === 0) {
assertErr(initialValue, TypeError, 'Reduce of empty string with no initial value')
return initialValue
}
var initialValuePassed = arguments.length === 3
var result
var startIndex
if (initialValuePassed) {
... | javascript | {
"resource": ""
} |
q38934 | handleAny | train | function handleAny (obj) {
if (isPromiseAlike(obj)) {
return obj.then(handleAny)
} else if (isPlainObject(obj)) {
return handleObject(obj)
} else if (Object.prototype.toString.call(obj) === '[object Array]') {
return handleArray(obj)
} else {
return new Promise(function (resolve,... | javascript | {
"resource": ""
} |
q38935 | execute | train | function execute(req, res) {
var value = req.db.getKey(req.args[0], req);
if(value === undefined) return res.send(null, null);
var buf = dump(
{value: value}, value.rtype || Constants.TYPE_NAMES.STRING, null);
res.send(null, buf);
} | javascript | {
"resource": ""
} |
q38936 | assertFiles | train | function assertFiles(expectedNumFiles, tmpDir, callback) {
function countFiles() {
var numFiles = 0;
grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
numFiles++;
});
return numFiles === expectedNumFiles;
}
var interval = setInterval(function() {
... | javascript | {
"resource": ""
} |
q38937 | jsonStream | train | function jsonStream(target, socket) {
// first set the channel encodeing to utf8
socket.setEncoding('utf8');
// data chunks may not contain a complete json string, thats why we store the data
var jsonBuffer = '';
// emits when new data from TCP connection is received
socket.on('data', function (chunk) {
... | javascript | {
"resource": ""
} |
q38938 | train | function (token, context, chain) {
var i ,
len ,
files = [] ,
output = '' ,
viewData = Object.create(context) ,
env = container.getParameter('kernel.environment') ,
data = container.get('assets.template.helper.assets')
.assets(token.files[0], token.files[1], token.files[2], false);
... | javascript | {
"resource": ""
} | |
q38939 | Module | train | function Module(id, parent) {
this.id = id
this.parent = parent;
if (parent && parent.children) {
parent.children.push(this);
}
this.children = [];
this.filename = null;
this.format = undefined;
this.loaded = false;
} | javascript | {
"resource": ""
} |
q38940 | train | function( matrix )
{
// default to empty 2d array
if ( typeof( matrix ) == "undefined" )
var matrix = []; // zero rows
// store rows for O(n) retrieval after initial
// operation. sacrifices memory efficiency
this.__rows = matrix;
this.__cols = d3.transpose(matrix);
// get the default in... | javascript | {
"resource": ""
} | |
q38941 | plugin_parser | train | function plugin_parser(xmlPath) {
this.path = xmlPath;
this.doc = xml.parseElementtreeSync(xmlPath);
this.platforms = this.doc.findall('platform').map(function(p) {
return p.attrib.name;
});
} | javascript | {
"resource": ""
} |
q38942 | onContentChanged | train | function onContentChanged( contentStringOrObject ) {
try {
const
isString = typeof contentStringOrObject === 'string',
content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;
this._content = createSvgFromDefinition.call( this, content );
... | javascript | {
"resource": ""
} |
q38943 | updatePen | train | function updatePen( penIndex, penColor = "0" ) {
if ( !this._content ) return;
let elementsToFill = this._content.elementsToFillPerColor[ penIndex ];
if ( !Array.isArray( elementsToFill ) ) elementsToFill = [];
let elementsToStroke = this._content.elementsToStrokePerColor[ penIndex ];
if ( !Array.i... | javascript | {
"resource": ""
} |
q38944 | aliasesTaken | train | function aliasesTaken (arr) {
var taken
for (var ind in arr) {
if (!arr.hasOwnProperty(ind)) continue;
if (aliasTaken(arr[ind]) !== false) return arr[ind];
}
return false;
} | javascript | {
"resource": ""
} |
q38945 | simpleChar | train | function simpleChar(character) {
return CHAR_TAB !== character &&
CHAR_LINE_FEED !== character &&
CHAR_CARRIAGE_RETURN !== character &&
CHAR_COMMA !== character &&
CHAR_LEFT_SQUARE_BRACKET !== character &&
CHAR_RIGHT_SQUARE_... | javascript | {
"resource": ""
} |
q38946 | needsHexEscape | train | function needsHexEscape(character) {
return !((0x00020 <= character && character <= 0x00007E) ||
(0x00085 === character) ||
(0x000A0 <= character && character <= 0x00D7FF) ||
(0x0E000 <= character && character <= 0x00FFFD) ||
(0x10000 <= character &&... | javascript | {
"resource": ""
} |
q38947 | fromCodePoint | train | function fromCodePoint(cp) {
return (cp < 0x10000) ? String.fromCharCode(cp) :
String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
} | javascript | {
"resource": ""
} |
q38948 | isKeyword | train | function isKeyword(id) {
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === ... | javascript | {
"resource": ""
} |
q38949 | scanPunctuator | train | function scanPunctuator() {
var token, str;
token = {
type: Token.Punctuator,
value: '',
lineNumber: lineNumber,
lineStart: lineStart,
start: index,
end: index
};
// Check for most common single-character punctuato... | javascript | {
"resource": ""
} |
q38950 | scanTemplate | train | function scanTemplate() {
var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
terminated = false;
tail = false;
start = index;
head = (source[index] === '`');
rawOffset = 2;
++index;
while (index < length) {
ch... | javascript | {
"resource": ""
} |
q38951 | parseArrayPattern | train | function parseArrayPattern(params, kind) {
var node = new Node(), elements = [], rest, restNode;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
if (match('...')) {
... | javascript | {
"resource": ""
} |
q38952 | parsePropertyFunction | train | function parsePropertyFunction(node, paramInfo, isGenerator) {
var previousStrict, body;
isAssignmentTarget = isBindingElement = false;
previousStrict = strict;
body = isolateCoverGrammar(parseFunctionSourceElements);
if (strict && paramInfo.firstRestricted) {
tole... | javascript | {
"resource": ""
} |
q38953 | parseTemplateElement | train | function parseTemplateElement(option) {
var node, token;
if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
throwUnexpectedToken();
}
node = new Node();
token = lex();
return node.finishTemplateElement({ raw: token.value.raw, cooke... | javascript | {
"resource": ""
} |
q38954 | parseGroupExpression | train | function parseGroupExpression() {
var expr, expressions, startToken, i, params = [];
expect('(');
if (match(')')) {
lex();
if (!match('=>')) {
expect('=>');
}
return {
type: PlaceHolders.ArrowParameterPlaceHolder,
... | javascript | {
"resource": ""
} |
q38955 | parsePrimaryExpression | train | function parsePrimaryExpression() {
var type, token, expr, node;
if (match('(')) {
isBindingElement = false;
return inheritCoverGrammar(parseGroupExpression);
}
if (match('[')) {
return inheritCoverGrammar(parseArrayInitializer);
}
i... | javascript | {
"resource": ""
} |
q38956 | parseArguments | train | function parseArguments() {
var args = [], expr;
expect('(');
if (!match(')')) {
while (startIndex < length) {
if (match('...')) {
expr = new Node();
lex();
expr.finishSpreadElement(isolateCoverGrammar(pars... | javascript | {
"resource": ""
} |
q38957 | parseNewExpression | train | function parseNewExpression() {
var callee, args, node = new Node();
expectKeyword('new');
if (match('.')) {
lex();
if (lookahead.type === Token.Identifier && lookahead.value === 'target') {
if (state.inFunctionBody) {
lex();
... | javascript | {
"resource": ""
} |
q38958 | parseLeftHandSideExpressionAllowCall | train | function parseLeftHandSideExpressionAllowCall() {
var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
startToken = lookahead;
state.allowIn = true;
if (matchKeyword('super') && state.inFunctionBody) {
expr = new Node();
lex();
... | javascript | {
"resource": ""
} |
q38959 | parsePostfixExpression | train | function parsePostfixExpression() {
var expr, token, startToken = lookahead;
expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
if (match('++') || match('--')) {
// ECMA-262 11.3.1, 11.3... | javascript | {
"resource": ""
} |
q38960 | parseUnaryExpression | train | function parseUnaryExpression() {
var token, expr, startToken;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
startToken = lookahead;
token = lex();
... | javascript | {
"resource": ""
} |
q38961 | parseConditionalExpression | train | function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate, startToken;
startToken = lookahead;
expr = inheritCoverGrammar(parseBinaryExpression);
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn =... | javascript | {
"resource": ""
} |
q38962 | parseYieldExpression | train | function parseYieldExpression() {
var argument, expr, delegate, previousAllowYield;
argument = null;
expr = new Node();
delegate = false;
expectKeyword('yield');
if (!hasLineTerminator) {
previousAllowYield = state.allowYield;
state.allowYield =... | javascript | {
"resource": ""
} |
q38963 | parseAssignmentExpression | train | function parseAssignmentExpression() {
var token, expr, right, list, startToken;
startToken = lookahead;
token = lookahead;
if (!state.allowYield && matchKeyword('yield')) {
return parseYieldExpression();
}
expr = parseConditionalExpression();
if (... | javascript | {
"resource": ""
} |
q38964 | parseExpression | train | function parseExpression() {
var expr, startToken = lookahead, expressions;
expr = isolateCoverGrammar(parseAssignmentExpression);
if (match(',')) {
expressions = [expr];
while (startIndex < length) {
if (!match(',')) {
break;
... | javascript | {
"resource": ""
} |
q38965 | parseStatementListItem | train | function parseStatementListItem() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
if (state.sourceType !== 'module') {
tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
}
... | javascript | {
"resource": ""
} |
q38966 | parseLexicalBinding | train | function parseLexicalBinding(kind, options) {
var init = null, id, node = new Node(), params = [];
id = parsePattern(params, kind);
// ECMA-262 12.2.1
if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
tolerateError(Messages.StrictVarName);
... | javascript | {
"resource": ""
} |
q38967 | parseIfStatement | train | function parseIfStatement(node) {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement()... | javascript | {
"resource": ""
} |
q38968 | parseDoWhileStatement | train | function parseDoWhileStatement(node) {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(')... | javascript | {
"resource": ""
} |
q38969 | parseContinueStatement | train | function parseContinueStatement(node) {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(startIndex) === 0x3B) {
lex();
if (!state.inIteration) {
throwError(Messages.IllegalCo... | javascript | {
"resource": ""
} |
q38970 | parseReturnStatement | train | function parseReturnStatement(node) {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
tolerateError(Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(lastIndex) === ... | javascript | {
"resource": ""
} |
q38971 | parseWithStatement | train | function parseWithStatement(node) {
var object, body;
if (strict) {
tolerateError(Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return node.finis... | javascript | {
"resource": ""
} |
q38972 | parseSwitchCase | train | function parseSwitchCase() {
var test, consequent = [], statement, node = new Node();
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (start... | javascript | {
"resource": ""
} |
q38973 | parseThrowStatement | train | function parseThrowStatement(node) {
var argument;
expectKeyword('throw');
if (hasLineTerminator) {
throwError(Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return node.finishThrowStatement(argument);
} | javascript | {
"resource": ""
} |
q38974 | parseCatchClause | train | function parseCatchClause() {
var param, params = [], paramMap = {}, key, i, body, node = new Node();
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpectedToken(lookahead);
}
param = parsePattern(params);
for (i = 0; i < params.leng... | javascript | {
"resource": ""
} |
q38975 | parseFunctionSourceElements | train | function parseFunctionSourceElements() {
var statement, body = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
node = new Node();
expect('{');
while (startIndex < length) {
if (lookahea... | javascript | {
"resource": ""
} |
q38976 | parseModuleSpecifier | train | function parseModuleSpecifier() {
var node = new Node();
if (lookahead.type !== Token.StringLiteral) {
throwError(Messages.InvalidModuleSpecifier);
}
return node.finishLiteral(lex());
} | javascript | {
"resource": ""
} |
q38977 | parseScriptBody | train | function parseScriptBody() {
var statement, body = [], token, directive, firstRestricted;
while (startIndex < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
statement = parseStatementListItem();
... | javascript | {
"resource": ""
} |
q38978 | train | function(){
// Initialize the API object
if (this.mainView) {
this.mainView.clear();
}
var url = this.options.url;
if (url && url.indexOf('http') !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
if(this.api) {
this.options.authorizations = this.api.clie... | javascript | {
"resource": ""
} | |
q38979 | flushCurrentCell | train | function flushCurrentCell() {
if (currentCell.children.length > 0) {
cells.push(currentCell);
currentCell = N.tag("div");
cellsWeights.push(1);
totalWeight++;
}
} | javascript | {
"resource": ""
} |
q38980 | readFileContent | train | function readFileContent(fileName){
try{
return(fs.readFileSync(fileName , "utf-8"));
}catch(e){
console.log("---readFileContent-- Error reading file "+fileName);
console.log(e);
return null;
}
} | javascript | {
"resource": ""
} |
q38981 | output | train | function output (consumer, template, params, getDefault) {
return new Output (consumer, template, params, getDefault);
} | javascript | {
"resource": ""
} |
q38982 | train | function (xhr, options, promise) {
console.log(NAME, '_initXHR');
var instance = this,
url = options.url,
method = options.method || GET,
headers = options.headers || {}, // all request will get some headers
async = !options.sync,
... | javascript | {
"resource": ""
} | |
q38983 | train | function(xhr, promise, headers, method) {
// XDR cannot set requestheaders, only XHR:
if (!xhr._isXDR) {
console.log(NAME, '_setHeaders');
var name;
if ((method!=='POST') && (method!=='PUT')) {
// force GET-request to make a req... | javascript | {
"resource": ""
} | |
q38984 | train | function(data) {
var paramArray = [],
key, value;
// TODO: use `object` module
for (key in data) {
value = data[key];
key = ENCODE_URI_COMPONENT(key);
paramArray.push((value === null) ? key : (key + '=' + ENCODE_URI_COMPONEN... | javascript | {
"resource": ""
} | |
q38985 | AnalyticsEventEmitter | train | function AnalyticsEventEmitter(logger, utils, CONSTANT, onErrorCallback, optionalArguments, serviceName) {
'use strict';
this.logger = logger || {};
this.utils = utils || {};
this.CONSTANT = CONSTANT || {};
optionalArguments = optionalArguments || {};
this.settings = optionalArguments.settings;
this.re... | javascript | {
"resource": ""
} |
q38986 | train | function (types) {
that.logger.logEnter('callback in loadEventTypes, types:\n' + JSON.stringify(types));
// The "raw" event type data has a deeply-nested structure and it
// contains a bunch of stuff we're not interested in. We'll just
// store the names of each type's properties.
Object.keys(typ... | javascript | {
"resource": ""
} | |
q38987 | train | function (filePath, options)
{
gulpUtil.log(gulpUtil.colors.blue("jsHint"), pathHelper.makeRelative(filePath));
var jsHintConfig = jsHintConfigHelper.getRules(xtend({
lookup: false,
esnext: false
}, options));
gulp.src(filePath)
.pipe(plumber())
... | javascript | {
"resource": ""
} | |
q38988 | moveETP2End | train | function moveETP2End(config) {
if (!ExtractTextPlugin) return
const etps = config.plugins.filter(val => val instanceof ExtractTextPlugin)
_.chain(config.plugins)
.pullAll(etps)
.push(...etps)
.value()
} | javascript | {
"resource": ""
} |
q38989 | defineGlobalVars | train | function defineGlobalVars(runtimeConfig, isDebug) {
const globals = Object.assign({}, runtimeConfig.globals, {
APP_DEBUG_MODE: isDebug || !!runtimeConfig.debuggable
})
return new webpack.DefinePlugin(globals)
} | javascript | {
"resource": ""
} |
q38990 | assertContext | train | function assertContext() {
return new Promise(function(resolve, reject) {
// Check if we're in an active session
let d = process.domain
if (d == null ||
d.context == null ||
d.context.bardo == null) {
// Begin the session before proceeding
return begin().then((ctx) => {
... | javascript | {
"resource": ""
} |
q38991 | execute_ | train | function execute_(ctx, statement, values) {
return new Promise(function(resolve, reject) {
if (/^begin/i.test(statement)) {
// If this is a `BEGIN` statement; put us in a transaction
ctx.inTransaction = true
} else if (/^(commit|rollback)/i.test(statement)) {
// Else if this is a `COMMIT` or... | javascript | {
"resource": ""
} |
q38992 | issueCountReporter | train | function issueCountReporter (file)
{
if (!file.scsslint.success)
{
totalIssues += file.scsslint.issues.length;
}
scssLintReporter.defaultReporter(file);
} | javascript | {
"resource": ""
} |
q38993 | compileSingleFile | train | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace("assets/scss", "public/css");
gulpUtil.log(gulpUtil.colors.blue("Sass"), pathHelper.makeRelative(filePath), " -> ", outputPath + "/" + path.basename(filePath).replace(/\.scss$/, ".css"));
var in... | javascript | {
"resource": ""
} |
q38994 | lintFiles | train | function lintFiles (src)
{
gulp.src(src)
.pipe(scssLint({
config: __dirname + "/../config/scss-lint.yml",
customReport: issueCountReporter
}))
.on('error', function (error)
{
gulpUtil.log(gulpUtil.colors.red('An error has occurred while executing s... | javascript | {
"resource": ""
} |
q38995 | startWatcherForLinting | train | function startWatcherForLinting (src)
{
watch(src,
function (file)
{
if (file.path)
{
lintFiles(file.path);
}
}
);
} | javascript | {
"resource": ""
} |
q38996 | compileAllFiles | train | function compileAllFiles (src, isDebug, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
// only start compilation at root files
if (sassHelpers.isRootFile(files[i]))
... | javascript | {
"resource": ""
} |
q38997 | makeModule | train | function makeModule(index) {
var stored, src, srcPath, relpath;
// Prepare module
var module = new Module({
uid: index
,req: []
,path: index
,relpath: null
,isNodeModule: false
,isAsyncModule: arequirePath === index
,arequirePath: arequirePath
,index: index
});
if(~modul... | javascript | {
"resource": ""
} |
q38998 | update | train | function update (client) {
return function update (options) {
options = options || {};
const req = {
url: `${client.baseUrl}/rest/applications/${options.variantId}/installations/${options.installation.id}`,
body: options.installation,
method: 'PUT'
};
return request(client, req)
... | javascript | {
"resource": ""
} |
q38999 | BaseTexture | train | function BaseTexture(source, scaleMode, resolution)
{
EventEmitter.call(this);
this.uuid = utils.uuid();
/**
* The Resolution of the texture.
*
* @member {number}
*/
this.resolution = resolution || 1;
/**
* The width of the base texture set when the image has loaded
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.