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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
mz121star/NJBlog | libs/mocha/should.js | function(code){
this.obj.should.have.property('statusCode');
var status = this.obj.statusCode;
this.assert(
code == status
, function(){ return 'expected response code of ' + code + ' ' + i(statusCodes[code])
+ ', but got ' + status + ' ' + i(statu... | javascript | function(code){
this.obj.should.have.property('statusCode');
var status = this.obj.statusCode;
this.assert(
code == status
, function(){ return 'expected response code of ' + code + ' ' + i(statusCodes[code])
+ ', but got ' + status + ' ' + i(statu... | [
"function",
"(",
"code",
")",
"{",
"this",
".",
"obj",
".",
"should",
".",
"have",
".",
"property",
"(",
"'statusCode'",
")",
";",
"var",
"status",
"=",
"this",
".",
"obj",
".",
"statusCode",
";",
"this",
".",
"assert",
"(",
"code",
"==",
"status",
... | Assert `.statusCode` of `code`.
@param {Number} code
@return {Assertion} for chaining
@api public | [
"Assert",
".",
"statusCode",
"of",
"code",
"."
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/libs/mocha/should.js#L624-L635 | train | |
mz121star/NJBlog | public/lib/jquery/jquery-1.8.2.js | addToPrefiltersOrTransports | function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType, list, placeBefore,
dataTypes = ... | javascript | function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType, list, placeBefore,
dataTypes = ... | [
"function",
"addToPrefiltersOrTransports",
"(",
"structure",
")",
"{",
"// dataTypeExpression is optional and defaults to \"*\"",
"return",
"function",
"(",
"dataTypeExpression",
",",
"func",
")",
"{",
"if",
"(",
"typeof",
"dataTypeExpression",
"!==",
"\"string\"",
")",
"... | Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport | [
"Base",
"constructor",
"for",
"jQuery",
".",
"ajaxPrefilter",
"and",
"jQuery",
".",
"ajaxTransport"
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/lib/jquery/jquery-1.8.2.js#L7320-L7351 | train |
mz121star/NJBlog | public/lib/angular/angular-bootstrap-prettify.js | appendDecorations | function appendDecorations(basePos, sourceCode, langHandler, out) {
if (!sourceCode) { return; }
var job = {
sourceCode: sourceCode,
basePos: basePos
};
langHandler(job);
out.push.apply(out, job.decorations);
} | javascript | function appendDecorations(basePos, sourceCode, langHandler, out) {
if (!sourceCode) { return; }
var job = {
sourceCode: sourceCode,
basePos: basePos
};
langHandler(job);
out.push.apply(out, job.decorations);
} | [
"function",
"appendDecorations",
"(",
"basePos",
",",
"sourceCode",
",",
"langHandler",
",",
"out",
")",
"{",
"if",
"(",
"!",
"sourceCode",
")",
"{",
"return",
";",
"}",
"var",
"job",
"=",
"{",
"sourceCode",
":",
"sourceCode",
",",
"basePos",
":",
"baseP... | Apply the given language handler to sourceCode and add the resulting
decorations to out.
@param {number} basePos the index of sourceCode within the chunk of source
whose decorations are already present on out. | [
"Apply",
"the",
"given",
"language",
"handler",
"to",
"sourceCode",
"and",
"add",
"the",
"resulting",
"decorations",
"to",
"out",
"."
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/lib/angular/angular-bootstrap-prettify.js#L866-L874 | train |
mz121star/NJBlog | public/js/main-built.js | isWindow | function isWindow(obj) {
return obj && obj.document && obj.location && obj.alert && obj.setInterval;
} | javascript | function isWindow(obj) {
return obj && obj.document && obj.location && obj.alert && obj.setInterval;
} | [
"function",
"isWindow",
"(",
"obj",
")",
"{",
"return",
"obj",
"&&",
"obj",
".",
"document",
"&&",
"obj",
".",
"location",
"&&",
"obj",
".",
"alert",
"&&",
"obj",
".",
"setInterval",
";",
"}"
] | Checks if `obj` is a window object.
@private
@param {*} obj Object to check
@returns {boolean} True if `obj` is a window obj. | [
"Checks",
"if",
"obj",
"is",
"a",
"window",
"object",
"."
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L381-L383 | train |
mz121star/NJBlog | public/js/main-built.js | shallowCopy | function shallowCopy(src, dst) {
dst = dst || {};
for(var key in src) {
if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') {
dst[key] = src[key];
}
}
return dst;
} | javascript | function shallowCopy(src, dst) {
dst = dst || {};
for(var key in src) {
if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') {
dst[key] = src[key];
}
}
return dst;
} | [
"function",
"shallowCopy",
"(",
"src",
",",
"dst",
")",
"{",
"dst",
"=",
"dst",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"key",
"in",
"src",
")",
"{",
"if",
"(",
"src",
".",
"hasOwnProperty",
"(",
"key",
")",
"&&",
"key",
".",
"substr",
"(",
"0"... | Create a shallow copy of an object | [
"Create",
"a",
"shallow",
"copy",
"of",
"an",
"object"
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L574-L584 | train |
mz121star/NJBlog | public/js/main-built.js | function(key, value) {
var array = this[key = hashKey(key)];
if (!array) {
this[key] = [value];
} else {
array.push(value);
}
} | javascript | function(key, value) {
var array = this[key = hashKey(key)];
if (!array) {
this[key] = [value];
} else {
array.push(value);
}
} | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"var",
"array",
"=",
"this",
"[",
"key",
"=",
"hashKey",
"(",
"key",
")",
"]",
";",
"if",
"(",
"!",
"array",
")",
"{",
"this",
"[",
"key",
"]",
"=",
"[",
"value",
"]",
";",
"}",
"else",
"{",
"... | Same as array push, but using an array as the value for the hash | [
"Same",
"as",
"array",
"push",
"but",
"using",
"an",
"array",
"as",
"the",
"value",
"for",
"the",
"hash"
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L2192-L2199 | train | |
mz121star/NJBlog | public/js/main-built.js | function(key) {
var array = this[key = hashKey(key)];
if (array) {
if (array.length == 1) {
delete this[key];
return array[0];
} else {
return array.shift();
}
}
} | javascript | function(key) {
var array = this[key = hashKey(key)];
if (array) {
if (array.length == 1) {
delete this[key];
return array[0];
} else {
return array.shift();
}
}
} | [
"function",
"(",
"key",
")",
"{",
"var",
"array",
"=",
"this",
"[",
"key",
"=",
"hashKey",
"(",
"key",
")",
"]",
";",
"if",
"(",
"array",
")",
"{",
"if",
"(",
"array",
".",
"length",
"==",
"1",
")",
"{",
"delete",
"this",
"[",
"key",
"]",
";"... | Same as array shift, but using an array as the value for the hash | [
"Same",
"as",
"array",
"shift",
"but",
"using",
"an",
"array",
"as",
"the",
"value",
"for",
"the",
"hash"
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L2204-L2214 | train | |
mz121star/NJBlog | public/js/main-built.js | function(key, fn) {
var attrs = this,
$$observers = (attrs.$$observers || (attrs.$$observers = {})),
listeners = ($$observers[key] || ($$observers[key] = []));
listeners.push(fn);
$rootScope.$evalAsync(function() {
if (!listeners.$$inter) {
// no on... | javascript | function(key, fn) {
var attrs = this,
$$observers = (attrs.$$observers || (attrs.$$observers = {})),
listeners = ($$observers[key] || ($$observers[key] = []));
listeners.push(fn);
$rootScope.$evalAsync(function() {
if (!listeners.$$inter) {
// no on... | [
"function",
"(",
"key",
",",
"fn",
")",
"{",
"var",
"attrs",
"=",
"this",
",",
"$$observers",
"=",
"(",
"attrs",
".",
"$$observers",
"||",
"(",
"attrs",
".",
"$$observers",
"=",
"{",
"}",
")",
")",
",",
"listeners",
"=",
"(",
"$$observers",
"[",
"k... | Observe an interpolated attribute.
The observer will never be called, if given attribute is not interpolated.
@param {string} key Normalized key. (ie ngAttribute) .
@param {function(*)} fn Function that will be called whenever the attribute value changes.
@returns {function(*)} the `fn` Function passed in. | [
"Observe",
"an",
"interpolated",
"attribute",
".",
"The",
"observer",
"will",
"never",
"be",
"called",
"if",
"given",
"attribute",
"is",
"not",
"interpolated",
"."
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L3695-L3708 | train | |
mz121star/NJBlog | public/js/main-built.js | $SnifferProvider | function $SnifferProvider() {
this.$get = ['$window', function($window) {
var eventSupport = {},
android = int((/android (\d+)/.exec(lowercase($window.navigator.userAgent)) || [])[1]);
return {
// Android has history.pushState, but it does not update location correctly
// so let's not use... | javascript | function $SnifferProvider() {
this.$get = ['$window', function($window) {
var eventSupport = {},
android = int((/android (\d+)/.exec(lowercase($window.navigator.userAgent)) || [])[1]);
return {
// Android has history.pushState, but it does not update location correctly
// so let's not use... | [
"function",
"$SnifferProvider",
"(",
")",
"{",
"this",
".",
"$get",
"=",
"[",
"'$window'",
",",
"function",
"(",
"$window",
")",
"{",
"var",
"eventSupport",
"=",
"{",
"}",
",",
"android",
"=",
"int",
"(",
"(",
"/",
"android (\\d+)",
"/",
".",
"exec",
... | !!! This is an undocumented "private" service !!!
@name ng.$sniffer
@requires $window
@property {boolean} history Does the browser support html5 history api ?
@property {boolean} hashchange Does the browser support hashchange event ?
@description
This is very simple implementation of testing browser's features. | [
"!!!",
"This",
"is",
"an",
"undocumented",
"private",
"service",
"!!!"
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L8104-L8135 | train |
mz121star/NJBlog | public/js/main-built.js | headersGetter | function headersGetter(headers) {
var headersObj = isObject(headers) ? headers : undefined;
return function(name) {
if (!headersObj) headersObj = parseHeaders(headers);
if (name) {
return headersObj[lowercase(name)] || null;
}
return headersObj;
};
} | javascript | function headersGetter(headers) {
var headersObj = isObject(headers) ? headers : undefined;
return function(name) {
if (!headersObj) headersObj = parseHeaders(headers);
if (name) {
return headersObj[lowercase(name)] || null;
}
return headersObj;
};
} | [
"function",
"headersGetter",
"(",
"headers",
")",
"{",
"var",
"headersObj",
"=",
"isObject",
"(",
"headers",
")",
"?",
"headers",
":",
"undefined",
";",
"return",
"function",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"headersObj",
")",
"headersObj",
"=",
"p... | Returns a function that provides access to parsed headers.
Headers are lazy parsed when first requested.
@see parseHeaders
@param {(string|Object)} headers Headers to provide access to.
@returns {function(string=)} Returns a getter function which if called with:
- if called with single an argument returns a single h... | [
"Returns",
"a",
"function",
"that",
"provides",
"access",
"to",
"parsed",
"headers",
"."
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L8205-L8217 | train |
mz121star/NJBlog | public/js/main-built.js | toggleValidCss | function toggleValidCss(isValid, validationErrorKey) {
validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
$element.
removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey).
addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey)... | javascript | function toggleValidCss(isValid, validationErrorKey) {
validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
$element.
removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey).
addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey)... | [
"function",
"toggleValidCss",
"(",
"isValid",
",",
"validationErrorKey",
")",
"{",
"validationErrorKey",
"=",
"validationErrorKey",
"?",
"'-'",
"+",
"snake_case",
"(",
"validationErrorKey",
",",
"'-'",
")",
":",
"''",
";",
"$element",
".",
"removeClass",
"(",
"(... | convenience method for easy toggling of classes | [
"convenience",
"method",
"for",
"easy",
"toggling",
"of",
"classes"
] | 08be4473daa854e3e8942340998a6c282f3f8c44 | https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L11679-L11684 | train |
box/leche | lib/leche.js | isES5DataProperty | function isES5DataProperty(object, key) {
var result = false;
// make sure this works in older browsers without error
if (Object.getOwnPropertyDescriptor && object.hasOwnProperty(key)) {
var descriptor = Object.getOwnPropertyDescriptor(object, key);
result = ('value' in descriptor) && (typeof descriptor.value... | javascript | function isES5DataProperty(object, key) {
var result = false;
// make sure this works in older browsers without error
if (Object.getOwnPropertyDescriptor && object.hasOwnProperty(key)) {
var descriptor = Object.getOwnPropertyDescriptor(object, key);
result = ('value' in descriptor) && (typeof descriptor.value... | [
"function",
"isES5DataProperty",
"(",
"object",
",",
"key",
")",
"{",
"var",
"result",
"=",
"false",
";",
"// make sure this works in older browsers without error",
"if",
"(",
"Object",
".",
"getOwnPropertyDescriptor",
"&&",
"object",
".",
"hasOwnProperty",
"(",
"key"... | Determines if a given property is a data property in ES5. This is
important because we can overwrite data properties with getters in ES5,
but not in ES3.
@param {Object} object The object to check.
@param {string} key The property name to check.
@returns {boolean} True if it's an ES5 data property, false if not.
@priva... | [
"Determines",
"if",
"a",
"given",
"property",
"is",
"a",
"data",
"property",
"in",
"ES5",
".",
"This",
"is",
"important",
"because",
"we",
"can",
"overwrite",
"data",
"properties",
"with",
"getters",
"in",
"ES5",
"but",
"not",
"in",
"ES3",
"."
] | 25d633a6321a08ffea89b311f525c294aeddebfd | https://github.com/box/leche/blob/25d633a6321a08ffea89b311f525c294aeddebfd/lib/leche.js#L61-L73 | train |
box/leche | lib/leche.js | function(methods) {
var object = {};
for (var i = 0, len = methods.length; i < len; i++) {
// it's safe to use the same method for all since it doesn't do anything
object[methods[i]] = noop;
}
return object;
} | javascript | function(methods) {
var object = {};
for (var i = 0, len = methods.length; i < len; i++) {
// it's safe to use the same method for all since it doesn't do anything
object[methods[i]] = noop;
}
return object;
} | [
"function",
"(",
"methods",
")",
"{",
"var",
"object",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"methods",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"// it's safe to use the same method for all since i... | Creates a new object with the specified methods. All methods do nothing,
so the resulting object is suitable for use in a variety of situations.
@param {string[]} methods The method names to create methods for.
@returns {Object} A new object with the specified methods defined. | [
"Creates",
"a",
"new",
"object",
"with",
"the",
"specified",
"methods",
".",
"All",
"methods",
"do",
"nothing",
"so",
"the",
"resulting",
"object",
"is",
"suitable",
"for",
"use",
"in",
"a",
"variety",
"of",
"situations",
"."
] | 25d633a6321a08ffea89b311f525c294aeddebfd | https://github.com/box/leche/blob/25d633a6321a08ffea89b311f525c294aeddebfd/lib/leche.js#L195-L207 | train | |
tblobaum/mongoose-troop | helpers/index.js | nestedPath | function nestedPath (obj, path, val) {
if (typeof obj !== 'object') {
return obj
}
var keys = path.split('.')
if (keys.length > 1) {
path = keys.shift()
return nestedPath(obj[path], keys.join('.'), val)
}
if (val !== undefined) {
obj[path] = val
}
return obj[path]
} | javascript | function nestedPath (obj, path, val) {
if (typeof obj !== 'object') {
return obj
}
var keys = path.split('.')
if (keys.length > 1) {
path = keys.shift()
return nestedPath(obj[path], keys.join('.'), val)
}
if (val !== undefined) {
obj[path] = val
}
return obj[path]
} | [
"function",
"nestedPath",
"(",
"obj",
",",
"path",
",",
"val",
")",
"{",
"if",
"(",
"typeof",
"obj",
"!==",
"'object'",
")",
"{",
"return",
"obj",
"}",
"var",
"keys",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
"if",
"(",
"keys",
".",
"length",
"... | Create an object out of a nested path | [
"Create",
"an",
"object",
"out",
"of",
"a",
"nested",
"path"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/helpers/index.js#L23-L36 | train |
tblobaum/mongoose-troop | helpers/index.js | dataToObjects | function dataToObjects (data) {
if (!data) return null
if (data instanceof Array) {
return data.map(function(doc) {
return doc.toObject()
})
}
return data.toObject()
} | javascript | function dataToObjects (data) {
if (!data) return null
if (data instanceof Array) {
return data.map(function(doc) {
return doc.toObject()
})
}
return data.toObject()
} | [
"function",
"dataToObjects",
"(",
"data",
")",
"{",
"if",
"(",
"!",
"data",
")",
"return",
"null",
"if",
"(",
"data",
"instanceof",
"Array",
")",
"{",
"return",
"data",
".",
"map",
"(",
"function",
"(",
"doc",
")",
"{",
"return",
"doc",
".",
"toObjec... | Convert a document or an array of documents to objects | [
"Convert",
"a",
"document",
"or",
"an",
"array",
"of",
"documents",
"to",
"objects"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/helpers/index.js#L39-L47 | train |
tblobaum/mongoose-troop | helpers/index.js | dropDatabase | function dropDatabase (db, fn) {
db.connection.db.executeDbCommand({
dropDatabase: 1
}, function(err, result) {
db.disconnect()
fn && fn(err, result)
})
} | javascript | function dropDatabase (db, fn) {
db.connection.db.executeDbCommand({
dropDatabase: 1
}, function(err, result) {
db.disconnect()
fn && fn(err, result)
})
} | [
"function",
"dropDatabase",
"(",
"db",
",",
"fn",
")",
"{",
"db",
".",
"connection",
".",
"db",
".",
"executeDbCommand",
"(",
"{",
"dropDatabase",
":",
"1",
"}",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"db",
".",
"disconnect",
"(",
")",... | Destroy a database and disconnect | [
"Destroy",
"a",
"database",
"and",
"disconnect"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/helpers/index.js#L58-L65 | train |
tblobaum/mongoose-troop | helpers/index.js | dropCollections | function dropCollections (db, each, fn) {
if (each && !fn) { fn = each; each = null }
var conn = db.connection
, cols = Object.keys(conn.collections)
cols.forEach(function (name, k) {
console.log('name: ', name, k)
conn.collections[name].drop(function (err) {
if (err == 'ns not found') {
... | javascript | function dropCollections (db, each, fn) {
if (each && !fn) { fn = each; each = null }
var conn = db.connection
, cols = Object.keys(conn.collections)
cols.forEach(function (name, k) {
console.log('name: ', name, k)
conn.collections[name].drop(function (err) {
if (err == 'ns not found') {
... | [
"function",
"dropCollections",
"(",
"db",
",",
"each",
",",
"fn",
")",
"{",
"if",
"(",
"each",
"&&",
"!",
"fn",
")",
"{",
"fn",
"=",
"each",
";",
"each",
"=",
"null",
"}",
"var",
"conn",
"=",
"db",
".",
"connection",
",",
"cols",
"=",
"Object",
... | Drop all collections in a database | [
"Drop",
"all",
"collections",
"in",
"a",
"database"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/helpers/index.js#L68-L83 | train |
tblobaum/mongoose-troop | lib/keywords/porter_stemmer.js | step5a | function step5a(token) {
var m = measure(token);
if((m > 1 && token.substr(-1) == 'e') || (m == 1 && !(categorizeChars(token).substr(-4, 3) == 'CVC' && token.match(/[^wxy].$/))))
return token.replace(/e$/, '');
return token;
} | javascript | function step5a(token) {
var m = measure(token);
if((m > 1 && token.substr(-1) == 'e') || (m == 1 && !(categorizeChars(token).substr(-4, 3) == 'CVC' && token.match(/[^wxy].$/))))
return token.replace(/e$/, '');
return token;
} | [
"function",
"step5a",
"(",
"token",
")",
"{",
"var",
"m",
"=",
"measure",
"(",
"token",
")",
";",
"if",
"(",
"(",
"m",
">",
"1",
"&&",
"token",
".",
"substr",
"(",
"-",
"1",
")",
"==",
"'e'",
")",
"||",
"(",
"m",
"==",
"1",
"&&",
"!",
"(",
... | step 5a as defined for the porter stemmer algorithm. | [
"step",
"5a",
"as",
"defined",
"for",
"the",
"porter",
"stemmer",
"algorithm",
"."
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/lib/keywords/porter_stemmer.js#L171-L178 | train |
tblobaum/mongoose-troop | lib/keywords/porter_stemmer.js | step5b | function step5b(token) {
if(measure(token) > 1) {
if(endsWithDoublCons(token) && token.substr(-2) == 'll')
return token.replace(/ll$/, 'l');
}
return token;
} | javascript | function step5b(token) {
if(measure(token) > 1) {
if(endsWithDoublCons(token) && token.substr(-2) == 'll')
return token.replace(/ll$/, 'l');
}
return token;
} | [
"function",
"step5b",
"(",
"token",
")",
"{",
"if",
"(",
"measure",
"(",
"token",
")",
">",
"1",
")",
"{",
"if",
"(",
"endsWithDoublCons",
"(",
"token",
")",
"&&",
"token",
".",
"substr",
"(",
"-",
"2",
")",
"==",
"'ll'",
")",
"return",
"token",
... | step 5b as defined for the porter stemmer algorithm. | [
"step",
"5b",
"as",
"defined",
"for",
"the",
"porter",
"stemmer",
"algorithm",
"."
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/lib/keywords/porter_stemmer.js#L181-L188 | train |
GitbookIO/tokenize-text | lib/tokens.js | normalizeTokens | function normalizeTokens(relative, tokens) {
var _index = 0;
// Force as an array
if (!_.isArray(tokens)) tokens = [tokens];
return _.map(tokens, function(subtoken) {
if (_.isNull(subtoken)) return null;
if (_.isString(subtoken)) {
subtoken = {
value: subtok... | javascript | function normalizeTokens(relative, tokens) {
var _index = 0;
// Force as an array
if (!_.isArray(tokens)) tokens = [tokens];
return _.map(tokens, function(subtoken) {
if (_.isNull(subtoken)) return null;
if (_.isString(subtoken)) {
subtoken = {
value: subtok... | [
"function",
"normalizeTokens",
"(",
"relative",
",",
"tokens",
")",
"{",
"var",
"_index",
"=",
"0",
";",
"// Force as an array",
"if",
"(",
"!",
"_",
".",
"isArray",
"(",
"tokens",
")",
")",
"tokens",
"=",
"[",
"tokens",
"]",
";",
"return",
"_",
".",
... | Normalize and resolve a list of tokens relative to a token | [
"Normalize",
"and",
"resolve",
"a",
"list",
"of",
"tokens",
"relative",
"to",
"a",
"token"
] | 7dd8101a9f6ddde39b29c8ecc2132f9c42a74705 | https://github.com/GitbookIO/tokenize-text/blob/7dd8101a9f6ddde39b29c8ecc2132f9c42a74705/lib/tokens.js#L38-L65 | train |
tblobaum/mongoose-troop | lib/obfuscate.js | encrypt | function encrypt (str) {
var cipher = crypto.createCipher(algorithm, key)
, crypted = cipher.update(str, from, to) + cipher.final(to)
return crypted;
} | javascript | function encrypt (str) {
var cipher = crypto.createCipher(algorithm, key)
, crypted = cipher.update(str, from, to) + cipher.final(to)
return crypted;
} | [
"function",
"encrypt",
"(",
"str",
")",
"{",
"var",
"cipher",
"=",
"crypto",
".",
"createCipher",
"(",
"algorithm",
",",
"key",
")",
",",
"crypted",
"=",
"cipher",
".",
"update",
"(",
"str",
",",
"from",
",",
"to",
")",
"+",
"cipher",
".",
"final",
... | Encrypt a string with the options provided | [
"Encrypt",
"a",
"string",
"with",
"the",
"options",
"provided"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/lib/obfuscate.js#L28-L32 | train |
tblobaum/mongoose-troop | lib/obfuscate.js | decrypt | function decrypt (str) {
var decipher = crypto.createDecipher(algorithm, key)
, dec = decipher.update(str, to, from) + decipher.final(from)
return dec;
} | javascript | function decrypt (str) {
var decipher = crypto.createDecipher(algorithm, key)
, dec = decipher.update(str, to, from) + decipher.final(from)
return dec;
} | [
"function",
"decrypt",
"(",
"str",
")",
"{",
"var",
"decipher",
"=",
"crypto",
".",
"createDecipher",
"(",
"algorithm",
",",
"key",
")",
",",
"dec",
"=",
"decipher",
".",
"update",
"(",
"str",
",",
"to",
",",
"from",
")",
"+",
"decipher",
".",
"final... | Decrypt an encrypted string | [
"Decrypt",
"an",
"encrypted",
"string"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/lib/obfuscate.js#L35-L39 | train |
tblobaum/mongoose-troop | lib/obfuscate.js | encode | function encode (schema, doc, toEncrypt) {
if (!doc) return false
var method = (toEncrypt) ? encrypt : decrypt
, obj = (doc.toObject) ? doc.toObject() : doc
// Traverse through all schema paths
schema.eachPath(function (name, path) {
var val = nestedPath(doc, name)
// ObjectID paths
... | javascript | function encode (schema, doc, toEncrypt) {
if (!doc) return false
var method = (toEncrypt) ? encrypt : decrypt
, obj = (doc.toObject) ? doc.toObject() : doc
// Traverse through all schema paths
schema.eachPath(function (name, path) {
var val = nestedPath(doc, name)
// ObjectID paths
... | [
"function",
"encode",
"(",
"schema",
",",
"doc",
",",
"toEncrypt",
")",
"{",
"if",
"(",
"!",
"doc",
")",
"return",
"false",
"var",
"method",
"=",
"(",
"toEncrypt",
")",
"?",
"encrypt",
":",
"decrypt",
",",
"obj",
"=",
"(",
"doc",
".",
"toObject",
"... | Recursively encode all ObjectID's in schema | [
"Recursively",
"encode",
"all",
"ObjectID",
"s",
"in",
"schema"
] | 09747e90b7f6d45a734c806c18cf635642634235 | https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/lib/obfuscate.js#L42-L71 | train |
ritz078/react-filters | components/Slider/Rail.js | getDirectionPositionForRange | function getDirectionPositionForRange (value, min, max, orientation) {
return isVertical(orientation) ? (
// as upper value is used to calculate `top`;
Math.round(((max - value[1]) / max - min) * 100)
) : (
Math.round((value[0] / max - min) * 100)
);
} | javascript | function getDirectionPositionForRange (value, min, max, orientation) {
return isVertical(orientation) ? (
// as upper value is used to calculate `top`;
Math.round(((max - value[1]) / max - min) * 100)
) : (
Math.round((value[0] / max - min) * 100)
);
} | [
"function",
"getDirectionPositionForRange",
"(",
"value",
",",
"min",
",",
"max",
",",
"orientation",
")",
"{",
"return",
"isVertical",
"(",
"orientation",
")",
"?",
"(",
"// as upper value is used to calculate `top`;",
"Math",
".",
"round",
"(",
"(",
"(",
"max",
... | Returns rail's position value of `left` for horizontal slider and `top`
for vertical slider
@param value
@param min
@param max
@param orientation
@returns {number} Value in Percentage | [
"Returns",
"rail",
"s",
"position",
"value",
"of",
"left",
"for",
"horizontal",
"slider",
"and",
"top",
"for",
"vertical",
"slider"
] | 7dd8dafb18795285f1bf9bdd2d758172d4f732ca | https://github.com/ritz078/react-filters/blob/7dd8dafb18795285f1bf9bdd2d758172d4f732ca/components/Slider/Rail.js#L14-L21 | train |
ritz078/react-filters | components/Slider/Steps.js | isInActiveRange | function isInActiveRange (stepValue, value, isRangeType) {
if (isRangeType) {
return stepValue > value[0] && stepValue < value[1];
} else {
return stepValue < value;
}
} | javascript | function isInActiveRange (stepValue, value, isRangeType) {
if (isRangeType) {
return stepValue > value[0] && stepValue < value[1];
} else {
return stepValue < value;
}
} | [
"function",
"isInActiveRange",
"(",
"stepValue",
",",
"value",
",",
"isRangeType",
")",
"{",
"if",
"(",
"isRangeType",
")",
"{",
"return",
"stepValue",
">",
"value",
"[",
"0",
"]",
"&&",
"stepValue",
"<",
"value",
"[",
"1",
"]",
";",
"}",
"else",
"{",
... | Tells whether a particular step comes in between two controls or not
@param stepValue value of the position where this step is located
@param value Array of control values
@param isRangeType
@returns {boolean} | [
"Tells",
"whether",
"a",
"particular",
"step",
"comes",
"in",
"between",
"two",
"controls",
"or",
"not"
] | 7dd8dafb18795285f1bf9bdd2d758172d4f732ca | https://github.com/ritz078/react-filters/blob/7dd8dafb18795285f1bf9bdd2d758172d4f732ca/components/Slider/Steps.js#L13-L19 | train |
ritz078/react-filters | components/Slider/Steps.js | getSteps | function getSteps (props) {
const { step, min, max, value, isRangeType, orientation } = props;
const steps = [];
const totalSteps = ((max - min) / step) + 1;
for (let i = 0; i < totalSteps; i++) {
let position = getPositionInPercentage(i * step, min, max);
if (isVertical(orientation)) position = 100 -... | javascript | function getSteps (props) {
const { step, min, max, value, isRangeType, orientation } = props;
const steps = [];
const totalSteps = ((max - min) / step) + 1;
for (let i = 0; i < totalSteps; i++) {
let position = getPositionInPercentage(i * step, min, max);
if (isVertical(orientation)) position = 100 -... | [
"function",
"getSteps",
"(",
"props",
")",
"{",
"const",
"{",
"step",
",",
"min",
",",
"max",
",",
"value",
",",
"isRangeType",
",",
"orientation",
"}",
"=",
"props",
";",
"const",
"steps",
"=",
"[",
"]",
";",
"const",
"totalSteps",
"=",
"(",
"(",
... | Array of step elements placed side by side
@param props
@returns {Array} | [
"Array",
"of",
"step",
"elements",
"placed",
"side",
"by",
"side"
] | 7dd8dafb18795285f1bf9bdd2d758172d4f732ca | https://github.com/ritz078/react-filters/blob/7dd8dafb18795285f1bf9bdd2d758172d4f732ca/components/Slider/Steps.js#L38-L56 | train |
tdecaluwe/node-edifact | parser.js | function (validator) {
EventEmitter.apply(this);
this._validator = validator || Parser.defaultValidator;
this._configuration = new Configuration();
this._tokenizer = new Tokenizer(this._configuration);
this.state = Parser.states.empty;
this.buffer = '';
} | javascript | function (validator) {
EventEmitter.apply(this);
this._validator = validator || Parser.defaultValidator;
this._configuration = new Configuration();
this._tokenizer = new Tokenizer(this._configuration);
this.state = Parser.states.empty;
this.buffer = '';
} | [
"function",
"(",
"validator",
")",
"{",
"EventEmitter",
".",
"apply",
"(",
"this",
")",
";",
"this",
".",
"_validator",
"=",
"validator",
"||",
"Parser",
".",
"defaultValidator",
";",
"this",
".",
"_configuration",
"=",
"new",
"Configuration",
"(",
")",
";... | The `Parser` class encapsulates an online parsing algorithm, similar to a
SAX-parser. By itself it doesn't do anything useful, however several
callbacks can be provided for different parsing events.
@constructs Parser
@param {Validator} [validator] Accepts a validator class for handling
data validation. | [
"The",
"Parser",
"class",
"encapsulates",
"an",
"online",
"parsing",
"algorithm",
"similar",
"to",
"a",
"SAX",
"-",
"parser",
".",
"By",
"itself",
"it",
"doesn",
"t",
"do",
"anything",
"useful",
"however",
"several",
"callbacks",
"can",
"be",
"provided",
"fo... | 37bf0498ad276310455804410d40975998aaeb02 | https://github.com/tdecaluwe/node-edifact/blob/37bf0498ad276310455804410d40975998aaeb02/parser.js#L35-L42 | train | |
nullobject/bokeh | examples/worker.js | reverse | function reverse (data, callback) {
if (Math.random() > 0.9) {
callback('oh noes!')
} else {
callback(null, data.split('').reverse().join(''))
}
} | javascript | function reverse (data, callback) {
if (Math.random() > 0.9) {
callback('oh noes!')
} else {
callback(null, data.split('').reverse().join(''))
}
} | [
"function",
"reverse",
"(",
"data",
",",
"callback",
")",
"{",
"if",
"(",
"Math",
".",
"random",
"(",
")",
">",
"0.9",
")",
"{",
"callback",
"(",
"'oh noes!'",
")",
"}",
"else",
"{",
"callback",
"(",
"null",
",",
"data",
".",
"split",
"(",
"''",
... | This task reverses the given string, failing randomly. | [
"This",
"task",
"reverses",
"the",
"given",
"string",
"failing",
"randomly",
"."
] | 72e01054ff8301ac930b8a151380aaaef6ff02ce | https://github.com/nullobject/bokeh/blob/72e01054ff8301ac930b8a151380aaaef6ff02ce/examples/worker.js#L4-L10 | train |
pocketjoso/specificity-graph | lib/index.js | createDirectory | function createDirectory(options) {
return new Promise(function(resolve, reject) {
mkdirp( options.directory, function (err) {
if(err && err.code !== 'EEXIST') {
reject(err);
} else {
resolve(options);
}
});
});
} | javascript | function createDirectory(options) {
return new Promise(function(resolve, reject) {
mkdirp( options.directory, function (err) {
if(err && err.code !== 'EEXIST') {
reject(err);
} else {
resolve(options);
}
});
});
} | [
"function",
"createDirectory",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"mkdirp",
"(",
"options",
".",
"directory",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"&&",
"e... | Create directory to hold files.
@param {Object} options Options data
@param {String} options.directory Directory
@param {Object} options.json JSON data.
@return {void} | [
"Create",
"directory",
"to",
"hold",
"files",
"."
] | a00621606d4a48810128cfe20ff0b73b384887f0 | https://github.com/pocketjoso/specificity-graph/blob/a00621606d4a48810128cfe20ff0b73b384887f0/lib/index.js#L46-L56 | train |
pocketjoso/specificity-graph | lib/index.js | writeHTMLFile | function writeHTMLFile(options) {
return new Promise(function(resolve, reject) {
var templateFile = path.join(__dirname, '../template/cli.html');
// read our template file
fs.readFile(templateFile, 'utf8', function (err,data) {
if (err) {
reject(err);
}
// insert the generated ... | javascript | function writeHTMLFile(options) {
return new Promise(function(resolve, reject) {
var templateFile = path.join(__dirname, '../template/cli.html');
// read our template file
fs.readFile(templateFile, 'utf8', function (err,data) {
if (err) {
reject(err);
}
// insert the generated ... | [
"function",
"writeHTMLFile",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"templateFile",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'../template/cli.html'",
")",
";",
"// read ... | This method creates index.html with injected data.
@param {Object} options Options data
@param {String} options.directory Directory
@param {Object} options.json JSON data.
@return {void} | [
"This",
"method",
"creates",
"index",
".",
"html",
"with",
"injected",
"data",
"."
] | a00621606d4a48810128cfe20ff0b73b384887f0 | https://github.com/pocketjoso/specificity-graph/blob/a00621606d4a48810128cfe20ff0b73b384887f0/lib/index.js#L110-L130 | train |
eXigentCoder/swagger-spec-express | lib/swaggerise.js | describe | function describe(metaData) {
if (item.stack) {
describeRouterRoute(item, metaData);
return item;
}
describeRouterRoute(item._router, metaData);
return item;
} | javascript | function describe(metaData) {
if (item.stack) {
describeRouterRoute(item, metaData);
return item;
}
describeRouterRoute(item._router, metaData);
return item;
} | [
"function",
"describe",
"(",
"metaData",
")",
"{",
"if",
"(",
"item",
".",
"stack",
")",
"{",
"describeRouterRoute",
"(",
"item",
",",
"metaData",
")",
";",
"return",
"item",
";",
"}",
"describeRouterRoute",
"(",
"item",
".",
"_router",
",",
"metaData",
... | Allows you describe an app our router route.
@paramSchema metaData ./lib/schemas/meta-data.json
@param {object} metaData Metadata about a route. At least one of metaData.responses or metaData.common.responses must be specified.
@param {string[]} [metaData.tags] - A list of tags used by the specification with additional... | [
"Allows",
"you",
"describe",
"an",
"app",
"our",
"router",
"route",
"."
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/swaggerise.js#L62-L69 | train |
eXigentCoder/swagger-spec-express | lib/index.js | compile | function compile() {
ensureInitialised('compile');
if (state.app.name === 'router') {
state.app = { _router: state.app };
}
if (!state.app._router) {
throw new Error("app._router was null, either your app is not an express app, or you have called compile before adding at least one route"... | javascript | function compile() {
ensureInitialised('compile');
if (state.app.name === 'router') {
state.app = { _router: state.app };
}
if (!state.app._router) {
throw new Error("app._router was null, either your app is not an express app, or you have called compile before adding at least one route"... | [
"function",
"compile",
"(",
")",
"{",
"ensureInitialised",
"(",
"'compile'",
")",
";",
"if",
"(",
"state",
".",
"app",
".",
"name",
"===",
"'router'",
")",
"{",
"state",
".",
"app",
"=",
"{",
"_router",
":",
"state",
".",
"app",
"}",
";",
"}",
"if"... | Will gather together all your described app routes and compile them into a single document to be served up by your api when you call `json`.
Can only be called once `initialise` has been called. Should only call this once you have completely finished describing your routes.
@returns {void}
@throws {Error} Will throw an... | [
"Will",
"gather",
"together",
"all",
"your",
"described",
"app",
"routes",
"and",
"compile",
"them",
"into",
"a",
"single",
"document",
"to",
"be",
"served",
"up",
"by",
"your",
"api",
"when",
"you",
"call",
"json",
".",
"Can",
"only",
"be",
"called",
"o... | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/index.js#L52-L62 | train |
eXigentCoder/swagger-spec-express | lib/common.js | addTag | function addTag(tag, options) {
addToCommon({
schemaKey: schemaIds.tag,
object: tag,
targetObject: state.common.tags,
displayName: 'Tag'
}, options);
} | javascript | function addTag(tag, options) {
addToCommon({
schemaKey: schemaIds.tag,
object: tag,
targetObject: state.common.tags,
displayName: 'Tag'
}, options);
} | [
"function",
"addTag",
"(",
"tag",
",",
"options",
")",
"{",
"addToCommon",
"(",
"{",
"schemaKey",
":",
"schemaIds",
".",
"tag",
",",
"object",
":",
"tag",
",",
"targetObject",
":",
"state",
".",
"common",
".",
"tags",
",",
"displayName",
":",
"'Tag'",
... | Adds a common tag for later use.
@paramSchema tag ./lib/schemas/tag.json
@param {object} tag Allows adding meta data to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag used there.
@param {string} tag.name - Required. The name of the tag.
@param {string} [tag.descripti... | [
"Adds",
"a",
"common",
"tag",
"for",
"later",
"use",
"."
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L44-L51 | train |
eXigentCoder/swagger-spec-express | lib/common.js | addBodyParameter | function addBodyParameter(body, options) {
addToCommon({
schemaKey: schemaIds.parameter.body,
in: 'body',
object: body,
targetObject: state.common.parameters.body,
displayName: 'body parameter'
}, options);
} | javascript | function addBodyParameter(body, options) {
addToCommon({
schemaKey: schemaIds.parameter.body,
in: 'body',
object: body,
targetObject: state.common.parameters.body,
displayName: 'body parameter'
}, options);
} | [
"function",
"addBodyParameter",
"(",
"body",
",",
"options",
")",
"{",
"addToCommon",
"(",
"{",
"schemaKey",
":",
"schemaIds",
".",
"parameter",
".",
"body",
",",
"in",
":",
"'body'",
",",
"object",
":",
"body",
",",
"targetObject",
":",
"state",
".",
"c... | Adds a common body parameter for later use.
@paramSchema body ./lib/schemas/body-parameter.json
@param {object} body The payload that's appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is use... | [
"Adds",
"a",
"common",
"body",
"parameter",
"for",
"later",
"use",
"."
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L159-L167 | train |
eXigentCoder/swagger-spec-express | lib/common.js | addResponse | function addResponse(response, options) {
addToCommon({
schemaKey: schemaIds.response,
object: response,
targetObject: state.common.responses,
displayName: 'response'
}, options);
} | javascript | function addResponse(response, options) {
addToCommon({
schemaKey: schemaIds.response,
object: response,
targetObject: state.common.responses,
displayName: 'response'
}, options);
} | [
"function",
"addResponse",
"(",
"response",
",",
"options",
")",
"{",
"addToCommon",
"(",
"{",
"schemaKey",
":",
"schemaIds",
".",
"response",
",",
"object",
":",
"response",
",",
"targetObject",
":",
"state",
".",
"common",
".",
"responses",
",",
"displayNa... | Adds a common response for later use.
@paramSchema response ./lib/schemas/response.json
@param {object} response Describes a single response from an API Operation.
@param {string} response.description - **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-mark... | [
"Adds",
"a",
"common",
"response",
"for",
"later",
"use",
"."
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L401-L408 | train |
eXigentCoder/swagger-spec-express | lib/common.js | addModel | function addModel(model, inputOptions) {
var options = {
schemaKey: schemaIds.schema,
object: model,
targetObject: state.common.models,
displayName: 'Model',
deleteNameFromCommon: true
};
applyDefaults(options, inputOptions);
ensureObjectExists(options);
clone... | javascript | function addModel(model, inputOptions) {
var options = {
schemaKey: schemaIds.schema,
object: model,
targetObject: state.common.models,
displayName: 'Model',
deleteNameFromCommon: true
};
applyDefaults(options, inputOptions);
ensureObjectExists(options);
clone... | [
"function",
"addModel",
"(",
"model",
",",
"inputOptions",
")",
"{",
"var",
"options",
"=",
"{",
"schemaKey",
":",
"schemaIds",
".",
"schema",
",",
"object",
":",
"model",
",",
"targetObject",
":",
"state",
".",
"common",
".",
"models",
",",
"displayName",... | Adds a common model for later use.
@param {object} model The schema for the model object to add. Should be a valid [Schema](http://swagger.io/specification/#schemaObject) object.
@param {AddCommonItemOptions} [inputOptions] - Options to apply when adding the provided item.
@returns {void}
@example
var swagger = require... | [
"Adds",
"a",
"common",
"model",
"for",
"later",
"use",
"."
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L499-L527 | train |
eXigentCoder/swagger-spec-express | utility/metadata-schema-to-js-doc/inject-schema.js | generateCommentFromOptions | function generateCommentFromOptions(options, callback) {
console.info('\t\tGenerating comments for', options.paramName, '...');
async.waterfall([
async.apply(loadSchema, options),
derefSchema,
generateComment,
addGeneratedComment
], function (err) {
if (err) {
... | javascript | function generateCommentFromOptions(options, callback) {
console.info('\t\tGenerating comments for', options.paramName, '...');
async.waterfall([
async.apply(loadSchema, options),
derefSchema,
generateComment,
addGeneratedComment
], function (err) {
if (err) {
... | [
"function",
"generateCommentFromOptions",
"(",
"options",
",",
"callback",
")",
"{",
"console",
".",
"info",
"(",
"'\\t\\tGenerating comments for'",
",",
"options",
".",
"paramName",
",",
"'...'",
")",
";",
"async",
".",
"waterfall",
"(",
"[",
"async",
".",
"a... | Generates a comment based on input options
@param {object} options - Options to use to generate the comment.
@param {object} options.comment - The AST comment object.
@param {string} options.comment.type - The type of comment, string block etc.
@param {string} options.comment.value - The string comment value.
@param {s... | [
"Generates",
"a",
"comment",
"based",
"on",
"input",
"options"
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/utility/metadata-schema-to-js-doc/inject-schema.js#L117-L131 | train |
eXigentCoder/swagger-spec-express | lib/validator.js | getErrorMessage | function getErrorMessage(errors) {
var fullMessage = '';
errors.forEach(function (err) {
var message = ajv.errorsText([err]);
if (message.indexOf('should NOT have additional properties') < 0) {
fullMessage += message + os.EOL;
}
else {
fullMessage += messa... | javascript | function getErrorMessage(errors) {
var fullMessage = '';
errors.forEach(function (err) {
var message = ajv.errorsText([err]);
if (message.indexOf('should NOT have additional properties') < 0) {
fullMessage += message + os.EOL;
}
else {
fullMessage += messa... | [
"function",
"getErrorMessage",
"(",
"errors",
")",
"{",
"var",
"fullMessage",
"=",
"''",
";",
"errors",
".",
"forEach",
"(",
"function",
"(",
"err",
")",
"{",
"var",
"message",
"=",
"ajv",
".",
"errorsText",
"(",
"[",
"err",
"]",
")",
";",
"if",
"(",... | Gets a human readable error message from the ajv errors object, using the ajv.errorsText and some custom logic
@param {Object[]} errors the ajv.errors object
@returns {String} The human readable error message
@see Ajv.ajv.errorsText
@private | [
"Gets",
"a",
"human",
"readable",
"error",
"message",
"from",
"the",
"ajv",
"errors",
"object",
"using",
"the",
"ajv",
".",
"errorsText",
"and",
"some",
"custom",
"logic"
] | 03479da4bcd0e2655563b33ff486af7241664f56 | https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/validator.js#L104-L116 | train |
arccoza/postcss-aspect-ratio | index.js | objToRule | function objToRule(obj, clonedRule) {
var rule = clonedRule || postcss.rule();
var skipKeys = ['selector', 'selectors', 'source'];
if (obj.selector)
rule.selector = obj.selector;
else if (obj.selectors)
rule.selectors = obj.selectors;
if (obj.source)
rule.source = obj.source;
for (var k in ob... | javascript | function objToRule(obj, clonedRule) {
var rule = clonedRule || postcss.rule();
var skipKeys = ['selector', 'selectors', 'source'];
if (obj.selector)
rule.selector = obj.selector;
else if (obj.selectors)
rule.selectors = obj.selectors;
if (obj.source)
rule.source = obj.source;
for (var k in ob... | [
"function",
"objToRule",
"(",
"obj",
",",
"clonedRule",
")",
"{",
"var",
"rule",
"=",
"clonedRule",
"||",
"postcss",
".",
"rule",
"(",
")",
";",
"var",
"skipKeys",
"=",
"[",
"'selector'",
",",
"'selectors'",
",",
"'source'",
"]",
";",
"if",
"(",
"obj",... | Convert a js obj to a postcss rule, extending clonedRule if it is passed in. | [
"Convert",
"a",
"js",
"obj",
"to",
"a",
"postcss",
"rule",
"extending",
"clonedRule",
"if",
"it",
"is",
"passed",
"in",
"."
] | 65590294ee10d67449b94d48fa6243e2f1a8b8a0 | https://github.com/arccoza/postcss-aspect-ratio/blob/65590294ee10d67449b94d48fa6243e2f1a8b8a0/index.js#L96-L131 | train |
natefaubion/matches.js | matches.js | start | function start (inp) {
var res = parseArgumentList(inp.skipWs());
// If there is any leftover, we have input that did not match our grammar,
// so throw a generic syntax error.
if (inp.skipWs().buffer) syntaxError(inp);
return res;
} | javascript | function start (inp) {
var res = parseArgumentList(inp.skipWs());
// If there is any leftover, we have input that did not match our grammar,
// so throw a generic syntax error.
if (inp.skipWs().buffer) syntaxError(inp);
return res;
} | [
"function",
"start",
"(",
"inp",
")",
"{",
"var",
"res",
"=",
"parseArgumentList",
"(",
"inp",
".",
"skipWs",
"(",
")",
")",
";",
"// If there is any leftover, we have input that did not match our grammar,",
"// so throw a generic syntax error.",
"if",
"(",
"inp",
".",
... | The entry point of the parser. | [
"The",
"entry",
"point",
"of",
"the",
"parser",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L72-L79 | train |
natefaubion/matches.js | matches.js | parsePattern | function parsePattern (inp) {
return parseWildcard(inp)
|| parseNullLiteral(inp)
|| parseUndefinedLiteral(inp)
|| parseBooleanLiteral(inp)
|| parseNumberLiteral(inp)
|| parseStringLiteral(inp)
|| parseClassPattern(inp)
|| parseExtractor(inp)
|| parseAr... | javascript | function parsePattern (inp) {
return parseWildcard(inp)
|| parseNullLiteral(inp)
|| parseUndefinedLiteral(inp)
|| parseBooleanLiteral(inp)
|| parseNumberLiteral(inp)
|| parseStringLiteral(inp)
|| parseClassPattern(inp)
|| parseExtractor(inp)
|| parseAr... | [
"function",
"parsePattern",
"(",
"inp",
")",
"{",
"return",
"parseWildcard",
"(",
"inp",
")",
"||",
"parseNullLiteral",
"(",
"inp",
")",
"||",
"parseUndefinedLiteral",
"(",
"inp",
")",
"||",
"parseBooleanLiteral",
"(",
"inp",
")",
"||",
"parseNumberLiteral",
"... | Matches a single pattern expression. | [
"Matches",
"a",
"single",
"pattern",
"expression",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L106-L118 | train |
natefaubion/matches.js | matches.js | parseExtractor | function parseExtractor (inp) {
var match = inp.takeAPeek(EXTRACTOR);
if (match)
return wrapped("(", ")", parsePattern, extractorRes, inp)
|| nodeExtractor(match[1]);
function extractorRes (res) {
return nodeExtractor(match[1], res);
}
} | javascript | function parseExtractor (inp) {
var match = inp.takeAPeek(EXTRACTOR);
if (match)
return wrapped("(", ")", parsePattern, extractorRes, inp)
|| nodeExtractor(match[1]);
function extractorRes (res) {
return nodeExtractor(match[1], res);
}
} | [
"function",
"parseExtractor",
"(",
"inp",
")",
"{",
"var",
"match",
"=",
"inp",
".",
"takeAPeek",
"(",
"EXTRACTOR",
")",
";",
"if",
"(",
"match",
")",
"return",
"wrapped",
"(",
"\"(\"",
",",
"\")\"",
",",
"parsePattern",
",",
"extractorRes",
",",
"inp",
... | Parses custom extractors. Extractors are identifiers that begin with a dollar sign. | [
"Parses",
"custom",
"extractors",
".",
"Extractors",
"are",
"identifiers",
"that",
"begin",
"with",
"a",
"dollar",
"sign",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L188-L197 | train |
natefaubion/matches.js | matches.js | parseObjectPattern | function parseObjectPattern (inp) {
var res = parseKey(inp);
if (res) {
if (inp.skipWs().takeAPeek(":")) {
var patt = parsePattern(inp.skipWs());
if (patt) return nodeKeyValue(res, patt);
}
return nodeKey(res);
}
} | javascript | function parseObjectPattern (inp) {
var res = parseKey(inp);
if (res) {
if (inp.skipWs().takeAPeek(":")) {
var patt = parsePattern(inp.skipWs());
if (patt) return nodeKeyValue(res, patt);
}
return nodeKey(res);
}
} | [
"function",
"parseObjectPattern",
"(",
"inp",
")",
"{",
"var",
"res",
"=",
"parseKey",
"(",
"inp",
")",
";",
"if",
"(",
"res",
")",
"{",
"if",
"(",
"inp",
".",
"skipWs",
"(",
")",
".",
"takeAPeek",
"(",
"\":\"",
")",
")",
"{",
"var",
"patt",
"=",... | Objects can only contain keys or key-value pairs. | [
"Objects",
"can",
"only",
"contain",
"keys",
"or",
"key",
"-",
"value",
"pairs",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L215-L224 | train |
natefaubion/matches.js | matches.js | parseKey | function parseKey (inp) {
var res = parseString(inp);
if (res) return res;
var match = inp.takeAPeek(JS_IDENT);
if (match) return match[0]
} | javascript | function parseKey (inp) {
var res = parseString(inp);
if (res) return res;
var match = inp.takeAPeek(JS_IDENT);
if (match) return match[0]
} | [
"function",
"parseKey",
"(",
"inp",
")",
"{",
"var",
"res",
"=",
"parseString",
"(",
"inp",
")",
";",
"if",
"(",
"res",
")",
"return",
"res",
";",
"var",
"match",
"=",
"inp",
".",
"takeAPeek",
"(",
"JS_IDENT",
")",
";",
"if",
"(",
"match",
")",
"... | Keys can be strings or JS identifiers. | [
"Keys",
"can",
"be",
"strings",
"or",
"JS",
"identifiers",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L227-L233 | train |
natefaubion/matches.js | matches.js | parseIdentPattern | function parseIdentPattern (inp) {
var match = inp.takeAPeek(IDENT);
if (match) {
if (inp.takeAPeek("@")) {
var patt = parseBinderPattern(inp);
if (patt) return nodeBinder(match[0], patt);
}
return nodeIdentifier(match[0])
}
} | javascript | function parseIdentPattern (inp) {
var match = inp.takeAPeek(IDENT);
if (match) {
if (inp.takeAPeek("@")) {
var patt = parseBinderPattern(inp);
if (patt) return nodeBinder(match[0], patt);
}
return nodeIdentifier(match[0])
}
} | [
"function",
"parseIdentPattern",
"(",
"inp",
")",
"{",
"var",
"match",
"=",
"inp",
".",
"takeAPeek",
"(",
"IDENT",
")",
";",
"if",
"(",
"match",
")",
"{",
"if",
"(",
"inp",
".",
"takeAPeek",
"(",
"\"@\"",
")",
")",
"{",
"var",
"patt",
"=",
"parseBi... | Parses identifiers and binders, which are for when you want to destructure the value but also pass the original value to the function. Binders are an identifier, followed by an @ and another pattern. | [
"Parses",
"identifiers",
"and",
"binders",
"which",
"are",
"for",
"when",
"you",
"want",
"to",
"destructure",
"the",
"value",
"but",
"also",
"pass",
"the",
"original",
"value",
"to",
"the",
"function",
".",
"Binders",
"are",
"an",
"identifier",
"followed",
"... | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L238-L247 | train |
natefaubion/matches.js | matches.js | wrapped | function wrapped (del1, del2, pattFn, nodeFn, inp) {
if (inp.takeAPeek(del1)) {
var res = pattFn(inp.skipWs());
if (inp.skipWs().takeAPeek(del2)) return nodeFn(res);
else syntaxError(inp, "Expected " + del2);
}
} | javascript | function wrapped (del1, del2, pattFn, nodeFn, inp) {
if (inp.takeAPeek(del1)) {
var res = pattFn(inp.skipWs());
if (inp.skipWs().takeAPeek(del2)) return nodeFn(res);
else syntaxError(inp, "Expected " + del2);
}
} | [
"function",
"wrapped",
"(",
"del1",
",",
"del2",
",",
"pattFn",
",",
"nodeFn",
",",
"inp",
")",
"{",
"if",
"(",
"inp",
".",
"takeAPeek",
"(",
"del1",
")",
")",
"{",
"var",
"res",
"=",
"pattFn",
"(",
"inp",
".",
"skipWs",
"(",
")",
")",
";",
"if... | Parses a wrapped pattern, like an array or object. | [
"Parses",
"a",
"wrapped",
"pattern",
"like",
"an",
"array",
"or",
"object",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L259-L265 | train |
natefaubion/matches.js | matches.js | nodeClass | function nodeClass (name, res) {
var patt = name;
if (res) {
patt += res.type === "array"
? "(" + res.pattern.substring(1, res.pattern.length - 1) + ")"
: res.pattern;
}
return node("class", patt, name, res ? [res] : undefined);
} | javascript | function nodeClass (name, res) {
var patt = name;
if (res) {
patt += res.type === "array"
? "(" + res.pattern.substring(1, res.pattern.length - 1) + ")"
: res.pattern;
}
return node("class", patt, name, res ? [res] : undefined);
} | [
"function",
"nodeClass",
"(",
"name",
",",
"res",
")",
"{",
"var",
"patt",
"=",
"name",
";",
"if",
"(",
"res",
")",
"{",
"patt",
"+=",
"res",
".",
"type",
"===",
"\"array\"",
"?",
"\"(\"",
"+",
"res",
".",
"pattern",
".",
"substring",
"(",
"1",
"... | Array-like class destructuring results in a child array node, but the pattern is inacurately reflected as being surrounded by brackets. We check for that and correct it. | [
"Array",
"-",
"like",
"class",
"destructuring",
"results",
"in",
"a",
"child",
"array",
"node",
"but",
"the",
"pattern",
"is",
"inacurately",
"reflected",
"as",
"being",
"surrounded",
"by",
"brackets",
".",
"We",
"check",
"for",
"that",
"and",
"correct",
"it... | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L506-L514 | train |
natefaubion/matches.js | matches.js | compileRest | function compileRest (argName, node) {
var source = [];
var retInit = [];
// Count the number of identifiers we will need to stash.
var i = 0, len = countIdentifiers(node);
for (; i < len; i++) retInit.push('[]');
var retName = argName + '_ret';
var loopName = argName + '_loop... | javascript | function compileRest (argName, node) {
var source = [];
var retInit = [];
// Count the number of identifiers we will need to stash.
var i = 0, len = countIdentifiers(node);
for (; i < len; i++) retInit.push('[]');
var retName = argName + '_ret';
var loopName = argName + '_loop... | [
"function",
"compileRest",
"(",
"argName",
",",
"node",
")",
"{",
"var",
"source",
"=",
"[",
"]",
";",
"var",
"retInit",
"=",
"[",
"]",
";",
"// Count the number of identifiers we will need to stash.",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"countIdentifiers",... | The basic idea of rest expressions is that we create another matching function and call that function on all items in the array. We then aggregate all the stashed values and concat them with the `ret` array. We need to know ahead of time how many values are going to be stashed, so we call `countIdentifiers` to traverse... | [
"The",
"basic",
"idea",
"of",
"rest",
"expressions",
"is",
"that",
"we",
"create",
"another",
"matching",
"function",
"and",
"call",
"that",
"function",
"on",
"all",
"items",
"in",
"the",
"array",
".",
"We",
"then",
"aggregate",
"all",
"the",
"stashed",
"v... | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L797-L838 | train |
natefaubion/matches.js | matches.js | hasRest | function hasRest (node) {
for (var i = 0, child; (child = node.children[i]); i++) {
if (child.type === "rest") return true;
}
return false;
} | javascript | function hasRest (node) {
for (var i = 0, child; (child = node.children[i]); i++) {
if (child.type === "rest") return true;
}
return false;
} | [
"function",
"hasRest",
"(",
"node",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"child",
";",
"(",
"child",
"=",
"node",
".",
"children",
"[",
"i",
"]",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"child",
".",
"type",
"===",
"\"rest\"",
"... | Checks if a rest expression is present in the node's children. | [
"Checks",
"if",
"a",
"rest",
"expression",
"is",
"present",
"in",
"the",
"node",
"s",
"children",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L841-L846 | train |
natefaubion/matches.js | matches.js | countIdentifiers | function countIdentifiers (node) {
if (!node.children) return 0;
var count = 0, i = 0, len = node.children.length, type;
for (; i < len; i++) {
type = node.children[i].type;
if (type === "identifier" || type === "binder" || type === "key") count += 1;
else count += countIdentifiers(node.ch... | javascript | function countIdentifiers (node) {
if (!node.children) return 0;
var count = 0, i = 0, len = node.children.length, type;
for (; i < len; i++) {
type = node.children[i].type;
if (type === "identifier" || type === "binder" || type === "key") count += 1;
else count += countIdentifiers(node.ch... | [
"function",
"countIdentifiers",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"children",
")",
"return",
"0",
";",
"var",
"count",
"=",
"0",
",",
"i",
"=",
"0",
",",
"len",
"=",
"node",
".",
"children",
".",
"length",
",",
"type",
";",
"for... | Scans all children for a node and counts the number of identifier patterns. Identifier patterns include captures and object keys. | [
"Scans",
"all",
"children",
"for",
"a",
"node",
"and",
"counts",
"the",
"number",
"of",
"identifier",
"patterns",
".",
"Identifier",
"patterns",
"include",
"captures",
"and",
"object",
"keys",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L850-L859 | train |
natefaubion/matches.js | matches.js | getOrCompile | function getOrCompile (patternStr) {
var tree, fn;
if (!patterns.hasOwnProperty(patternStr)) {
tree = parse(patternStr);
if (!normalized.hasOwnProperty(tree.pattern)) {
fn = compile(tree);
fn.pattern = tree.pattern;
normalized[tree.pattern] = fn;
}
patterns[patter... | javascript | function getOrCompile (patternStr) {
var tree, fn;
if (!patterns.hasOwnProperty(patternStr)) {
tree = parse(patternStr);
if (!normalized.hasOwnProperty(tree.pattern)) {
fn = compile(tree);
fn.pattern = tree.pattern;
normalized[tree.pattern] = fn;
}
patterns[patter... | [
"function",
"getOrCompile",
"(",
"patternStr",
")",
"{",
"var",
"tree",
",",
"fn",
";",
"if",
"(",
"!",
"patterns",
".",
"hasOwnProperty",
"(",
"patternStr",
")",
")",
"{",
"tree",
"=",
"parse",
"(",
"patternStr",
")",
";",
"if",
"(",
"!",
"normalized"... | Retrieves a patternFn from the cache or compiles it if it's not there. | [
"Retrieves",
"a",
"patternFn",
"from",
"the",
"cache",
"or",
"compiles",
"it",
"if",
"it",
"s",
"not",
"there",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L969-L981 | train |
natefaubion/matches.js | matches.js | pattern | function pattern () {
var targ0 = typeof arguments[0];
var targ1 = typeof arguments[1];
var targ2 = typeof arguments[2];
// Shared vars
var matcherFn, patternObj, patternFn, patternStr, successFn, chain, tree, last;
// pattern(matcherFn, chain)
if (targ0 == "function" && (targ1 == "und... | javascript | function pattern () {
var targ0 = typeof arguments[0];
var targ1 = typeof arguments[1];
var targ2 = typeof arguments[2];
// Shared vars
var matcherFn, patternObj, patternFn, patternStr, successFn, chain, tree, last;
// pattern(matcherFn, chain)
if (targ0 == "function" && (targ1 == "und... | [
"function",
"pattern",
"(",
")",
"{",
"var",
"targ0",
"=",
"typeof",
"arguments",
"[",
"0",
"]",
";",
"var",
"targ1",
"=",
"typeof",
"arguments",
"[",
"1",
"]",
";",
"var",
"targ2",
"=",
"typeof",
"arguments",
"[",
"2",
"]",
";",
"// Shared vars",
"v... | Creates a pattern matching function given a string and a fn to execute. The `chain` argument is for internal use only. It's a reference to the chain that we are adding a pattern to. | [
"Creates",
"a",
"pattern",
"matching",
"function",
"given",
"a",
"string",
"and",
"a",
"fn",
"to",
"execute",
".",
"The",
"chain",
"argument",
"is",
"for",
"internal",
"use",
"only",
".",
"It",
"s",
"a",
"reference",
"to",
"the",
"chain",
"that",
"we",
... | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L986-L1039 | train |
natefaubion/matches.js | matches.js | matcher | function matcher (patternFn, successFn, chain) {
var matcherObj = new Matcher(patternFn, successFn);
// If a chain was provided, add the new matcher to the end of the chain.
if (chain) {
chain.last().next = matcherObj;
} else {
chain = matcherObj;
}
var fn = function () {
... | javascript | function matcher (patternFn, successFn, chain) {
var matcherObj = new Matcher(patternFn, successFn);
// If a chain was provided, add the new matcher to the end of the chain.
if (chain) {
chain.last().next = matcherObj;
} else {
chain = matcherObj;
}
var fn = function () {
... | [
"function",
"matcher",
"(",
"patternFn",
",",
"successFn",
",",
"chain",
")",
"{",
"var",
"matcherObj",
"=",
"new",
"Matcher",
"(",
"patternFn",
",",
"successFn",
")",
";",
"// If a chain was provided, add the new matcher to the end of the chain.",
"if",
"(",
"chain",... | Creates a function that tries a match and executes the given fn if successful. If not it tries subsequent patterns. | [
"Creates",
"a",
"function",
"that",
"tries",
"a",
"match",
"and",
"executes",
"the",
"given",
"fn",
"if",
"successful",
".",
"If",
"not",
"it",
"tries",
"subsequent",
"patterns",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L1043-L1071 | train |
natefaubion/matches.js | matches.js | caseOf | function caseOf (/* ...args, matcher */) {
var args = slice.call(arguments, 0, -1);
var matcher = arguments[arguments.length - 1];
var context = this === exports ? null : this;
if (typeof matcher === "function") {
if (!matcher.__matchChain) throw new Error("Not a matcher function");
retur... | javascript | function caseOf (/* ...args, matcher */) {
var args = slice.call(arguments, 0, -1);
var matcher = arguments[arguments.length - 1];
var context = this === exports ? null : this;
if (typeof matcher === "function") {
if (!matcher.__matchChain) throw new Error("Not a matcher function");
retur... | [
"function",
"caseOf",
"(",
"/* ...args, matcher */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
",",
"-",
"1",
")",
";",
"var",
"matcher",
"=",
"arguments",
"[",
"arguments",
".",
"length",
"-",
"1",
"]",
";",
"va... | Sugar for creating a new pattern and immediately invoking it with arguments. This just lets you put the arguments first instead of after the patterns. | [
"Sugar",
"for",
"creating",
"a",
"new",
"pattern",
"and",
"immediately",
"invoking",
"it",
"with",
"arguments",
".",
"This",
"just",
"lets",
"you",
"put",
"the",
"arguments",
"first",
"instead",
"of",
"after",
"the",
"patterns",
"."
] | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L1075-L1086 | train |
natefaubion/matches.js | matches.js | extract | function extract (/* pattern, ...args */) {
var args = slice.call(arguments, 1);
var context = this === exports ? null : this;
var patternFn = getOrCompile(arguments[0]);
return patternFn.call(context, args, runtime) || null;
} | javascript | function extract (/* pattern, ...args */) {
var args = slice.call(arguments, 1);
var context = this === exports ? null : this;
var patternFn = getOrCompile(arguments[0]);
return patternFn.call(context, args, runtime) || null;
} | [
"function",
"extract",
"(",
"/* pattern, ...args */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"var",
"context",
"=",
"this",
"===",
"exports",
"?",
"null",
":",
"this",
";",
"var",
"patternFn",
"=",
"ge... | Extract works similar to regular expression matching on strings. If the pattern fails to match, it returns null. If it is successful it will return an array of extracted values. | [
"Extract",
"works",
"similar",
"to",
"regular",
"expression",
"matching",
"on",
"strings",
".",
"If",
"the",
"pattern",
"fails",
"to",
"match",
"it",
"returns",
"null",
".",
"If",
"it",
"is",
"successful",
"it",
"will",
"return",
"an",
"array",
"of",
"extr... | 9114609c7009b4ad6db6c9bdf044380c022b921a | https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L1091-L1096 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | hash | function hash() {
var i = 0,
args = arguments,
length = args.length,
obj = {};
for (; i < length; i++) {
obj[args[i++]] = args[i];
}
return obj;
} | javascript | function hash() {
var i = 0,
args = arguments,
length = args.length,
obj = {};
for (; i < length; i++) {
obj[args[i++]] = args[i];
}
return obj;
} | [
"function",
"hash",
"(",
")",
"{",
"var",
"i",
"=",
"0",
",",
"args",
"=",
"arguments",
",",
"length",
"=",
"args",
".",
"length",
",",
"obj",
"=",
"{",
"}",
";",
"for",
"(",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"obj",
"[",
"a... | Take an array and turn into a hash with even number arguments as keys and odd numbers as
values. Allows creating constants for commonly used style properties, attributes etc.
Avoid it in performance critical situations like looping | [
"Take",
"an",
"array",
"and",
"turn",
"into",
"a",
"hash",
"with",
"even",
"number",
"arguments",
"as",
"keys",
"and",
"odd",
"numbers",
"as",
"values",
".",
"Allows",
"creating",
"constants",
"for",
"commonly",
"used",
"style",
"properties",
"attributes",
"... | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L188-L197 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | pad | function pad(number, length) {
// Create an array of the remaining length +1 and join it with 0's
return new Array((length || 2) + 1 - String(number).length).join(0) + number;
} | javascript | function pad(number, length) {
// Create an array of the remaining length +1 and join it with 0's
return new Array((length || 2) + 1 - String(number).length).join(0) + number;
} | [
"function",
"pad",
"(",
"number",
",",
"length",
")",
"{",
"// Create an array of the remaining length +1 and join it with 0's",
"return",
"new",
"Array",
"(",
"(",
"length",
"||",
"2",
")",
"+",
"1",
"-",
"String",
"(",
"number",
")",
".",
"length",
")",
".",... | Pad a string to a given length by adding 0 to the beginning
@param {Number} number
@param {Number} length | [
"Pad",
"a",
"string",
"to",
"a",
"given",
"length",
"by",
"adding",
"0",
"to",
"the",
"beginning"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L409-L412 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | wrap | function wrap(obj, method, func) {
var proceed = obj[method];
obj[method] = function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(proceed);
return func.apply(this, args);
};
} | javascript | function wrap(obj, method, func) {
var proceed = obj[method];
obj[method] = function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(proceed);
return func.apply(this, args);
};
} | [
"function",
"wrap",
"(",
"obj",
",",
"method",
",",
"func",
")",
"{",
"var",
"proceed",
"=",
"obj",
"[",
"method",
"]",
";",
"obj",
"[",
"method",
"]",
"=",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
"... | Wrap a method with extended functionality, preserving the original function
@param {Object} obj The context object that the method belongs to
@param {String} method The name of the method to extend
@param {Function} func A wrapper function callback. This function is called with the same arguments
as the original functi... | [
"Wrap",
"a",
"method",
"with",
"extended",
"functionality",
"preserving",
"the",
"original",
"function"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L422-L429 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | format | function format(str, ctx) {
var splitter = '{',
isInside = false,
segment,
valueAndFormat,
path,
i,
len,
ret = [],
val,
index;
while ((index = str.indexOf(splitter)) !== -1) {
segment = str.slice(0, index);
if (isInside) { // we're on the closing bracket looking back
valueAndFormat =... | javascript | function format(str, ctx) {
var splitter = '{',
isInside = false,
segment,
valueAndFormat,
path,
i,
len,
ret = [],
val,
index;
while ((index = str.indexOf(splitter)) !== -1) {
segment = str.slice(0, index);
if (isInside) { // we're on the closing bracket looking back
valueAndFormat =... | [
"function",
"format",
"(",
"str",
",",
"ctx",
")",
"{",
"var",
"splitter",
"=",
"'{'",
",",
"isInside",
"=",
"false",
",",
"segment",
",",
"valueAndFormat",
",",
"path",
",",
"i",
",",
"len",
",",
"ret",
"=",
"[",
"]",
",",
"val",
",",
"index",
"... | Format a string according to a subset of the rules of Python's String.format method. | [
"Format",
"a",
"string",
"according",
"to",
"a",
"subset",
"of",
"the",
"rules",
"of",
"Python",
"s",
"String",
".",
"format",
"method",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L525-L570 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | getMagnitude | function getMagnitude(num) {
return math.pow(10, mathFloor(math.log(num) / math.LN10));
} | javascript | function getMagnitude(num) {
return math.pow(10, mathFloor(math.log(num) / math.LN10));
} | [
"function",
"getMagnitude",
"(",
"num",
")",
"{",
"return",
"math",
".",
"pow",
"(",
"10",
",",
"mathFloor",
"(",
"math",
".",
"log",
"(",
"num",
")",
"/",
"math",
".",
"LN10",
")",
")",
";",
"}"
] | Get the magnitude of a number | [
"Get",
"the",
"magnitude",
"of",
"a",
"number"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L575-L577 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | destroyObjectProperties | function destroyObjectProperties(obj, except) {
var n;
for (n in obj) {
// If the object is non-null and destroy is defined
if (obj[n] && obj[n] !== except && obj[n].destroy) {
// Invoke the destroy
obj[n].destroy();
}
// Delete the property from the object.
delete obj[n];
}
} | javascript | function destroyObjectProperties(obj, except) {
var n;
for (n in obj) {
// If the object is non-null and destroy is defined
if (obj[n] && obj[n] !== except && obj[n].destroy) {
// Invoke the destroy
obj[n].destroy();
}
// Delete the property from the object.
delete obj[n];
}
} | [
"function",
"destroyObjectProperties",
"(",
"obj",
",",
"except",
")",
"{",
"var",
"n",
";",
"for",
"(",
"n",
"in",
"obj",
")",
"{",
"// If the object is non-null and destroy is defined",
"if",
"(",
"obj",
"[",
"n",
"]",
"&&",
"obj",
"[",
"n",
"]",
"!==",
... | Utility method that destroys any SVGElement or VMLElement that are properties on the given object.
It loops all properties and invokes destroy if there is a destroy method. The property is
then delete'ed.
@param {Object} The object to destroy properties on
@param {Object} Exception, do not destroy this property, only d... | [
"Utility",
"method",
"that",
"destroys",
"any",
"SVGElement",
"or",
"VMLElement",
"that",
"are",
"properties",
"on",
"the",
"given",
"object",
".",
"It",
"loops",
"all",
"properties",
"and",
"invokes",
"destroy",
"if",
"there",
"is",
"a",
"destroy",
"method",
... | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L914-L926 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | discardElement | function discardElement(element) {
// create a garbage bin element, not part of the DOM
if (!garbageBin) {
garbageBin = createElement(DIV);
}
// move the node and empty bin
if (element) {
garbageBin.appendChild(element);
}
garbageBin.innerHTML = '';
} | javascript | function discardElement(element) {
// create a garbage bin element, not part of the DOM
if (!garbageBin) {
garbageBin = createElement(DIV);
}
// move the node and empty bin
if (element) {
garbageBin.appendChild(element);
}
garbageBin.innerHTML = '';
} | [
"function",
"discardElement",
"(",
"element",
")",
"{",
"// create a garbage bin element, not part of the DOM",
"if",
"(",
"!",
"garbageBin",
")",
"{",
"garbageBin",
"=",
"createElement",
"(",
"DIV",
")",
";",
"}",
"// move the node and empty bin",
"if",
"(",
"element... | Discard an element by moving it to the bin and delete
@param {Object} The HTML node to discard | [
"Discard",
"an",
"element",
"by",
"moving",
"it",
"to",
"the",
"bin",
"and",
"delete"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L933-L944 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | error | function error(code, stop) {
var msg = 'Highcharts error #' + code + ': www.highcharts.com/errors/' + code;
if (stop) {
throw msg;
} else if (win.console) {
console.log(msg);
}
} | javascript | function error(code, stop) {
var msg = 'Highcharts error #' + code + ': www.highcharts.com/errors/' + code;
if (stop) {
throw msg;
} else if (win.console) {
console.log(msg);
}
} | [
"function",
"error",
"(",
"code",
",",
"stop",
")",
"{",
"var",
"msg",
"=",
"'Highcharts error #'",
"+",
"code",
"+",
"': www.highcharts.com/errors/'",
"+",
"code",
";",
"if",
"(",
"stop",
")",
"{",
"throw",
"msg",
";",
"}",
"else",
"if",
"(",
"win",
"... | Provide error messages for debugging, with links to online explanation | [
"Provide",
"error",
"messages",
"for",
"debugging",
"with",
"links",
"to",
"online",
"explanation"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L949-L956 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (elem, fromD, toD) {
fromD = fromD || '';
var shift = elem.shift,
bezier = fromD.indexOf('C') > -1,
numParams = bezier ? 7 : 3,
endLength,
slice,
i,
start = fromD.split(' '),
end = [].concat(toD), // copy
startBaseLine,
endBaseLine,
sixify = function (arr) { // in splines make... | javascript | function (elem, fromD, toD) {
fromD = fromD || '';
var shift = elem.shift,
bezier = fromD.indexOf('C') > -1,
numParams = bezier ? 7 : 3,
endLength,
slice,
i,
start = fromD.split(' '),
end = [].concat(toD), // copy
startBaseLine,
endBaseLine,
sixify = function (arr) { // in splines make... | [
"function",
"(",
"elem",
",",
"fromD",
",",
"toD",
")",
"{",
"fromD",
"=",
"fromD",
"||",
"''",
";",
"var",
"shift",
"=",
"elem",
".",
"shift",
",",
"bezier",
"=",
"fromD",
".",
"indexOf",
"(",
"'C'",
")",
">",
"-",
"1",
",",
"numParams",
"=",
... | Prepare start and end values so that the path can be animated one to one | [
"Prepare",
"start",
"and",
"end",
"values",
"so",
"that",
"the",
"path",
"can",
"be",
"animated",
"one",
"to",
"one"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L1000-L1060 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (el, eventType, handler) {
// workaround for jQuery issue with unbinding custom events:
// http://forum.jQuery.com/topic/javascript-error-when-unbinding-a-custom-event-using-jQuery-1-4-2
var func = doc.removeEventListener ? 'removeEventListener' : 'detachEvent';
if (doc[func] && el && !el[func]) {
... | javascript | function (el, eventType, handler) {
// workaround for jQuery issue with unbinding custom events:
// http://forum.jQuery.com/topic/javascript-error-when-unbinding-a-custom-event-using-jQuery-1-4-2
var func = doc.removeEventListener ? 'removeEventListener' : 'detachEvent';
if (doc[func] && el && !el[func]) {
... | [
"function",
"(",
"el",
",",
"eventType",
",",
"handler",
")",
"{",
"// workaround for jQuery issue with unbinding custom events:",
"// http://forum.jQuery.com/topic/javascript-error-when-unbinding-a-custom-event-using-jQuery-1-4-2",
"var",
"func",
"=",
"doc",
".",
"removeEventListene... | Remove event added with addEvent
@param {Object} el The object
@param {String} eventType The event type. Leave blank to remove all events.
@param {Function} handler The function to remove | [
"Remove",
"event",
"added",
"with",
"addEvent"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L1318-L1327 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (el, type, eventArguments, defaultFunction) {
var event = $.Event(type),
detachedType = 'detached' + type,
defaultPrevented;
// Remove warnings in Chrome when accessing layerX and layerY. Although Highcharts
// never uses these properties, Chrome includes them in the default click event and
... | javascript | function (el, type, eventArguments, defaultFunction) {
var event = $.Event(type),
detachedType = 'detached' + type,
defaultPrevented;
// Remove warnings in Chrome when accessing layerX and layerY. Although Highcharts
// never uses these properties, Chrome includes them in the default click event and
... | [
"function",
"(",
"el",
",",
"type",
",",
"eventArguments",
",",
"defaultFunction",
")",
"{",
"var",
"event",
"=",
"$",
".",
"Event",
"(",
"type",
")",
",",
"detachedType",
"=",
"'detached'",
"+",
"type",
",",
"defaultPrevented",
";",
"// Remove warnings in C... | Fire an event on a custom object
@param {Object} el
@param {String} type
@param {Object} eventArguments
@param {Function} defaultFunction | [
"Fire",
"an",
"event",
"on",
"a",
"custom",
"object"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L1336-L1392 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (e) {
var ret = e.originalEvent || e;
// computed by jQuery, needed by IE8
if (ret.pageX === UNDEFINED) { // #1236
ret.pageX = e.pageX;
ret.pageY = e.pageY;
}
return ret;
} | javascript | function (e) {
var ret = e.originalEvent || e;
// computed by jQuery, needed by IE8
if (ret.pageX === UNDEFINED) { // #1236
ret.pageX = e.pageX;
ret.pageY = e.pageY;
}
return ret;
} | [
"function",
"(",
"e",
")",
"{",
"var",
"ret",
"=",
"e",
".",
"originalEvent",
"||",
"e",
";",
"// computed by jQuery, needed by IE8",
"if",
"(",
"ret",
".",
"pageX",
"===",
"UNDEFINED",
")",
"{",
"// #1236",
"ret",
".",
"pageX",
"=",
"e",
".",
"pageX",
... | Extension method needed for MooTools | [
"Extension",
"method",
"needed",
"for",
"MooTools"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L1397-L1407 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (renderer, nodeName) {
var wrapper = this;
wrapper.element = nodeName === 'span' ?
createElement(nodeName) :
doc.createElementNS(SVG_NS, nodeName);
wrapper.renderer = renderer;
/**
* A collection of attribute setters. These methods, if defined, are called right before a certain
* attribute ... | javascript | function (renderer, nodeName) {
var wrapper = this;
wrapper.element = nodeName === 'span' ?
createElement(nodeName) :
doc.createElementNS(SVG_NS, nodeName);
wrapper.renderer = renderer;
/**
* A collection of attribute setters. These methods, if defined, are called right before a certain
* attribute ... | [
"function",
"(",
"renderer",
",",
"nodeName",
")",
"{",
"var",
"wrapper",
"=",
"this",
";",
"wrapper",
".",
"element",
"=",
"nodeName",
"===",
"'span'",
"?",
"createElement",
"(",
"nodeName",
")",
":",
"doc",
".",
"createElementNS",
"(",
"SVG_NS",
",",
"... | Initialize the SVG renderer
@param {Object} renderer
@param {String} nodeName | [
"Initialize",
"the",
"SVG",
"renderer"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L2008-L2021 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (params, options, complete) {
var animOptions = pick(options, globalAnimation, true);
stop(this); // stop regardless of animation actually running, or reverting to .attr (#607)
if (animOptions) {
animOptions = merge(animOptions);
if (complete) { // allows using a callback with the global animation ... | javascript | function (params, options, complete) {
var animOptions = pick(options, globalAnimation, true);
stop(this); // stop regardless of animation actually running, or reverting to .attr (#607)
if (animOptions) {
animOptions = merge(animOptions);
if (complete) { // allows using a callback with the global animation ... | [
"function",
"(",
"params",
",",
"options",
",",
"complete",
")",
"{",
"var",
"animOptions",
"=",
"pick",
"(",
"options",
",",
"globalAnimation",
",",
"true",
")",
";",
"stop",
"(",
"this",
")",
";",
"// stop regardless of animation actually running, or reverting t... | Animate a given attribute
@param {Object} params
@param {Number} options The same options as in jQuery animation
@param {Function} complete Function to perform at the end of animation | [
"Animate",
"a",
"given",
"attribute"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L2032-L2047 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (className) {
var element = this.element,
currentClassName = attr(element, 'class') || '';
if (currentClassName.indexOf(className) === -1) {
attr(element, 'class', currentClassName + ' ' + className);
}
return this;
} | javascript | function (className) {
var element = this.element,
currentClassName = attr(element, 'class') || '';
if (currentClassName.indexOf(className) === -1) {
attr(element, 'class', currentClassName + ' ' + className);
}
return this;
} | [
"function",
"(",
"className",
")",
"{",
"var",
"element",
"=",
"this",
".",
"element",
",",
"currentClassName",
"=",
"attr",
"(",
"element",
",",
"'class'",
")",
"||",
"''",
";",
"if",
"(",
"currentClassName",
".",
"indexOf",
"(",
"className",
")",
"==="... | Add a class name to an element | [
"Add",
"a",
"class",
"name",
"to",
"an",
"element"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L2289-L2297 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (styles) {
/*jslint unparam: true*//* allow unused param a in the regexp function below */
var elemWrapper = this,
elem = elemWrapper.element,
textWidth = styles && styles.width && elem.nodeName.toLowerCase() === 'text',
n,
serializedCss = '',
hyphenate = function (a, b) { return '-' + b.toL... | javascript | function (styles) {
/*jslint unparam: true*//* allow unused param a in the regexp function below */
var elemWrapper = this,
elem = elemWrapper.element,
textWidth = styles && styles.width && elem.nodeName.toLowerCase() === 'text',
n,
serializedCss = '',
hyphenate = function (a, b) { return '-' + b.toL... | [
"function",
"(",
"styles",
")",
"{",
"/*jslint unparam: true*/",
"/* allow unused param a in the regexp function below */",
"var",
"elemWrapper",
"=",
"this",
",",
"elem",
"=",
"elemWrapper",
".",
"element",
",",
"textWidth",
"=",
"styles",
"&&",
"styles",
".",
"width... | Set styles for the element
@param {Object} styles | [
"Set",
"styles",
"for",
"the",
"element"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L2380-L2430 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (styles) {
var wrapper = this,
element = wrapper.element,
textWidth = styles && element.tagName === 'SPAN' && styles.width;
if (textWidth) {
delete styles.width;
wrapper.textWidth = textWidth;
wrapper.updateTransform();
}
wrapper.styles = extend(wrapper.styles, styles);
css(wrapper.e... | javascript | function (styles) {
var wrapper = this,
element = wrapper.element,
textWidth = styles && element.tagName === 'SPAN' && styles.width;
if (textWidth) {
delete styles.width;
wrapper.textWidth = textWidth;
wrapper.updateTransform();
}
wrapper.styles = extend(wrapper.styles, styles);
css(wrapper.e... | [
"function",
"(",
"styles",
")",
"{",
"var",
"wrapper",
"=",
"this",
",",
"element",
"=",
"wrapper",
".",
"element",
",",
"textWidth",
"=",
"styles",
"&&",
"element",
".",
"tagName",
"===",
"'SPAN'",
"&&",
"styles",
".",
"width",
";",
"if",
"(",
"textWi... | Apply CSS to HTML elements. This is used in text within SVG rendering and
by the VML renderer | [
"Apply",
"CSS",
"to",
"HTML",
"elements",
".",
"This",
"is",
"used",
"in",
"text",
"within",
"SVG",
"rendering",
"and",
"by",
"the",
"VML",
"renderer"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L2496-L2511 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (path) {
var attr = {
fill: NONE
};
if (isArray(path)) {
attr.d = path;
} else if (isObject(path)) { // attributes
extend(attr, path);
}
return this.createElement('path').attr(attr);
} | javascript | function (path) {
var attr = {
fill: NONE
};
if (isArray(path)) {
attr.d = path;
} else if (isObject(path)) { // attributes
extend(attr, path);
}
return this.createElement('path').attr(attr);
} | [
"function",
"(",
"path",
")",
"{",
"var",
"attr",
"=",
"{",
"fill",
":",
"NONE",
"}",
";",
"if",
"(",
"isArray",
"(",
"path",
")",
")",
"{",
"attr",
".",
"d",
"=",
"path",
";",
"}",
"else",
"if",
"(",
"isObject",
"(",
"path",
")",
")",
"{",
... | Draw a path
@param {Array} path An SVG path in array form | [
"Draw",
"a",
"path"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L3537-L3547 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (src, x, y, width, height) {
var attribs = {
preserveAspectRatio: NONE
},
elemWrapper;
// optional properties
if (arguments.length > 1) {
extend(attribs, {
x: x,
y: y,
width: width,
height: height
});
}
elemWrapper = this.createElement('image').attr(attribs);
// s... | javascript | function (src, x, y, width, height) {
var attribs = {
preserveAspectRatio: NONE
},
elemWrapper;
// optional properties
if (arguments.length > 1) {
extend(attribs, {
x: x,
y: y,
width: width,
height: height
});
}
elemWrapper = this.createElement('image').attr(attribs);
// s... | [
"function",
"(",
"src",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
"{",
"var",
"attribs",
"=",
"{",
"preserveAspectRatio",
":",
"NONE",
"}",
",",
"elemWrapper",
";",
"// optional properties",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
... | Display an image
@param {String} src
@param {Number} x
@param {Number} y
@param {Number} width
@param {Number} height | [
"Display",
"an",
"image"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L3668-L3697 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | updateTextPadding | function updateTextPadding() {
var styles = wrapper.styles,
textAlign = styles && styles.textAlign,
x = paddingLeft + padding * (1 - alignFactor),
y;
// determin y based on the baseline
y = baseline ? 0 : baselineOffset;
// compensate for alignment
if (defined(width) && (textAlign === 'cent... | javascript | function updateTextPadding() {
var styles = wrapper.styles,
textAlign = styles && styles.textAlign,
x = paddingLeft + padding * (1 - alignFactor),
y;
// determin y based on the baseline
y = baseline ? 0 : baselineOffset;
// compensate for alignment
if (defined(width) && (textAlign === 'cent... | [
"function",
"updateTextPadding",
"(",
")",
"{",
"var",
"styles",
"=",
"wrapper",
".",
"styles",
",",
"textAlign",
"=",
"styles",
"&&",
"styles",
".",
"textAlign",
",",
"x",
"=",
"paddingLeft",
"+",
"padding",
"*",
"(",
"1",
"-",
"alignFactor",
")",
",",
... | This function runs after setting text or padding, but only if padding is changed | [
"This",
"function",
"runs",
"after",
"setting",
"text",
"or",
"padding",
"but",
"only",
"if",
"padding",
"is",
"changed"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L4312-L4337 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | boxAttr | function boxAttr(key, value) {
if (box) {
box.attr(key, value);
} else {
deferredAttr[key] = value;
}
} | javascript | function boxAttr(key, value) {
if (box) {
box.attr(key, value);
} else {
deferredAttr[key] = value;
}
} | [
"function",
"boxAttr",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"box",
")",
"{",
"box",
".",
"attr",
"(",
"key",
",",
"value",
")",
";",
"}",
"else",
"{",
"deferredAttr",
"[",
"key",
"]",
"=",
"value",
";",
"}",
"}"
] | Set a box attribute, or defer it if the box is not yet created
@param {Object} key
@param {Object} value | [
"Set",
"a",
"box",
"attribute",
"or",
"defer",
"it",
"if",
"the",
"box",
"is",
"not",
"yet",
"created"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L4344-L4350 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (styles) {
if (styles) {
var textStyles = {};
styles = merge(styles); // create a copy to avoid altering the original object (#537)
each(['fontSize', 'fontWeight', 'fontFamily', 'color', 'lineHeight', 'width', 'textDecoration', 'textShadow'], function (prop) {
if (styles[prop] !== UNDE... | javascript | function (styles) {
if (styles) {
var textStyles = {};
styles = merge(styles); // create a copy to avoid altering the original object (#537)
each(['fontSize', 'fontWeight', 'fontFamily', 'color', 'lineHeight', 'width', 'textDecoration', 'textShadow'], function (prop) {
if (styles[prop] !== UNDE... | [
"function",
"(",
"styles",
")",
"{",
"if",
"(",
"styles",
")",
"{",
"var",
"textStyles",
"=",
"{",
"}",
";",
"styles",
"=",
"merge",
"(",
"styles",
")",
";",
"// create a copy to avoid altering the original object (#537)",
"each",
"(",
"[",
"'fontSize'",
",",
... | Pick up some properties and apply them to the text instead of the wrapper | [
"Pick",
"up",
"some",
"properties",
"and",
"apply",
"them",
"to",
"the",
"text",
"instead",
"of",
"the",
"wrapper"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L4463-L4476 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
return {
width: bBox.width + 2 * padding,
height: bBox.height + 2 * padding,
x: bBox.x - padding,
y: bBox.y - padding
};
} | javascript | function () {
return {
width: bBox.width + 2 * padding,
height: bBox.height + 2 * padding,
x: bBox.x - padding,
y: bBox.y - padding
};
} | [
"function",
"(",
")",
"{",
"return",
"{",
"width",
":",
"bBox",
".",
"width",
"+",
"2",
"*",
"padding",
",",
"height",
":",
"bBox",
".",
"height",
"+",
"2",
"*",
"padding",
",",
"x",
":",
"bBox",
".",
"x",
"-",
"padding",
",",
"y",
":",
"bBox",... | Return the bounding box of the box, not the group | [
"Return",
"the",
"bounding",
"box",
"of",
"the",
"box",
"not",
"the",
"group"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L4480-L4487 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (value) {
// convert paths
var i = value.length,
path = [],
clockwise;
while (i--) {
// Multiply by 10 to allow subpixel precision.
// Substracting half a pixel seems to make the coordinates
// align with SVG, but this hasn't been tested thoroughly
if (isNumber(value[i])) {
path[i... | javascript | function (value) {
// convert paths
var i = value.length,
path = [],
clockwise;
while (i--) {
// Multiply by 10 to allow subpixel precision.
// Substracting half a pixel seems to make the coordinates
// align with SVG, but this hasn't been tested thoroughly
if (isNumber(value[i])) {
path[i... | [
"function",
"(",
"value",
")",
"{",
"// convert paths",
"var",
"i",
"=",
"value",
".",
"length",
",",
"path",
"=",
"[",
"]",
",",
"clockwise",
";",
"while",
"(",
"i",
"--",
")",
"{",
"// Multiply by 10 to allow subpixel precision.",
"// Substracting half a pixel... | Converts a subset of an SVG path definition to its VML counterpart. Takes an array
as the parameter and returns a string. | [
"Converts",
"a",
"subset",
"of",
"an",
"SVG",
"path",
"definition",
"to",
"its",
"VML",
"counterpart",
".",
"Takes",
"an",
"array",
"as",
"the",
"parameter",
"and",
"returns",
"a",
"string",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L4642-L4686 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (path, length) {
var len;
path = path.split(/[ ,]/);
len = path.length;
if (len === 9 || len === 11) {
path[len - 4] = path[len - 2] = pInt(path[len - 2]) - 10 * length;
}
return path.join(' ');
} | javascript | function (path, length) {
var len;
path = path.split(/[ ,]/);
len = path.length;
if (len === 9 || len === 11) {
path[len - 4] = path[len - 2] = pInt(path[len - 2]) - 10 * length;
}
return path.join(' ');
} | [
"function",
"(",
"path",
",",
"length",
")",
"{",
"var",
"len",
";",
"path",
"=",
"path",
".",
"split",
"(",
"/",
"[ ,]",
"/",
")",
";",
"len",
"=",
"path",
".",
"length",
";",
"if",
"(",
"len",
"===",
"9",
"||",
"len",
"===",
"11",
")",
"{",... | In stacked columns, cut off the shadows so that they don't overlap | [
"In",
"stacked",
"columns",
"cut",
"off",
"the",
"shadows",
"so",
"that",
"they",
"don",
"t",
"overlap"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L4990-L5001 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (path) {
var attr = {
// subpixel precision down to 0.1 (width and height = 1px)
coordsize: '10 10'
};
if (isArray(path)) {
attr.d = path;
} else if (isObject(path)) { // attributes
extend(attr, path);
}
// create the shape
return this.createElement('shape').attr(attr);
} | javascript | function (path) {
var attr = {
// subpixel precision down to 0.1 (width and height = 1px)
coordsize: '10 10'
};
if (isArray(path)) {
attr.d = path;
} else if (isObject(path)) { // attributes
extend(attr, path);
}
// create the shape
return this.createElement('shape').attr(attr);
} | [
"function",
"(",
"path",
")",
"{",
"var",
"attr",
"=",
"{",
"// subpixel precision down to 0.1 (width and height = 1px)",
"coordsize",
":",
"'10 10'",
"}",
";",
"if",
"(",
"isArray",
"(",
"path",
")",
")",
"{",
"attr",
".",
"d",
"=",
"path",
";",
"}",
"els... | Create and return a path element
@param {Array} path | [
"Create",
"and",
"return",
"a",
"path",
"element"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L5409-L5421 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | drawDeferred | function drawDeferred() {
var callLength = deferredRenderCalls.length,
callIndex;
// Draw all pending render calls
for (callIndex = 0; callIndex < callLength; callIndex++) {
deferredRenderCalls[callIndex]();
}
// Clear the list
deferredRenderCalls = [];
} | javascript | function drawDeferred() {
var callLength = deferredRenderCalls.length,
callIndex;
// Draw all pending render calls
for (callIndex = 0; callIndex < callLength; callIndex++) {
deferredRenderCalls[callIndex]();
}
// Clear the list
deferredRenderCalls = [];
} | [
"function",
"drawDeferred",
"(",
")",
"{",
"var",
"callLength",
"=",
"deferredRenderCalls",
".",
"length",
",",
"callIndex",
";",
"// Draw all pending render calls",
"for",
"(",
"callIndex",
"=",
"0",
";",
"callIndex",
"<",
"callLength",
";",
"callIndex",
"++",
... | When downloaded, we are ready to draw deferred charts. | [
"When",
"downloaded",
"we",
"are",
"ready",
"to",
"draw",
"deferred",
"charts",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L5727-L5737 | train |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var label = this.label,
axis = this.axis;
return label ?
((this.labelBBox = label.getBBox()))[axis.horiz ? 'height' : 'width'] :
0;
} | javascript | function () {
var label = this.label,
axis = this.axis;
return label ?
((this.labelBBox = label.getBBox()))[axis.horiz ? 'height' : 'width'] :
0;
} | [
"function",
"(",
")",
"{",
"var",
"label",
"=",
"this",
".",
"label",
",",
"axis",
"=",
"this",
".",
"axis",
";",
"return",
"label",
"?",
"(",
"(",
"this",
".",
"labelBBox",
"=",
"label",
".",
"getBBox",
"(",
")",
")",
")",
"[",
"axis",
".",
"h... | Get the offset height or width of the label | [
"Get",
"the",
"offset",
"height",
"or",
"width",
"of",
"the",
"label"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L5868-L5874 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (horiz, pos, tickmarkOffset, old) {
var axis = this.axis,
chart = axis.chart,
cHeight = (old && chart.oldChartHeight) || chart.chartHeight;
return {
x: horiz ?
axis.translate(pos + tickmarkOffset, null, null, old) + axis.transB :
axis.left + axis.offset + (axis.opposite ? ((old && chart... | javascript | function (horiz, pos, tickmarkOffset, old) {
var axis = this.axis,
chart = axis.chart,
cHeight = (old && chart.oldChartHeight) || chart.chartHeight;
return {
x: horiz ?
axis.translate(pos + tickmarkOffset, null, null, old) + axis.transB :
axis.left + axis.offset + (axis.opposite ? ((old && chart... | [
"function",
"(",
"horiz",
",",
"pos",
",",
"tickmarkOffset",
",",
"old",
")",
"{",
"var",
"axis",
"=",
"this",
".",
"axis",
",",
"chart",
"=",
"axis",
".",
"chart",
",",
"cHeight",
"=",
"(",
"old",
"&&",
"chart",
".",
"oldChartHeight",
")",
"||",
"... | Get the x and y position for ticks and labels | [
"Get",
"the",
"x",
"and",
"y",
"position",
"for",
"ticks",
"and",
"labels"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L5952-L5967 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (x, y, tickLength, tickWidth, horiz, renderer) {
return renderer.crispLine([
M,
x,
y,
L,
x + (horiz ? 0 : -tickLength),
y + (horiz ? tickLength : 0)
], tickWidth);
} | javascript | function (x, y, tickLength, tickWidth, horiz, renderer) {
return renderer.crispLine([
M,
x,
y,
L,
x + (horiz ? 0 : -tickLength),
y + (horiz ? tickLength : 0)
], tickWidth);
} | [
"function",
"(",
"x",
",",
"y",
",",
"tickLength",
",",
"tickWidth",
",",
"horiz",
",",
"renderer",
")",
"{",
"return",
"renderer",
".",
"crispLine",
"(",
"[",
"M",
",",
"x",
",",
"y",
",",
"L",
",",
"x",
"+",
"(",
"horiz",
"?",
"0",
":",
"-",
... | Extendible method to return the path of the marker | [
"Extendible",
"method",
"to",
"return",
"the",
"path",
"of",
"the",
"marker"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L6009-L6018 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (newOptions, redraw) {
var chart = this.chart;
newOptions = chart.options[this.xOrY + 'Axis'][this.options.index] = merge(this.userOptions, newOptions);
this.destroy(true);
this._addedPlotLB = this.userMin = this.userMax = UNDEFINED; // #1611, #2306
this.init(chart, extend(newOptions, { events: UN... | javascript | function (newOptions, redraw) {
var chart = this.chart;
newOptions = chart.options[this.xOrY + 'Axis'][this.options.index] = merge(this.userOptions, newOptions);
this.destroy(true);
this._addedPlotLB = this.userMin = this.userMax = UNDEFINED; // #1611, #2306
this.init(chart, extend(newOptions, { events: UN... | [
"function",
"(",
"newOptions",
",",
"redraw",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
";",
"newOptions",
"=",
"chart",
".",
"options",
"[",
"this",
".",
"xOrY",
"+",
"'Axis'",
"]",
"[",
"this",
".",
"options",
".",
"index",
"]",
"=",
"... | Update the axis with a new options structure | [
"Update",
"the",
"axis",
"with",
"a",
"new",
"options",
"structure"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L6811-L6825 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (redraw) {
var chart = this.chart,
key = this.xOrY + 'Axis'; // xAxis or yAxis
// Remove associated series
each(this.series, function (series) {
series.remove(false);
});
// Remove the axis
erase(chart.axes, this);
erase(chart[key], this);
chart.options[key].splice(this.options.index, 1... | javascript | function (redraw) {
var chart = this.chart,
key = this.xOrY + 'Axis'; // xAxis or yAxis
// Remove associated series
each(this.series, function (series) {
series.remove(false);
});
// Remove the axis
erase(chart.axes, this);
erase(chart[key], this);
chart.options[key].splice(this.options.index, 1... | [
"function",
"(",
"redraw",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
",",
"key",
"=",
"this",
".",
"xOrY",
"+",
"'Axis'",
";",
"// xAxis or yAxis",
"// Remove associated series",
"each",
"(",
"this",
".",
"series",
",",
"function",
"(",
"series"... | Remove the axis from the chart | [
"Remove",
"the",
"axis",
"from",
"the",
"chart"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L6830-L6852 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (value, paneCoordinates) {
return this.translate(value, false, !this.horiz, null, true) + (paneCoordinates ? 0 : this.pos);
} | javascript | function (value, paneCoordinates) {
return this.translate(value, false, !this.horiz, null, true) + (paneCoordinates ? 0 : this.pos);
} | [
"function",
"(",
"value",
",",
"paneCoordinates",
")",
"{",
"return",
"this",
".",
"translate",
"(",
"value",
",",
"false",
",",
"!",
"this",
".",
"horiz",
",",
"null",
",",
"true",
")",
"+",
"(",
"paneCoordinates",
"?",
"0",
":",
"this",
".",
"pos",... | Utility method to translate an axis value to pixel position.
@param {Number} value A value in terms of axis units
@param {Boolean} paneCoordinates Whether to return the pixel coordinate relative to the chart
or just the axis/pane itself. | [
"Utility",
"method",
"to",
"translate",
"an",
"axis",
"value",
"to",
"pixel",
"position",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7041-L7043 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (from, to) {
var toPath = this.getPlotLinePath(to),
path = this.getPlotLinePath(from);
if (path && toPath) {
path.push(
toPath[4],
toPath[5],
toPath[1],
toPath[2]
);
} else { // outside the axis area
path = null;
}
return path;
} | javascript | function (from, to) {
var toPath = this.getPlotLinePath(to),
path = this.getPlotLinePath(from);
if (path && toPath) {
path.push(
toPath[4],
toPath[5],
toPath[1],
toPath[2]
);
} else { // outside the axis area
path = null;
}
return path;
} | [
"function",
"(",
"from",
",",
"to",
")",
"{",
"var",
"toPath",
"=",
"this",
".",
"getPlotLinePath",
"(",
"to",
")",
",",
"path",
"=",
"this",
".",
"getPlotLinePath",
"(",
"from",
")",
";",
"if",
"(",
"path",
"&&",
"toPath",
")",
"{",
"path",
".",
... | Create the path for a plot band | [
"Create",
"the",
"path",
"for",
"a",
"plot",
"band"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7105-L7122 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (interval, min, max, minor) {
var axis = this,
options = axis.options,
axisLength = axis.len,
// Since we use this method for both major and minor ticks,
// use a local variable and return the result
positions = [];
// Reset
if (!minor) {
axis._minorAutoInterval = null;
}
// ... | javascript | function (interval, min, max, minor) {
var axis = this,
options = axis.options,
axisLength = axis.len,
// Since we use this method for both major and minor ticks,
// use a local variable and return the result
positions = [];
// Reset
if (!minor) {
axis._minorAutoInterval = null;
}
// ... | [
"function",
"(",
"interval",
",",
"min",
",",
"max",
",",
"minor",
")",
"{",
"var",
"axis",
"=",
"this",
",",
"options",
"=",
"axis",
".",
"options",
",",
"axisLength",
"=",
"axis",
".",
"len",
",",
"// Since we use this method for both major and minor ticks,"... | Set the tick positions of a logarithmic axis | [
"Set",
"the",
"tick",
"positions",
"of",
"a",
"logarithmic",
"axis"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7159-L7252 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var axis = this,
options = axis.options,
tickPositions = axis.tickPositions,
minorTickInterval = axis.minorTickInterval,
minorTickPositions = [],
pos,
i,
len;
if (axis.isLog) {
len = tickPositions.length;
for (i = 1; i < len; i++) {
minorTickPositions = minorTickPosit... | javascript | function () {
var axis = this,
options = axis.options,
tickPositions = axis.tickPositions,
minorTickInterval = axis.minorTickInterval,
minorTickPositions = [],
pos,
i,
len;
if (axis.isLog) {
len = tickPositions.length;
for (i = 1; i < len; i++) {
minorTickPositions = minorTickPosit... | [
"function",
"(",
")",
"{",
"var",
"axis",
"=",
"this",
",",
"options",
"=",
"axis",
".",
"options",
",",
"tickPositions",
"=",
"axis",
".",
"tickPositions",
",",
"minorTickInterval",
"=",
"axis",
".",
"minorTickInterval",
",",
"minorTickPositions",
"=",
"[",... | Return the minor tick positions. For logarithmic axes, reuse the same logic
as for major ticks. | [
"Return",
"the",
"minor",
"tick",
"positions",
".",
"For",
"logarithmic",
"axes",
"reuse",
"the",
"same",
"logic",
"as",
"for",
"major",
"ticks",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7258-L7293 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var axis = this,
options = axis.options,
min = axis.min,
max = axis.max,
zoomOffset,
spaceAvailable = axis.dataMax - axis.dataMin >= axis.minRange,
closestDataRange,
i,
distance,
xData,
loopLength,
minArgs,
maxArgs;
// Set the automatic minimum range based on the c... | javascript | function () {
var axis = this,
options = axis.options,
min = axis.min,
max = axis.max,
zoomOffset,
spaceAvailable = axis.dataMax - axis.dataMin >= axis.minRange,
closestDataRange,
i,
distance,
xData,
loopLength,
minArgs,
maxArgs;
// Set the automatic minimum range based on the c... | [
"function",
"(",
")",
"{",
"var",
"axis",
"=",
"this",
",",
"options",
"=",
"axis",
".",
"options",
",",
"min",
"=",
"axis",
".",
"min",
",",
"max",
"=",
"axis",
".",
"max",
",",
"zoomOffset",
",",
"spaceAvailable",
"=",
"axis",
".",
"dataMax",
"-"... | Adjust the min and max for the minimum range. Keep in mind that the series data is
not yet processed, so we don't have information on data cropping and grouping, or
updated axis.pointRange or series.pointRange. The data can't be processed until
we have finally established min and max. | [
"Adjust",
"the",
"min",
"and",
"max",
"for",
"the",
"minimum",
"range",
".",
"Keep",
"in",
"mind",
"that",
"the",
"series",
"data",
"is",
"not",
"yet",
"processed",
"so",
"we",
"don",
"t",
"have",
"information",
"on",
"data",
"cropping",
"and",
"grouping... | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7301-L7370 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (saveOld) {
var axis = this,
range = axis.max - axis.min,
pointRange = 0,
closestPointRange,
minPointOffset = 0,
pointRangePadding = 0,
linkedParent = axis.linkedParent,
ordinalCorrection,
transA = axis.transA;
// adjust translation for padding
if (axis.isXAxis) {
if (linkedPa... | javascript | function (saveOld) {
var axis = this,
range = axis.max - axis.min,
pointRange = 0,
closestPointRange,
minPointOffset = 0,
pointRangePadding = 0,
linkedParent = axis.linkedParent,
ordinalCorrection,
transA = axis.transA;
// adjust translation for padding
if (axis.isXAxis) {
if (linkedPa... | [
"function",
"(",
"saveOld",
")",
"{",
"var",
"axis",
"=",
"this",
",",
"range",
"=",
"axis",
".",
"max",
"-",
"axis",
".",
"min",
",",
"pointRange",
"=",
"0",
",",
"closestPointRange",
",",
"minPointOffset",
"=",
"0",
",",
"pointRangePadding",
"=",
"0"... | Update translation information | [
"Update",
"translation",
"information"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7375-L7448 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this.chart,
options = this.options,
offsetLeft = options.offsetLeft || 0,
offsetRight = options.offsetRight || 0,
horiz = this.horiz,
width,
height,
top,
left;
// Expose basic values to use in Series object and navigator
this.left = left = pick(options.left, char... | javascript | function () {
var chart = this.chart,
options = this.options,
offsetLeft = options.offsetLeft || 0,
offsetRight = options.offsetRight || 0,
horiz = this.horiz,
width,
height,
top,
left;
// Expose basic values to use in Series object and navigator
this.left = left = pick(options.left, char... | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
",",
"options",
"=",
"this",
".",
"options",
",",
"offsetLeft",
"=",
"options",
".",
"offsetLeft",
"||",
"0",
",",
"offsetRight",
"=",
"options",
".",
"offsetRight",
"||",
"0",
",",
... | Update the axis metrics | [
"Update",
"the",
"axis",
"metrics"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7850-L7872 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (rotation) {
var ret,
angle = (pick(rotation, 0) - (this.side * 90) + 720) % 360;
if (angle > 15 && angle < 165) {
ret = 'right';
} else if (angle > 195 && angle < 345) {
ret = 'left';
} else {
ret = 'center';
}
return ret;
} | javascript | function (rotation) {
var ret,
angle = (pick(rotation, 0) - (this.side * 90) + 720) % 360;
if (angle > 15 && angle < 165) {
ret = 'right';
} else if (angle > 195 && angle < 345) {
ret = 'left';
} else {
ret = 'center';
}
return ret;
} | [
"function",
"(",
"rotation",
")",
"{",
"var",
"ret",
",",
"angle",
"=",
"(",
"pick",
"(",
"rotation",
",",
"0",
")",
"-",
"(",
"this",
".",
"side",
"*",
"90",
")",
"+",
"720",
")",
"%",
"360",
";",
"if",
"(",
"angle",
">",
"15",
"&&",
"angle"... | Compute auto alignment for the axis label based on which side the axis is on
and the given rotation for the label | [
"Compute",
"auto",
"alignment",
"for",
"the",
"axis",
"label",
"based",
"on",
"which",
"side",
"the",
"axis",
"is",
"on",
"and",
"the",
"given",
"rotation",
"for",
"the",
"label"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7944-L7956 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (lineWidth) {
var chart = this.chart,
opposite = this.opposite,
offset = this.offset,
horiz = this.horiz,
lineLeft = this.left + (opposite ? this.width : 0) + offset,
lineTop = chart.chartHeight - this.bottom - (opposite ? this.height : 0) + offset;
if (opposite) {
lineWidth *= -1; //... | javascript | function (lineWidth) {
var chart = this.chart,
opposite = this.opposite,
offset = this.offset,
horiz = this.horiz,
lineLeft = this.left + (opposite ? this.width : 0) + offset,
lineTop = chart.chartHeight - this.bottom - (opposite ? this.height : 0) + offset;
if (opposite) {
lineWidth *= -1; //... | [
"function",
"(",
"lineWidth",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
",",
"opposite",
"=",
"this",
".",
"opposite",
",",
"offset",
"=",
"this",
".",
"offset",
",",
"horiz",
"=",
"this",
".",
"horiz",
",",
"lineLeft",
"=",
"this",
".",
... | Get the path for the axis line | [
"Get",
"the",
"path",
"for",
"the",
"axis",
"line"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L8136-L8164 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
// compute anchor points for each of the title align options
var horiz = this.horiz,
axisLeft = this.left,
axisTop = this.top,
axisLength = this.len,
axisTitleOptions = this.options.title,
margin = horiz ? axisLeft : axisTop,
opposite = this.opposite,
offset = this.offset,
f... | javascript | function () {
// compute anchor points for each of the title align options
var horiz = this.horiz,
axisLeft = this.left,
axisTop = this.top,
axisLength = this.len,
axisTitleOptions = this.options.title,
margin = horiz ? axisLeft : axisTop,
opposite = this.opposite,
offset = this.offset,
f... | [
"function",
"(",
")",
"{",
"// compute anchor points for each of the title align options",
"var",
"horiz",
"=",
"this",
".",
"horiz",
",",
"axisLeft",
"=",
"this",
".",
"left",
",",
"axisTop",
"=",
"this",
".",
"top",
",",
"axisLength",
"=",
"this",
".",
"len"... | Position the title | [
"Position",
"the",
"title"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L8169-L8204 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this.series,
i = series.length;
if (!this.isXAxis) {
while (i--) {
series[i].setStackedPoints();
}
// Loop up again to compute percent stack
if (this.usePercentage) {
for (i = 0; i < series.length; i++) {
series[i].setPercentStacks();
}
}
}
} | javascript | function () {
var series = this.series,
i = series.length;
if (!this.isXAxis) {
while (i--) {
series[i].setStackedPoints();
}
// Loop up again to compute percent stack
if (this.usePercentage) {
for (i = 0; i < series.length; i++) {
series[i].setPercentStacks();
}
}
}
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
".",
"series",
",",
"i",
"=",
"series",
".",
"length",
";",
"if",
"(",
"!",
"this",
".",
"isXAxis",
")",
"{",
"while",
"(",
"i",
"--",
")",
"{",
"series",
"[",
"i",
"]",
".",
"setStackedP... | Build the stacks from top down | [
"Build",
"the",
"stacks",
"from",
"top",
"down"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L8488-L8502 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (points, mouseEvent) {
var ret,
chart = this.chart,
inverted = chart.inverted,
plotTop = chart.plotTop,
plotX = 0,
plotY = 0,
yAxis;
points = splat(points);
// Pie uses a special tooltipPos
ret = points[0].tooltipPos;
// When tooltip follows mouse, relate the position to th... | javascript | function (points, mouseEvent) {
var ret,
chart = this.chart,
inverted = chart.inverted,
plotTop = chart.plotTop,
plotX = 0,
plotY = 0,
yAxis;
points = splat(points);
// Pie uses a special tooltipPos
ret = points[0].tooltipPos;
// When tooltip follows mouse, relate the position to th... | [
"function",
"(",
"points",
",",
"mouseEvent",
")",
"{",
"var",
"ret",
",",
"chart",
"=",
"this",
".",
"chart",
",",
"inverted",
"=",
"chart",
".",
"inverted",
",",
"plotTop",
"=",
"chart",
".",
"plotTop",
",",
"plotX",
"=",
"0",
",",
"plotY",
"=",
... | Extendable method to get the anchor position of the tooltip
from a point or set of points | [
"Extendable",
"method",
"to",
"get",
"the",
"anchor",
"position",
"of",
"the",
"tooltip",
"from",
"a",
"point",
"or",
"set",
"of",
"points"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L8714-L8759 | train | |
sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (point) {
var chart = this.chart,
label = this.label,
pos = (this.options.positioner || this.getPosition).call(
this,
label.width,
label.height,
point
);
// do the move
this.move(
mathRound(pos.x),
mathRound(pos.y),
point.plotX + chart.plotLeft,
point.plotY + cha... | javascript | function (point) {
var chart = this.chart,
label = this.label,
pos = (this.options.positioner || this.getPosition).call(
this,
label.width,
label.height,
point
);
// do the move
this.move(
mathRound(pos.x),
mathRound(pos.y),
point.plotX + chart.plotLeft,
point.plotY + cha... | [
"function",
"(",
"point",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
",",
"label",
"=",
"this",
".",
"label",
",",
"pos",
"=",
"(",
"this",
".",
"options",
".",
"positioner",
"||",
"this",
".",
"getPosition",
")",
".",
"call",
"(",
"this"... | Find the new position and perform the move | [
"Find",
"the",
"new",
"position",
"and",
"perform",
"the",
"move"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L8985-L9002 | 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.