repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
marionettejs/backbone.radio | src/backbone.radio.js | function(name) {
var args = _.toArray(arguments).slice(1);
var results = eventsApi(this, 'request', name, args);
if (results) {
return results;
}
var channelName = this.channelName;
var requests = this._requests;
// Check if we should log the request, and if so, do it
if (channelN... | javascript | function(name) {
var args = _.toArray(arguments).slice(1);
var results = eventsApi(this, 'request', name, args);
if (results) {
return results;
}
var channelName = this.channelName;
var requests = this._requests;
// Check if we should log the request, and if so, do it
if (channelN... | [
"function",
"(",
"name",
")",
"{",
"var",
"args",
"=",
"_",
".",
"toArray",
"(",
"arguments",
")",
".",
"slice",
"(",
"1",
")",
";",
"var",
"results",
"=",
"eventsApi",
"(",
"this",
",",
"'request'",
",",
"name",
",",
"args",
")",
";",
"if",
"(",... | Make a request | [
"Make",
"a",
"request"
] | 7a58ade84bedb5551c2e12bdd3434d0fd6b1bdbd | https://github.com/marionettejs/backbone.radio/blob/7a58ade84bedb5551c2e12bdd3434d0fd6b1bdbd/src/backbone.radio.js#L181-L203 | train | |
marionettejs/backbone.radio | src/backbone.radio.js | function(name, callback, context) {
if (eventsApi(this, 'replyOnce', name, [callback, context])) {
return this;
}
var self = this;
var once = _.once(function() {
self.stopReplying(name);
return makeCallback(callback).apply(this, arguments);
});
return this.reply(name, once, ... | javascript | function(name, callback, context) {
if (eventsApi(this, 'replyOnce', name, [callback, context])) {
return this;
}
var self = this;
var once = _.once(function() {
self.stopReplying(name);
return makeCallback(callback).apply(this, arguments);
});
return this.reply(name, once, ... | [
"function",
"(",
"name",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"eventsApi",
"(",
"this",
",",
"'replyOnce'",
",",
"name",
",",
"[",
"callback",
",",
"context",
"]",
")",
")",
"{",
"return",
"this",
";",
"}",
"var",
"self",
"=",
"thi... | Set up a handler that can only be requested once | [
"Set",
"up",
"a",
"handler",
"that",
"can",
"only",
"be",
"requested",
"once"
] | 7a58ade84bedb5551c2e12bdd3434d0fd6b1bdbd | https://github.com/marionettejs/backbone.radio/blob/7a58ade84bedb5551c2e12bdd3434d0fd6b1bdbd/src/backbone.radio.js#L226-L239 | train | |
lpinca/forwarded-parse | lib/ascii.js | isDelimiter | function isDelimiter(code) {
return code === 0x22 // '"'
|| code === 0x28 // '('
|| code === 0x29 // ')'
|| code === 0x2C // ','
|| code === 0x2F // '/'
|| code >= 0x3A && code <= 0x40 // ':', ';', '<', '=', '>', ... | javascript | function isDelimiter(code) {
return code === 0x22 // '"'
|| code === 0x28 // '('
|| code === 0x29 // ')'
|| code === 0x2C // ','
|| code === 0x2F // '/'
|| code >= 0x3A && code <= 0x40 // ':', ';', '<', '=', '>', ... | [
"function",
"isDelimiter",
"(",
"code",
")",
"{",
"return",
"code",
"===",
"0x22",
"// '\"'",
"||",
"code",
"===",
"0x28",
"// '('",
"||",
"code",
"===",
"0x29",
"// ')'",
"||",
"code",
"===",
"0x2C",
"// ','",
"||",
"code",
"===",
"0x2F",
"// '/'",
"||"... | Check if a character is a delimiter as defined in section 3.2.6 of RFC 7230.
@param {number} code The code of the character to check.
@returns {boolean} `true` if the character is a delimiter, else `false`.
@public | [
"Check",
"if",
"a",
"character",
"is",
"a",
"delimiter",
"as",
"defined",
"in",
"section",
"3",
".",
"2",
".",
"6",
"of",
"RFC",
"7230",
"."
] | a80ef2cb3892ff7c0a2ec80800cd8aa4580dfe89 | https://github.com/lpinca/forwarded-parse/blob/a80ef2cb3892ff7c0a2ec80800cd8aa4580dfe89/lib/ascii.js#L11-L21 | train |
lpinca/forwarded-parse | lib/ascii.js | isTokenChar | function isTokenChar(code) {
return code === 0x21 // '!'
|| code >= 0x23 && code <= 0x27 // '#', '$', '%', '&', '''
|| code === 0x2A // '*'
|| code === 0x2B // '+'
|| code === 0x2D // '-'
|| code === 0x2E // '.'
... | javascript | function isTokenChar(code) {
return code === 0x21 // '!'
|| code >= 0x23 && code <= 0x27 // '#', '$', '%', '&', '''
|| code === 0x2A // '*'
|| code === 0x2B // '+'
|| code === 0x2D // '-'
|| code === 0x2E // '.'
... | [
"function",
"isTokenChar",
"(",
"code",
")",
"{",
"return",
"code",
"===",
"0x21",
"// '!'",
"||",
"code",
">=",
"0x23",
"&&",
"code",
"<=",
"0x27",
"// '#', '$', '%', '&', '''",
"||",
"code",
"===",
"0x2A",
"// '*'",
"||",
"code",
"===",
"0x2B",
"// '+'",
... | Check if a character is allowed in a token as defined in section 3.2.6
of RFC 7230.
@param {number} code The code of the character to check.
@returns {boolean} `true` if the character is allowed, else `false`.
@public | [
"Check",
"if",
"a",
"character",
"is",
"allowed",
"in",
"a",
"token",
"as",
"defined",
"in",
"section",
"3",
".",
"2",
".",
"6",
"of",
"RFC",
"7230",
"."
] | a80ef2cb3892ff7c0a2ec80800cd8aa4580dfe89 | https://github.com/lpinca/forwarded-parse/blob/a80ef2cb3892ff7c0a2ec80800cd8aa4580dfe89/lib/ascii.js#L31-L43 | train |
lpinca/forwarded-parse | lib/error.js | ParseError | function ParseError(message, input) {
Error.captureStackTrace(this, ParseError);
this.name = this.constructor.name;
this.message = message;
this.input = input;
} | javascript | function ParseError(message, input) {
Error.captureStackTrace(this, ParseError);
this.name = this.constructor.name;
this.message = message;
this.input = input;
} | [
"function",
"ParseError",
"(",
"message",
",",
"input",
")",
"{",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"ParseError",
")",
";",
"this",
".",
"name",
"=",
"this",
".",
"constructor",
".",
"name",
";",
"this",
".",
"message",
"=",
"message",... | An error thrown by the parser on unexpected input.
@constructor
@param {string} message The error message.
@param {string} input The unexpected input.
@public | [
"An",
"error",
"thrown",
"by",
"the",
"parser",
"on",
"unexpected",
"input",
"."
] | a80ef2cb3892ff7c0a2ec80800cd8aa4580dfe89 | https://github.com/lpinca/forwarded-parse/blob/a80ef2cb3892ff7c0a2ec80800cd8aa4580dfe89/lib/error.js#L13-L19 | train |
RisingStack/graffiti-mongoose | src/model/model.js | extractPath | function extractPath(schemaPath) {
const subNames = schemaPath.path.split('.');
return reduceRight(subNames, (fields, name, key) => {
const obj = {};
if (schemaPath instanceof mongoose.Schema.Types.DocumentArray) {
const subSchemaPaths = schemaPath.schema.paths;
const fields = extractPaths(sub... | javascript | function extractPath(schemaPath) {
const subNames = schemaPath.path.split('.');
return reduceRight(subNames, (fields, name, key) => {
const obj = {};
if (schemaPath instanceof mongoose.Schema.Types.DocumentArray) {
const subSchemaPaths = schemaPath.schema.paths;
const fields = extractPaths(sub... | [
"function",
"extractPath",
"(",
"schemaPath",
")",
"{",
"const",
"subNames",
"=",
"schemaPath",
".",
"path",
".",
"split",
"(",
"'.'",
")",
";",
"return",
"reduceRight",
"(",
"subNames",
",",
"(",
"fields",
",",
"name",
",",
"key",
")",
"=>",
"{",
"con... | Extracts tree chunk from path if it's a sub-document
@method extractPath
@param {Object} schemaPath
@param {Object} model
@return {Object} field | [
"Extracts",
"tree",
"chunk",
"from",
"path",
"if",
"it",
"s",
"a",
"sub",
"-",
"document"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/model/model.js#L65-L106 | train |
RisingStack/graffiti-mongoose | src/model/model.js | extractPaths | function extractPaths(schemaPaths, model) {
return reduce(schemaPaths, (fields, schemaPath) => (
merge(fields, extractPath(schemaPath, model))
), {});
} | javascript | function extractPaths(schemaPaths, model) {
return reduce(schemaPaths, (fields, schemaPath) => (
merge(fields, extractPath(schemaPath, model))
), {});
} | [
"function",
"extractPaths",
"(",
"schemaPaths",
",",
"model",
")",
"{",
"return",
"reduce",
"(",
"schemaPaths",
",",
"(",
"fields",
",",
"schemaPath",
")",
"=>",
"(",
"merge",
"(",
"fields",
",",
"extractPath",
"(",
"schemaPath",
",",
"model",
")",
")",
... | Merge sub-document tree chunks
@method extractPaths
@param {Object} schemaPaths
@param {Object} model
@return {Object) extractedSchemaPaths | [
"Merge",
"sub",
"-",
"document",
"tree",
"chunks"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/model/model.js#L115-L119 | train |
RisingStack/graffiti-mongoose | src/model/model.js | getModel | function getModel(model) {
const schemaPaths = model.schema.paths;
const name = model.modelName;
const fields = extractPaths(schemaPaths, { name });
return {
name,
fields,
model
};
} | javascript | function getModel(model) {
const schemaPaths = model.schema.paths;
const name = model.modelName;
const fields = extractPaths(schemaPaths, { name });
return {
name,
fields,
model
};
} | [
"function",
"getModel",
"(",
"model",
")",
"{",
"const",
"schemaPaths",
"=",
"model",
".",
"schema",
".",
"paths",
";",
"const",
"name",
"=",
"model",
".",
"modelName",
";",
"const",
"fields",
"=",
"extractPaths",
"(",
"schemaPaths",
",",
"{",
"name",
"}... | Turn mongoose model to graffiti model
@method getModel
@param {Object} model Mongoose model
@return {Object} graffiti model | [
"Turn",
"mongoose",
"model",
"to",
"graffiti",
"model"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/model/model.js#L127-L138 | train |
RisingStack/graffiti-mongoose | src/query/query.js | getIdFetcher | function getIdFetcher(graffitiModels) {
return function idFetcher(obj, { id: globalId }, context, info) {
const { type, id } = fromGlobalId(globalId);
if (type === 'Viewer') {
return viewer;
} else if (graffitiModels[type]) {
const Collection = graffitiModels[type].model;
return getOne(... | javascript | function getIdFetcher(graffitiModels) {
return function idFetcher(obj, { id: globalId }, context, info) {
const { type, id } = fromGlobalId(globalId);
if (type === 'Viewer') {
return viewer;
} else if (graffitiModels[type]) {
const Collection = graffitiModels[type].model;
return getOne(... | [
"function",
"getIdFetcher",
"(",
"graffitiModels",
")",
"{",
"return",
"function",
"idFetcher",
"(",
"obj",
",",
"{",
"id",
":",
"globalId",
"}",
",",
"context",
",",
"info",
")",
"{",
"const",
"{",
"type",
",",
"id",
"}",
"=",
"fromGlobalId",
"(",
"gl... | Returns an idFetcher function, that can resolve
an object based on a global id | [
"Returns",
"an",
"idFetcher",
"function",
"that",
"can",
"resolve",
"an",
"object",
"based",
"on",
"a",
"global",
"id"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/query/query.js#L198-L211 | train |
RisingStack/graffiti-mongoose | src/query/query.js | emptyConnection | function emptyConnection() {
return {
count: 0,
edges: [],
pageInfo: {
startCursor: null,
endCursor: null,
hasPreviousPage: false,
hasNextPage: false
}
};
} | javascript | function emptyConnection() {
return {
count: 0,
edges: [],
pageInfo: {
startCursor: null,
endCursor: null,
hasPreviousPage: false,
hasNextPage: false
}
};
} | [
"function",
"emptyConnection",
"(",
")",
"{",
"return",
"{",
"count",
":",
"0",
",",
"edges",
":",
"[",
"]",
",",
"pageInfo",
":",
"{",
"startCursor",
":",
"null",
",",
"endCursor",
":",
"null",
",",
"hasPreviousPage",
":",
"false",
",",
"hasNextPage",
... | Helper to get an empty connection. | [
"Helper",
"to",
"get",
"an",
"empty",
"connection",
"."
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/query/query.js#L216-L227 | train |
RisingStack/graffiti-mongoose | src/query/query.js | connectionFromModel | async function connectionFromModel(graffitiModel, args, context, info) {
const Collection = graffitiModel.model;
if (!Collection) {
return emptyConnection();
}
const { before, after, first, last, id, orderBy = { _id: 1 }, ...selector } = args;
const begin = getId(after);
const end = getId(before);
... | javascript | async function connectionFromModel(graffitiModel, args, context, info) {
const Collection = graffitiModel.model;
if (!Collection) {
return emptyConnection();
}
const { before, after, first, last, id, orderBy = { _id: 1 }, ...selector } = args;
const begin = getId(after);
const end = getId(before);
... | [
"async",
"function",
"connectionFromModel",
"(",
"graffitiModel",
",",
"args",
",",
"context",
",",
"info",
")",
"{",
"const",
"Collection",
"=",
"graffitiModel",
".",
"model",
";",
"if",
"(",
"!",
"Collection",
")",
"{",
"return",
"emptyConnection",
"(",
")... | Returns a connection based on a graffitiModel | [
"Returns",
"a",
"connection",
"based",
"on",
"a",
"graffitiModel"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/query/query.js#L269-L324 | train |
RisingStack/graffiti-mongoose | src/type/type.js | stringToGraphQLType | function stringToGraphQLType(type) {
switch (type) {
case 'String':
return GraphQLString;
case 'Number':
return GraphQLFloat;
case 'Date':
return GraphQLDate;
case 'Buffer':
return GraphQLBuffer;
case 'Boolean':
return GraphQLBoolean;
case 'ObjectID':
return... | javascript | function stringToGraphQLType(type) {
switch (type) {
case 'String':
return GraphQLString;
case 'Number':
return GraphQLFloat;
case 'Date':
return GraphQLDate;
case 'Buffer':
return GraphQLBuffer;
case 'Boolean':
return GraphQLBoolean;
case 'ObjectID':
return... | [
"function",
"stringToGraphQLType",
"(",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"'String'",
":",
"return",
"GraphQLString",
";",
"case",
"'Number'",
":",
"return",
"GraphQLFloat",
";",
"case",
"'Date'",
":",
"return",
"GraphQLDate",
";",
"... | Returns a GraphQL type based on a String representation
@param {String} type
@return {GraphQLType} | [
"Returns",
"a",
"GraphQL",
"type",
"based",
"on",
"a",
"String",
"representation"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/type/type.js#L61-L78 | train |
RisingStack/graffiti-mongoose | src/type/type.js | listToGraphQLEnumType | function listToGraphQLEnumType(list, name) {
const values = reduce(list, (values, val) => {
values[val] = { value: val };
return values;
}, {});
return new GraphQLEnumType({ name, values });
} | javascript | function listToGraphQLEnumType(list, name) {
const values = reduce(list, (values, val) => {
values[val] = { value: val };
return values;
}, {});
return new GraphQLEnumType({ name, values });
} | [
"function",
"listToGraphQLEnumType",
"(",
"list",
",",
"name",
")",
"{",
"const",
"values",
"=",
"reduce",
"(",
"list",
",",
"(",
"values",
",",
"val",
")",
"=>",
"{",
"values",
"[",
"val",
"]",
"=",
"{",
"value",
":",
"val",
"}",
";",
"return",
"v... | Returns a GraphQL Enum type based on a List of Strings
@param {Array} list
@param {String} name
@return {Object} | [
"Returns",
"a",
"GraphQL",
"Enum",
"type",
"based",
"on",
"a",
"List",
"of",
"Strings"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/type/type.js#L86-L92 | train |
RisingStack/graffiti-mongoose | src/type/type.js | getTypeFields | function getTypeFields(type) {
const fields = type._typeConfig.fields;
return isFunction(fields) ? fields() : fields;
} | javascript | function getTypeFields(type) {
const fields = type._typeConfig.fields;
return isFunction(fields) ? fields() : fields;
} | [
"function",
"getTypeFields",
"(",
"type",
")",
"{",
"const",
"fields",
"=",
"type",
".",
"_typeConfig",
".",
"fields",
";",
"return",
"isFunction",
"(",
"fields",
")",
"?",
"fields",
"(",
")",
":",
"fields",
";",
"}"
] | Extracts the fields of a GraphQL type
@param {GraphQLType} type
@return {Object} | [
"Extracts",
"the",
"fields",
"of",
"a",
"GraphQL",
"type"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/type/type.js#L99-L102 | train |
RisingStack/graffiti-mongoose | src/type/type.js | getOrderByType | function getOrderByType({ name }, fields) {
if (!orderByTypes[name]) {
// save new enum
orderByTypes[name] = new GraphQLEnumType({
name: `orderBy${name}`,
values: reduce(fields, (values, field) => {
if (field.type instanceof GraphQLScalarType) {
const upperCaseName = field.name.t... | javascript | function getOrderByType({ name }, fields) {
if (!orderByTypes[name]) {
// save new enum
orderByTypes[name] = new GraphQLEnumType({
name: `orderBy${name}`,
values: reduce(fields, (values, field) => {
if (field.type instanceof GraphQLScalarType) {
const upperCaseName = field.name.t... | [
"function",
"getOrderByType",
"(",
"{",
"name",
"}",
",",
"fields",
")",
"{",
"if",
"(",
"!",
"orderByTypes",
"[",
"name",
"]",
")",
"{",
"// save new enum",
"orderByTypes",
"[",
"name",
"]",
"=",
"new",
"GraphQLEnumType",
"(",
"{",
"name",
":",
"`",
"... | Returns order by GraphQLEnumType for fields
@param {{String}} {name}
@param {Object} fields
@return {GraphQLEnumType} | [
"Returns",
"order",
"by",
"GraphQLEnumType",
"for",
"fields"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/type/type.js#L120-L147 | train |
RisingStack/graffiti-mongoose | src/type/type.js | getArguments | function getArguments(type, args = {}) {
const fields = getTypeFields(type);
return reduce(fields, (args, field) => {
// Extract non null fields, those are not required in the arguments
if (field.type instanceof GraphQLNonNull && field.name !== 'id') {
field.type = field.type.ofType;
}
if (f... | javascript | function getArguments(type, args = {}) {
const fields = getTypeFields(type);
return reduce(fields, (args, field) => {
// Extract non null fields, those are not required in the arguments
if (field.type instanceof GraphQLNonNull && field.name !== 'id') {
field.type = field.type.ofType;
}
if (f... | [
"function",
"getArguments",
"(",
"type",
",",
"args",
"=",
"{",
"}",
")",
"{",
"const",
"fields",
"=",
"getTypeFields",
"(",
"type",
")",
";",
"return",
"reduce",
"(",
"fields",
",",
"(",
"args",
",",
"field",
")",
"=>",
"{",
"// Extract non null fields,... | Returns query arguments for a GraphQL type
@param {GraphQLType} type
@param {Object} args
@return {Object} | [
"Returns",
"query",
"arguments",
"for",
"a",
"GraphQL",
"type"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/type/type.js#L155-L176 | train |
RisingStack/graffiti-mongoose | src/type/type.js | getTypeFieldName | function getTypeFieldName(typeName, fieldName) {
const fieldNameCapitalized = fieldName.charAt(0).toUpperCase() + fieldName.slice(1);
return `${typeName}${fieldNameCapitalized}`;
} | javascript | function getTypeFieldName(typeName, fieldName) {
const fieldNameCapitalized = fieldName.charAt(0).toUpperCase() + fieldName.slice(1);
return `${typeName}${fieldNameCapitalized}`;
} | [
"function",
"getTypeFieldName",
"(",
"typeName",
",",
"fieldName",
")",
"{",
"const",
"fieldNameCapitalized",
"=",
"fieldName",
".",
"charAt",
"(",
"0",
")",
".",
"toUpperCase",
"(",
")",
"+",
"fieldName",
".",
"slice",
"(",
"1",
")",
";",
"return",
"`",
... | Returns a concatenation of type and field name, used for nestedObjects
@param {String} typeName
@param {String} fieldName
@returns {String} | [
"Returns",
"a",
"concatenation",
"of",
"type",
"and",
"field",
"name",
"used",
"for",
"nestedObjects"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/type/type.js#L184-L187 | train |
RisingStack/graffiti-mongoose | src/schema/schema.js | getFields | function getFields(graffitiModels, {
hooks = {}, mutation = true, allowMongoIDMutation = false,
customQueries = {}, customMutations = {}
} = {}) {
const types = type.getTypes(graffitiModels);
const { viewer, singular } = hooks;
const viewerFields = reduce(types, (fields, type, key) => {
type.name =... | javascript | function getFields(graffitiModels, {
hooks = {}, mutation = true, allowMongoIDMutation = false,
customQueries = {}, customMutations = {}
} = {}) {
const types = type.getTypes(graffitiModels);
const { viewer, singular } = hooks;
const viewerFields = reduce(types, (fields, type, key) => {
type.name =... | [
"function",
"getFields",
"(",
"graffitiModels",
",",
"{",
"hooks",
"=",
"{",
"}",
",",
"mutation",
"=",
"true",
",",
"allowMongoIDMutation",
"=",
"false",
",",
"customQueries",
"=",
"{",
"}",
",",
"customMutations",
"=",
"{",
"}",
"}",
"=",
"{",
"}",
"... | Returns query and mutation root fields
@param {Array} graffitiModels
@param {{Object, Boolean}} {hooks, mutation, allowMongoIDMutation}
@return {Object} | [
"Returns",
"query",
"and",
"mutation",
"root",
"fields"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/schema/schema.js#L231-L313 | train |
RisingStack/graffiti-mongoose | src/schema/schema.js | getSchema | function getSchema(mongooseModels, options) {
if (!isArray(mongooseModels)) {
mongooseModels = [mongooseModels];
}
const graffitiModels = model.getModels(mongooseModels);
const fields = getFields(graffitiModels, options);
return new GraphQLSchema(fields);
} | javascript | function getSchema(mongooseModels, options) {
if (!isArray(mongooseModels)) {
mongooseModels = [mongooseModels];
}
const graffitiModels = model.getModels(mongooseModels);
const fields = getFields(graffitiModels, options);
return new GraphQLSchema(fields);
} | [
"function",
"getSchema",
"(",
"mongooseModels",
",",
"options",
")",
"{",
"if",
"(",
"!",
"isArray",
"(",
"mongooseModels",
")",
")",
"{",
"mongooseModels",
"=",
"[",
"mongooseModels",
"]",
";",
"}",
"const",
"graffitiModels",
"=",
"model",
".",
"getModels",... | Returns a GraphQL schema including query and mutation fields
@param {Array} mongooseModels
@param {Object} options
@return {GraphQLSchema} | [
"Returns",
"a",
"GraphQL",
"schema",
"including",
"query",
"and",
"mutation",
"fields"
] | 414c91e4b2081bf0d14ecd2de545f621713f5da7 | https://github.com/RisingStack/graffiti-mongoose/blob/414c91e4b2081bf0d14ecd2de545f621713f5da7/src/schema/schema.js#L321-L328 | train |
FWeinb/grunt-svgstore | tasks/svgstore.js | function (name) {
var dotPos = name.indexOf('.');
if (dotPos > -1) {
name = name.substring(0, dotPos);
}
return name;
} | javascript | function (name) {
var dotPos = name.indexOf('.');
if (dotPos > -1) {
name = name.substring(0, dotPos);
}
return name;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"dotPos",
"=",
"name",
".",
"indexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"dotPos",
">",
"-",
"1",
")",
"{",
"name",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"dotPos",
")",
";",
"}",
"return",
"name"... | Default function used to extract an id from a name | [
"Default",
"function",
"used",
"to",
"extract",
"an",
"id",
"from",
"a",
"name"
] | e9fa79cb44925bb85af31db55bc925aed536907d | https://github.com/FWeinb/grunt-svgstore/blob/e9fa79cb44925bb85af31db55bc925aed536907d/tasks/svgstore.js#L46-L52 | train | |
taptapship/wiredep | lib/detect-dependencies.js | detectDependencies | function detectDependencies(config) {
var allDependencies = {};
if (config.get('dependencies')) {
$._.assign(allDependencies, config.get('bower.json').dependencies);
}
if (config.get('dev-dependencies')) {
$._.assign(allDependencies, config.get('bower.json').devDependencies);
}
if (config.get('in... | javascript | function detectDependencies(config) {
var allDependencies = {};
if (config.get('dependencies')) {
$._.assign(allDependencies, config.get('bower.json').dependencies);
}
if (config.get('dev-dependencies')) {
$._.assign(allDependencies, config.get('bower.json').devDependencies);
}
if (config.get('in... | [
"function",
"detectDependencies",
"(",
"config",
")",
"{",
"var",
"allDependencies",
"=",
"{",
"}",
";",
"if",
"(",
"config",
".",
"get",
"(",
"'dependencies'",
")",
")",
"{",
"$",
".",
"_",
".",
"assign",
"(",
"allDependencies",
",",
"config",
".",
"g... | Detect dependencies of the components from `bower.json`.
@param {object} config the global configuration object.
@return {object} config | [
"Detect",
"dependencies",
"of",
"the",
"components",
"from",
"bower",
".",
"json",
"."
] | 0c247f93656147789c6aba5d8fb8decd45ea449c | https://github.com/taptapship/wiredep/blob/0c247f93656147789c6aba5d8fb8decd45ea449c/lib/detect-dependencies.js#L19-L48 | train |
taptapship/wiredep | lib/inject-dependencies.js | injectDependencies | function injectDependencies(globalConfig) {
config = globalConfig;
var stream = config.get('stream');
globalDependenciesSorted = config.get('global-dependencies-sorted');
ignorePath = config.get('ignore-path');
fileTypes = config.get('file-types');
if (stream.src) {
config.set('stream', {
src: i... | javascript | function injectDependencies(globalConfig) {
config = globalConfig;
var stream = config.get('stream');
globalDependenciesSorted = config.get('global-dependencies-sorted');
ignorePath = config.get('ignore-path');
fileTypes = config.get('file-types');
if (stream.src) {
config.set('stream', {
src: i... | [
"function",
"injectDependencies",
"(",
"globalConfig",
")",
"{",
"config",
"=",
"globalConfig",
";",
"var",
"stream",
"=",
"config",
".",
"get",
"(",
"'stream'",
")",
";",
"globalDependenciesSorted",
"=",
"config",
".",
"get",
"(",
"'global-dependencies-sorted'",
... | Inject dependencies into the specified source file.
@param {object} globalConfig the global configuration object.
@return {object} config | [
"Inject",
"dependencies",
"into",
"the",
"specified",
"source",
"file",
"."
] | 0c247f93656147789c6aba5d8fb8decd45ea449c | https://github.com/taptapship/wiredep/blob/0c247f93656147789c6aba5d8fb8decd45ea449c/lib/inject-dependencies.js#L20-L38 | train |
smartystreets/jquery.liveaddress | src/liveAddressPlugin.js | uiTagOffset | function uiTagOffset(corners) {
return {
top: corners.top + corners.height / 2 - 10,
left: corners.right - 6
};
} | javascript | function uiTagOffset(corners) {
return {
top: corners.top + corners.height / 2 - 10,
left: corners.right - 6
};
} | [
"function",
"uiTagOffset",
"(",
"corners",
")",
"{",
"return",
"{",
"top",
":",
"corners",
".",
"top",
"+",
"corners",
".",
"height",
"/",
"2",
"-",
"10",
",",
"left",
":",
"corners",
".",
"right",
"-",
"6",
"}",
";",
"}"
] | Computes where the little checkmark tag of the UI goes, relative to the boundaries of the last field | [
"Computes",
"where",
"the",
"little",
"checkmark",
"tag",
"of",
"the",
"UI",
"goes",
"relative",
"to",
"the",
"boundaries",
"of",
"the",
"last",
"field"
] | 1e76580ada9405797f5472eb54571b68d5a64a27 | https://github.com/smartystreets/jquery.liveaddress/blob/1e76580ada9405797f5472eb54571b68d5a64a27/src/liveAddressPlugin.js#L1052-L1057 | train |
smartystreets/jquery.liveaddress | src/liveAddressPlugin.js | filterDomElement | function filterDomElement(domElement, names, labels) {
/*
Where we look to find a match, in this order:
name, id, <label> tags, placeholder, title
Our searches first conduct fairly liberal "contains" searches:
if the attribute even contains the name or label, we map it.
The names and labels we ch... | javascript | function filterDomElement(domElement, names, labels) {
/*
Where we look to find a match, in this order:
name, id, <label> tags, placeholder, title
Our searches first conduct fairly liberal "contains" searches:
if the attribute even contains the name or label, we map it.
The names and labels we ch... | [
"function",
"filterDomElement",
"(",
"domElement",
",",
"names",
",",
"labels",
")",
"{",
"/*\n\t\t\t Where we look to find a match, in this order:\n\t\t\t name, id, <label> tags, placeholder, title\n\t\t\t Our searches first conduct fairly liberal \"contains\" searches:\n\t\t\t if the attribute... | This function is used to find and properly map elements to their field type | [
"This",
"function",
"is",
"used",
"to",
"find",
"and",
"properly",
"map",
"elements",
"to",
"their",
"field",
"type"
] | 1e76580ada9405797f5472eb54571b68d5a64a27 | https://github.com/smartystreets/jquery.liveaddress/blob/1e76580ada9405797f5472eb54571b68d5a64a27/src/liveAddressPlugin.js#L1060-L1103 | train |
smartystreets/jquery.liveaddress | src/liveAddressPlugin.js | turnOffAllClicks | function turnOffAllClicks(selectors) {
if (Array.isArray(selectors) || typeof selectors == "object") {
for (var selector in selectors) {
if (selectors.hasOwnProperty(selector)) {
$("body").off("click", selectors[selector]);
}
}
} else if (typeof selectors === "string") {
$("body").off(... | javascript | function turnOffAllClicks(selectors) {
if (Array.isArray(selectors) || typeof selectors == "object") {
for (var selector in selectors) {
if (selectors.hasOwnProperty(selector)) {
$("body").off("click", selectors[selector]);
}
}
} else if (typeof selectors === "string") {
$("body").off(... | [
"function",
"turnOffAllClicks",
"(",
"selectors",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"selectors",
")",
"||",
"typeof",
"selectors",
"==",
"\"object\"",
")",
"{",
"for",
"(",
"var",
"selector",
"in",
"selectors",
")",
"{",
"if",
"(",
"sele... | When we're done with a "pop-up" where the user chooses what to do, we need to remove all other events bound on that whole "pop-up" so that it doesn't interfere with any future "pop-ups". | [
"When",
"we",
"re",
"done",
"with",
"a",
"pop",
"-",
"up",
"where",
"the",
"user",
"chooses",
"what",
"to",
"do",
"we",
"need",
"to",
"remove",
"all",
"other",
"events",
"bound",
"on",
"that",
"whole",
"pop",
"-",
"up",
"so",
"that",
"it",
"doesn",
... | 1e76580ada9405797f5472eb54571b68d5a64a27 | https://github.com/smartystreets/jquery.liveaddress/blob/1e76580ada9405797f5472eb54571b68d5a64a27/src/liveAddressPlugin.js#L1120-L1132 | train |
smartystreets/jquery.liveaddress | src/liveAddressPlugin.js | function (invokeOn, invokeFunction) {
if (invokeOn && typeof invokeOn !== "function" && invokeFunction) {
if (invokeFunction == "click") {
setTimeout(function () {
$(invokeOn).click(); // Very particular: we MUST fire the native "click" event!
}, 5);
} else if (invokeFunction == "submit")
$(inv... | javascript | function (invokeOn, invokeFunction) {
if (invokeOn && typeof invokeOn !== "function" && invokeFunction) {
if (invokeFunction == "click") {
setTimeout(function () {
$(invokeOn).click(); // Very particular: we MUST fire the native "click" event!
}, 5);
} else if (invokeFunction == "submit")
$(inv... | [
"function",
"(",
"invokeOn",
",",
"invokeFunction",
")",
"{",
"if",
"(",
"invokeOn",
"&&",
"typeof",
"invokeOn",
"!==",
"\"function\"",
"&&",
"invokeFunction",
")",
"{",
"if",
"(",
"invokeFunction",
"==",
"\"click\"",
")",
"{",
"setTimeout",
"(",
"function",
... | Submits a form by calling `click` on a button element or `submit` on a form element | [
"Submits",
"a",
"form",
"by",
"calling",
"click",
"on",
"a",
"button",
"element",
"or",
"submit",
"on",
"a",
"form",
"element"
] | 1e76580ada9405797f5472eb54571b68d5a64a27 | https://github.com/smartystreets/jquery.liveaddress/blob/1e76580ada9405797f5472eb54571b68d5a64a27/src/liveAddressPlugin.js#L2830-L2839 | train | |
Modernizr/customizr | src/utils.js | function (options, patterns) {
// Return all matching filepaths.
var matches = processPatterns(patterns, function (pattern) {
// Find all matching files for this pattern.
return glob.sync(pattern, options);
});
// Filter result set?
if (options.filter) {
matches = matches.filter(func... | javascript | function (options, patterns) {
// Return all matching filepaths.
var matches = processPatterns(patterns, function (pattern) {
// Find all matching files for this pattern.
return glob.sync(pattern, options);
});
// Filter result set?
if (options.filter) {
matches = matches.filter(func... | [
"function",
"(",
"options",
",",
"patterns",
")",
"{",
"// Return all matching filepaths.",
"var",
"matches",
"=",
"processPatterns",
"(",
"patterns",
",",
"function",
"(",
"pattern",
")",
"{",
"// Find all matching files for this pattern.",
"return",
"glob",
".",
"sy... | Return an array of all file paths that match the given wildcard patterns. | [
"Return",
"an",
"array",
"of",
"all",
"file",
"paths",
"that",
"match",
"the",
"given",
"wildcard",
"patterns",
"."
] | 01541efc72bf08fdaf127270aad1abcc26968398 | https://github.com/Modernizr/customizr/blob/01541efc72bf08fdaf127270aad1abcc26968398/src/utils.js#L59-L86 | train | |
immersive-web/cardboard-vr-display | src/sensor-fusion/fusion-pose-sensor.js | FusionPoseSensor | function FusionPoseSensor(kFilter, predictionTime, yawOnly, isDebug) {
this.yawOnly = yawOnly;
this.accelerometer = new MathUtil.Vector3();
this.gyroscope = new MathUtil.Vector3();
this.filter = new ComplementaryFilter(kFilter, isDebug);
this.posePredictor = new PosePredictor(predictionTime, isDebug);
th... | javascript | function FusionPoseSensor(kFilter, predictionTime, yawOnly, isDebug) {
this.yawOnly = yawOnly;
this.accelerometer = new MathUtil.Vector3();
this.gyroscope = new MathUtil.Vector3();
this.filter = new ComplementaryFilter(kFilter, isDebug);
this.posePredictor = new PosePredictor(predictionTime, isDebug);
th... | [
"function",
"FusionPoseSensor",
"(",
"kFilter",
",",
"predictionTime",
",",
"yawOnly",
",",
"isDebug",
")",
"{",
"this",
".",
"yawOnly",
"=",
"yawOnly",
";",
"this",
".",
"accelerometer",
"=",
"new",
"MathUtil",
".",
"Vector3",
"(",
")",
";",
"this",
".",
... | The pose sensor, implemented using DeviceMotion APIs.
@param {number} kFilter
@param {number} predictionTime
@param {boolean} yawOnly
@param {boolean} isDebug | [
"The",
"pose",
"sensor",
"implemented",
"using",
"DeviceMotion",
"APIs",
"."
] | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/sensor-fusion/fusion-pose-sensor.js#L28-L76 | train |
immersive-web/cardboard-vr-display | src/device-info.js | DeviceInfo | function DeviceInfo(deviceParams, additionalViewers) {
this.viewer = Viewers.CardboardV2;
this.updateDeviceParams(deviceParams);
this.distortion = new Distortion(this.viewer.distortionCoefficients);
for (var i = 0; i < additionalViewers.length; i++) {
var viewer = additionalViewers[i];
Viewers[viewer.id... | javascript | function DeviceInfo(deviceParams, additionalViewers) {
this.viewer = Viewers.CardboardV2;
this.updateDeviceParams(deviceParams);
this.distortion = new Distortion(this.viewer.distortionCoefficients);
for (var i = 0; i < additionalViewers.length; i++) {
var viewer = additionalViewers[i];
Viewers[viewer.id... | [
"function",
"DeviceInfo",
"(",
"deviceParams",
",",
"additionalViewers",
")",
"{",
"this",
".",
"viewer",
"=",
"Viewers",
".",
"CardboardV2",
";",
"this",
".",
"updateDeviceParams",
"(",
"deviceParams",
")",
";",
"this",
".",
"distortion",
"=",
"new",
"Distort... | Manages information about the device and the viewer.
deviceParams indicates the parameters of the device to use (generally
obtained from dpdb.getDeviceParams()). Can be null to mean no device
params were found. | [
"Manages",
"information",
"about",
"the",
"device",
"and",
"the",
"viewer",
"."
] | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/device-info.js#L84-L92 | train |
immersive-web/cardboard-vr-display | src/cardboard-distorter.js | CardboardDistorter | function CardboardDistorter(gl, cardboardUI, bufferScale, dirtySubmitFrameBindings) {
this.gl = gl;
this.cardboardUI = cardboardUI;
this.bufferScale = bufferScale;
this.dirtySubmitFrameBindings = dirtySubmitFrameBindings;
this.ctxAttribs = gl.getContextAttributes();
this.meshWidth = 20;
this.meshHeight =... | javascript | function CardboardDistorter(gl, cardboardUI, bufferScale, dirtySubmitFrameBindings) {
this.gl = gl;
this.cardboardUI = cardboardUI;
this.bufferScale = bufferScale;
this.dirtySubmitFrameBindings = dirtySubmitFrameBindings;
this.ctxAttribs = gl.getContextAttributes();
this.meshWidth = 20;
this.meshHeight =... | [
"function",
"CardboardDistorter",
"(",
"gl",
",",
"cardboardUI",
",",
"bufferScale",
",",
"dirtySubmitFrameBindings",
")",
"{",
"this",
".",
"gl",
"=",
"gl",
";",
"this",
".",
"cardboardUI",
"=",
"cardboardUI",
";",
"this",
".",
"bufferScale",
"=",
"bufferScal... | A mesh-based distorter.
@param {WebGLRenderingContext} gl
@param {CardboardUI?} cardboardUI;
@param {number} bufferScale;
@param {boolean} dirtySubmitFrameBindings; | [
"A",
"mesh",
"-",
"based",
"distorter",
"."
] | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/cardboard-distorter.js#L53-L125 | train |
immersive-web/cardboard-vr-display | src/sensor-fusion/pose-predictor.js | PosePredictor | function PosePredictor(predictionTimeS, isDebug) {
this.predictionTimeS = predictionTimeS;
this.isDebug = isDebug;
// The quaternion corresponding to the previous state.
this.previousQ = new MathUtil.Quaternion();
// Previous time a prediction occurred.
this.previousTimestampS = null;
// The delta quate... | javascript | function PosePredictor(predictionTimeS, isDebug) {
this.predictionTimeS = predictionTimeS;
this.isDebug = isDebug;
// The quaternion corresponding to the previous state.
this.previousQ = new MathUtil.Quaternion();
// Previous time a prediction occurred.
this.previousTimestampS = null;
// The delta quate... | [
"function",
"PosePredictor",
"(",
"predictionTimeS",
",",
"isDebug",
")",
"{",
"this",
".",
"predictionTimeS",
"=",
"predictionTimeS",
";",
"this",
".",
"isDebug",
"=",
"isDebug",
";",
"// The quaternion corresponding to the previous state.",
"this",
".",
"previousQ",
... | Given an orientation and the gyroscope data, predicts the future orientation
of the head. This makes rendering appear faster.
Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf
@param {Number} predictionTimeS time from head movement to the appearance of
the corresponding image. | [
"Given",
"an",
"orientation",
"and",
"the",
"gyroscope",
"data",
"predicts",
"the",
"future",
"orientation",
"of",
"the",
"head",
".",
"This",
"makes",
"rendering",
"appear",
"faster",
"."
] | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/sensor-fusion/pose-predictor.js#L26-L39 | train |
immersive-web/cardboard-vr-display | src/cardboard-vr-display.js | CardboardVRDisplay | function CardboardVRDisplay(config) {
var defaults = Util.extend({}, Options);
config = Util.extend(defaults, config || {});
VRDisplay.call(this, {
wakelock: config.MOBILE_WAKE_LOCK,
});
this.config = config;
this.displayName = 'Cardboard VRDisplay';
this.capabilities = new VRDisplayCapabilities({... | javascript | function CardboardVRDisplay(config) {
var defaults = Util.extend({}, Options);
config = Util.extend(defaults, config || {});
VRDisplay.call(this, {
wakelock: config.MOBILE_WAKE_LOCK,
});
this.config = config;
this.displayName = 'Cardboard VRDisplay';
this.capabilities = new VRDisplayCapabilities({... | [
"function",
"CardboardVRDisplay",
"(",
"config",
")",
"{",
"var",
"defaults",
"=",
"Util",
".",
"extend",
"(",
"{",
"}",
",",
"Options",
")",
";",
"config",
"=",
"Util",
".",
"extend",
"(",
"defaults",
",",
"config",
"||",
"{",
"}",
")",
";",
"VRDisp... | VRDisplay based on mobile device parameters and DeviceMotion APIs. | [
"VRDisplay",
"based",
"on",
"mobile",
"device",
"parameters",
"and",
"DeviceMotion",
"APIs",
"."
] | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/cardboard-vr-display.js#L35-L81 | train |
immersive-web/cardboard-vr-display | src/viewer-selector.js | ViewerSelector | function ViewerSelector(defaultViewer) {
// Try to load the selected key from local storage.
try {
this.selectedKey = localStorage.getItem(VIEWER_KEY);
} catch (error) {
console.error('Failed to load viewer profile: %s', error);
}
//If none exists, or if localstorage is unavailable, use the default k... | javascript | function ViewerSelector(defaultViewer) {
// Try to load the selected key from local storage.
try {
this.selectedKey = localStorage.getItem(VIEWER_KEY);
} catch (error) {
console.error('Failed to load viewer profile: %s', error);
}
//If none exists, or if localstorage is unavailable, use the default k... | [
"function",
"ViewerSelector",
"(",
"defaultViewer",
")",
"{",
"// Try to load the selected key from local storage.",
"try",
"{",
"this",
".",
"selectedKey",
"=",
"localStorage",
".",
"getItem",
"(",
"VIEWER_KEY",
")",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"co... | Creates a viewer selector with the options specified. Supports being shown
and hidden. Generates events when viewer parameters change. Also supports
saving the currently selected index in localStorage. | [
"Creates",
"a",
"viewer",
"selector",
"with",
"the",
"options",
"specified",
".",
"Supports",
"being",
"shown",
"and",
"hidden",
".",
"Generates",
"events",
"when",
"viewer",
"parameters",
"change",
".",
"Also",
"supports",
"saving",
"the",
"currently",
"selecte... | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/viewer-selector.js#L28-L44 | train |
immersive-web/cardboard-vr-display | src/sensor-fusion/complementary-filter.js | ComplementaryFilter | function ComplementaryFilter(kFilter, isDebug) {
this.kFilter = kFilter;
this.isDebug = isDebug;
// Raw sensor measurements.
this.currentAccelMeasurement = new SensorSample();
this.currentGyroMeasurement = new SensorSample();
this.previousGyroMeasurement = new SensorSample();
// Set default look directi... | javascript | function ComplementaryFilter(kFilter, isDebug) {
this.kFilter = kFilter;
this.isDebug = isDebug;
// Raw sensor measurements.
this.currentAccelMeasurement = new SensorSample();
this.currentGyroMeasurement = new SensorSample();
this.previousGyroMeasurement = new SensorSample();
// Set default look directi... | [
"function",
"ComplementaryFilter",
"(",
"kFilter",
",",
"isDebug",
")",
"{",
"this",
".",
"kFilter",
"=",
"kFilter",
";",
"this",
".",
"isDebug",
"=",
"isDebug",
";",
"// Raw sensor measurements.",
"this",
".",
"currentAccelMeasurement",
"=",
"new",
"SensorSample"... | An implementation of a simple complementary filter, which fuses gyroscope and
accelerometer data from the 'devicemotion' event.
Accelerometer data is very noisy, but stable over the long term.
Gyroscope data is smooth, but tends to drift over the long term.
This fusion is relatively simple:
1. Get orientation estimat... | [
"An",
"implementation",
"of",
"a",
"simple",
"complementary",
"filter",
"which",
"fuses",
"gyroscope",
"and",
"accelerometer",
"data",
"from",
"the",
"devicemotion",
"event",
"."
] | de59375309e637edbd3fd5e5213eac602930bb2b | https://github.com/immersive-web/cardboard-vr-display/blob/de59375309e637edbd3fd5e5213eac602930bb2b/src/sensor-fusion/complementary-filter.js#L34-L63 | train |
DevExpress/testcafe-browser-tools | src/api/get-installations.js | addInstallation | async function addInstallation (installations, name, instPath) {
var fileExists = await exists(instPath);
if (fileExists) {
Object.keys(ALIASES).some(alias => {
var { nameRe, cmd, macOpenCmdTemplate, path } = ALIASES[alias];
if (nameRe.test(name)) {
installation... | javascript | async function addInstallation (installations, name, instPath) {
var fileExists = await exists(instPath);
if (fileExists) {
Object.keys(ALIASES).some(alias => {
var { nameRe, cmd, macOpenCmdTemplate, path } = ALIASES[alias];
if (nameRe.test(name)) {
installation... | [
"async",
"function",
"addInstallation",
"(",
"installations",
",",
"name",
",",
"instPath",
")",
"{",
"var",
"fileExists",
"=",
"await",
"exists",
"(",
"instPath",
")",
";",
"if",
"(",
"fileExists",
")",
"{",
"Object",
".",
"keys",
"(",
"ALIASES",
")",
"... | Find installations for different platforms | [
"Find",
"installations",
"for",
"different",
"platforms"
] | db7242b7a97b1ea02973fa2cac160d0a351d0893 | https://github.com/DevExpress/testcafe-browser-tools/blob/db7242b7a97b1ea02973fa2cac160d0a351d0893/src/api/get-installations.js#L14-L29 | train |
ProseMirror/prosemirror-menu | src/menu.js | setClass | function setClass(dom, cls, on) {
if (on) dom.classList.add(cls)
else dom.classList.remove(cls)
} | javascript | function setClass(dom, cls, on) {
if (on) dom.classList.add(cls)
else dom.classList.remove(cls)
} | [
"function",
"setClass",
"(",
"dom",
",",
"cls",
",",
"on",
")",
"{",
"if",
"(",
"on",
")",
"dom",
".",
"classList",
".",
"add",
"(",
"cls",
")",
"else",
"dom",
".",
"classList",
".",
"remove",
"(",
"cls",
")",
"}"
] | Work around classList.toggle being broken in IE11 | [
"Work",
"around",
"classList",
".",
"toggle",
"being",
"broken",
"in",
"IE11"
] | 5c8668dae081dd358c75fa31a62b5035e15b2eb2 | https://github.com/ProseMirror/prosemirror-menu/blob/5c8668dae081dd358c75fa31a62b5035e15b2eb2/src/menu.js#L458-L461 | train |
ProseMirror/prosemirror-menu | src/menubar.js | selectionIsInverted | function selectionIsInverted(selection) {
if (selection.anchorNode == selection.focusNode) return selection.anchorOffset > selection.focusOffset
return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING
} | javascript | function selectionIsInverted(selection) {
if (selection.anchorNode == selection.focusNode) return selection.anchorOffset > selection.focusOffset
return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING
} | [
"function",
"selectionIsInverted",
"(",
"selection",
")",
"{",
"if",
"(",
"selection",
".",
"anchorNode",
"==",
"selection",
".",
"focusNode",
")",
"return",
"selection",
".",
"anchorOffset",
">",
"selection",
".",
"focusOffset",
"return",
"selection",
".",
"anc... | Not precise, but close enough | [
"Not",
"precise",
"but",
"close",
"enough"
] | 5c8668dae081dd358c75fa31a62b5035e15b2eb2 | https://github.com/ProseMirror/prosemirror-menu/blob/5c8668dae081dd358c75fa31a62b5035e15b2eb2/src/menubar.js#L140-L143 | train |
ioBroker/ioBroker.web | www/lib/js/materialize.js | Select | function Select(el, options) {
_classCallCheck(this, Select);
// Don't init if browser default version
var _this16 = _possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).call(this, Select, el, options));
if (_this16.$el.hasClass('browser-default')) {
ret... | javascript | function Select(el, options) {
_classCallCheck(this, Select);
// Don't init if browser default version
var _this16 = _possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).call(this, Select, el, options));
if (_this16.$el.hasClass('browser-default')) {
ret... | [
"function",
"Select",
"(",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"Select",
")",
";",
"// Don't init if browser default version",
"var",
"_this16",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"(",
"Select",
".",
"__proto__",
... | Construct Select instance
@constructor
@param {Element} el
@param {Object} options | [
"Construct",
"Select",
"instance"
] | b2b4e086659d0a8c0662d64804e7380fa30f8338 | https://github.com/ioBroker/ioBroker.web/blob/b2b4e086659d0a8c0662d64804e7380fa30f8338/www/lib/js/materialize.js#L3656-L3684 | train |
LukaszWatroba/v-accordion | dist/v-accordion.js | vPaneController | function vPaneController ($scope) {
var ctrl = this;
ctrl.isExpanded = function isExpanded () {
return $scope.isExpanded;
};
ctrl.toggle = function toggle () {
if (!$scope.isAnimating && !$scope.isDisabled) {
$scope.accordionCtrl.toggle($scope);
}
};
ctrl.expand = function expand () {
... | javascript | function vPaneController ($scope) {
var ctrl = this;
ctrl.isExpanded = function isExpanded () {
return $scope.isExpanded;
};
ctrl.toggle = function toggle () {
if (!$scope.isAnimating && !$scope.isDisabled) {
$scope.accordionCtrl.toggle($scope);
}
};
ctrl.expand = function expand () {
... | [
"function",
"vPaneController",
"(",
"$scope",
")",
"{",
"var",
"ctrl",
"=",
"this",
";",
"ctrl",
".",
"isExpanded",
"=",
"function",
"isExpanded",
"(",
")",
"{",
"return",
"$scope",
".",
"isExpanded",
";",
"}",
";",
"ctrl",
".",
"toggle",
"=",
"function"... | vPane directive controller | [
"vPane",
"directive",
"controller"
] | eb95f31b784ec91dae3a42bdfd192a4487eb1c0e | https://github.com/LukaszWatroba/v-accordion/blob/eb95f31b784ec91dae3a42bdfd192a4487eb1c0e/dist/v-accordion.js#L506-L545 | train |
weaveworks/ui-components | src/components/TimeTravel/TimeTravel.js | maxDurationMsPerTimelinePx | function maxDurationMsPerTimelinePx(earliestTimestamp) {
const durationMsLowerBound = minDurationMsPerTimelinePx();
const durationMsUpperBound = moment.duration(3, 'days').asMilliseconds();
const durationMs = availableTimelineDurationMs(earliestTimestamp) / 400.0;
return clamp(durationMs, durationMsLowerBound, ... | javascript | function maxDurationMsPerTimelinePx(earliestTimestamp) {
const durationMsLowerBound = minDurationMsPerTimelinePx();
const durationMsUpperBound = moment.duration(3, 'days').asMilliseconds();
const durationMs = availableTimelineDurationMs(earliestTimestamp) / 400.0;
return clamp(durationMs, durationMsLowerBound, ... | [
"function",
"maxDurationMsPerTimelinePx",
"(",
"earliestTimestamp",
")",
"{",
"const",
"durationMsLowerBound",
"=",
"minDurationMsPerTimelinePx",
"(",
")",
";",
"const",
"durationMsUpperBound",
"=",
"moment",
".",
"duration",
"(",
"3",
",",
"'days'",
")",
".",
"asMi... | Maximum level we can zoom out is such that the available range takes 400px. The 3 days per pixel upper bound on that scale is to prevent ugly rendering in extreme cases. | [
"Maximum",
"level",
"we",
"can",
"zoom",
"out",
"is",
"such",
"that",
"the",
"available",
"range",
"takes",
"400px",
".",
"The",
"3",
"days",
"per",
"pixel",
"upper",
"bound",
"on",
"that",
"scale",
"is",
"to",
"prevent",
"ugly",
"rendering",
"in",
"extr... | 2496b5f2d769a5aac64867206d6a045fedcb5f0c | https://github.com/weaveworks/ui-components/blob/2496b5f2d769a5aac64867206d6a045fedcb5f0c/src/components/TimeTravel/TimeTravel.js#L56-L61 | train |
weaveworks/ui-components | docs/js/routes.js | isSubComponent | function isSubComponent(resource) {
const [dir, module] = resource.split('/').filter(n => n !== '.');
return dir !== module;
} | javascript | function isSubComponent(resource) {
const [dir, module] = resource.split('/').filter(n => n !== '.');
return dir !== module;
} | [
"function",
"isSubComponent",
"(",
"resource",
")",
"{",
"const",
"[",
"dir",
",",
"module",
"]",
"=",
"resource",
".",
"split",
"(",
"'/'",
")",
".",
"filter",
"(",
"n",
"=>",
"n",
"!==",
"'.'",
")",
";",
"return",
"dir",
"!==",
"module",
";",
"}"... | Don't render an example panel if the component is not the top-level component. | [
"Don",
"t",
"render",
"an",
"example",
"panel",
"if",
"the",
"component",
"is",
"not",
"the",
"top",
"-",
"level",
"component",
"."
] | 2496b5f2d769a5aac64867206d6a045fedcb5f0c | https://github.com/weaveworks/ui-components/blob/2496b5f2d769a5aac64867206d6a045fedcb5f0c/docs/js/routes.js#L37-L40 | train |
ensdomains/ensjs | index.js | ENS | function ENS (provider, address, Web3js) {
if (Web3js !== undefined) {
Web3 = Web3js;
}
if (!!/^0\./.exec(Web3.version || (new Web3(provider)).version.api)) {
return utils.construct(ENS_0, [provider, address]);
} else {
return utils.construct(ENS_1, [provider, address]);
}
} | javascript | function ENS (provider, address, Web3js) {
if (Web3js !== undefined) {
Web3 = Web3js;
}
if (!!/^0\./.exec(Web3.version || (new Web3(provider)).version.api)) {
return utils.construct(ENS_0, [provider, address]);
} else {
return utils.construct(ENS_1, [provider, address]);
}
} | [
"function",
"ENS",
"(",
"provider",
",",
"address",
",",
"Web3js",
")",
"{",
"if",
"(",
"Web3js",
"!==",
"undefined",
")",
"{",
"Web3",
"=",
"Web3js",
";",
"}",
"if",
"(",
"!",
"!",
"/",
"^0\\.",
"/",
".",
"exec",
"(",
"Web3",
".",
"version",
"||... | Wrapper function that returns a version of ENS that is compatible
with the provided version of Web3 | [
"Wrapper",
"function",
"that",
"returns",
"a",
"version",
"of",
"ENS",
"that",
"is",
"compatible",
"with",
"the",
"provided",
"version",
"of",
"Web3"
] | ae6293041661ff4807f42e3057013f223cfbe99d | https://github.com/ensdomains/ensjs/blob/ae6293041661ff4807f42e3057013f223cfbe99d/index.js#L56-L65 | train |
angular/jasminewd | index.js | initJasmineWd | function initJasmineWd(scheduler, webdriver) {
if (jasmine.JasmineWdInitialized) {
throw Error('JasmineWd already initialized when init() was called');
}
jasmine.JasmineWdInitialized = true;
// Pull information from webdriver instance
if (webdriver) {
WebElement = webdriver.WebElement || WebElement;... | javascript | function initJasmineWd(scheduler, webdriver) {
if (jasmine.JasmineWdInitialized) {
throw Error('JasmineWd already initialized when init() was called');
}
jasmine.JasmineWdInitialized = true;
// Pull information from webdriver instance
if (webdriver) {
WebElement = webdriver.WebElement || WebElement;... | [
"function",
"initJasmineWd",
"(",
"scheduler",
",",
"webdriver",
")",
"{",
"if",
"(",
"jasmine",
".",
"JasmineWdInitialized",
")",
"{",
"throw",
"Error",
"(",
"'JasmineWd already initialized when init() was called'",
")",
";",
"}",
"jasmine",
".",
"JasmineWdInitialize... | Initialize the JasmineWd adapter with a particlar scheduler, generally a webdriver control flow.
@param {Object=} scheduler The scheduler to wrap tests in. See scheduler.md for details.
Defaults to a mock scheduler that calls functions immediately.
@param {Object=} webdriver The result of `require('selenium-webdriver'... | [
"Initialize",
"the",
"JasmineWd",
"adapter",
"with",
"a",
"particlar",
"scheduler",
"generally",
"a",
"webdriver",
"control",
"flow",
"."
] | 236b0d211ef7b8510629dcbc7d2a18afaabd2f10 | https://github.com/angular/jasminewd/blob/236b0d211ef7b8510629dcbc7d2a18afaabd2f10/index.js#L178-L239 | train |
angular/jasminewd | index.js | compareDone | function compareDone(pass) {
var message = '';
if (!pass) {
if (!result.message) {
args.unshift(expectation.isNot);
args.unshift(name);
message = expectation.util.buildFailureMessage.apply(null, args);
} else {
if (Object.prototype.toString.apply(result... | javascript | function compareDone(pass) {
var message = '';
if (!pass) {
if (!result.message) {
args.unshift(expectation.isNot);
args.unshift(name);
message = expectation.util.buildFailureMessage.apply(null, args);
} else {
if (Object.prototype.toString.apply(result... | [
"function",
"compareDone",
"(",
"pass",
")",
"{",
"var",
"message",
"=",
"''",
";",
"if",
"(",
"!",
"pass",
")",
"{",
"if",
"(",
"!",
"result",
".",
"message",
")",
"{",
"args",
".",
"unshift",
"(",
"expectation",
".",
"isNot",
")",
";",
"args",
... | compareDone always returns undefined | [
"compareDone",
"always",
"returns",
"undefined"
] | 236b0d211ef7b8510629dcbc7d2a18afaabd2f10 | https://github.com/angular/jasminewd/blob/236b0d211ef7b8510629dcbc7d2a18afaabd2f10/index.js#L289-L318 | train |
ten1seven/jRespond | js/jRespond.js | function() {
var w = 0;
// IE
if (typeof( window.innerWidth ) != 'number') {
if (!(document.documentElement.clientWidth === 0)) {
// strict mode
w = document.documentElement.clientWidth;
} else {
// quirks mode
w = document.body.clientWidth;
}
} else {
// w3c
w ... | javascript | function() {
var w = 0;
// IE
if (typeof( window.innerWidth ) != 'number') {
if (!(document.documentElement.clientWidth === 0)) {
// strict mode
w = document.documentElement.clientWidth;
} else {
// quirks mode
w = document.body.clientWidth;
}
} else {
// w3c
w ... | [
"function",
"(",
")",
"{",
"var",
"w",
"=",
"0",
";",
"// IE",
"if",
"(",
"typeof",
"(",
"window",
".",
"innerWidth",
")",
"!=",
"'number'",
")",
"{",
"if",
"(",
"!",
"(",
"document",
".",
"documentElement",
".",
"clientWidth",
"===",
"0",
")",
")"... | cross browser window width | [
"cross",
"browser",
"window",
"width"
] | 2e5112fceea57d8a707271ee34b8fb36e9eacd48 | https://github.com/ten1seven/jRespond/blob/2e5112fceea57d8a707271ee34b8fb36e9eacd48/js/jRespond.js#L48-L71 | train | |
ten1seven/jRespond | js/jRespond.js | function(elm) {
if (elm.length === undefined) {
addToStack(elm);
} else {
for (var i = 0; i < elm.length; i++) {
addToStack(elm[i]);
}
}
} | javascript | function(elm) {
if (elm.length === undefined) {
addToStack(elm);
} else {
for (var i = 0; i < elm.length; i++) {
addToStack(elm[i]);
}
}
} | [
"function",
"(",
"elm",
")",
"{",
"if",
"(",
"elm",
".",
"length",
"===",
"undefined",
")",
"{",
"addToStack",
"(",
"elm",
")",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elm",
".",
"length",
";",
"i",
"++",
")",... | determine input type | [
"determine",
"input",
"type"
] | 2e5112fceea57d8a707271ee34b8fb36e9eacd48 | https://github.com/ten1seven/jRespond/blob/2e5112fceea57d8a707271ee34b8fb36e9eacd48/js/jRespond.js#L74-L82 | train | |
ten1seven/jRespond | js/jRespond.js | function(elm) {
var brkpt = elm['breakpoint'];
var entr = elm['enter'] || undefined;
// add function to stack
mediaListeners.push(elm);
// add corresponding entry to mediaInit
mediaInit.push(false);
if (testForCurr(brkpt)) {
if (entr !== undefined) {
entr.call(null, {entering : curr, ex... | javascript | function(elm) {
var brkpt = elm['breakpoint'];
var entr = elm['enter'] || undefined;
// add function to stack
mediaListeners.push(elm);
// add corresponding entry to mediaInit
mediaInit.push(false);
if (testForCurr(brkpt)) {
if (entr !== undefined) {
entr.call(null, {entering : curr, ex... | [
"function",
"(",
"elm",
")",
"{",
"var",
"brkpt",
"=",
"elm",
"[",
"'breakpoint'",
"]",
";",
"var",
"entr",
"=",
"elm",
"[",
"'enter'",
"]",
"||",
"undefined",
";",
"// add function to stack",
"mediaListeners",
".",
"push",
"(",
"elm",
")",
";",
"// add ... | send media to the mediaListeners array | [
"send",
"media",
"to",
"the",
"mediaListeners",
"array"
] | 2e5112fceea57d8a707271ee34b8fb36e9eacd48 | https://github.com/ten1seven/jRespond/blob/2e5112fceea57d8a707271ee34b8fb36e9eacd48/js/jRespond.js#L85-L101 | train | |
ten1seven/jRespond | js/jRespond.js | function() {
var enterArray = [];
var exitArray = [];
for (var i = 0; i < mediaListeners.length; i++) {
var brkpt = mediaListeners[i]['breakpoint'];
var entr = mediaListeners[i]['enter'] || undefined;
var exit = mediaListeners[i]['exit'] || undefined;
if (brkpt === '*') {
if (entr !== u... | javascript | function() {
var enterArray = [];
var exitArray = [];
for (var i = 0; i < mediaListeners.length; i++) {
var brkpt = mediaListeners[i]['breakpoint'];
var entr = mediaListeners[i]['enter'] || undefined;
var exit = mediaListeners[i]['exit'] || undefined;
if (brkpt === '*') {
if (entr !== u... | [
"function",
"(",
")",
"{",
"var",
"enterArray",
"=",
"[",
"]",
";",
"var",
"exitArray",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"mediaListeners",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"brkpt",
"=",
"mediaL... | loops through all registered functions and determines what should be fired | [
"loops",
"through",
"all",
"registered",
"functions",
"and",
"determines",
"what",
"should",
"be",
"fired"
] | 2e5112fceea57d8a707271ee34b8fb36e9eacd48 | https://github.com/ten1seven/jRespond/blob/2e5112fceea57d8a707271ee34b8fb36e9eacd48/js/jRespond.js#L104-L148 | train | |
ten1seven/jRespond | js/jRespond.js | function(width) {
var foundBrkpt = false;
// look for existing breakpoint based on width
for (var i = 0; i < mediaBreakpoints.length; i++) {
// if registered breakpoint found, break out of loop
if (width >= mediaBreakpoints[i]['enter'] && width <= mediaBreakpoints[i]['exit']) {
foundBrkpt = tru... | javascript | function(width) {
var foundBrkpt = false;
// look for existing breakpoint based on width
for (var i = 0; i < mediaBreakpoints.length; i++) {
// if registered breakpoint found, break out of loop
if (width >= mediaBreakpoints[i]['enter'] && width <= mediaBreakpoints[i]['exit']) {
foundBrkpt = tru... | [
"function",
"(",
"width",
")",
"{",
"var",
"foundBrkpt",
"=",
"false",
";",
"// look for existing breakpoint based on width",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"mediaBreakpoints",
".",
"length",
";",
"i",
"++",
")",
"{",
"// if registered breakp... | checks for the correct breakpoint against the mediaBreakpoints list | [
"checks",
"for",
"the",
"correct",
"breakpoint",
"against",
"the",
"mediaBreakpoints",
"list"
] | 2e5112fceea57d8a707271ee34b8fb36e9eacd48 | https://github.com/ten1seven/jRespond/blob/2e5112fceea57d8a707271ee34b8fb36e9eacd48/js/jRespond.js#L151-L182 | train | |
ten1seven/jRespond | js/jRespond.js | function() {
// get current width
var w = winWidth();
// if there is a change speed up the timer and fire the returnBreakpoint function
if (w !== resizeW) {
resizeTmrSpd = resizeTmrFast;
returnBreakpoint(w);
// otherwise keep on keepin' on
} else {
resizeTmrSpd = resizeTmrSlow;
}
... | javascript | function() {
// get current width
var w = winWidth();
// if there is a change speed up the timer and fire the returnBreakpoint function
if (w !== resizeW) {
resizeTmrSpd = resizeTmrFast;
returnBreakpoint(w);
// otherwise keep on keepin' on
} else {
resizeTmrSpd = resizeTmrSlow;
}
... | [
"function",
"(",
")",
"{",
"// get current width",
"var",
"w",
"=",
"winWidth",
"(",
")",
";",
"// if there is a change speed up the timer and fire the returnBreakpoint function",
"if",
"(",
"w",
"!==",
"resizeW",
")",
"{",
"resizeTmrSpd",
"=",
"resizeTmrFast",
";",
"... | self-calling function that checks the browser width and delegates if it detects a change | [
"self",
"-",
"calling",
"function",
"that",
"checks",
"the",
"browser",
"width",
"and",
"delegates",
"if",
"it",
"detects",
"a",
"change"
] | 2e5112fceea57d8a707271ee34b8fb36e9eacd48 | https://github.com/ten1seven/jRespond/blob/2e5112fceea57d8a707271ee34b8fb36e9eacd48/js/jRespond.js#L206-L226 | train | |
broccolijs/broccoli-funnel | index.js | isNotAPattern | function isNotAPattern(pattern) {
let set = new Minimatch(pattern).set;
if (set.length > 1) {
return false;
}
for (let j = 0; j < set[0].length; j++) {
if (typeof set[0][j] !== 'string') {
return false;
}
}
return true;
} | javascript | function isNotAPattern(pattern) {
let set = new Minimatch(pattern).set;
if (set.length > 1) {
return false;
}
for (let j = 0; j < set[0].length; j++) {
if (typeof set[0][j] !== 'string') {
return false;
}
}
return true;
} | [
"function",
"isNotAPattern",
"(",
"pattern",
")",
"{",
"let",
"set",
"=",
"new",
"Minimatch",
"(",
"pattern",
")",
".",
"set",
";",
"if",
"(",
"set",
".",
"length",
">",
"1",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"let",
"j",
"=",
"0"... | copied mostly from node-glob cc @isaacs | [
"copied",
"mostly",
"from",
"node",
"-",
"glob",
"cc"
] | 50ea34e9a5549dcff2d3c077029b542ed3698e8c | https://github.com/broccolijs/broccoli-funnel/blob/50ea34e9a5549dcff2d3c077029b542ed3698e8c/index.js#L36-L49 | train |
akoenig/angular-deckgrid | angular-deckgrid.js | Deckgrid | function Deckgrid (scope, element) {
var self = this,
watcher,
mql;
this.$$elem = element;
this.$$watchers = [];
this.$$scope = scope;
this.$$scope.columns = [];
//
// The layout configuration will be ... | javascript | function Deckgrid (scope, element) {
var self = this,
watcher,
mql;
this.$$elem = element;
this.$$watchers = [];
this.$$scope = scope;
this.$$scope.columns = [];
//
// The layout configuration will be ... | [
"function",
"Deckgrid",
"(",
"scope",
",",
"element",
")",
"{",
"var",
"self",
"=",
"this",
",",
"watcher",
",",
"mql",
";",
"this",
".",
"$$elem",
"=",
"element",
";",
"this",
".",
"$$watchers",
"=",
"[",
"]",
";",
"this",
".",
"$$scope",
"=",
"sc... | The deckgrid directive. | [
"The",
"deckgrid",
"directive",
"."
] | 7d58a6ae59604a27a6a9b6ec39a192afdb5a7c9f | https://github.com/akoenig/angular-deckgrid/blob/7d58a6ae59604a27a6a9b6ec39a192afdb5a7c9f/angular-deckgrid.js#L175-L220 | train |
nodeca/mincer | lib/mincer/assets/processed.js | buildRequiredAssets | function buildRequiredAssets(self, context) {
var paths = context.__requiredPaths__.concat([ self.pathname ]),
assets = resolveDependencies(self, paths),
stubs = resolveDependencies(self, context.__stubbedAssets__);
if (stubs.length > 0) {
// exclude stubbed assets if any
assets = _.filter... | javascript | function buildRequiredAssets(self, context) {
var paths = context.__requiredPaths__.concat([ self.pathname ]),
assets = resolveDependencies(self, paths),
stubs = resolveDependencies(self, context.__stubbedAssets__);
if (stubs.length > 0) {
// exclude stubbed assets if any
assets = _.filter... | [
"function",
"buildRequiredAssets",
"(",
"self",
",",
"context",
")",
"{",
"var",
"paths",
"=",
"context",
".",
"__requiredPaths__",
".",
"concat",
"(",
"[",
"self",
".",
"pathname",
"]",
")",
",",
"assets",
"=",
"resolveDependencies",
"(",
"self",
",",
"pa... | build all required assets | [
"build",
"all",
"required",
"assets"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/assets/processed.js#L70-L83 | train |
nodeca/mincer | lib/mincer/assets/processed.js | computeDependencyDigest | function computeDependencyDigest(self) {
return _.reduce(self.requiredAssets, function (digest, asset) {
return digest.update(asset.digest);
}, self.environment.digest).digest('hex');
} | javascript | function computeDependencyDigest(self) {
return _.reduce(self.requiredAssets, function (digest, asset) {
return digest.update(asset.digest);
}, self.environment.digest).digest('hex');
} | [
"function",
"computeDependencyDigest",
"(",
"self",
")",
"{",
"return",
"_",
".",
"reduce",
"(",
"self",
".",
"requiredAssets",
",",
"function",
"(",
"digest",
",",
"asset",
")",
"{",
"return",
"digest",
".",
"update",
"(",
"asset",
".",
"digest",
")",
"... | return digest based on digests of all dependencies | [
"return",
"digest",
"based",
"on",
"digests",
"of",
"all",
"dependencies"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/assets/processed.js#L120-L124 | train |
nodeca/mincer | lib/mincer/engines/sass_engine.js | sassError | function sassError(ctx /*, options*/) {
if (ctx.line && ctx.message) { // libsass 3.x error object
return new Error('Line ' + ctx.line + ': ' + ctx.message);
}
if (typeof ctx === 'string') { // libsass error string format: path:line: error: message
var error = _.zipObject(
[ 'path', 'line', 'level',... | javascript | function sassError(ctx /*, options*/) {
if (ctx.line && ctx.message) { // libsass 3.x error object
return new Error('Line ' + ctx.line + ': ' + ctx.message);
}
if (typeof ctx === 'string') { // libsass error string format: path:line: error: message
var error = _.zipObject(
[ 'path', 'line', 'level',... | [
"function",
"sassError",
"(",
"ctx",
"/*, options*/",
")",
"{",
"if",
"(",
"ctx",
".",
"line",
"&&",
"ctx",
".",
"message",
")",
"{",
"// libsass 3.x error object",
"return",
"new",
"Error",
"(",
"'Line '",
"+",
"ctx",
".",
"line",
"+",
"': '",
"+",
"ctx... | helper to generate human-friendly errors. adapted version from less_engine.js | [
"helper",
"to",
"generate",
"human",
"-",
"friendly",
"errors",
".",
"adapted",
"version",
"from",
"less_engine",
".",
"js"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/engines/sass_engine.js#L78-L93 | train |
nodeca/mincer | lib/mincer/engines/sass_engine.js | importArgumentRelativeToSearchPaths | function importArgumentRelativeToSearchPaths(importer, importArgument, searchPaths) {
var importAbsolutePath = path.resolve(path.dirname(importer), importArgument);
var importSearchPath = _.find(searchPaths, function (path) {
return importAbsolutePath.indexOf(path) === 0;
});
if (importSearchPath) {
ret... | javascript | function importArgumentRelativeToSearchPaths(importer, importArgument, searchPaths) {
var importAbsolutePath = path.resolve(path.dirname(importer), importArgument);
var importSearchPath = _.find(searchPaths, function (path) {
return importAbsolutePath.indexOf(path) === 0;
});
if (importSearchPath) {
ret... | [
"function",
"importArgumentRelativeToSearchPaths",
"(",
"importer",
",",
"importArgument",
",",
"searchPaths",
")",
"{",
"var",
"importAbsolutePath",
"=",
"path",
".",
"resolve",
"(",
"path",
".",
"dirname",
"(",
"importer",
")",
",",
"importArgument",
")",
";",
... | Returns the argument of the @import() call relative to the asset search paths. | [
"Returns",
"the",
"argument",
"of",
"the"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/engines/sass_engine.js#L141-L149 | train |
blakeembrey/array-flatten | array-flatten.js | flattenDepth | function flattenDepth (array, depth) {
if (!Array.isArray(array)) {
throw new TypeError('Expected value to be an array')
}
return flattenFromDepth(array, depth)
} | javascript | function flattenDepth (array, depth) {
if (!Array.isArray(array)) {
throw new TypeError('Expected value to be an array')
}
return flattenFromDepth(array, depth)
} | [
"function",
"flattenDepth",
"(",
"array",
",",
"depth",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"array",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Expected value to be an array'",
")",
"}",
"return",
"flattenFromDepth",
"(",
"array",... | Flatten an array-like structure with depth.
@param {Array} array
@param {number} depth
@return {Array} | [
"Flatten",
"an",
"array",
"-",
"like",
"structure",
"with",
"depth",
"."
] | 04b45e7a5a9fb7e7946a1321287a09e84f1d352d | https://github.com/blakeembrey/array-flatten/blob/04b45e7a5a9fb7e7946a1321287a09e84f1d352d/array-flatten.js#L42-L48 | train |
blakeembrey/array-flatten | array-flatten.js | flattenDown | function flattenDown (array, result) {
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (Array.isArray(value)) {
flattenDown(value, result)
} else {
result.push(value)
}
}
return result
} | javascript | function flattenDown (array, result) {
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (Array.isArray(value)) {
flattenDown(value, result)
} else {
result.push(value)
}
}
return result
} | [
"function",
"flattenDown",
"(",
"array",
",",
"result",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"value",
"=",
"array",
"[",
"i",
"]",
"if",
"(",
"Array",
".",
"isArray"... | Flatten an array indefinitely.
@param {Array} array
@param {Array} result
@return {Array} | [
"Flatten",
"an",
"array",
"indefinitely",
"."
] | 04b45e7a5a9fb7e7946a1321287a09e84f1d352d | https://github.com/blakeembrey/array-flatten/blob/04b45e7a5a9fb7e7946a1321287a09e84f1d352d/array-flatten.js#L72-L84 | train |
blakeembrey/array-flatten | array-flatten.js | flattenDownDepth | function flattenDownDepth (array, result, depth) {
depth--
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (depth > -1 && Array.isArray(value)) {
flattenDownDepth(value, result, depth)
} else {
result.push(value)
}
}
return result
} | javascript | function flattenDownDepth (array, result, depth) {
depth--
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (depth > -1 && Array.isArray(value)) {
flattenDownDepth(value, result, depth)
} else {
result.push(value)
}
}
return result
} | [
"function",
"flattenDownDepth",
"(",
"array",
",",
"result",
",",
"depth",
")",
"{",
"depth",
"--",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"value",
"=",
"array",
"[",
"i",
"]",
... | Flatten an array with depth.
@param {Array} array
@param {Array} result
@param {number} depth
@return {Array} | [
"Flatten",
"an",
"array",
"with",
"depth",
"."
] | 04b45e7a5a9fb7e7946a1321287a09e84f1d352d | https://github.com/blakeembrey/array-flatten/blob/04b45e7a5a9fb7e7946a1321287a09e84f1d352d/array-flatten.js#L94-L108 | train |
nodeca/mincer | lib/mincer/base.js | matches_filter | function matches_filter(filters, logicalPath, filename) {
if (filters.length === 0) {
return true;
}
return _.some(filters, function (filter) {
if (_.isRegExp(filter)) {
return filter.test(logicalPath);
}
if (_.isFunction(filter)) {
return filter(logicalPath, filename);
}
//... | javascript | function matches_filter(filters, logicalPath, filename) {
if (filters.length === 0) {
return true;
}
return _.some(filters, function (filter) {
if (_.isRegExp(filter)) {
return filter.test(logicalPath);
}
if (_.isFunction(filter)) {
return filter(logicalPath, filename);
}
//... | [
"function",
"matches_filter",
"(",
"filters",
",",
"logicalPath",
",",
"filename",
")",
"{",
"if",
"(",
"filters",
".",
"length",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"return",
"_",
".",
"some",
"(",
"filters",
",",
"function",
"(",
"filte... | Returns true if there were no filters, or `filename` matches at least one | [
"Returns",
"true",
"if",
"there",
"were",
"no",
"filters",
"or",
"filename",
"matches",
"at",
"least",
"one"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/base.js#L414-L451 | train |
nodeca/mincer | lib/mincer/base.js | logical_path_for_filename | function logical_path_for_filename(self, filename, filters) {
var logical_path = self.attributesFor(filename).logicalPath;
if (matches_filter(filters, logical_path, filename)) {
return logical_path;
}
// If filename is an index file, retest with alias
if (path.basename(filename).split('.').shift() === '... | javascript | function logical_path_for_filename(self, filename, filters) {
var logical_path = self.attributesFor(filename).logicalPath;
if (matches_filter(filters, logical_path, filename)) {
return logical_path;
}
// If filename is an index file, retest with alias
if (path.basename(filename).split('.').shift() === '... | [
"function",
"logical_path_for_filename",
"(",
"self",
",",
"filename",
",",
"filters",
")",
"{",
"var",
"logical_path",
"=",
"self",
".",
"attributesFor",
"(",
"filename",
")",
".",
"logicalPath",
";",
"if",
"(",
"matches_filter",
"(",
"filters",
",",
"logical... | Returns logicalPath for `filename` if it matches given filters | [
"Returns",
"logicalPath",
"for",
"filename",
"if",
"it",
"matches",
"given",
"filters"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/base.js#L455-L469 | train |
nodeca/mincer | examples/server.js | rewrite_extension | function rewrite_extension(source, ext) {
var source_ext = path.extname(source);
return (source_ext === ext) ? source : (source + ext);
} | javascript | function rewrite_extension(source, ext) {
var source_ext = path.extname(source);
return (source_ext === ext) ? source : (source + ext);
} | [
"function",
"rewrite_extension",
"(",
"source",
",",
"ext",
")",
"{",
"var",
"source_ext",
"=",
"path",
".",
"extname",
"(",
"source",
")",
";",
"return",
"(",
"source_ext",
"===",
"ext",
")",
"?",
"source",
":",
"(",
"source",
"+",
"ext",
")",
";",
... | dummy helper that injects extension | [
"dummy",
"helper",
"that",
"injects",
"extension"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/examples/server.js#L68-L71 | train |
nodeca/mincer | lib/mincer/helpers/configuring.js | configuration | function configuration(self, name) {
if (!self.__configurations__[name]) {
throw new Error('Unknown configuration: ' + name);
}
return self.__configurations__[name];
} | javascript | function configuration(self, name) {
if (!self.__configurations__[name]) {
throw new Error('Unknown configuration: ' + name);
}
return self.__configurations__[name];
} | [
"function",
"configuration",
"(",
"self",
",",
"name",
")",
"{",
"if",
"(",
"!",
"self",
".",
"__configurations__",
"[",
"name",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unknown configuration: '",
"+",
"name",
")",
";",
"}",
"return",
"self",
".",
... | unified access to a config hash by name | [
"unified",
"access",
"to",
"a",
"config",
"hash",
"by",
"name"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/helpers/configuring.js#L57-L63 | train |
nodeca/mincer | lib/mincer/assets/asset.js | stub_getter | function stub_getter(name) {
getter(Asset.prototype, name, function () {
// this should never happen, as Asset is an abstract class and not
// supposed to be used directly. subclasses must override this getters
throw new Error(this.constructor.name + '#' + name + ' getter is not implemented.');
});
} | javascript | function stub_getter(name) {
getter(Asset.prototype, name, function () {
// this should never happen, as Asset is an abstract class and not
// supposed to be used directly. subclasses must override this getters
throw new Error(this.constructor.name + '#' + name + ' getter is not implemented.');
});
} | [
"function",
"stub_getter",
"(",
"name",
")",
"{",
"getter",
"(",
"Asset",
".",
"prototype",
",",
"name",
",",
"function",
"(",
")",
"{",
"// this should never happen, as Asset is an abstract class and not",
"// supposed to be used directly. subclasses must override this getters... | helper to sub-out getters of Asset.prototype | [
"helper",
"to",
"sub",
"-",
"out",
"getters",
"of",
"Asset",
".",
"prototype"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/assets/asset.js#L72-L78 | train |
nodeca/mincer | lib/mincer/server.js | end | function end(res, code) {
if (code >= 400) {
// check res object contains connect/express request and next structure
if (res.req && res.req.next) {
var error = new Error(http.STATUS_CODES[code]);
error.status = code;
return res.req.next(error);
}
// write human-friendly error messag... | javascript | function end(res, code) {
if (code >= 400) {
// check res object contains connect/express request and next structure
if (res.req && res.req.next) {
var error = new Error(http.STATUS_CODES[code]);
error.status = code;
return res.req.next(error);
}
// write human-friendly error messag... | [
"function",
"end",
"(",
"res",
",",
"code",
")",
"{",
"if",
"(",
"code",
">=",
"400",
")",
"{",
"// check res object contains connect/express request and next structure",
"if",
"(",
"res",
".",
"req",
"&&",
"res",
".",
"req",
".",
"next",
")",
"{",
"var",
... | Helper to write the code and end response | [
"Helper",
"to",
"write",
"the",
"code",
"and",
"end",
"response"
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/server.js#L82-L100 | train |
nodeca/mincer | lib/mincer/server.js | log_event | function log_event(req, code, message, elapsed) {
return {
code: code,
message: message,
elapsed: elapsed,
request: req,
url: req.originalUrl || req.url,
method: req.method,
headers: req.headers,
httpVersion: req.httpVersion,
... | javascript | function log_event(req, code, message, elapsed) {
return {
code: code,
message: message,
elapsed: elapsed,
request: req,
url: req.originalUrl || req.url,
method: req.method,
headers: req.headers,
httpVersion: req.httpVersion,
... | [
"function",
"log_event",
"(",
"req",
",",
"code",
",",
"message",
",",
"elapsed",
")",
"{",
"return",
"{",
"code",
":",
"code",
",",
"message",
":",
"message",
",",
"elapsed",
":",
"elapsed",
",",
"request",
":",
"req",
",",
"url",
":",
"req",
".",
... | Returns log event structure. | [
"Returns",
"log",
"event",
"structure",
"."
] | a44368093bf11545712378f19c1a0139eafe13e4 | https://github.com/nodeca/mincer/blob/a44368093bf11545712378f19c1a0139eafe13e4/lib/mincer/server.js#L124-L136 | train |
Microsoft/taco-team-build | lib/ttb-cache.js | getModuleVersionFromConfig | function getModuleVersionFromConfig(config) {
if (config.moduleVersion === undefined && config.nodePackageName == CORDOVA) {
// If no version is set, try to get the version from taco.json
// This check is specific to the Cordova module
if (utilities.fileExistsSync(path.join(config.projectPat... | javascript | function getModuleVersionFromConfig(config) {
if (config.moduleVersion === undefined && config.nodePackageName == CORDOVA) {
// If no version is set, try to get the version from taco.json
// This check is specific to the Cordova module
if (utilities.fileExistsSync(path.join(config.projectPat... | [
"function",
"getModuleVersionFromConfig",
"(",
"config",
")",
"{",
"if",
"(",
"config",
".",
"moduleVersion",
"===",
"undefined",
"&&",
"config",
".",
"nodePackageName",
"==",
"CORDOVA",
")",
"{",
"// If no version is set, try to get the version from taco.json",
"// This ... | Extracts the module version from a configuration | [
"Extracts",
"the",
"module",
"version",
"from",
"a",
"configuration"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/lib/ttb-cache.js#L23-L38 | train |
Microsoft/taco-team-build | lib/ttb-cache.js | cacheModule | function cacheModule(config) {
config = utilities.parseConfig(config);
var moduleCache = utilities.getCachePath();
console.log('Module cache at ' + moduleCache);
var version = getModuleVersionFromConfig(config);
var pkgStr = config.nodePackageName + (version ? '@' + version : '');
return utili... | javascript | function cacheModule(config) {
config = utilities.parseConfig(config);
var moduleCache = utilities.getCachePath();
console.log('Module cache at ' + moduleCache);
var version = getModuleVersionFromConfig(config);
var pkgStr = config.nodePackageName + (version ? '@' + version : '');
return utili... | [
"function",
"cacheModule",
"(",
"config",
")",
"{",
"config",
"=",
"utilities",
".",
"parseConfig",
"(",
"config",
")",
";",
"var",
"moduleCache",
"=",
"utilities",
".",
"getCachePath",
"(",
")",
";",
"console",
".",
"log",
"(",
"'Module cache at '",
"+",
... | Install module method | [
"Install",
"module",
"method"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/lib/ttb-cache.js#L49-L90 | train |
Microsoft/taco-team-build | lib/ttb-cache.js | loadModule | function loadModule(modulePath) {
// Setup environment
if (loadedModule === undefined || loadedModulePath != modulePath) {
loadedModule = require(modulePath);
loadedModulePath = modulePath;
return Q(loadedModule);
} else {
return Q(loadedModule);
}
} | javascript | function loadModule(modulePath) {
// Setup environment
if (loadedModule === undefined || loadedModulePath != modulePath) {
loadedModule = require(modulePath);
loadedModulePath = modulePath;
return Q(loadedModule);
} else {
return Q(loadedModule);
}
} | [
"function",
"loadModule",
"(",
"modulePath",
")",
"{",
"// Setup environment",
"if",
"(",
"loadedModule",
"===",
"undefined",
"||",
"loadedModulePath",
"!=",
"modulePath",
")",
"{",
"loadedModule",
"=",
"require",
"(",
"modulePath",
")",
";",
"loadedModulePath",
"... | Utility method that loads a previously cached module and returns a promise that resolves to that object | [
"Utility",
"method",
"that",
"loads",
"a",
"previously",
"cached",
"module",
"and",
"returns",
"a",
"promise",
"that",
"resolves",
"to",
"that",
"object"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/lib/ttb-cache.js#L93-L103 | train |
Microsoft/taco-team-build | lib/ttb-util.js | getCallArgs | function getCallArgs(platforms, args, cordovaVersion) {
// Processes single platform string (or array of length 1) and an array of args or an object of args per platform
args = args || [];
if (typeof (platforms) == 'string') {
platforms = [platforms];
}
// If only one platform is specif... | javascript | function getCallArgs(platforms, args, cordovaVersion) {
// Processes single platform string (or array of length 1) and an array of args or an object of args per platform
args = args || [];
if (typeof (platforms) == 'string') {
platforms = [platforms];
}
// If only one platform is specif... | [
"function",
"getCallArgs",
"(",
"platforms",
",",
"args",
",",
"cordovaVersion",
")",
"{",
"// Processes single platform string (or array of length 1) and an array of args or an object of args per platform",
"args",
"=",
"args",
"||",
"[",
"]",
";",
"if",
"(",
"typeof",
"("... | Utility method that coverts args into a consistant input understood by cordova-lib | [
"Utility",
"method",
"that",
"coverts",
"args",
"into",
"a",
"consistant",
"input",
"understood",
"by",
"cordova",
"-",
"lib"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/lib/ttb-util.js#L87-L109 | train |
Microsoft/taco-team-build | lib/ttb-util.js | isCompatibleNpmPackage | function isCompatibleNpmPackage(pkgName) {
if (pkgName !== 'cordova' && pkgName.indexOf('cordova@') !== 0) {
return Q(NodeCompatibilityResult.Compatible);
}
// Get the version of npm and the version of cordova requested. If the
// cordova version <= 5.3.3, and the Node version is 5.0.0, the... | javascript | function isCompatibleNpmPackage(pkgName) {
if (pkgName !== 'cordova' && pkgName.indexOf('cordova@') !== 0) {
return Q(NodeCompatibilityResult.Compatible);
}
// Get the version of npm and the version of cordova requested. If the
// cordova version <= 5.3.3, and the Node version is 5.0.0, the... | [
"function",
"isCompatibleNpmPackage",
"(",
"pkgName",
")",
"{",
"if",
"(",
"pkgName",
"!==",
"'cordova'",
"&&",
"pkgName",
".",
"indexOf",
"(",
"'cordova@'",
")",
"!==",
"0",
")",
"{",
"return",
"Q",
"(",
"NodeCompatibilityResult",
".",
"Compatible",
")",
";... | Returns a promise that resolves to whether or not the currently installed version of Node is compatible with the requested version of cordova. | [
"Returns",
"a",
"promise",
"that",
"resolves",
"to",
"whether",
"or",
"not",
"the",
"currently",
"installed",
"version",
"of",
"Node",
"is",
"compatible",
"with",
"the",
"requested",
"version",
"of",
"cordova",
"."
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/lib/ttb-util.js#L133-L161 | train |
Microsoft/taco-team-build | taco-team-build.js | applyExecutionBitFix | function applyExecutionBitFix(platforms) {
// Only bother if we're on OSX and are after platform add for iOS itself (still need to run for other platforms)
if (process.platform !== "darwin" && process.platform !== 'linux') {
return Q();
}
// Disable -E flag for non-OSX platforms
var regex_f... | javascript | function applyExecutionBitFix(platforms) {
// Only bother if we're on OSX and are after platform add for iOS itself (still need to run for other platforms)
if (process.platform !== "darwin" && process.platform !== 'linux') {
return Q();
}
// Disable -E flag for non-OSX platforms
var regex_f... | [
"function",
"applyExecutionBitFix",
"(",
"platforms",
")",
"{",
"// Only bother if we're on OSX and are after platform add for iOS itself (still need to run for other platforms)",
"if",
"(",
"process",
".",
"platform",
"!==",
"\"darwin\"",
"&&",
"process",
".",
"platform",
"!==",... | It's possible that checking in the platforms folder on Windows and then checking out and building the project on OSX can cause the eXecution bit on the platform version files to be cleared, resulting in errors when performing project operations. This method restores it if needed. It will also set the excute bit on the ... | [
"It",
"s",
"possible",
"that",
"checking",
"in",
"the",
"platforms",
"folder",
"on",
"Windows",
"and",
"then",
"checking",
"out",
"and",
"building",
"the",
"project",
"on",
"OSX",
"can",
"cause",
"the",
"eXecution",
"bit",
"on",
"the",
"platform",
"version",... | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/taco-team-build.js#L82-L110 | train |
Microsoft/taco-team-build | taco-team-build.js | prepareProject | function prepareProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == "string") {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
var appendedVersion = cache.getModuleVersionFromConfig(... | javascript | function prepareProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == "string") {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
var appendedVersion = cache.getModuleVersionFromConfig(... | [
"function",
"prepareProject",
"(",
"cordovaPlatforms",
",",
"args",
",",
"/* optional */",
"projectPath",
")",
"{",
"if",
"(",
"typeof",
"(",
"cordovaPlatforms",
")",
"==",
"\"string\"",
")",
"{",
"cordovaPlatforms",
"=",
"[",
"cordovaPlatforms",
"]",
";",
"}",
... | Method to prepare the platforms | [
"Method",
"to",
"prepare",
"the",
"platforms"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/taco-team-build.js#L180-L223 | train |
Microsoft/taco-team-build | taco-team-build.js | buildProject | function buildProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == 'string') {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
var appendedVersion = cache.getModuleVersionFromConfig(de... | javascript | function buildProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == 'string') {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
var appendedVersion = cache.getModuleVersionFromConfig(de... | [
"function",
"buildProject",
"(",
"cordovaPlatforms",
",",
"args",
",",
"/* optional */",
"projectPath",
")",
"{",
"if",
"(",
"typeof",
"(",
"cordovaPlatforms",
")",
"==",
"'string'",
")",
"{",
"cordovaPlatforms",
"=",
"[",
"cordovaPlatforms",
"]",
";",
"}",
"i... | Main build method | [
"Main",
"build",
"method"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/taco-team-build.js#L226-L282 | train |
Microsoft/taco-team-build | taco-team-build.js | _addPlatformsToProject | function _addPlatformsToProject(cordovaPlatforms, projectPath, cordova) {
var promise = Q();
cordovaPlatforms.forEach(function (platform) {
if (!utilities.fileExistsSync(path.join(projectPath, 'platforms', platform))) {
promise = promise.then(function () { return cordova.raw.platform('add', ... | javascript | function _addPlatformsToProject(cordovaPlatforms, projectPath, cordova) {
var promise = Q();
cordovaPlatforms.forEach(function (platform) {
if (!utilities.fileExistsSync(path.join(projectPath, 'platforms', platform))) {
promise = promise.then(function () { return cordova.raw.platform('add', ... | [
"function",
"_addPlatformsToProject",
"(",
"cordovaPlatforms",
",",
"projectPath",
",",
"cordova",
")",
"{",
"var",
"promise",
"=",
"Q",
"(",
")",
";",
"cordovaPlatforms",
".",
"forEach",
"(",
"function",
"(",
"platform",
")",
"{",
"if",
"(",
"!",
"utilities... | Prep for build by adding platforms and setting environment variables | [
"Prep",
"for",
"build",
"by",
"adding",
"platforms",
"and",
"setting",
"environment",
"variables"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/taco-team-build.js#L293-L304 | train |
Microsoft/taco-team-build | taco-team-build.js | packageProject | function packageProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == 'string') {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
return setupCordova().then(function (cordova) {
... | javascript | function packageProject(cordovaPlatforms, args, /* optional */ projectPath) {
if (typeof (cordovaPlatforms) == 'string') {
cordovaPlatforms = [cordovaPlatforms];
}
if (!projectPath) {
projectPath = defaultConfig.projectPath;
}
return setupCordova().then(function (cordova) {
... | [
"function",
"packageProject",
"(",
"cordovaPlatforms",
",",
"args",
",",
"/* optional */",
"projectPath",
")",
"{",
"if",
"(",
"typeof",
"(",
"cordovaPlatforms",
")",
"==",
"'string'",
")",
"{",
"cordovaPlatforms",
"=",
"[",
"cordovaPlatforms",
"]",
";",
"}",
... | Package project method - Just for iOS currently | [
"Package",
"project",
"method",
"-",
"Just",
"for",
"iOS",
"currently"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/taco-team-build.js#L307-L327 | train |
Microsoft/taco-team-build | taco-team-build.js | _createIpa | function _createIpa(projectPath, args) {
return utilities.getInstalledPlatformVersion(projectPath, 'ios').then(function (version) {
if (semver.lt(version, '3.9.0')) {
var deferred = Q.defer();
glob(projectPath + '/platforms/ios/build/device/*.app', function (err, matches) {
... | javascript | function _createIpa(projectPath, args) {
return utilities.getInstalledPlatformVersion(projectPath, 'ios').then(function (version) {
if (semver.lt(version, '3.9.0')) {
var deferred = Q.defer();
glob(projectPath + '/platforms/ios/build/device/*.app', function (err, matches) {
... | [
"function",
"_createIpa",
"(",
"projectPath",
",",
"args",
")",
"{",
"return",
"utilities",
".",
"getInstalledPlatformVersion",
"(",
"projectPath",
",",
"'ios'",
")",
".",
"then",
"(",
"function",
"(",
"version",
")",
"{",
"if",
"(",
"semver",
".",
"lt",
"... | Find the .app folder and use exec to call xcrun with the appropriate set of args | [
"Find",
"the",
".",
"app",
"folder",
"and",
"use",
"exec",
"to",
"call",
"xcrun",
"with",
"the",
"appropriate",
"set",
"of",
"args"
] | c9f0f678efd42e1a7f6f953a30ab13213d4f8dae | https://github.com/Microsoft/taco-team-build/blob/c9f0f678efd42e1a7f6f953a30ab13213d4f8dae/taco-team-build.js#L330-L369 | train |
Urigo/meteor-rxjs | dist/bundles/index.umd.js | Collection | function Collection(nameOrExisting, options) {
if (nameOrExisting instanceof Mongo.Collection) {
this._collection = nameOrExisting;
}
else {
this._collection = new Mongo.Collection(nameOrExisting, options);
}
} | javascript | function Collection(nameOrExisting, options) {
if (nameOrExisting instanceof Mongo.Collection) {
this._collection = nameOrExisting;
}
else {
this._collection = new Mongo.Collection(nameOrExisting, options);
}
} | [
"function",
"Collection",
"(",
"nameOrExisting",
",",
"options",
")",
"{",
"if",
"(",
"nameOrExisting",
"instanceof",
"Mongo",
".",
"Collection",
")",
"{",
"this",
".",
"_collection",
"=",
"nameOrExisting",
";",
"}",
"else",
"{",
"this",
".",
"_collection",
... | Creates a new Mongo.Collection instance wrapped with Observable features.
@param {String | Mongo.Collection} nameOrExisting - The name of the collection. If null, creates an
unmanaged (unsynchronized) local collection. If provided an instance of existing collection, will
create a wrapper for the existing Mongo.Collecti... | [
"Creates",
"a",
"new",
"Mongo",
".",
"Collection",
"instance",
"wrapped",
"with",
"Observable",
"features",
"."
] | 3c9c453291b83c564a416096b2023d7f45257dec | https://github.com/Urigo/meteor-rxjs/blob/3c9c453291b83c564a416096b2023d7f45257dec/dist/bundles/index.umd.js#L261-L268 | train |
smooch/smooch-core-js | src/api/integrations.js | IntegrationType | function IntegrationType(required, optional = []) {
//convert parameter string values to object
this.required = required.map(transformProps);
this.optional = optional.map(transformProps);
} | javascript | function IntegrationType(required, optional = []) {
//convert parameter string values to object
this.required = required.map(transformProps);
this.optional = optional.map(transformProps);
} | [
"function",
"IntegrationType",
"(",
"required",
",",
"optional",
"=",
"[",
"]",
")",
"{",
"//convert parameter string values to object",
"this",
".",
"required",
"=",
"required",
".",
"map",
"(",
"transformProps",
")",
";",
"this",
".",
"optional",
"=",
"optiona... | Integration API properties
@typedef IntegrationProps | [
"Integration",
"API",
"properties"
] | 81e35d4154d12ff5c94ad40179fb503b2bc2d0ce | https://github.com/smooch/smooch-core-js/blob/81e35d4154d12ff5c94ad40179fb503b2bc2d0ce/src/api/integrations.js#L20-L24 | train |
rolaveric/karma-systemjs | lib/adapter.js | function(filePaths, importRegexp, System) {
var moduleNames = [];
for (var filePath in filePaths) {
if (filePaths.hasOwnProperty(filePath) && importRegexp.test(filePath)) {
moduleNames.push(adapter.getModuleNameFromPath(filePath, System.baseURL, System));
}
}
return mod... | javascript | function(filePaths, importRegexp, System) {
var moduleNames = [];
for (var filePath in filePaths) {
if (filePaths.hasOwnProperty(filePath) && importRegexp.test(filePath)) {
moduleNames.push(adapter.getModuleNameFromPath(filePath, System.baseURL, System));
}
}
return mod... | [
"function",
"(",
"filePaths",
",",
"importRegexp",
",",
"System",
")",
"{",
"var",
"moduleNames",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"filePath",
"in",
"filePaths",
")",
"{",
"if",
"(",
"filePaths",
".",
"hasOwnProperty",
"(",
"filePath",
")",
"&&",
... | Returns the modules names for files that match a given import RegExp.
@param filePaths {object}
@param importRegexp {object}
@param System {object}
@returns {string[]} | [
"Returns",
"the",
"modules",
"names",
"for",
"files",
"that",
"match",
"a",
"given",
"import",
"RegExp",
"."
] | 579a83a7c80a16484353df53e4ba6cf73db43e96 | https://github.com/rolaveric/karma-systemjs/blob/579a83a7c80a16484353df53e4ba6cf73db43e96/lib/adapter.js#L28-L36 | train | |
rolaveric/karma-systemjs | lib/adapter.js | function(System, Promise, files, importRegexps, strictImportSequence) {
if (strictImportSequence) {
return adapter.sequentialImportFiles(System, Promise, files, importRegexps)
} else {
return adapter.parallelImportFiles(System, Promise, files, importRegexps)
}
} | javascript | function(System, Promise, files, importRegexps, strictImportSequence) {
if (strictImportSequence) {
return adapter.sequentialImportFiles(System, Promise, files, importRegexps)
} else {
return adapter.parallelImportFiles(System, Promise, files, importRegexps)
}
} | [
"function",
"(",
"System",
",",
"Promise",
",",
"files",
",",
"importRegexps",
",",
"strictImportSequence",
")",
"{",
"if",
"(",
"strictImportSequence",
")",
"{",
"return",
"adapter",
".",
"sequentialImportFiles",
"(",
"System",
",",
"Promise",
",",
"files",
"... | Calls System.import on all the files that match one of the importPatterns.
Returns a single promise which resolves once all imports are complete.
@param System {object}
@param Promise {object}
@param files {object} key/value map of filePaths to change counters
@param importRegexps {RegExp[]}
@param [strictImportSequenc... | [
"Calls",
"System",
".",
"import",
"on",
"all",
"the",
"files",
"that",
"match",
"one",
"of",
"the",
"importPatterns",
".",
"Returns",
"a",
"single",
"promise",
"which",
"resolves",
"once",
"all",
"imports",
"are",
"complete",
"."
] | 579a83a7c80a16484353df53e4ba6cf73db43e96 | https://github.com/rolaveric/karma-systemjs/blob/579a83a7c80a16484353df53e4ba6cf73db43e96/lib/adapter.js#L103-L109 | train | |
rolaveric/karma-systemjs | lib/adapter.js | function(karma, System, Promise) {
// Fail fast if any of the dependencies are undefined
if (!karma) {
(console.error || console.log)('Error: Not setup properly. window.__karma__ is undefined');
return;
}
if (!System) {
(console.error || console.log)('Error: Not setup pr... | javascript | function(karma, System, Promise) {
// Fail fast if any of the dependencies are undefined
if (!karma) {
(console.error || console.log)('Error: Not setup properly. window.__karma__ is undefined');
return;
}
if (!System) {
(console.error || console.log)('Error: Not setup pr... | [
"function",
"(",
"karma",
",",
"System",
",",
"Promise",
")",
"{",
"// Fail fast if any of the dependencies are undefined",
"if",
"(",
"!",
"karma",
")",
"{",
"(",
"console",
".",
"error",
"||",
"console",
".",
"log",
")",
"(",
"'Error: Not setup properly. window... | Has SystemJS load each test suite, then starts Karma
@param karma {object}
@param System {object}
@param Promise {object} | [
"Has",
"SystemJS",
"load",
"each",
"test",
"suite",
"then",
"starts",
"Karma"
] | 579a83a7c80a16484353df53e4ba6cf73db43e96 | https://github.com/rolaveric/karma-systemjs/blob/579a83a7c80a16484353df53e4ba6cf73db43e96/lib/adapter.js#L135-L195 | train | |
rolaveric/karma-systemjs | lib/adapter.js | function(err, System) {
err = String(err);
// Look for common issues in the error message, and try to add hints to them
switch (true) {
// Some people use ".es6" instead of ".js" for ES6 code
case /^Error loading ".*\.es6" at .*\.es6\.js/.test(err):
return err + '\nHint: If you u... | javascript | function(err, System) {
err = String(err);
// Look for common issues in the error message, and try to add hints to them
switch (true) {
// Some people use ".es6" instead of ".js" for ES6 code
case /^Error loading ".*\.es6" at .*\.es6\.js/.test(err):
return err + '\nHint: If you u... | [
"function",
"(",
"err",
",",
"System",
")",
"{",
"err",
"=",
"String",
"(",
"err",
")",
";",
"// Look for common issues in the error message, and try to add hints to them",
"switch",
"(",
"true",
")",
"{",
"// Some people use \".es6\" instead of \".js\" for ES6 code",
"case... | Checks errors to see if they match known issues, and tries to decorate them
with hints on how to resolve them.
@param err {string}
@param System {object}
@returns {string} | [
"Checks",
"errors",
"to",
"see",
"if",
"they",
"match",
"known",
"issues",
"and",
"tries",
"to",
"decorate",
"them",
"with",
"hints",
"on",
"how",
"to",
"resolve",
"them",
"."
] | 579a83a7c80a16484353df53e4ba6cf73db43e96 | https://github.com/rolaveric/karma-systemjs/blob/579a83a7c80a16484353df53e4ba6cf73db43e96/lib/adapter.js#L204-L220 | train | |
segmentio/analytics.js-integration | lib/index.js | Integration | function Integration(options) {
if (options && options.addIntegration) {
// plugin
return options.addIntegration(Integration);
}
this.debug = debug('analytics:integration:' + slug(name));
var clonedOpts = {};
extend(true, clonedOpts, options); // deep clone options
this.options = def... | javascript | function Integration(options) {
if (options && options.addIntegration) {
// plugin
return options.addIntegration(Integration);
}
this.debug = debug('analytics:integration:' + slug(name));
var clonedOpts = {};
extend(true, clonedOpts, options); // deep clone options
this.options = def... | [
"function",
"Integration",
"(",
"options",
")",
"{",
"if",
"(",
"options",
"&&",
"options",
".",
"addIntegration",
")",
"{",
"// plugin",
"return",
"options",
".",
"addIntegration",
"(",
"Integration",
")",
";",
"}",
"this",
".",
"debug",
"=",
"debug",
"("... | Initialize a new `Integration`.
@class
@param {Object} options | [
"Initialize",
"a",
"new",
"Integration",
"."
] | 9392b72c34ee2446e97e37b737966fde3fee58cb | https://github.com/segmentio/analytics.js-integration/blob/9392b72c34ee2446e97e37b737966fde3fee58cb/lib/index.js#L31-L48 | train |
segmentio/analytics.js-integration | lib/protos.js | isMixed | function isMixed(item) {
if (!is.object(item)) return false;
if (!is.string(item.key)) return false;
if (!has.call(item, 'value')) return false;
return true;
} | javascript | function isMixed(item) {
if (!is.object(item)) return false;
if (!is.string(item.key)) return false;
if (!has.call(item, 'value')) return false;
return true;
} | [
"function",
"isMixed",
"(",
"item",
")",
"{",
"if",
"(",
"!",
"is",
".",
"object",
"(",
"item",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"is",
".",
"string",
"(",
"item",
".",
"key",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
... | Determine if item in mapping array is a valid "mixed" type value
Must be an object with properties "key" (of type string)
and "value" (of any type)
@api private
@param {*} item
@return {Boolean} | [
"Determine",
"if",
"item",
"in",
"mapping",
"array",
"is",
"a",
"valid",
"mixed",
"type",
"value"
] | 9392b72c34ee2446e97e37b737966fde3fee58cb | https://github.com/segmentio/analytics.js-integration/blob/9392b72c34ee2446e97e37b737966fde3fee58cb/lib/protos.js#L398-L403 | train |
davidtheclark/scut | docs/dev/js/main.js | toggleCss | function toggleCss() {
if (!cssOpen) {
exampleCss.classList.remove(hiddenClass);
showCssBtn.innerHTML = hideText;
cssOpen = true;
} else {
exampleCss.classList.add(hiddenClass);
exampleScss.scrollIntoView();
showCssBtn.innerHTML = showText;
cssOpen = false;
}
} | javascript | function toggleCss() {
if (!cssOpen) {
exampleCss.classList.remove(hiddenClass);
showCssBtn.innerHTML = hideText;
cssOpen = true;
} else {
exampleCss.classList.add(hiddenClass);
exampleScss.scrollIntoView();
showCssBtn.innerHTML = showText;
cssOpen = false;
}
} | [
"function",
"toggleCss",
"(",
")",
"{",
"if",
"(",
"!",
"cssOpen",
")",
"{",
"exampleCss",
".",
"classList",
".",
"remove",
"(",
"hiddenClass",
")",
";",
"showCssBtn",
".",
"innerHTML",
"=",
"hideText",
";",
"cssOpen",
"=",
"true",
";",
"}",
"else",
"{... | make button work | [
"make",
"button",
"work"
] | 3d6f8fb7a26af441c87bd6d4199a56b4cf4982d8 | https://github.com/davidtheclark/scut/blob/3d6f8fb7a26af441c87bd6d4199a56b4cf4982d8/docs/dev/js/main.js#L22-L33 | train |
signalfx/signalfx-nodejs | lib/client/signalflow/websocket_message_parser.js | getSnowflakeIdFromUint8Array | function getSnowflakeIdFromUint8Array(Uint8Arr) {
// packaged lib uses base64 not base64URL, so swap the different chars
return base64js.fromByteArray(Uint8Arr).substring(0, 11).replace(/\+/g, '-').replace(/\//g, '_');
} | javascript | function getSnowflakeIdFromUint8Array(Uint8Arr) {
// packaged lib uses base64 not base64URL, so swap the different chars
return base64js.fromByteArray(Uint8Arr).substring(0, 11).replace(/\+/g, '-').replace(/\//g, '_');
} | [
"function",
"getSnowflakeIdFromUint8Array",
"(",
"Uint8Arr",
")",
"{",
"// packaged lib uses base64 not base64URL, so swap the different chars",
"return",
"base64js",
".",
"fromByteArray",
"(",
"Uint8Arr",
")",
".",
"substring",
"(",
"0",
",",
"11",
")",
".",
"replace",
... | Convert the given Uint8 array into a SignalFx Snowflake ID. | [
"Convert",
"the",
"given",
"Uint8",
"array",
"into",
"a",
"SignalFx",
"Snowflake",
"ID",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/client/signalflow/websocket_message_parser.js#L200-L203 | train |
signalfx/signalfx-nodejs | lib/client/signalflow/websocket_message_parser.js | extractBinaryFields | function extractBinaryFields(target, spec, data) {
var offset = 0;
for (var x = 0; x < spec.length; x++) {
var item = spec[x];
if (item.label) {
if (item.type === 'string') {
var bytes = new DataView(data.buffer, offset, item.size);
var str = textDecoder.decode(bytes);
target[... | javascript | function extractBinaryFields(target, spec, data) {
var offset = 0;
for (var x = 0; x < spec.length; x++) {
var item = spec[x];
if (item.label) {
if (item.type === 'string') {
var bytes = new DataView(data.buffer, offset, item.size);
var str = textDecoder.decode(bytes);
target[... | [
"function",
"extractBinaryFields",
"(",
"target",
",",
"spec",
",",
"data",
")",
"{",
"var",
"offset",
"=",
"0",
";",
"for",
"(",
"var",
"x",
"=",
"0",
";",
"x",
"<",
"spec",
".",
"length",
";",
"x",
"++",
")",
"{",
"var",
"item",
"=",
"spec",
... | Extract fields from the given DataView following a specific a binary format
specification into the given target object. | [
"Extract",
"fields",
"from",
"the",
"given",
"DataView",
"following",
"a",
"specific",
"a",
"binary",
"format",
"specification",
"into",
"the",
"given",
"target",
"object",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/client/signalflow/websocket_message_parser.js#L209-L227 | train |
signalfx/signalfx-nodejs | lib/client/signalflow/websocket_message_parser.js | parseBinaryMessage | function parseBinaryMessage(data, knownComputations) {
var msg = {};
var header = new DataView(data, 0, binaryHeaderLength);
var version = header.getUint8(0);
extractBinaryFields(msg, binaryHeaderFormats[version], header);
var type = binaryMessageTypes[msg.type];
if (type === undefined) {
console.warn... | javascript | function parseBinaryMessage(data, knownComputations) {
var msg = {};
var header = new DataView(data, 0, binaryHeaderLength);
var version = header.getUint8(0);
extractBinaryFields(msg, binaryHeaderFormats[version], header);
var type = binaryMessageTypes[msg.type];
if (type === undefined) {
console.warn... | [
"function",
"parseBinaryMessage",
"(",
"data",
",",
"knownComputations",
")",
"{",
"var",
"msg",
"=",
"{",
"}",
";",
"var",
"header",
"=",
"new",
"DataView",
"(",
"data",
",",
"0",
",",
"binaryHeaderLength",
")",
";",
"var",
"version",
"=",
"header",
"."... | Parse a binary WebSocket message.
Binary messages have a 20-byte header (binaryHeaderLength), followed by a
body. Depending on the flags set in the header, the body of the message may
be compressed, so it needs to be decompressed before being parsed.
Finally, depending on the message type and the 'json' flag, the bod... | [
"Parse",
"a",
"binary",
"WebSocket",
"message",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/client/signalflow/websocket_message_parser.js#L241-L286 | train |
signalfx/signalfx-nodejs | lib/client/signalflow/websocket_message_parser.js | parseBinaryDataMessage | function parseBinaryDataMessage(msg, data, bigNumberRequested) {
var offset = extractBinaryFields(msg, binaryDataMessageFormats[msg['version']], data);
msg.logicalTimestampMs = (msg.timestampMs1 * hiMult) + msg.timestampMs2;
delete msg.timestampMs1;
delete msg.timestampMs2;
if (typeof msg.maxDelayMs1 !== 'u... | javascript | function parseBinaryDataMessage(msg, data, bigNumberRequested) {
var offset = extractBinaryFields(msg, binaryDataMessageFormats[msg['version']], data);
msg.logicalTimestampMs = (msg.timestampMs1 * hiMult) + msg.timestampMs2;
delete msg.timestampMs1;
delete msg.timestampMs2;
if (typeof msg.maxDelayMs1 !== 'u... | [
"function",
"parseBinaryDataMessage",
"(",
"msg",
",",
"data",
",",
"bigNumberRequested",
")",
"{",
"var",
"offset",
"=",
"extractBinaryFields",
"(",
"msg",
",",
"binaryDataMessageFormats",
"[",
"msg",
"[",
"'version'",
"]",
"]",
",",
"data",
")",
";",
"msg",
... | Parse a binary data message body.
Parse the binary-encoded information and datapoints of a data batch message. | [
"Parse",
"a",
"binary",
"data",
"message",
"body",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/client/signalflow/websocket_message_parser.js#L293-L365 | train |
signalfx/signalfx-nodejs | lib/client/signalflow/websocket_message_parser.js | function (msg, knownComputations) {
if (msg.data && msg.data.byteLength) {
// The presence of byteLength indicates data is an ArrayBuffer from a WebSocket data frame.
return parseBinaryMessage(msg.data, knownComputations);
} else if (msg.type) {
// Otherwise it's JSON in a WebSocket text frame... | javascript | function (msg, knownComputations) {
if (msg.data && msg.data.byteLength) {
// The presence of byteLength indicates data is an ArrayBuffer from a WebSocket data frame.
return parseBinaryMessage(msg.data, knownComputations);
} else if (msg.type) {
// Otherwise it's JSON in a WebSocket text frame... | [
"function",
"(",
"msg",
",",
"knownComputations",
")",
"{",
"if",
"(",
"msg",
".",
"data",
"&&",
"msg",
".",
"data",
".",
"byteLength",
")",
"{",
"// The presence of byteLength indicates data is an ArrayBuffer from a WebSocket data frame.",
"return",
"parseBinaryMessage",... | Parse the given received WebSocket message into its canonical Javascript representation. | [
"Parse",
"the",
"given",
"received",
"WebSocket",
"message",
"into",
"its",
"canonical",
"Javascript",
"representation",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/client/signalflow/websocket_message_parser.js#L374-L385 | train | |
signalfx/signalfx-nodejs | lib/client/ingest/signal_fx_client.js | SignalFxClient | function SignalFxClient(apiToken, options) {
var _this = this;
this.apiToken = apiToken;
var params = options || {};
this.ingestEndpoint = params.ingestEndpoint || conf.DEFAULT_INGEST_ENDPOINT;
this.timeout = params.timeout || conf.DEFAULT_TIMEOUT;
this.batchSize = Math.max(1, (params.batchSize ? params.b... | javascript | function SignalFxClient(apiToken, options) {
var _this = this;
this.apiToken = apiToken;
var params = options || {};
this.ingestEndpoint = params.ingestEndpoint || conf.DEFAULT_INGEST_ENDPOINT;
this.timeout = params.timeout || conf.DEFAULT_TIMEOUT;
this.batchSize = Math.max(1, (params.batchSize ? params.b... | [
"function",
"SignalFxClient",
"(",
"apiToken",
",",
"options",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"this",
".",
"apiToken",
"=",
"apiToken",
";",
"var",
"params",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"ingestEndpoint",
"=",
"params",
... | SignalFx API client.
This class presents a programmatic interface to SignalFx's metadata and
ingest APIs. At the time being, only ingest is supported; more will come
later.
@constructor
@param apiToken
@param options - {
enableAmazonUniqueId: boolean, // "false by default"
dimensions:"object", // dimensions for each d... | [
"SignalFx",
"API",
"client",
".",
"This",
"class",
"presents",
"a",
"programmatic",
"interface",
"to",
"SignalFx",
"s",
"metadata",
"and",
"ingest",
"APIs",
".",
"At",
"the",
"time",
"being",
"only",
"ingest",
"is",
"supported",
";",
"more",
"will",
"come",
... | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/client/ingest/signal_fx_client.js#L32-L73 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | Datum | function Datum(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function Datum(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"Datum",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",
... | Properties of a Datum.
@memberof com.signalfx.metrics.protobuf
@interface IDatum
@property {string|null} [strValue] Datum strValue
@property {number|null} [doubleValue] Datum doubleValue
@property {number|Long|null} [intValue] Datum intValue
Constructs a new Datum.
@memberof com.signalfx.metrics.protobuf
@classdesc R... | [
"Properties",
"of",
"a",
"Datum",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L86-L91 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | Dimension | function Dimension(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function Dimension(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"Dimension",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if"... | Properties of a Dimension.
@memberof com.signalfx.metrics.protobuf
@interface IDimension
@property {string|null} [key] Dimension key
@property {string|null} [value] Dimension value
Constructs a new Dimension.
@memberof com.signalfx.metrics.protobuf
@classdesc Represents a Dimension.
@implements IDimension
@constructo... | [
"Properties",
"of",
"a",
"Dimension",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L331-L336 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | DataPoint | function DataPoint(properties) {
this.dimensions = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
th... | javascript | function DataPoint(properties) {
this.dimensions = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
th... | [
"function",
"DataPoint",
"(",
"properties",
")",
"{",
"this",
".",
"dimensions",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"... | Properties of a DataPoint.
@memberof com.signalfx.metrics.protobuf
@interface IDataPoint
@property {string|null} [source] DataPoint source
@property {string|null} [metric] DataPoint metric
@property {number|Long|null} [timestamp] DataPoint timestamp
@property {com.signalfx.metrics.protobuf.IDatum|null} [value] DataPoin... | [
"Properties",
"of",
"a",
"DataPoint",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L545-L551 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | DataPointUploadMessage | function DataPointUploadMessage(properties) {
this.datapoints = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | javascript | function DataPointUploadMessage(properties) {
this.datapoints = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | [
"function",
"DataPointUploadMessage",
"(",
"properties",
")",
"{",
"this",
".",
"datapoints",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i... | Properties of a DataPointUploadMessage.
@memberof com.signalfx.metrics.protobuf
@interface IDataPointUploadMessage
@property {Array.<com.signalfx.metrics.protobuf.IDataPoint>|null} [datapoints] DataPointUploadMessage datapoints
Constructs a new DataPointUploadMessage.
@memberof com.signalfx.metrics.protobuf
@classdes... | [
"Properties",
"of",
"a",
"DataPointUploadMessage",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L902-L908 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | PointValue | function PointValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function PointValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"PointValue",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if... | Properties of a PointValue.
@memberof com.signalfx.metrics.protobuf
@interface IPointValue
@property {number|Long|null} [timestamp] PointValue timestamp
@property {com.signalfx.metrics.protobuf.IDatum|null} [value] PointValue value
Constructs a new PointValue.
@memberof com.signalfx.metrics.protobuf
@classdesc Repres... | [
"Properties",
"of",
"a",
"PointValue",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L1111-L1116 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | Property | function Property(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function Property(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"Property",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",... | Properties of a Property.
@memberof com.signalfx.metrics.protobuf
@interface IProperty
@property {string|null} [key] Property key
@property {com.signalfx.metrics.protobuf.IPropertyValue|null} [value] Property value
Constructs a new Property.
@memberof com.signalfx.metrics.protobuf
@classdesc Represents a Property.
@i... | [
"Properties",
"of",
"a",
"Property",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L1364-L1369 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | PropertyValue | function PropertyValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function PropertyValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"PropertyValue",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a PropertyValue.
@memberof com.signalfx.metrics.protobuf
@interface IPropertyValue
@property {string|null} [strValue] PropertyValue strValue
@property {number|null} [doubleValue] PropertyValue doubleValue
@property {number|Long|null} [intValue] PropertyValue intValue
@property {boolean|null} [boolValue] P... | [
"Properties",
"of",
"a",
"PropertyValue",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L1581-L1586 | train |
signalfx/signalfx-nodejs | lib/proto/signal_fx_protocol_buffers_pb2.js | Event | function Event(properties) {
this.dimensions = [];
this.properties = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != nu... | javascript | function Event(properties) {
this.dimensions = [];
this.properties = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != nu... | [
"function",
"Event",
"(",
"properties",
")",
"{",
"this",
".",
"dimensions",
"=",
"[",
"]",
";",
"this",
".",
"properties",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
... | Properties of an Event.
@memberof com.signalfx.metrics.protobuf
@interface IEvent
@property {string} eventType Event eventType
@property {Array.<com.signalfx.metrics.protobuf.IDimension>|null} [dimensions] Event dimensions
@property {Array.<com.signalfx.metrics.protobuf.IProperty>|null} [properties] Event properties
@p... | [
"Properties",
"of",
"an",
"Event",
"."
] | 88f14af02c9af8de54e3ff273b5c9d3ab32030de | https://github.com/signalfx/signalfx-nodejs/blob/88f14af02c9af8de54e3ff273b5c9d3ab32030de/lib/proto/signal_fx_protocol_buffers_pb2.js#L1850-L1857 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.