id
int32
0
58k
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
23,400
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", "=", "parseHeaders", "(", "headers", ")", ";", "if", "(", "name", ")", "{", "return", "headersObj", "[", "lowercase", "(", "name", ")", "]", "||", "null", ";", "}", "return", "headersObj", ";", "}", ";", "}" ]
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 header value or null - if called with no arguments returns an object containing all headers.
[ "Returns", "a", "function", "that", "provides", "access", "to", "parsed", "headers", "." ]
08be4473daa854e3e8942340998a6c282f3f8c44
https://github.com/mz121star/NJBlog/blob/08be4473daa854e3e8942340998a6c282f3f8c44/public/js/main-built.js#L8205-L8217
23,401
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", "(", "(", "isValid", "?", "INVALID_CLASS", ":", "VALID_CLASS", ")", "+", "validationErrorKey", ")", ".", "addClass", "(", "(", "isValid", "?", "VALID_CLASS", ":", "INVALID_CLASS", ")", "+", "validationErrorKey", ")", ";", "}" ]
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
23,402
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 !== 'function'); } return result; }
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'); } return result; }
[ "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'", ")", ";", "}", "return", "result", ";", "}" ]
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. @private
[ "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
23,403
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 it doesn't do anything", "object", "[", "methods", "[", "i", "]", "]", "=", "noop", ";", "}", "return", "object", ";", "}" ]
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
23,404
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", ">", "1", ")", "{", "path", "=", "keys", ".", "shift", "(", ")", "return", "nestedPath", "(", "obj", "[", "path", "]", ",", "keys", ".", "join", "(", "'.'", ")", ",", "val", ")", "}", "if", "(", "val", "!==", "undefined", ")", "{", "obj", "[", "path", "]", "=", "val", "}", "return", "obj", "[", "path", "]", "}" ]
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
23,405
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", ".", "toObject", "(", ")", "}", ")", "}", "return", "data", ".", "toObject", "(", ")", "}" ]
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
23,406
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", "(", ")", "fn", "&&", "fn", "(", "err", ",", "result", ")", "}", ")", "}" ]
Destroy a database and disconnect
[ "Destroy", "a", "database", "and", "disconnect" ]
09747e90b7f6d45a734c806c18cf635642634235
https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/helpers/index.js#L58-L65
23,407
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') { err = null } each && each(err, name) }) }) fn && fn(null) }
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') { err = null } each && each(err, name) }) }) fn && fn(null) }
[ "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'", ")", "{", "err", "=", "null", "}", "each", "&&", "each", "(", "err", ",", "name", ")", "}", ")", "}", ")", "fn", "&&", "fn", "(", "null", ")", "}" ]
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
23,408
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", "&&", "!", "(", "categorizeChars", "(", "token", ")", ".", "substr", "(", "-", "4", ",", "3", ")", "==", "'CVC'", "&&", "token", ".", "match", "(", "/", "[^wxy].$", "/", ")", ")", ")", ")", "return", "token", ".", "replace", "(", "/", "e$", "/", ",", "''", ")", ";", "return", "token", ";", "}" ]
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
23,409
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", ".", "replace", "(", "/", "ll$", "/", ",", "'l'", ")", ";", "}", "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
23,410
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: subtoken, index: _index, offset: subtoken.length }; } if (_.isObject(subtoken)) { subtoken.index = subtoken.index || 0; _index = _index + subtoken.index + subtoken.offset; // Transform as an absolute token subtoken.index = relative.index + subtoken.index; subtoken.offset = subtoken.offset || subtoken.value.length; } return subtoken; }); }
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: subtoken, index: _index, offset: subtoken.length }; } if (_.isObject(subtoken)) { subtoken.index = subtoken.index || 0; _index = _index + subtoken.index + subtoken.offset; // Transform as an absolute token subtoken.index = relative.index + subtoken.index; subtoken.offset = subtoken.offset || subtoken.value.length; } return subtoken; }); }
[ "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", ":", "subtoken", ",", "index", ":", "_index", ",", "offset", ":", "subtoken", ".", "length", "}", ";", "}", "if", "(", "_", ".", "isObject", "(", "subtoken", ")", ")", "{", "subtoken", ".", "index", "=", "subtoken", ".", "index", "||", "0", ";", "_index", "=", "_index", "+", "subtoken", ".", "index", "+", "subtoken", ".", "offset", ";", "// Transform as an absolute token", "subtoken", ".", "index", "=", "relative", ".", "index", "+", "subtoken", ".", "index", ";", "subtoken", ".", "offset", "=", "subtoken", ".", "offset", "||", "subtoken", ".", "value", ".", "length", ";", "}", "return", "subtoken", ";", "}", ")", ";", "}" ]
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
23,411
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", "(", "to", ")", "return", "crypted", ";", "}" ]
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
23,412
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", "(", "from", ")", "return", "dec", ";", "}" ]
Decrypt an encrypted string
[ "Decrypt", "an", "encrypted", "string" ]
09747e90b7f6d45a734c806c18cf635642634235
https://github.com/tblobaum/mongoose-troop/blob/09747e90b7f6d45a734c806c18cf635642634235/lib/obfuscate.js#L35-L39
23,413
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 if (path.instance === 'ObjectID' && val) { nestedPath(obj, name, method(val.toString())) } if (path.casterConstructor) { // Array of DBRefs if (!!~path.casterConstructor.toString().indexOf('ObjectId')) { nestedPath(obj, name).forEach(function (v, k) { nestedPath(obj, name)[k] = method(val[k].toString()) }) // Array of embedded schemas } else if (!!~path.casterConstructor.toString().indexOf('EmbeddedDocument')) { nestedPath(obj, name).forEach(function (v, k) { nestedPath(obj, name)[k] = encode(path.schema, val[k], toEncrypt) }) } } }) return obj }
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 if (path.instance === 'ObjectID' && val) { nestedPath(obj, name, method(val.toString())) } if (path.casterConstructor) { // Array of DBRefs if (!!~path.casterConstructor.toString().indexOf('ObjectId')) { nestedPath(obj, name).forEach(function (v, k) { nestedPath(obj, name)[k] = method(val[k].toString()) }) // Array of embedded schemas } else if (!!~path.casterConstructor.toString().indexOf('EmbeddedDocument')) { nestedPath(obj, name).forEach(function (v, k) { nestedPath(obj, name)[k] = encode(path.schema, val[k], toEncrypt) }) } } }) return obj }
[ "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", "if", "(", "path", ".", "instance", "===", "'ObjectID'", "&&", "val", ")", "{", "nestedPath", "(", "obj", ",", "name", ",", "method", "(", "val", ".", "toString", "(", ")", ")", ")", "}", "if", "(", "path", ".", "casterConstructor", ")", "{", "// Array of DBRefs", "if", "(", "!", "!", "~", "path", ".", "casterConstructor", ".", "toString", "(", ")", ".", "indexOf", "(", "'ObjectId'", ")", ")", "{", "nestedPath", "(", "obj", ",", "name", ")", ".", "forEach", "(", "function", "(", "v", ",", "k", ")", "{", "nestedPath", "(", "obj", ",", "name", ")", "[", "k", "]", "=", "method", "(", "val", "[", "k", "]", ".", "toString", "(", ")", ")", "}", ")", "// Array of embedded schemas", "}", "else", "if", "(", "!", "!", "~", "path", ".", "casterConstructor", ".", "toString", "(", ")", ".", "indexOf", "(", "'EmbeddedDocument'", ")", ")", "{", "nestedPath", "(", "obj", ",", "name", ")", ".", "forEach", "(", "function", "(", "v", ",", "k", ")", "{", "nestedPath", "(", "obj", ",", "name", ")", "[", "k", "]", "=", "encode", "(", "path", ".", "schema", ",", "val", "[", "k", "]", ",", "toEncrypt", ")", "}", ")", "}", "}", "}", ")", "return", "obj", "}" ]
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
23,414
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", "-", "value", "[", "1", "]", ")", "/", "max", "-", "min", ")", "*", "100", ")", ")", ":", "(", "Math", ".", "round", "(", "(", "value", "[", "0", "]", "/", "max", "-", "min", ")", "*", "100", ")", ")", ";", "}" ]
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
23,415
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", "{", "return", "stepValue", "<", "value", ";", "}", "}" ]
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
23,416
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 - position; const style = { [constants[orientation].direction]: `${position}%` }; const className = classNames('slider-step', { 'slider-step-active': isInActiveRange(i * step, value, isRangeType) }); steps.push(<span className={className} key={i} style={style} />); } return steps; }
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 - position; const style = { [constants[orientation].direction]: `${position}%` }; const className = classNames('slider-step', { 'slider-step-active': isInActiveRange(i * step, value, isRangeType) }); steps.push(<span className={className} key={i} style={style} />); } return steps; }
[ "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", "-", "position", ";", "const", "style", "=", "{", "[", "constants", "[", "orientation", "]", ".", "direction", "]", ":", "`", "${", "position", "}", "`", "}", ";", "const", "className", "=", "classNames", "(", "'slider-step'", ",", "{", "'slider-step-active'", ":", "isInActiveRange", "(", "i", "*", "step", ",", "value", ",", "isRangeType", ")", "}", ")", ";", "steps", ".", "push", "(", "<", "span", "className", "=", "{", "className", "}", "key", "=", "{", "i", "}", "style", "=", "{", "style", "}", "/", ">", ")", ";", "}", "return", "steps", ";", "}" ]
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
23,417
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", "(", ")", ";", "this", ".", "_tokenizer", "=", "new", "Tokenizer", "(", "this", ".", "_configuration", ")", ";", "this", ".", "state", "=", "Parser", ".", "states", ".", "empty", ";", "this", ".", "buffer", "=", "''", ";", "}" ]
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", "for", "different", "parsing", "events", "." ]
37bf0498ad276310455804410d40975998aaeb02
https://github.com/tdecaluwe/node-edifact/blob/37bf0498ad276310455804410d40975998aaeb02/parser.js#L35-L42
23,418
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", "(", "''", ")", ".", "reverse", "(", ")", ".", "join", "(", "''", ")", ")", "}", "}" ]
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
23,419
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", "&&", "err", ".", "code", "!==", "'EEXIST'", ")", "{", "reject", "(", "err", ")", ";", "}", "else", "{", "resolve", "(", "options", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}" ]
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
23,420
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 json data var result = data.replace('{{ insertJSONHere }}', 'var embeddedJsonData = '+ options.json + ';'); // write file to directory fs.writeFile(path.join(options.directory, 'index.html'), result, 'utf8', function (err) { if (err) { reject(err); } resolve(options.directory); }); }); }); }
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 json data var result = data.replace('{{ insertJSONHere }}', 'var embeddedJsonData = '+ options.json + ';'); // write file to directory fs.writeFile(path.join(options.directory, 'index.html'), result, 'utf8', function (err) { if (err) { reject(err); } resolve(options.directory); }); }); }); }
[ "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 json data", "var", "result", "=", "data", ".", "replace", "(", "'{{ insertJSONHere }}'", ",", "'var embeddedJsonData = '", "+", "options", ".", "json", "+", "';'", ")", ";", "// write file to directory", "fs", ".", "writeFile", "(", "path", ".", "join", "(", "options", ".", "directory", ",", "'index.html'", ")", ",", "result", ",", "'utf8'", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "reject", "(", "err", ")", ";", "}", "resolve", "(", "options", ".", "directory", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
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
23,421
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", ")", ";", "return", "item", ";", "}" ]
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 metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](swagger.io/specification/#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. See {@link http://swagger.io/specification/#tagObject Tag Object}. @param {string} [metaData.summary] - A brief summary of the operation. @param {string} [metaData.description] - A longer description of the operation, GitHub Flavored Markdown is allowed. @param {object} [metaData.externalDocs] - information about external documentation @param {string} [metaData.externalDocs.description] - A short description of the target documentation. GFM syntax can be used for rich text representation. @param {string} metaData.externalDocs.url - Required. The URL for the target documentation. Value MUST be in the format of a URL. @param {string} [metaData.operationId] - A unique identifier of the operation. @param {string[]} [metaData.produces] - A list of MIME types the API can produce. @param {string[]} [metaData.consumes] - A list of MIME types the API can consume. @param {object|string} [metaData.parameters] - An object to hold parameters that can be used across operations. This property does not define global parameters for all operations. See {@link http://swagger.io/specification/#parametersDefinitionsObject Parameter Definitions Object}. @param {object} [metaData.responses] - Response objects names can either be any valid HTTP status code or 'default'. @param {string[]} [metaData.schemes] - The transfer protocol of the API. @param {boolean} [metaData.deprecated] - Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false. @param {array|boolean|string} [metaData.security] - A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. See {@link http://swagger.io/specification/#securityRequirementObject Security Requirement Object}. @param {object} [metaData.common] - A collection of common data to include in this route. @param {string[]} [metaData.common.responses] - Common responses as added by calling common.addResponse @param {object} [metaData.common.parameters] - A collection of common parameters to use for this route. @param {string[]} [metaData.common.parameters.header] - A common header parameter as added by calling common.parameters.addHeader @param {string[]} [metaData.common.parameters.body] - A common body parameter as added by calling common.parameters.addBody @param {string[]} [metaData.common.parameters.query] - A common query string parameter as added by calling common.parameters.addQuery @param {string[]} [metaData.common.parameters.formData] - A common form data parameter as added by calling common.parameters.addFormData @param {string[]} [metaData.common.parameters.path] - A common path parameter as added by calling common.parameters.addPath @link http://swagger.io/specification/#tagObject Tag Object}. @link http://swagger.io/specification/#parametersDefinitionsObject Parameter Definitions Object}. @link http://swagger.io/specification/#securityRequirementObject Security Requirement Object}. @link http://swagger.io/specification/#tagObject Tag Object}. (Generated) @link http://swagger.io/specification/#parametersDefinitionsObject Parameter Definitions Object}. (Generated) @link http://swagger.io/specification/#securityRequirementObject Security Requirement Object}. (Generated) @return {object} the router or app object to allow for fluent calls. @example var swagger = require('swagger-spec-express'); var express = require('express'); var router = new express.Router(); swagger.swaggerize(router); router.get('/', function (req, res) { //... }).describe({ //... });
[ "Allows", "you", "describe", "an", "app", "our", "router", "route", "." ]
03479da4bcd0e2655563b33ff486af7241664f56
https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/swaggerise.js#L62-L69
23,422
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"); } state.document = generate(state); state.compiled = true; }
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"); } state.document = generate(state); state.compiled = true; }
[ "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\"", ")", ";", "}", "state", ".", "document", "=", "generate", "(", "state", ")", ";", "state", ".", "compiled", "=", "true", ";", "}" ]
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 error if `initialise` wasn't called or if you don't yet have any routes defined or if there are certain errors in your metadata @example var swagger = require('swagger-spec-express'); var express = require('express'); var router = new express.Router(); swagger.swaggerize(router); router.get('/', function (req, res) { //... }).describe({ //... }); swagger.compile();
[ "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", "." ]
03479da4bcd0e2655563b33ff486af7241664f56
https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/index.js#L52-L62
23,423
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'", "}", ",", "options", ")", ";", "}" ]
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.description] - A short description for the tag. GFM syntax can be used for rich text representation. @param {object} [tag.externalDocs] - information about external documentation @param {string} [tag.externalDocs.description] - A short description of the target documentation. GFM syntax can be used for rich text representation. @param {string} tag.externalDocs.url - Required. The URL for the target documentation. Value MUST be in the format of a URL. @param {AddCommonItemOptions} [options] - Options to apply when adding the provided item. @returns {void} @example var swagger = require('swagger-spec-express'); swagger.common.addTag({ name: "Info", description: "Info about the api" }); //... router.get('/', function (req, res) { //... }).describe({ //... tags: ["Info"], //... });
[ "Adds", "a", "common", "tag", "for", "later", "use", "." ]
03479da4bcd0e2655563b33ff486af7241664f56
https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L44-L51
23,424
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", ".", "common", ".", "parameters", ".", "body", ",", "displayName", ":", "'body parameter'", "}", ",", "options", ")", ";", "}" ]
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 used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. @param {string} [body.description] - A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. @param {string} [body.name] - The name of the parameter. @param {string} [body.in] - Determines the location of the parameter. @param {boolean} [body.required] - Determines whether or not this parameter is required or optional. @param {object} [body.schema] - A deterministic version of a JSON Schema object. @param {string} [body.model] - The name of the model produced or consumed. @param {string} [body.arrayOfModel] - The name of the model produced or consumed as an array. @param {AddCommonItemOptions} [options] - Options to apply when adding the provided item. @returns {void}* @example var swagger = require('swagger-spec-express'); swagger.common.parameters.addBody({ name: "process", description: "Kicks off the process function on the server at the rest endpoint using the options provided", required: true, type: "object", schema : { type: "object", properties: { "async": { "type": "boolean" } } additionalProperties: true } }); //... router.get('/', function (req, res) { //... }).describe({ //... common: { //... parameters: { body: ["process"] } //... } //... });
[ "Adds", "a", "common", "body", "parameter", "for", "later", "use", "." ]
03479da4bcd0e2655563b33ff486af7241664f56
https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L159-L167
23,425
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", ",", "displayName", ":", "'response'", "}", ",", "options", ")", ";", "}" ]
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-markdown) can be used for rich text representation. @param {object} [response.schema] - A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](http://swagger.io/specification/#schemaObject), its root type value may also be `file`. This SHOULD be accompanied by a relevant produces mime-type. @param {object} [response.headers] - A list of headers that are sent with the response. See [http://swagger.io/specification/#headersObject](http://swagger.io/specification/#headersObject) @param {object} [response.examples] - An example of the response message. See [http://swagger.io/specification/#exampleObject](http://swagger.io/specification/#exampleObject) @param {string} response.name - The name or http status code used to refer to this response at a later stage. @param {string} [response.model] - The name of the model produced or consumed. @param {string} [response.arrayOfModel] - The name of the model produced or consumed as an array. @param {AddCommonItemOptions} [options] - Options to apply when adding the provided item. @returns {void} @example var swagger = require('swagger-spec-express'); swagger.common.addResponse({ name: "500", description: "Server Error", "schema": { $ref: "#/definitions/serverError" } }); //... router.get('/', function (req, res) { //... }).describe({ //... common: { //... responses: ["500", "400", "401", "404"], //... } //... });
[ "Adds", "a", "common", "response", "for", "later", "use", "." ]
03479da4bcd0e2655563b33ff486af7241664f56
https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L401-L408
23,426
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); cloneObject(options); delete options.object.$schema; delete options.object.$id; var definitions = options.object.definitions; delete options.object.definitions; applyValidation(options); ensureHasName(options); ensureNotAlreadyAdded(options); setObjectOnTarget(options); applyNameDeletion(options); if (!definitions) { return; } Object.keys(definitions).forEach(function (key) { var definition = _.cloneDeep(definitions[key]); definition.name = key; addModel(definition, inputOptions); }); }
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); cloneObject(options); delete options.object.$schema; delete options.object.$id; var definitions = options.object.definitions; delete options.object.definitions; applyValidation(options); ensureHasName(options); ensureNotAlreadyAdded(options); setObjectOnTarget(options); applyNameDeletion(options); if (!definitions) { return; } Object.keys(definitions).forEach(function (key) { var definition = _.cloneDeep(definitions[key]); definition.name = key; addModel(definition, inputOptions); }); }
[ "function", "addModel", "(", "model", ",", "inputOptions", ")", "{", "var", "options", "=", "{", "schemaKey", ":", "schemaIds", ".", "schema", ",", "object", ":", "model", ",", "targetObject", ":", "state", ".", "common", ".", "models", ",", "displayName", ":", "'Model'", ",", "deleteNameFromCommon", ":", "true", "}", ";", "applyDefaults", "(", "options", ",", "inputOptions", ")", ";", "ensureObjectExists", "(", "options", ")", ";", "cloneObject", "(", "options", ")", ";", "delete", "options", ".", "object", ".", "$schema", ";", "delete", "options", ".", "object", ".", "$id", ";", "var", "definitions", "=", "options", ".", "object", ".", "definitions", ";", "delete", "options", ".", "object", ".", "definitions", ";", "applyValidation", "(", "options", ")", ";", "ensureHasName", "(", "options", ")", ";", "ensureNotAlreadyAdded", "(", "options", ")", ";", "setObjectOnTarget", "(", "options", ")", ";", "applyNameDeletion", "(", "options", ")", ";", "if", "(", "!", "definitions", ")", "{", "return", ";", "}", "Object", ".", "keys", "(", "definitions", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "var", "definition", "=", "_", ".", "cloneDeep", "(", "definitions", "[", "key", "]", ")", ";", "definition", ".", "name", "=", "key", ";", "addModel", "(", "definition", ",", "inputOptions", ")", ";", "}", ")", ";", "}" ]
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('swagger-spec-express'); swagger.common.addModel({ "name": "serverError", "type": "object", "properties": { "message": { "type": "string" } } }); //... router.get('/', function (req, res) { //... }).describe({ //... responses: { "500": { //... model: "serverError" } } //... });
[ "Adds", "a", "common", "model", "for", "later", "use", "." ]
03479da4bcd0e2655563b33ff486af7241664f56
https://github.com/eXigentCoder/swagger-spec-express/blob/03479da4bcd0e2655563b33ff486af7241664f56/lib/common.js#L499-L527
23,427
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) { return callback(err); } console.info('\t\t\tDone.'); return callback(null, options); }); }
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) { return callback(err); } console.info('\t\t\tDone.'); return callback(null, options); }); }
[ "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", ")", "{", "return", "callback", "(", "err", ")", ";", "}", "console", ".", "info", "(", "'\\t\\t\\tDone.'", ")", ";", "return", "callback", "(", "null", ",", "options", ")", ";", "}", ")", ";", "}" ]
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 {string[]} options.line - The comment, split out into lines. @param {string} options.paramName - The name of the parameter. @param {string} options.schemaPath - The path to the schema file. @param {number} options.insertAfterIndex - The index (line number) within the comment object where the comment should be inserted @param {function} callback - A callback object with err param if something went wrong. @returns {void}
[ "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
23,428
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 += message + '. Offending property : ' + err.params.additionalProperty + os.EOL; } }); return fullMessage; }
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 += message + '. Offending property : ' + err.params.additionalProperty + os.EOL; } }); return fullMessage; }
[ "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", "+=", "message", "+", "'. Offending property : '", "+", "err", ".", "params", ".", "additionalProperty", "+", "os", ".", "EOL", ";", "}", "}", ")", ";", "return", "fullMessage", ";", "}" ]
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
23,429
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 obj) { if (obj.hasOwnProperty(k) && !(skipKeys.indexOf(k) + 1)) { var v = obj[k]; var found = false; // If clonedRule was passed in, check for an existing property. if (clonedRule) { rule.each(function(decl) { if (decl.prop == k) { decl.value = v; found = true; return false; } }); } // If no clonedRule or there was no existing prop. if (!clonedRule || !found) rule.append({ prop: k, value: v }); } } return rule; }
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 obj) { if (obj.hasOwnProperty(k) && !(skipKeys.indexOf(k) + 1)) { var v = obj[k]; var found = false; // If clonedRule was passed in, check for an existing property. if (clonedRule) { rule.each(function(decl) { if (decl.prop == k) { decl.value = v; found = true; return false; } }); } // If no clonedRule or there was no existing prop. if (!clonedRule || !found) rule.append({ prop: k, value: v }); } } return rule; }
[ "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", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "k", ")", "&&", "!", "(", "skipKeys", ".", "indexOf", "(", "k", ")", "+", "1", ")", ")", "{", "var", "v", "=", "obj", "[", "k", "]", ";", "var", "found", "=", "false", ";", "// If clonedRule was passed in, check for an existing property.", "if", "(", "clonedRule", ")", "{", "rule", ".", "each", "(", "function", "(", "decl", ")", "{", "if", "(", "decl", ".", "prop", "==", "k", ")", "{", "decl", ".", "value", "=", "v", ";", "found", "=", "true", ";", "return", "false", ";", "}", "}", ")", ";", "}", "// If no clonedRule or there was no existing prop.", "if", "(", "!", "clonedRule", "||", "!", "found", ")", "rule", ".", "append", "(", "{", "prop", ":", "k", ",", "value", ":", "v", "}", ")", ";", "}", "}", "return", "rule", ";", "}" ]
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
23,430
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", ".", "skipWs", "(", ")", ".", "buffer", ")", "syntaxError", "(", "inp", ")", ";", "return", "res", ";", "}" ]
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
23,431
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) || parseArray(inp) || parseObject(inp) || parseIdentPattern(inp); }
javascript
function parsePattern (inp) { return parseWildcard(inp) || parseNullLiteral(inp) || parseUndefinedLiteral(inp) || parseBooleanLiteral(inp) || parseNumberLiteral(inp) || parseStringLiteral(inp) || parseClassPattern(inp) || parseExtractor(inp) || parseArray(inp) || parseObject(inp) || parseIdentPattern(inp); }
[ "function", "parsePattern", "(", "inp", ")", "{", "return", "parseWildcard", "(", "inp", ")", "||", "parseNullLiteral", "(", "inp", ")", "||", "parseUndefinedLiteral", "(", "inp", ")", "||", "parseBooleanLiteral", "(", "inp", ")", "||", "parseNumberLiteral", "(", "inp", ")", "||", "parseStringLiteral", "(", "inp", ")", "||", "parseClassPattern", "(", "inp", ")", "||", "parseExtractor", "(", "inp", ")", "||", "parseArray", "(", "inp", ")", "||", "parseObject", "(", "inp", ")", "||", "parseIdentPattern", "(", "inp", ")", ";", "}" ]
Matches a single pattern expression.
[ "Matches", "a", "single", "pattern", "expression", "." ]
9114609c7009b4ad6db6c9bdf044380c022b921a
https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L106-L118
23,432
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", ")", "||", "nodeExtractor", "(", "match", "[", "1", "]", ")", ";", "function", "extractorRes", "(", "res", ")", "{", "return", "nodeExtractor", "(", "match", "[", "1", "]", ",", "res", ")", ";", "}", "}" ]
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
23,433
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", "=", "parsePattern", "(", "inp", ".", "skipWs", "(", ")", ")", ";", "if", "(", "patt", ")", "return", "nodeKeyValue", "(", "res", ",", "patt", ")", ";", "}", "return", "nodeKey", "(", "res", ")", ";", "}", "}" ]
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
23,434
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", ")", "return", "match", "[", "0", "]", "}" ]
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
23,435
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", "=", "parseBinderPattern", "(", "inp", ")", ";", "if", "(", "patt", ")", "return", "nodeBinder", "(", "match", "[", "0", "]", ",", "patt", ")", ";", "}", "return", "nodeIdentifier", "(", "match", "[", "0", "]", ")", "}", "}" ]
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", "by", "an" ]
9114609c7009b4ad6db6c9bdf044380c022b921a
https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L238-L247
23,436
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", "(", "inp", ".", "skipWs", "(", ")", ".", "takeAPeek", "(", "del2", ")", ")", "return", "nodeFn", "(", "res", ")", ";", "else", "syntaxError", "(", "inp", ",", "\"Expected \"", "+", "del2", ")", ";", "}", "}" ]
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
23,437
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", ",", "res", ".", "pattern", ".", "length", "-", "1", ")", "+", "\")\"", ":", "res", ".", "pattern", ";", "}", "return", "node", "(", "\"class\"", ",", "patt", ",", "name", ",", "res", "?", "[", "res", "]", ":", "undefined", ")", ";", "}" ]
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
23,438
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'; var iName = argName + '_i'; var lenName = argName + '_len'; var retArgsName = argName + '_retargs'; source.push( 'var ' + retName + ' = [' + retInit.join(',') + '];', 'var ' + loopName + ' = function (val) {', ' var ret = [];', indent(2, compilePattern('val', node.children[0])), ' return ret;', '};', 'var ' + iName + ' = 0, ' + lenName + ' = ' + argName + '.length, ' + retArgsName + ';', 'for (; ' + iName + ' < ' + lenName + '; ' + iName + '++) {', ' ' + retArgsName + ' = ' + loopName + '(' + argName + '[' + iName + ']);', ' if (!' + retArgsName + ') return false;', (function () { var src = []; for (i = 0; i < len; i++) { src.push(' ' + retName + '[' + i + '].push(' + retArgsName + '[' + i + ']);'); } return src.join('\n'); })(), '}', 'ret = Array.prototype.concat.call(ret, ' + retName + ');' ); return source.join('\n'); }
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'; var iName = argName + '_i'; var lenName = argName + '_len'; var retArgsName = argName + '_retargs'; source.push( 'var ' + retName + ' = [' + retInit.join(',') + '];', 'var ' + loopName + ' = function (val) {', ' var ret = [];', indent(2, compilePattern('val', node.children[0])), ' return ret;', '};', 'var ' + iName + ' = 0, ' + lenName + ' = ' + argName + '.length, ' + retArgsName + ';', 'for (; ' + iName + ' < ' + lenName + '; ' + iName + '++) {', ' ' + retArgsName + ' = ' + loopName + '(' + argName + '[' + iName + ']);', ' if (!' + retArgsName + ') return false;', (function () { var src = []; for (i = 0; i < len; i++) { src.push(' ' + retName + '[' + i + '].push(' + retArgsName + '[' + i + ']);'); } return src.join('\n'); })(), '}', 'ret = Array.prototype.concat.call(ret, ' + retName + ');' ); return source.join('\n'); }
[ "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'", ";", "var", "iName", "=", "argName", "+", "'_i'", ";", "var", "lenName", "=", "argName", "+", "'_len'", ";", "var", "retArgsName", "=", "argName", "+", "'_retargs'", ";", "source", ".", "push", "(", "'var '", "+", "retName", "+", "' = ['", "+", "retInit", ".", "join", "(", "','", ")", "+", "'];'", ",", "'var '", "+", "loopName", "+", "' = function (val) {'", ",", "' var ret = [];'", ",", "indent", "(", "2", ",", "compilePattern", "(", "'val'", ",", "node", ".", "children", "[", "0", "]", ")", ")", ",", "' return ret;'", ",", "'};'", ",", "'var '", "+", "iName", "+", "' = 0, '", "+", "lenName", "+", "' = '", "+", "argName", "+", "'.length, '", "+", "retArgsName", "+", "';'", ",", "'for (; '", "+", "iName", "+", "' < '", "+", "lenName", "+", "'; '", "+", "iName", "+", "'++) {'", ",", "' '", "+", "retArgsName", "+", "' = '", "+", "loopName", "+", "'('", "+", "argName", "+", "'['", "+", "iName", "+", "']);'", ",", "' if (!'", "+", "retArgsName", "+", "') return false;'", ",", "(", "function", "(", ")", "{", "var", "src", "=", "[", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "src", ".", "push", "(", "' '", "+", "retName", "+", "'['", "+", "i", "+", "'].push('", "+", "retArgsName", "+", "'['", "+", "i", "+", "']);'", ")", ";", "}", "return", "src", ".", "join", "(", "'\\n'", ")", ";", "}", ")", "(", ")", ",", "'}'", ",", "'ret = Array.prototype.concat.call(ret, '", "+", "retName", "+", "');'", ")", ";", "return", "source", ".", "join", "(", "'\\n'", ")", ";", "}" ]
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 children, returning the number of nodes that can cause a value to be stashed.
[ "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", "children", "returning", "the", "number", "of", "nodes", "that", "can", "cause", "a", "value", "to", "be", "stashed", "." ]
9114609c7009b4ad6db6c9bdf044380c022b921a
https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L797-L838
23,439
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\"", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
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
23,440
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.children[i]); } return count; }
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.children[i]); } return count; }
[ "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", ".", "children", "[", "i", "]", ")", ";", "}", "return", "count", ";", "}" ]
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
23,441
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[patternStr] = normalized[tree.pattern]; } return patterns[patternStr]; }
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[patternStr] = normalized[tree.pattern]; } return patterns[patternStr]; }
[ "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", "[", "patternStr", "]", "=", "normalized", "[", "tree", ".", "pattern", "]", ";", "}", "return", "patterns", "[", "patternStr", "]", ";", "}" ]
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
23,442
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 == "undefined" || targ1 == "object")) { matcherFn = arguments[0]; chain = arguments[1]; // Throw an error if the supplied function does not have a match chain. if (!matcherFn.__matchChain) throw new Error("Not a matcher function"); // Splice the chains together. if (chain) { chain = chain.clone(); chain.last().next = matcherFn.__matchChain.clone(); } else { chain = matcherFn.__matchChain.clone(); } last = chain.pop(); return matcher(last.patternFn, last.successFn, chain); } // pattern(patternObj, chain) else if (targ0 == "object" && (targ1 == "undefined" || targ1 == "object")) { patternObj = arguments[0]; chain = arguments[1] ? arguments[1].clone() : null; for (patternStr in patternObj) { matcherFn = pattern(patternStr, patternObj[patternStr], chain); chain = matcherFn.__matchChain; } return matcherFn; } // pattern(patternFn, successFn, chain) else if (targ0 == "function" && targ1 == "function") { chain = arguments[2] ? arguments[2].clone() : null; return matcher(arguments[0], arguments[1], chain); } // pattern(patternStr, successFn, chain) else { patternStr = arguments[0]; successFn = arguments[1]; chain = arguments[2] ? arguments[2].clone() : null; patternFn = getOrCompile(patternStr); return matcher(patternFn, successFn, chain); } }
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 == "undefined" || targ1 == "object")) { matcherFn = arguments[0]; chain = arguments[1]; // Throw an error if the supplied function does not have a match chain. if (!matcherFn.__matchChain) throw new Error("Not a matcher function"); // Splice the chains together. if (chain) { chain = chain.clone(); chain.last().next = matcherFn.__matchChain.clone(); } else { chain = matcherFn.__matchChain.clone(); } last = chain.pop(); return matcher(last.patternFn, last.successFn, chain); } // pattern(patternObj, chain) else if (targ0 == "object" && (targ1 == "undefined" || targ1 == "object")) { patternObj = arguments[0]; chain = arguments[1] ? arguments[1].clone() : null; for (patternStr in patternObj) { matcherFn = pattern(patternStr, patternObj[patternStr], chain); chain = matcherFn.__matchChain; } return matcherFn; } // pattern(patternFn, successFn, chain) else if (targ0 == "function" && targ1 == "function") { chain = arguments[2] ? arguments[2].clone() : null; return matcher(arguments[0], arguments[1], chain); } // pattern(patternStr, successFn, chain) else { patternStr = arguments[0]; successFn = arguments[1]; chain = arguments[2] ? arguments[2].clone() : null; patternFn = getOrCompile(patternStr); return matcher(patternFn, successFn, chain); } }
[ "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", "==", "\"undefined\"", "||", "targ1", "==", "\"object\"", ")", ")", "{", "matcherFn", "=", "arguments", "[", "0", "]", ";", "chain", "=", "arguments", "[", "1", "]", ";", "// Throw an error if the supplied function does not have a match chain.", "if", "(", "!", "matcherFn", ".", "__matchChain", ")", "throw", "new", "Error", "(", "\"Not a matcher function\"", ")", ";", "// Splice the chains together.", "if", "(", "chain", ")", "{", "chain", "=", "chain", ".", "clone", "(", ")", ";", "chain", ".", "last", "(", ")", ".", "next", "=", "matcherFn", ".", "__matchChain", ".", "clone", "(", ")", ";", "}", "else", "{", "chain", "=", "matcherFn", ".", "__matchChain", ".", "clone", "(", ")", ";", "}", "last", "=", "chain", ".", "pop", "(", ")", ";", "return", "matcher", "(", "last", ".", "patternFn", ",", "last", ".", "successFn", ",", "chain", ")", ";", "}", "// pattern(patternObj, chain)", "else", "if", "(", "targ0", "==", "\"object\"", "&&", "(", "targ1", "==", "\"undefined\"", "||", "targ1", "==", "\"object\"", ")", ")", "{", "patternObj", "=", "arguments", "[", "0", "]", ";", "chain", "=", "arguments", "[", "1", "]", "?", "arguments", "[", "1", "]", ".", "clone", "(", ")", ":", "null", ";", "for", "(", "patternStr", "in", "patternObj", ")", "{", "matcherFn", "=", "pattern", "(", "patternStr", ",", "patternObj", "[", "patternStr", "]", ",", "chain", ")", ";", "chain", "=", "matcherFn", ".", "__matchChain", ";", "}", "return", "matcherFn", ";", "}", "// pattern(patternFn, successFn, chain)", "else", "if", "(", "targ0", "==", "\"function\"", "&&", "targ1", "==", "\"function\"", ")", "{", "chain", "=", "arguments", "[", "2", "]", "?", "arguments", "[", "2", "]", ".", "clone", "(", ")", ":", "null", ";", "return", "matcher", "(", "arguments", "[", "0", "]", ",", "arguments", "[", "1", "]", ",", "chain", ")", ";", "}", "// pattern(patternStr, successFn, chain)", "else", "{", "patternStr", "=", "arguments", "[", "0", "]", ";", "successFn", "=", "arguments", "[", "1", "]", ";", "chain", "=", "arguments", "[", "2", "]", "?", "arguments", "[", "2", "]", ".", "clone", "(", ")", ":", "null", ";", "patternFn", "=", "getOrCompile", "(", "patternStr", ")", ";", "return", "matcher", "(", "patternFn", ",", "successFn", ",", "chain", ")", ";", "}", "}" ]
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", "are", "adding", "a", "pattern", "to", "." ]
9114609c7009b4ad6db6c9bdf044380c022b921a
https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L986-L1039
23,443
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 () { // This seems like an odd optimization, but manually copying the // arguments object over to an array instead of calling `slice` can // speed up dispatch time 2-3x. var args = [], i = 0, len = arguments.length; for (; i < len; i++) args[i] = arguments[i]; return chain.match(args, this); }; fn.alt = function () { var args = slice.call(arguments); args.push(chain); return pattern.apply(null, args); }; fn.__matchChain = chain; return fn; }
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 () { // This seems like an odd optimization, but manually copying the // arguments object over to an array instead of calling `slice` can // speed up dispatch time 2-3x. var args = [], i = 0, len = arguments.length; for (; i < len; i++) args[i] = arguments[i]; return chain.match(args, this); }; fn.alt = function () { var args = slice.call(arguments); args.push(chain); return pattern.apply(null, args); }; fn.__matchChain = chain; return fn; }
[ "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", "(", ")", "{", "// This seems like an odd optimization, but manually copying the", "// arguments object over to an array instead of calling `slice` can", "// speed up dispatch time 2-3x.", "var", "args", "=", "[", "]", ",", "i", "=", "0", ",", "len", "=", "arguments", ".", "length", ";", "for", "(", ";", "i", "<", "len", ";", "i", "++", ")", "args", "[", "i", "]", "=", "arguments", "[", "i", "]", ";", "return", "chain", ".", "match", "(", "args", ",", "this", ")", ";", "}", ";", "fn", ".", "alt", "=", "function", "(", ")", "{", "var", "args", "=", "slice", ".", "call", "(", "arguments", ")", ";", "args", ".", "push", "(", "chain", ")", ";", "return", "pattern", ".", "apply", "(", "null", ",", "args", ")", ";", "}", ";", "fn", ".", "__matchChain", "=", "chain", ";", "return", "fn", ";", "}" ]
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
23,444
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"); return matcher.apply(context, args); } return pattern(matcher).apply(context, args); }
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"); return matcher.apply(context, args); } return pattern(matcher).apply(context, args); }
[ "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\"", ")", ";", "return", "matcher", ".", "apply", "(", "context", ",", "args", ")", ";", "}", "return", "pattern", "(", "matcher", ")", ".", "apply", "(", "context", ",", "args", ")", ";", "}" ]
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
23,445
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", "=", "getOrCompile", "(", "arguments", "[", "0", "]", ")", ";", "return", "patternFn", ".", "call", "(", "context", ",", "args", ",", "runtime", ")", "||", "null", ";", "}" ]
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", "extracted", "values", "." ]
9114609c7009b4ad6db6c9bdf044380c022b921a
https://github.com/natefaubion/matches.js/blob/9114609c7009b4ad6db6c9bdf044380c022b921a/matches.js#L1091-L1096
23,446
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", "[", "args", "[", "i", "++", "]", "]", "=", "args", "[", "i", "]", ";", "}", "return", "obj", ";", "}" ]
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", "etc", ".", "Avoid", "it", "in", "performance", "critical", "situations", "like", "looping" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L188-L197
23,447
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", ")", ".", "join", "(", "0", ")", "+", "number", ";", "}" ]
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
23,448
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", ".", "call", "(", "arguments", ")", ";", "args", ".", "unshift", "(", "proceed", ")", ";", "return", "func", ".", "apply", "(", "this", ",", "args", ")", ";", "}", ";", "}" ]
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 function, except that the original function is unshifted and passed as the first argument.
[ "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
23,449
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 = segment.split(':'); path = valueAndFormat.shift().split('.'); // get first and leave format len = path.length; val = ctx; // Assign deeper paths for (i = 0; i < len; i++) { val = val[path[i]]; } // Format the replacement if (valueAndFormat.length) { val = formatSingle(valueAndFormat.join(':'), val); } // Push the result and advance the cursor ret.push(val); } else { ret.push(segment); } str = str.slice(index + 1); // the rest isInside = !isInside; // toggle splitter = isInside ? '}' : '{'; // now look for next matching bracket } ret.push(str); return ret.join(''); }
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 = segment.split(':'); path = valueAndFormat.shift().split('.'); // get first and leave format len = path.length; val = ctx; // Assign deeper paths for (i = 0; i < len; i++) { val = val[path[i]]; } // Format the replacement if (valueAndFormat.length) { val = formatSingle(valueAndFormat.join(':'), val); } // Push the result and advance the cursor ret.push(val); } else { ret.push(segment); } str = str.slice(index + 1); // the rest isInside = !isInside; // toggle splitter = isInside ? '}' : '{'; // now look for next matching bracket } ret.push(str); return ret.join(''); }
[ "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", "=", "segment", ".", "split", "(", "':'", ")", ";", "path", "=", "valueAndFormat", ".", "shift", "(", ")", ".", "split", "(", "'.'", ")", ";", "// get first and leave format", "len", "=", "path", ".", "length", ";", "val", "=", "ctx", ";", "// Assign deeper paths", "for", "(", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "val", "=", "val", "[", "path", "[", "i", "]", "]", ";", "}", "// Format the replacement", "if", "(", "valueAndFormat", ".", "length", ")", "{", "val", "=", "formatSingle", "(", "valueAndFormat", ".", "join", "(", "':'", ")", ",", "val", ")", ";", "}", "// Push the result and advance the cursor", "ret", ".", "push", "(", "val", ")", ";", "}", "else", "{", "ret", ".", "push", "(", "segment", ")", ";", "}", "str", "=", "str", ".", "slice", "(", "index", "+", "1", ")", ";", "// the rest", "isInside", "=", "!", "isInside", ";", "// toggle", "splitter", "=", "isInside", "?", "'}'", ":", "'{'", ";", "// now look for next matching bracket", "}", "ret", ".", "push", "(", "str", ")", ";", "return", "ret", ".", "join", "(", "''", ")", ";", "}" ]
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
23,450
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
23,451
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", "]", "!==", "except", "&&", "obj", "[", "n", "]", ".", "destroy", ")", "{", "// Invoke the destroy", "obj", "[", "n", "]", ".", "destroy", "(", ")", ";", "}", "// Delete the property from the object.", "delete", "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 delete it.
[ "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", "." ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L914-L926
23,452
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", ")", "{", "garbageBin", ".", "appendChild", "(", "element", ")", ";", "}", "garbageBin", ".", "innerHTML", "=", "''", ";", "}" ]
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
23,453
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", ".", "console", ")", "{", "console", ".", "log", "(", "msg", ")", ";", "}", "}" ]
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
23,454
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 move points have six parameters like bezier curves i = arr.length; while (i--) { if (arr[i] === M) { arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]); } } }; if (bezier) { sixify(start); sixify(end); } // pull out the base lines before padding if (elem.isArea) { startBaseLine = start.splice(start.length - 6, 6); endBaseLine = end.splice(end.length - 6, 6); } // if shifting points, prepend a dummy point to the end path if (shift <= end.length / numParams && start.length === end.length) { while (shift--) { end = [].concat(end).splice(0, numParams).concat(end); } } elem.shift = 0; // reset for following animations // copy and append last point until the length matches the end length if (start.length) { endLength = end.length; while (start.length < endLength) { //bezier && sixify(start); slice = [].concat(start).splice(start.length - numParams, numParams); if (bezier) { // disable first control point slice[numParams - 6] = slice[numParams - 2]; slice[numParams - 5] = slice[numParams - 1]; } start = start.concat(slice); } } if (startBaseLine) { // append the base lines for areas start = start.concat(startBaseLine); end = end.concat(endBaseLine); } return [start, end]; }
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 move points have six parameters like bezier curves i = arr.length; while (i--) { if (arr[i] === M) { arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]); } } }; if (bezier) { sixify(start); sixify(end); } // pull out the base lines before padding if (elem.isArea) { startBaseLine = start.splice(start.length - 6, 6); endBaseLine = end.splice(end.length - 6, 6); } // if shifting points, prepend a dummy point to the end path if (shift <= end.length / numParams && start.length === end.length) { while (shift--) { end = [].concat(end).splice(0, numParams).concat(end); } } elem.shift = 0; // reset for following animations // copy and append last point until the length matches the end length if (start.length) { endLength = end.length; while (start.length < endLength) { //bezier && sixify(start); slice = [].concat(start).splice(start.length - numParams, numParams); if (bezier) { // disable first control point slice[numParams - 6] = slice[numParams - 2]; slice[numParams - 5] = slice[numParams - 1]; } start = start.concat(slice); } } if (startBaseLine) { // append the base lines for areas start = start.concat(startBaseLine); end = end.concat(endBaseLine); } return [start, end]; }
[ "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 move points have six parameters like bezier curves", "i", "=", "arr", ".", "length", ";", "while", "(", "i", "--", ")", "{", "if", "(", "arr", "[", "i", "]", "===", "M", ")", "{", "arr", ".", "splice", "(", "i", "+", "1", ",", "0", ",", "arr", "[", "i", "+", "1", "]", ",", "arr", "[", "i", "+", "2", "]", ",", "arr", "[", "i", "+", "1", "]", ",", "arr", "[", "i", "+", "2", "]", ")", ";", "}", "}", "}", ";", "if", "(", "bezier", ")", "{", "sixify", "(", "start", ")", ";", "sixify", "(", "end", ")", ";", "}", "// pull out the base lines before padding", "if", "(", "elem", ".", "isArea", ")", "{", "startBaseLine", "=", "start", ".", "splice", "(", "start", ".", "length", "-", "6", ",", "6", ")", ";", "endBaseLine", "=", "end", ".", "splice", "(", "end", ".", "length", "-", "6", ",", "6", ")", ";", "}", "// if shifting points, prepend a dummy point to the end path", "if", "(", "shift", "<=", "end", ".", "length", "/", "numParams", "&&", "start", ".", "length", "===", "end", ".", "length", ")", "{", "while", "(", "shift", "--", ")", "{", "end", "=", "[", "]", ".", "concat", "(", "end", ")", ".", "splice", "(", "0", ",", "numParams", ")", ".", "concat", "(", "end", ")", ";", "}", "}", "elem", ".", "shift", "=", "0", ";", "// reset for following animations", "// copy and append last point until the length matches the end length", "if", "(", "start", ".", "length", ")", "{", "endLength", "=", "end", ".", "length", ";", "while", "(", "start", ".", "length", "<", "endLength", ")", "{", "//bezier && sixify(start);", "slice", "=", "[", "]", ".", "concat", "(", "start", ")", ".", "splice", "(", "start", ".", "length", "-", "numParams", ",", "numParams", ")", ";", "if", "(", "bezier", ")", "{", "// disable first control point", "slice", "[", "numParams", "-", "6", "]", "=", "slice", "[", "numParams", "-", "2", "]", ";", "slice", "[", "numParams", "-", "5", "]", "=", "slice", "[", "numParams", "-", "1", "]", ";", "}", "start", "=", "start", ".", "concat", "(", "slice", ")", ";", "}", "}", "if", "(", "startBaseLine", ")", "{", "// append the base lines for areas", "start", "=", "start", ".", "concat", "(", "startBaseLine", ")", ";", "end", "=", "end", ".", "concat", "(", "endBaseLine", ")", ";", "}", "return", "[", "start", ",", "end", "]", ";", "}" ]
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
23,455
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]) { el[func] = function () {}; } $(el).unbind(eventType, handler); }
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]) { el[func] = function () {}; } $(el).unbind(eventType, handler); }
[ "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", "]", ")", "{", "el", "[", "func", "]", "=", "function", "(", ")", "{", "}", ";", "}", "$", "(", "el", ")", ".", "unbind", "(", "eventType", ",", "handler", ")", ";", "}" ]
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
23,456
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 // raises the warning when they are copied over in the extend statement below. // // To avoid problems in IE (see #1010) where we cannot delete the properties and avoid // testing if they are there (warning in chrome) the only option is to test if running IE. if (!isIE && eventArguments) { delete eventArguments.layerX; delete eventArguments.layerY; } extend(event, eventArguments); // Prevent jQuery from triggering the object method that is named the // same as the event. For example, if the event is 'select', jQuery // attempts calling el.select and it goes into a loop. if (el[type]) { el[detachedType] = el[type]; el[type] = null; } // Wrap preventDefault and stopPropagation in try/catch blocks in // order to prevent JS errors when cancelling events on non-DOM // objects. #615. /*jslint unparam: true*/ $.each(['preventDefault', 'stopPropagation'], function (i, fn) { var base = event[fn]; event[fn] = function () { try { base.call(event); } catch (e) { if (fn === 'preventDefault') { defaultPrevented = true; } } }; }); /*jslint unparam: false*/ // trigger it $(el).trigger(event); // attach the method if (el[detachedType]) { el[type] = el[detachedType]; el[detachedType] = null; } if (defaultFunction && !event.isDefaultPrevented() && !defaultPrevented) { defaultFunction(event); } }
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 // raises the warning when they are copied over in the extend statement below. // // To avoid problems in IE (see #1010) where we cannot delete the properties and avoid // testing if they are there (warning in chrome) the only option is to test if running IE. if (!isIE && eventArguments) { delete eventArguments.layerX; delete eventArguments.layerY; } extend(event, eventArguments); // Prevent jQuery from triggering the object method that is named the // same as the event. For example, if the event is 'select', jQuery // attempts calling el.select and it goes into a loop. if (el[type]) { el[detachedType] = el[type]; el[type] = null; } // Wrap preventDefault and stopPropagation in try/catch blocks in // order to prevent JS errors when cancelling events on non-DOM // objects. #615. /*jslint unparam: true*/ $.each(['preventDefault', 'stopPropagation'], function (i, fn) { var base = event[fn]; event[fn] = function () { try { base.call(event); } catch (e) { if (fn === 'preventDefault') { defaultPrevented = true; } } }; }); /*jslint unparam: false*/ // trigger it $(el).trigger(event); // attach the method if (el[detachedType]) { el[type] = el[detachedType]; el[detachedType] = null; } if (defaultFunction && !event.isDefaultPrevented() && !defaultPrevented) { defaultFunction(event); } }
[ "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", "// raises the warning when they are copied over in the extend statement below.", "//", "// To avoid problems in IE (see #1010) where we cannot delete the properties and avoid", "// testing if they are there (warning in chrome) the only option is to test if running IE.", "if", "(", "!", "isIE", "&&", "eventArguments", ")", "{", "delete", "eventArguments", ".", "layerX", ";", "delete", "eventArguments", ".", "layerY", ";", "}", "extend", "(", "event", ",", "eventArguments", ")", ";", "// Prevent jQuery from triggering the object method that is named the", "// same as the event. For example, if the event is 'select', jQuery", "// attempts calling el.select and it goes into a loop.", "if", "(", "el", "[", "type", "]", ")", "{", "el", "[", "detachedType", "]", "=", "el", "[", "type", "]", ";", "el", "[", "type", "]", "=", "null", ";", "}", "// Wrap preventDefault and stopPropagation in try/catch blocks in", "// order to prevent JS errors when cancelling events on non-DOM", "// objects. #615.", "/*jslint unparam: true*/", "$", ".", "each", "(", "[", "'preventDefault'", ",", "'stopPropagation'", "]", ",", "function", "(", "i", ",", "fn", ")", "{", "var", "base", "=", "event", "[", "fn", "]", ";", "event", "[", "fn", "]", "=", "function", "(", ")", "{", "try", "{", "base", ".", "call", "(", "event", ")", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "fn", "===", "'preventDefault'", ")", "{", "defaultPrevented", "=", "true", ";", "}", "}", "}", ";", "}", ")", ";", "/*jslint unparam: false*/", "// trigger it", "$", "(", "el", ")", ".", "trigger", "(", "event", ")", ";", "// attach the method", "if", "(", "el", "[", "detachedType", "]", ")", "{", "el", "[", "type", "]", "=", "el", "[", "detachedType", "]", ";", "el", "[", "detachedType", "]", "=", "null", ";", "}", "if", "(", "defaultFunction", "&&", "!", "event", ".", "isDefaultPrevented", "(", ")", "&&", "!", "defaultPrevented", ")", "{", "defaultFunction", "(", "event", ")", ";", "}", "}" ]
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
23,457
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", ";", "ret", ".", "pageY", "=", "e", ".", "pageY", ";", "}", "return", "ret", ";", "}" ]
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
23,458
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 is set on an element wrapper. Returning false prevents the default attribute * setter to run. Returning a value causes the default setter to set that value. Used in * Renderer.label. */ wrapper.attrSetters = {}; }
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 is set on an element wrapper. Returning false prevents the default attribute * setter to run. Returning a value causes the default setter to set that value. Used in * Renderer.label. */ wrapper.attrSetters = {}; }
[ "function", "(", "renderer", ",", "nodeName", ")", "{", "var", "wrapper", "=", "this", ";", "wrapper", ".", "element", "=", "nodeName", "===", "'span'", "?", "createElement", "(", "nodeName", ")", ":", "doc", ".", "createElementNS", "(", "SVG_NS", ",", "nodeName", ")", ";", "wrapper", ".", "renderer", "=", "renderer", ";", "/**\n\t\t * A collection of attribute setters. These methods, if defined, are called right before a certain\n\t\t * attribute is set on an element wrapper. Returning false prevents the default attribute\n\t\t * setter to run. Returning a value causes the default setter to set that value. Used in\n\t\t * Renderer.label.\n\t\t */", "wrapper", ".", "attrSetters", "=", "{", "}", ";", "}" ]
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
23,459
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 without overwriting it animOptions.complete = complete; } animate(this, params, animOptions); } else { this.attr(params); if (complete) { complete(); } } }
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 without overwriting it animOptions.complete = complete; } animate(this, params, animOptions); } else { this.attr(params); if (complete) { complete(); } } }
[ "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 without overwriting it", "animOptions", ".", "complete", "=", "complete", ";", "}", "animate", "(", "this", ",", "params", ",", "animOptions", ")", ";", "}", "else", "{", "this", ".", "attr", "(", "params", ")", ";", "if", "(", "complete", ")", "{", "complete", "(", ")", ";", "}", "}", "}" ]
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
23,460
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", ")", "===", "-", "1", ")", "{", "attr", "(", "element", ",", "'class'", ",", "currentClassName", "+", "' '", "+", "className", ")", ";", "}", "return", "this", ";", "}" ]
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
23,461
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.toLowerCase(); }; /*jslint unparam: false*/ // convert legacy if (styles && styles.color) { styles.fill = styles.color; } // Merge the new styles with the old ones styles = extend( elemWrapper.styles, styles ); // store object elemWrapper.styles = styles; // Don't handle line wrap on canvas if (useCanVG && textWidth) { delete styles.width; } // serialize and set style attribute if (isIE && !hasSVG) { // legacy IE doesn't support setting style attribute if (textWidth) { delete styles.width; } css(elemWrapper.element, styles); } else { for (n in styles) { serializedCss += n.replace(/([A-Z])/g, hyphenate) + ':' + styles[n] + ';'; } attr(elem, 'style', serializedCss); // #1881 } // re-build text if (textWidth && elemWrapper.added) { elemWrapper.renderer.buildText(elemWrapper); } return elemWrapper; }
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.toLowerCase(); }; /*jslint unparam: false*/ // convert legacy if (styles && styles.color) { styles.fill = styles.color; } // Merge the new styles with the old ones styles = extend( elemWrapper.styles, styles ); // store object elemWrapper.styles = styles; // Don't handle line wrap on canvas if (useCanVG && textWidth) { delete styles.width; } // serialize and set style attribute if (isIE && !hasSVG) { // legacy IE doesn't support setting style attribute if (textWidth) { delete styles.width; } css(elemWrapper.element, styles); } else { for (n in styles) { serializedCss += n.replace(/([A-Z])/g, hyphenate) + ':' + styles[n] + ';'; } attr(elem, 'style', serializedCss); // #1881 } // re-build text if (textWidth && elemWrapper.added) { elemWrapper.renderer.buildText(elemWrapper); } return elemWrapper; }
[ "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", ".", "toLowerCase", "(", ")", ";", "}", ";", "/*jslint unparam: false*/", "// convert legacy", "if", "(", "styles", "&&", "styles", ".", "color", ")", "{", "styles", ".", "fill", "=", "styles", ".", "color", ";", "}", "// Merge the new styles with the old ones", "styles", "=", "extend", "(", "elemWrapper", ".", "styles", ",", "styles", ")", ";", "// store object", "elemWrapper", ".", "styles", "=", "styles", ";", "// Don't handle line wrap on canvas", "if", "(", "useCanVG", "&&", "textWidth", ")", "{", "delete", "styles", ".", "width", ";", "}", "// serialize and set style attribute", "if", "(", "isIE", "&&", "!", "hasSVG", ")", "{", "// legacy IE doesn't support setting style attribute", "if", "(", "textWidth", ")", "{", "delete", "styles", ".", "width", ";", "}", "css", "(", "elemWrapper", ".", "element", ",", "styles", ")", ";", "}", "else", "{", "for", "(", "n", "in", "styles", ")", "{", "serializedCss", "+=", "n", ".", "replace", "(", "/", "([A-Z])", "/", "g", ",", "hyphenate", ")", "+", "':'", "+", "styles", "[", "n", "]", "+", "';'", ";", "}", "attr", "(", "elem", ",", "'style'", ",", "serializedCss", ")", ";", "// #1881", "}", "// re-build text", "if", "(", "textWidth", "&&", "elemWrapper", ".", "added", ")", "{", "elemWrapper", ".", "renderer", ".", "buildText", "(", "elemWrapper", ")", ";", "}", "return", "elemWrapper", ";", "}" ]
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
23,462
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.element, styles); return wrapper; }
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.element, styles); return wrapper; }
[ "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", ".", "element", ",", "styles", ")", ";", "return", "wrapper", ";", "}" ]
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
23,463
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", ")", ")", "{", "// attributes", "extend", "(", "attr", ",", "path", ")", ";", "}", "return", "this", ".", "createElement", "(", "'path'", ")", ".", "attr", "(", "attr", ")", ";", "}" ]
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
23,464
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); // set the href in the xlink namespace if (elemWrapper.element.setAttributeNS) { elemWrapper.element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src); } else { // could be exporting in IE // using href throws "not supported" in ie7 and under, requries regex shim to fix later elemWrapper.element.setAttribute('hc-svg-href', src); } return elemWrapper; }
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); // set the href in the xlink namespace if (elemWrapper.element.setAttributeNS) { elemWrapper.element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src); } else { // could be exporting in IE // using href throws "not supported" in ie7 and under, requries regex shim to fix later elemWrapper.element.setAttribute('hc-svg-href', src); } return elemWrapper; }
[ "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", ")", ";", "// set the href in the xlink namespace", "if", "(", "elemWrapper", ".", "element", ".", "setAttributeNS", ")", "{", "elemWrapper", ".", "element", ".", "setAttributeNS", "(", "'http://www.w3.org/1999/xlink'", ",", "'href'", ",", "src", ")", ";", "}", "else", "{", "// could be exporting in IE", "// using href throws \"not supported\" in ie7 and under, requries regex shim to fix later", "elemWrapper", ".", "element", ".", "setAttribute", "(", "'hc-svg-href'", ",", "src", ")", ";", "}", "return", "elemWrapper", ";", "}" ]
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
23,465
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 === 'center' || textAlign === 'right')) { x += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width); } // update if anything changed if (x !== text.x || y !== text.y) { text.attr({ x: x, y: y }); } // record current values text.x = x; text.y = y; }
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 === 'center' || textAlign === 'right')) { x += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width); } // update if anything changed if (x !== text.x || y !== text.y) { text.attr({ x: x, y: y }); } // record current values text.x = x; text.y = y; }
[ "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", "===", "'center'", "||", "textAlign", "===", "'right'", ")", ")", "{", "x", "+=", "{", "center", ":", "0.5", ",", "right", ":", "1", "}", "[", "textAlign", "]", "*", "(", "width", "-", "bBox", ".", "width", ")", ";", "}", "// update if anything changed", "if", "(", "x", "!==", "text", ".", "x", "||", "y", "!==", "text", ".", "y", ")", "{", "text", ".", "attr", "(", "{", "x", ":", "x", ",", "y", ":", "y", "}", ")", ";", "}", "// record current values", "text", ".", "x", "=", "x", ";", "text", ".", "y", "=", "y", ";", "}" ]
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
23,466
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
23,467
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] !== UNDEFINED) { textStyles[prop] = styles[prop]; delete styles[prop]; } }); text.css(textStyles); } return baseCss.call(wrapper, styles); }
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] !== UNDEFINED) { textStyles[prop] = styles[prop]; delete styles[prop]; } }); text.css(textStyles); } return baseCss.call(wrapper, styles); }
[ "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", "]", "!==", "UNDEFINED", ")", "{", "textStyles", "[", "prop", "]", "=", "styles", "[", "prop", "]", ";", "delete", "styles", "[", "prop", "]", ";", "}", "}", ")", ";", "text", ".", "css", "(", "textStyles", ")", ";", "}", "return", "baseCss", ".", "call", "(", "wrapper", ",", "styles", ")", ";", "}" ]
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
23,468
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", ".", "y", "-", "padding", "}", ";", "}" ]
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
23,469
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] = mathRound(value[i] * 10) - 5; } else if (value[i] === 'Z') { // close the path path[i] = 'x'; } else { path[i] = value[i]; // When the start X and end X coordinates of an arc are too close, // they are rounded to the same value above. In this case, substract 1 from the end X // position. #760, #1371. if (value.isArc && (value[i] === 'wa' || value[i] === 'at')) { clockwise = value[i] === 'wa' ? 1 : -1; // #1642 if (path[i + 5] === path[i + 7]) { path[i + 7] -= clockwise; } // Start and end Y (#1410) if (path[i + 6] === path[i + 8]) { path[i + 8] -= clockwise; } } } } // Loop up again to handle path shortcuts (#2132) /*while (i++ < path.length) { if (path[i] === 'H') { // horizontal line to path[i] = 'L'; path.splice(i + 2, 0, path[i - 1]); } else if (path[i] === 'V') { // vertical line to path[i] = 'L'; path.splice(i + 1, 0, path[i - 2]); } }*/ return path.join(' ') || 'x'; }
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] = mathRound(value[i] * 10) - 5; } else if (value[i] === 'Z') { // close the path path[i] = 'x'; } else { path[i] = value[i]; // When the start X and end X coordinates of an arc are too close, // they are rounded to the same value above. In this case, substract 1 from the end X // position. #760, #1371. if (value.isArc && (value[i] === 'wa' || value[i] === 'at')) { clockwise = value[i] === 'wa' ? 1 : -1; // #1642 if (path[i + 5] === path[i + 7]) { path[i + 7] -= clockwise; } // Start and end Y (#1410) if (path[i + 6] === path[i + 8]) { path[i + 8] -= clockwise; } } } } // Loop up again to handle path shortcuts (#2132) /*while (i++ < path.length) { if (path[i] === 'H') { // horizontal line to path[i] = 'L'; path.splice(i + 2, 0, path[i - 1]); } else if (path[i] === 'V') { // vertical line to path[i] = 'L'; path.splice(i + 1, 0, path[i - 2]); } }*/ return path.join(' ') || 'x'; }
[ "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", "]", "=", "mathRound", "(", "value", "[", "i", "]", "*", "10", ")", "-", "5", ";", "}", "else", "if", "(", "value", "[", "i", "]", "===", "'Z'", ")", "{", "// close the path", "path", "[", "i", "]", "=", "'x'", ";", "}", "else", "{", "path", "[", "i", "]", "=", "value", "[", "i", "]", ";", "// When the start X and end X coordinates of an arc are too close,", "// they are rounded to the same value above. In this case, substract 1 from the end X", "// position. #760, #1371.", "if", "(", "value", ".", "isArc", "&&", "(", "value", "[", "i", "]", "===", "'wa'", "||", "value", "[", "i", "]", "===", "'at'", ")", ")", "{", "clockwise", "=", "value", "[", "i", "]", "===", "'wa'", "?", "1", ":", "-", "1", ";", "// #1642", "if", "(", "path", "[", "i", "+", "5", "]", "===", "path", "[", "i", "+", "7", "]", ")", "{", "path", "[", "i", "+", "7", "]", "-=", "clockwise", ";", "}", "// Start and end Y (#1410)", "if", "(", "path", "[", "i", "+", "6", "]", "===", "path", "[", "i", "+", "8", "]", ")", "{", "path", "[", "i", "+", "8", "]", "-=", "clockwise", ";", "}", "}", "}", "}", "// Loop up again to handle path shortcuts (#2132)", "/*while (i++ < path.length) {\n\t\t\tif (path[i] === 'H') { // horizontal line to\n\t\t\t\tpath[i] = 'L';\n\t\t\t\tpath.splice(i + 2, 0, path[i - 1]);\n\t\t\t} else if (path[i] === 'V') { // vertical line to\n\t\t\t\tpath[i] = 'L';\n\t\t\t\tpath.splice(i + 1, 0, path[i - 2]);\n\t\t\t}\n\t\t}*/", "return", "path", ".", "join", "(", "' '", ")", "||", "'x'", ";", "}" ]
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
23,470
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", ")", "{", "path", "[", "len", "-", "4", "]", "=", "path", "[", "len", "-", "2", "]", "=", "pInt", "(", "path", "[", "len", "-", "2", "]", ")", "-", "10", "*", "length", ";", "}", "return", "path", ".", "join", "(", "' '", ")", ";", "}" ]
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
23,471
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", ";", "}", "else", "if", "(", "isObject", "(", "path", ")", ")", "{", "// attributes", "extend", "(", "attr", ",", "path", ")", ";", "}", "// create the shape", "return", "this", ".", "createElement", "(", "'shape'", ")", ".", "attr", "(", "attr", ")", ";", "}" ]
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
23,472
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", "++", ")", "{", "deferredRenderCalls", "[", "callIndex", "]", "(", ")", ";", "}", "// Clear the list", "deferredRenderCalls", "=", "[", "]", ";", "}" ]
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
23,473
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", ".", "horiz", "?", "'height'", ":", "'width'", "]", ":", "0", ";", "}" ]
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
23,474
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.oldChartWidth) || chart.chartWidth) - axis.right - axis.left : 0), y: horiz ? cHeight - axis.bottom + axis.offset - (axis.opposite ? axis.height : 0) : cHeight - axis.translate(pos + tickmarkOffset, null, null, old) - axis.transB }; }
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.oldChartWidth) || chart.chartWidth) - axis.right - axis.left : 0), y: horiz ? cHeight - axis.bottom + axis.offset - (axis.opposite ? axis.height : 0) : cHeight - axis.translate(pos + tickmarkOffset, null, null, old) - axis.transB }; }
[ "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", ".", "oldChartWidth", ")", "||", "chart", ".", "chartWidth", ")", "-", "axis", ".", "right", "-", "axis", ".", "left", ":", "0", ")", ",", "y", ":", "horiz", "?", "cHeight", "-", "axis", ".", "bottom", "+", "axis", ".", "offset", "-", "(", "axis", ".", "opposite", "?", "axis", ".", "height", ":", "0", ")", ":", "cHeight", "-", "axis", ".", "translate", "(", "pos", "+", "tickmarkOffset", ",", "null", ",", "null", ",", "old", ")", "-", "axis", ".", "transB", "}", ";", "}" ]
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
23,475
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", ":", "-", "tickLength", ")", ",", "y", "+", "(", "horiz", "?", "tickLength", ":", "0", ")", "]", ",", "tickWidth", ")", ";", "}" ]
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
23,476
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: UNDEFINED })); chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(); } }
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: UNDEFINED })); chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(); } }
[ "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", ":", "UNDEFINED", "}", ")", ")", ";", "chart", ".", "isDirtyBox", "=", "true", ";", "if", "(", "pick", "(", "redraw", ",", "true", ")", ")", "{", "chart", ".", "redraw", "(", ")", ";", "}", "}" ]
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
23,477
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); each(chart[key], function (axis, i) { // Re-index, #1706 axis.options.index = i; }); this.destroy(); chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(); } }
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); each(chart[key], function (axis, i) { // Re-index, #1706 axis.options.index = i; }); this.destroy(); chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(); } }
[ "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", ")", ";", "each", "(", "chart", "[", "key", "]", ",", "function", "(", "axis", ",", "i", ")", "{", "// Re-index, #1706", "axis", ".", "options", ".", "index", "=", "i", ";", "}", ")", ";", "this", ".", "destroy", "(", ")", ";", "chart", ".", "isDirtyBox", "=", "true", ";", "if", "(", "pick", "(", "redraw", ",", "true", ")", ")", "{", "chart", ".", "redraw", "(", ")", ";", "}", "}" ]
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
23,478
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
23,479
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", ".", "push", "(", "toPath", "[", "4", "]", ",", "toPath", "[", "5", "]", ",", "toPath", "[", "1", "]", ",", "toPath", "[", "2", "]", ")", ";", "}", "else", "{", "// outside the axis area", "path", "=", "null", ";", "}", "return", "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
23,480
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; } // First case: All ticks fall on whole logarithms: 1, 10, 100 etc. if (interval >= 0.5) { interval = mathRound(interval); positions = axis.getLinearTickPositions(interval, min, max); // Second case: We need intermediary ticks. For example // 1, 2, 4, 6, 8, 10, 20, 40 etc. } else if (interval >= 0.08) { var roundedMin = mathFloor(min), intermediate, i, j, len, pos, lastPos, break2; if (interval > 0.3) { intermediate = [1, 2, 4]; } else if (interval > 0.15) { // 0.2 equals five minor ticks per 1, 10, 100 etc intermediate = [1, 2, 4, 6, 8]; } else { // 0.1 equals ten minor ticks per 1, 10, 100 etc intermediate = [1, 2, 3, 4, 5, 6, 7, 8, 9]; } for (i = roundedMin; i < max + 1 && !break2; i++) { len = intermediate.length; for (j = 0; j < len && !break2; j++) { pos = log2lin(lin2log(i) * intermediate[j]); if (pos > min && (!minor || lastPos <= max)) { // #1670 positions.push(lastPos); } if (lastPos > max) { break2 = true; } lastPos = pos; } } // Third case: We are so deep in between whole logarithmic values that // we might as well handle the tick positions like a linear axis. For // example 1.01, 1.02, 1.03, 1.04. } else { var realMin = lin2log(min), realMax = lin2log(max), tickIntervalOption = options[minor ? 'minorTickInterval' : 'tickInterval'], filteredTickIntervalOption = tickIntervalOption === 'auto' ? null : tickIntervalOption, tickPixelIntervalOption = options.tickPixelInterval / (minor ? 5 : 1), totalPixelLength = minor ? axisLength / axis.tickPositions.length : axisLength; interval = pick( filteredTickIntervalOption, axis._minorAutoInterval, (realMax - realMin) * tickPixelIntervalOption / (totalPixelLength || 1) ); interval = normalizeTickInterval( interval, null, getMagnitude(interval) ); positions = map(axis.getLinearTickPositions( interval, realMin, realMax ), log2lin); if (!minor) { axis._minorAutoInterval = interval / 5; } } // Set the axis-level tickInterval variable if (!minor) { axis.tickInterval = interval; } return positions; }
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; } // First case: All ticks fall on whole logarithms: 1, 10, 100 etc. if (interval >= 0.5) { interval = mathRound(interval); positions = axis.getLinearTickPositions(interval, min, max); // Second case: We need intermediary ticks. For example // 1, 2, 4, 6, 8, 10, 20, 40 etc. } else if (interval >= 0.08) { var roundedMin = mathFloor(min), intermediate, i, j, len, pos, lastPos, break2; if (interval > 0.3) { intermediate = [1, 2, 4]; } else if (interval > 0.15) { // 0.2 equals five minor ticks per 1, 10, 100 etc intermediate = [1, 2, 4, 6, 8]; } else { // 0.1 equals ten minor ticks per 1, 10, 100 etc intermediate = [1, 2, 3, 4, 5, 6, 7, 8, 9]; } for (i = roundedMin; i < max + 1 && !break2; i++) { len = intermediate.length; for (j = 0; j < len && !break2; j++) { pos = log2lin(lin2log(i) * intermediate[j]); if (pos > min && (!minor || lastPos <= max)) { // #1670 positions.push(lastPos); } if (lastPos > max) { break2 = true; } lastPos = pos; } } // Third case: We are so deep in between whole logarithmic values that // we might as well handle the tick positions like a linear axis. For // example 1.01, 1.02, 1.03, 1.04. } else { var realMin = lin2log(min), realMax = lin2log(max), tickIntervalOption = options[minor ? 'minorTickInterval' : 'tickInterval'], filteredTickIntervalOption = tickIntervalOption === 'auto' ? null : tickIntervalOption, tickPixelIntervalOption = options.tickPixelInterval / (minor ? 5 : 1), totalPixelLength = minor ? axisLength / axis.tickPositions.length : axisLength; interval = pick( filteredTickIntervalOption, axis._minorAutoInterval, (realMax - realMin) * tickPixelIntervalOption / (totalPixelLength || 1) ); interval = normalizeTickInterval( interval, null, getMagnitude(interval) ); positions = map(axis.getLinearTickPositions( interval, realMin, realMax ), log2lin); if (!minor) { axis._minorAutoInterval = interval / 5; } } // Set the axis-level tickInterval variable if (!minor) { axis.tickInterval = interval; } return positions; }
[ "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", ";", "}", "// First case: All ticks fall on whole logarithms: 1, 10, 100 etc.", "if", "(", "interval", ">=", "0.5", ")", "{", "interval", "=", "mathRound", "(", "interval", ")", ";", "positions", "=", "axis", ".", "getLinearTickPositions", "(", "interval", ",", "min", ",", "max", ")", ";", "// Second case: We need intermediary ticks. For example ", "// 1, 2, 4, 6, 8, 10, 20, 40 etc. ", "}", "else", "if", "(", "interval", ">=", "0.08", ")", "{", "var", "roundedMin", "=", "mathFloor", "(", "min", ")", ",", "intermediate", ",", "i", ",", "j", ",", "len", ",", "pos", ",", "lastPos", ",", "break2", ";", "if", "(", "interval", ">", "0.3", ")", "{", "intermediate", "=", "[", "1", ",", "2", ",", "4", "]", ";", "}", "else", "if", "(", "interval", ">", "0.15", ")", "{", "// 0.2 equals five minor ticks per 1, 10, 100 etc", "intermediate", "=", "[", "1", ",", "2", ",", "4", ",", "6", ",", "8", "]", ";", "}", "else", "{", "// 0.1 equals ten minor ticks per 1, 10, 100 etc", "intermediate", "=", "[", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8", ",", "9", "]", ";", "}", "for", "(", "i", "=", "roundedMin", ";", "i", "<", "max", "+", "1", "&&", "!", "break2", ";", "i", "++", ")", "{", "len", "=", "intermediate", ".", "length", ";", "for", "(", "j", "=", "0", ";", "j", "<", "len", "&&", "!", "break2", ";", "j", "++", ")", "{", "pos", "=", "log2lin", "(", "lin2log", "(", "i", ")", "*", "intermediate", "[", "j", "]", ")", ";", "if", "(", "pos", ">", "min", "&&", "(", "!", "minor", "||", "lastPos", "<=", "max", ")", ")", "{", "// #1670", "positions", ".", "push", "(", "lastPos", ")", ";", "}", "if", "(", "lastPos", ">", "max", ")", "{", "break2", "=", "true", ";", "}", "lastPos", "=", "pos", ";", "}", "}", "// Third case: We are so deep in between whole logarithmic values that", "// we might as well handle the tick positions like a linear axis. For", "// example 1.01, 1.02, 1.03, 1.04.", "}", "else", "{", "var", "realMin", "=", "lin2log", "(", "min", ")", ",", "realMax", "=", "lin2log", "(", "max", ")", ",", "tickIntervalOption", "=", "options", "[", "minor", "?", "'minorTickInterval'", ":", "'tickInterval'", "]", ",", "filteredTickIntervalOption", "=", "tickIntervalOption", "===", "'auto'", "?", "null", ":", "tickIntervalOption", ",", "tickPixelIntervalOption", "=", "options", ".", "tickPixelInterval", "/", "(", "minor", "?", "5", ":", "1", ")", ",", "totalPixelLength", "=", "minor", "?", "axisLength", "/", "axis", ".", "tickPositions", ".", "length", ":", "axisLength", ";", "interval", "=", "pick", "(", "filteredTickIntervalOption", ",", "axis", ".", "_minorAutoInterval", ",", "(", "realMax", "-", "realMin", ")", "*", "tickPixelIntervalOption", "/", "(", "totalPixelLength", "||", "1", ")", ")", ";", "interval", "=", "normalizeTickInterval", "(", "interval", ",", "null", ",", "getMagnitude", "(", "interval", ")", ")", ";", "positions", "=", "map", "(", "axis", ".", "getLinearTickPositions", "(", "interval", ",", "realMin", ",", "realMax", ")", ",", "log2lin", ")", ";", "if", "(", "!", "minor", ")", "{", "axis", ".", "_minorAutoInterval", "=", "interval", "/", "5", ";", "}", "}", "// Set the axis-level tickInterval variable ", "if", "(", "!", "minor", ")", "{", "axis", ".", "tickInterval", "=", "interval", ";", "}", "return", "positions", ";", "}" ]
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
23,481
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 = minorTickPositions.concat( axis.getLogTickPositions(minorTickInterval, tickPositions[i - 1], tickPositions[i], true) ); } } else if (axis.isDatetimeAxis && options.minorTickInterval === 'auto') { // #1314 minorTickPositions = minorTickPositions.concat( getTimeTicks( normalizeTimeTickInterval(minorTickInterval), axis.min, axis.max, options.startOfWeek ) ); if (minorTickPositions[0] < axis.min) { minorTickPositions.shift(); } } else { for (pos = axis.min + (tickPositions[0] - axis.min) % minorTickInterval; pos <= axis.max; pos += minorTickInterval) { minorTickPositions.push(pos); } } return minorTickPositions; }
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 = minorTickPositions.concat( axis.getLogTickPositions(minorTickInterval, tickPositions[i - 1], tickPositions[i], true) ); } } else if (axis.isDatetimeAxis && options.minorTickInterval === 'auto') { // #1314 minorTickPositions = minorTickPositions.concat( getTimeTicks( normalizeTimeTickInterval(minorTickInterval), axis.min, axis.max, options.startOfWeek ) ); if (minorTickPositions[0] < axis.min) { minorTickPositions.shift(); } } else { for (pos = axis.min + (tickPositions[0] - axis.min) % minorTickInterval; pos <= axis.max; pos += minorTickInterval) { minorTickPositions.push(pos); } } return minorTickPositions; }
[ "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", "=", "minorTickPositions", ".", "concat", "(", "axis", ".", "getLogTickPositions", "(", "minorTickInterval", ",", "tickPositions", "[", "i", "-", "1", "]", ",", "tickPositions", "[", "i", "]", ",", "true", ")", ")", ";", "}", "}", "else", "if", "(", "axis", ".", "isDatetimeAxis", "&&", "options", ".", "minorTickInterval", "===", "'auto'", ")", "{", "// #1314", "minorTickPositions", "=", "minorTickPositions", ".", "concat", "(", "getTimeTicks", "(", "normalizeTimeTickInterval", "(", "minorTickInterval", ")", ",", "axis", ".", "min", ",", "axis", ".", "max", ",", "options", ".", "startOfWeek", ")", ")", ";", "if", "(", "minorTickPositions", "[", "0", "]", "<", "axis", ".", "min", ")", "{", "minorTickPositions", ".", "shift", "(", ")", ";", "}", "}", "else", "{", "for", "(", "pos", "=", "axis", ".", "min", "+", "(", "tickPositions", "[", "0", "]", "-", "axis", ".", "min", ")", "%", "minorTickInterval", ";", "pos", "<=", "axis", ".", "max", ";", "pos", "+=", "minorTickInterval", ")", "{", "minorTickPositions", ".", "push", "(", "pos", ")", ";", "}", "}", "return", "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
23,482
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 closest point distance if (axis.isXAxis && axis.minRange === UNDEFINED && !axis.isLog) { if (defined(options.min) || defined(options.max)) { axis.minRange = null; // don't do this again } else { // Find the closest distance between raw data points, as opposed to // closestPointRange that applies to processed points (cropped and grouped) each(axis.series, function (series) { xData = series.xData; loopLength = series.xIncrement ? 1 : xData.length - 1; for (i = loopLength; i > 0; i--) { distance = xData[i] - xData[i - 1]; if (closestDataRange === UNDEFINED || distance < closestDataRange) { closestDataRange = distance; } } }); axis.minRange = mathMin(closestDataRange * 5, axis.dataMax - axis.dataMin); } } // if minRange is exceeded, adjust if (max - min < axis.minRange) { var minRange = axis.minRange; zoomOffset = (minRange - max + min) / 2; // if min and max options have been set, don't go beyond it minArgs = [min - zoomOffset, pick(options.min, min - zoomOffset)]; if (spaceAvailable) { // if space is available, stay within the data range minArgs[2] = axis.dataMin; } min = arrayMax(minArgs); maxArgs = [min + minRange, pick(options.max, min + minRange)]; if (spaceAvailable) { // if space is availabe, stay within the data range maxArgs[2] = axis.dataMax; } max = arrayMin(maxArgs); // now if the max is adjusted, adjust the min back if (max - min < minRange) { minArgs[0] = max - minRange; minArgs[1] = pick(options.min, max - minRange); min = arrayMax(minArgs); } } // Record modified extremes axis.min = min; axis.max = max; }
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 closest point distance if (axis.isXAxis && axis.minRange === UNDEFINED && !axis.isLog) { if (defined(options.min) || defined(options.max)) { axis.minRange = null; // don't do this again } else { // Find the closest distance between raw data points, as opposed to // closestPointRange that applies to processed points (cropped and grouped) each(axis.series, function (series) { xData = series.xData; loopLength = series.xIncrement ? 1 : xData.length - 1; for (i = loopLength; i > 0; i--) { distance = xData[i] - xData[i - 1]; if (closestDataRange === UNDEFINED || distance < closestDataRange) { closestDataRange = distance; } } }); axis.minRange = mathMin(closestDataRange * 5, axis.dataMax - axis.dataMin); } } // if minRange is exceeded, adjust if (max - min < axis.minRange) { var minRange = axis.minRange; zoomOffset = (minRange - max + min) / 2; // if min and max options have been set, don't go beyond it minArgs = [min - zoomOffset, pick(options.min, min - zoomOffset)]; if (spaceAvailable) { // if space is available, stay within the data range minArgs[2] = axis.dataMin; } min = arrayMax(minArgs); maxArgs = [min + minRange, pick(options.max, min + minRange)]; if (spaceAvailable) { // if space is availabe, stay within the data range maxArgs[2] = axis.dataMax; } max = arrayMin(maxArgs); // now if the max is adjusted, adjust the min back if (max - min < minRange) { minArgs[0] = max - minRange; minArgs[1] = pick(options.min, max - minRange); min = arrayMax(minArgs); } } // Record modified extremes axis.min = min; axis.max = max; }
[ "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 closest point distance", "if", "(", "axis", ".", "isXAxis", "&&", "axis", ".", "minRange", "===", "UNDEFINED", "&&", "!", "axis", ".", "isLog", ")", "{", "if", "(", "defined", "(", "options", ".", "min", ")", "||", "defined", "(", "options", ".", "max", ")", ")", "{", "axis", ".", "minRange", "=", "null", ";", "// don't do this again", "}", "else", "{", "// Find the closest distance between raw data points, as opposed to", "// closestPointRange that applies to processed points (cropped and grouped)", "each", "(", "axis", ".", "series", ",", "function", "(", "series", ")", "{", "xData", "=", "series", ".", "xData", ";", "loopLength", "=", "series", ".", "xIncrement", "?", "1", ":", "xData", ".", "length", "-", "1", ";", "for", "(", "i", "=", "loopLength", ";", "i", ">", "0", ";", "i", "--", ")", "{", "distance", "=", "xData", "[", "i", "]", "-", "xData", "[", "i", "-", "1", "]", ";", "if", "(", "closestDataRange", "===", "UNDEFINED", "||", "distance", "<", "closestDataRange", ")", "{", "closestDataRange", "=", "distance", ";", "}", "}", "}", ")", ";", "axis", ".", "minRange", "=", "mathMin", "(", "closestDataRange", "*", "5", ",", "axis", ".", "dataMax", "-", "axis", ".", "dataMin", ")", ";", "}", "}", "// if minRange is exceeded, adjust", "if", "(", "max", "-", "min", "<", "axis", ".", "minRange", ")", "{", "var", "minRange", "=", "axis", ".", "minRange", ";", "zoomOffset", "=", "(", "minRange", "-", "max", "+", "min", ")", "/", "2", ";", "// if min and max options have been set, don't go beyond it", "minArgs", "=", "[", "min", "-", "zoomOffset", ",", "pick", "(", "options", ".", "min", ",", "min", "-", "zoomOffset", ")", "]", ";", "if", "(", "spaceAvailable", ")", "{", "// if space is available, stay within the data range", "minArgs", "[", "2", "]", "=", "axis", ".", "dataMin", ";", "}", "min", "=", "arrayMax", "(", "minArgs", ")", ";", "maxArgs", "=", "[", "min", "+", "minRange", ",", "pick", "(", "options", ".", "max", ",", "min", "+", "minRange", ")", "]", ";", "if", "(", "spaceAvailable", ")", "{", "// if space is availabe, stay within the data range", "maxArgs", "[", "2", "]", "=", "axis", ".", "dataMax", ";", "}", "max", "=", "arrayMin", "(", "maxArgs", ")", ";", "// now if the max is adjusted, adjust the min back", "if", "(", "max", "-", "min", "<", "minRange", ")", "{", "minArgs", "[", "0", "]", "=", "max", "-", "minRange", ";", "minArgs", "[", "1", "]", "=", "pick", "(", "options", ".", "min", ",", "max", "-", "minRange", ")", ";", "min", "=", "arrayMax", "(", "minArgs", ")", ";", "}", "}", "// Record modified extremes", "axis", ".", "min", "=", "min", ";", "axis", ".", "max", "=", "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, 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", "or", "updated", "axis", ".", "pointRange", "or", "series", ".", "pointRange", ".", "The", "data", "can", "t", "be", "processed", "until", "we", "have", "finally", "established", "min", "and", "max", "." ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L7301-L7370
23,483
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 (linkedParent) { minPointOffset = linkedParent.minPointOffset; pointRangePadding = linkedParent.pointRangePadding; } else { each(axis.series, function (series) { var seriesPointRange = series.pointRange, pointPlacement = series.options.pointPlacement, seriesClosestPointRange = series.closestPointRange; if (seriesPointRange > range) { // #1446 seriesPointRange = 0; } pointRange = mathMax(pointRange, seriesPointRange); // minPointOffset is the value padding to the left of the axis in order to make // room for points with a pointRange, typically columns. When the pointPlacement option // is 'between' or 'on', this padding does not apply. minPointOffset = mathMax( minPointOffset, isString(pointPlacement) ? 0 : seriesPointRange / 2 ); // Determine the total padding needed to the length of the axis to make room for the // pointRange. If the series' pointPlacement is 'on', no padding is added. pointRangePadding = mathMax( pointRangePadding, pointPlacement === 'on' ? 0 : seriesPointRange ); // Set the closestPointRange if (!series.noSharedTooltip && defined(seriesClosestPointRange)) { closestPointRange = defined(closestPointRange) ? mathMin(closestPointRange, seriesClosestPointRange) : seriesClosestPointRange; } }); } // Record minPointOffset and pointRangePadding ordinalCorrection = axis.ordinalSlope && closestPointRange ? axis.ordinalSlope / closestPointRange : 1; // #988, #1853 axis.minPointOffset = minPointOffset = minPointOffset * ordinalCorrection; axis.pointRangePadding = pointRangePadding = pointRangePadding * ordinalCorrection; // pointRange means the width reserved for each point, like in a column chart axis.pointRange = mathMin(pointRange, range); // closestPointRange means the closest distance between points. In columns // it is mostly equal to pointRange, but in lines pointRange is 0 while closestPointRange // is some other value axis.closestPointRange = closestPointRange; } // Secondary values if (saveOld) { axis.oldTransA = transA; } axis.translationSlope = axis.transA = transA = axis.len / ((range + pointRangePadding) || 1); axis.transB = axis.horiz ? axis.left : axis.bottom; // translation addend axis.minPixelPadding = transA * minPointOffset; }
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 (linkedParent) { minPointOffset = linkedParent.minPointOffset; pointRangePadding = linkedParent.pointRangePadding; } else { each(axis.series, function (series) { var seriesPointRange = series.pointRange, pointPlacement = series.options.pointPlacement, seriesClosestPointRange = series.closestPointRange; if (seriesPointRange > range) { // #1446 seriesPointRange = 0; } pointRange = mathMax(pointRange, seriesPointRange); // minPointOffset is the value padding to the left of the axis in order to make // room for points with a pointRange, typically columns. When the pointPlacement option // is 'between' or 'on', this padding does not apply. minPointOffset = mathMax( minPointOffset, isString(pointPlacement) ? 0 : seriesPointRange / 2 ); // Determine the total padding needed to the length of the axis to make room for the // pointRange. If the series' pointPlacement is 'on', no padding is added. pointRangePadding = mathMax( pointRangePadding, pointPlacement === 'on' ? 0 : seriesPointRange ); // Set the closestPointRange if (!series.noSharedTooltip && defined(seriesClosestPointRange)) { closestPointRange = defined(closestPointRange) ? mathMin(closestPointRange, seriesClosestPointRange) : seriesClosestPointRange; } }); } // Record minPointOffset and pointRangePadding ordinalCorrection = axis.ordinalSlope && closestPointRange ? axis.ordinalSlope / closestPointRange : 1; // #988, #1853 axis.minPointOffset = minPointOffset = minPointOffset * ordinalCorrection; axis.pointRangePadding = pointRangePadding = pointRangePadding * ordinalCorrection; // pointRange means the width reserved for each point, like in a column chart axis.pointRange = mathMin(pointRange, range); // closestPointRange means the closest distance between points. In columns // it is mostly equal to pointRange, but in lines pointRange is 0 while closestPointRange // is some other value axis.closestPointRange = closestPointRange; } // Secondary values if (saveOld) { axis.oldTransA = transA; } axis.translationSlope = axis.transA = transA = axis.len / ((range + pointRangePadding) || 1); axis.transB = axis.horiz ? axis.left : axis.bottom; // translation addend axis.minPixelPadding = transA * minPointOffset; }
[ "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", "(", "linkedParent", ")", "{", "minPointOffset", "=", "linkedParent", ".", "minPointOffset", ";", "pointRangePadding", "=", "linkedParent", ".", "pointRangePadding", ";", "}", "else", "{", "each", "(", "axis", ".", "series", ",", "function", "(", "series", ")", "{", "var", "seriesPointRange", "=", "series", ".", "pointRange", ",", "pointPlacement", "=", "series", ".", "options", ".", "pointPlacement", ",", "seriesClosestPointRange", "=", "series", ".", "closestPointRange", ";", "if", "(", "seriesPointRange", ">", "range", ")", "{", "// #1446", "seriesPointRange", "=", "0", ";", "}", "pointRange", "=", "mathMax", "(", "pointRange", ",", "seriesPointRange", ")", ";", "// minPointOffset is the value padding to the left of the axis in order to make", "// room for points with a pointRange, typically columns. When the pointPlacement option", "// is 'between' or 'on', this padding does not apply.", "minPointOffset", "=", "mathMax", "(", "minPointOffset", ",", "isString", "(", "pointPlacement", ")", "?", "0", ":", "seriesPointRange", "/", "2", ")", ";", "// Determine the total padding needed to the length of the axis to make room for the ", "// pointRange. If the series' pointPlacement is 'on', no padding is added.", "pointRangePadding", "=", "mathMax", "(", "pointRangePadding", ",", "pointPlacement", "===", "'on'", "?", "0", ":", "seriesPointRange", ")", ";", "// Set the closestPointRange", "if", "(", "!", "series", ".", "noSharedTooltip", "&&", "defined", "(", "seriesClosestPointRange", ")", ")", "{", "closestPointRange", "=", "defined", "(", "closestPointRange", ")", "?", "mathMin", "(", "closestPointRange", ",", "seriesClosestPointRange", ")", ":", "seriesClosestPointRange", ";", "}", "}", ")", ";", "}", "// Record minPointOffset and pointRangePadding", "ordinalCorrection", "=", "axis", ".", "ordinalSlope", "&&", "closestPointRange", "?", "axis", ".", "ordinalSlope", "/", "closestPointRange", ":", "1", ";", "// #988, #1853", "axis", ".", "minPointOffset", "=", "minPointOffset", "=", "minPointOffset", "*", "ordinalCorrection", ";", "axis", ".", "pointRangePadding", "=", "pointRangePadding", "=", "pointRangePadding", "*", "ordinalCorrection", ";", "// pointRange means the width reserved for each point, like in a column chart", "axis", ".", "pointRange", "=", "mathMin", "(", "pointRange", ",", "range", ")", ";", "// closestPointRange means the closest distance between points. In columns", "// it is mostly equal to pointRange, but in lines pointRange is 0 while closestPointRange", "// is some other value", "axis", ".", "closestPointRange", "=", "closestPointRange", ";", "}", "// Secondary values", "if", "(", "saveOld", ")", "{", "axis", ".", "oldTransA", "=", "transA", ";", "}", "axis", ".", "translationSlope", "=", "axis", ".", "transA", "=", "transA", "=", "axis", ".", "len", "/", "(", "(", "range", "+", "pointRangePadding", ")", "||", "1", ")", ";", "axis", ".", "transB", "=", "axis", ".", "horiz", "?", "axis", ".", "left", ":", "axis", ".", "bottom", ";", "// translation addend", "axis", ".", "minPixelPadding", "=", "transA", "*", "minPointOffset", ";", "}" ]
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
23,484
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, chart.plotLeft + offsetLeft); this.top = top = pick(options.top, chart.plotTop); this.width = width = pick(options.width, chart.plotWidth - offsetLeft + offsetRight); this.height = height = pick(options.height, chart.plotHeight); this.bottom = chart.chartHeight - height - top; this.right = chart.chartWidth - width - left; // Direction agnostic properties this.len = mathMax(horiz ? width : height, 0); // mathMax fixes #905 this.pos = horiz ? left : top; // distance from SVG origin }
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, chart.plotLeft + offsetLeft); this.top = top = pick(options.top, chart.plotTop); this.width = width = pick(options.width, chart.plotWidth - offsetLeft + offsetRight); this.height = height = pick(options.height, chart.plotHeight); this.bottom = chart.chartHeight - height - top; this.right = chart.chartWidth - width - left; // Direction agnostic properties this.len = mathMax(horiz ? width : height, 0); // mathMax fixes #905 this.pos = horiz ? left : top; // distance from SVG origin }
[ "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", ",", "chart", ".", "plotLeft", "+", "offsetLeft", ")", ";", "this", ".", "top", "=", "top", "=", "pick", "(", "options", ".", "top", ",", "chart", ".", "plotTop", ")", ";", "this", ".", "width", "=", "width", "=", "pick", "(", "options", ".", "width", ",", "chart", ".", "plotWidth", "-", "offsetLeft", "+", "offsetRight", ")", ";", "this", ".", "height", "=", "height", "=", "pick", "(", "options", ".", "height", ",", "chart", ".", "plotHeight", ")", ";", "this", ".", "bottom", "=", "chart", ".", "chartHeight", "-", "height", "-", "top", ";", "this", ".", "right", "=", "chart", ".", "chartWidth", "-", "width", "-", "left", ";", "// Direction agnostic properties", "this", ".", "len", "=", "mathMax", "(", "horiz", "?", "width", ":", "height", ",", "0", ")", ";", "// mathMax fixes #905", "this", ".", "pos", "=", "horiz", "?", "left", ":", "top", ";", "// distance from SVG origin", "}" ]
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
23,485
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", "<", "165", ")", "{", "ret", "=", "'right'", ";", "}", "else", "if", "(", "angle", ">", "195", "&&", "angle", "<", "345", ")", "{", "ret", "=", "'left'", ";", "}", "else", "{", "ret", "=", "'center'", ";", "}", "return", "ret", ";", "}" ]
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
23,486
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; // crispify the other way - #1480, #1687 } return chart.renderer.crispLine([ M, horiz ? this.left : lineLeft, horiz ? lineTop : this.top, L, horiz ? chart.chartWidth - this.right : lineLeft, horiz ? lineTop : chart.chartHeight - this.bottom ], lineWidth); }
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; // crispify the other way - #1480, #1687 } return chart.renderer.crispLine([ M, horiz ? this.left : lineLeft, horiz ? lineTop : this.top, L, horiz ? chart.chartWidth - this.right : lineLeft, horiz ? lineTop : chart.chartHeight - this.bottom ], lineWidth); }
[ "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", ";", "// crispify the other way - #1480, #1687", "}", "return", "chart", ".", "renderer", ".", "crispLine", "(", "[", "M", ",", "horiz", "?", "this", ".", "left", ":", "lineLeft", ",", "horiz", "?", "lineTop", ":", "this", ".", "top", ",", "L", ",", "horiz", "?", "chart", ".", "chartWidth", "-", "this", ".", "right", ":", "lineLeft", ",", "horiz", "?", "lineTop", ":", "chart", ".", "chartHeight", "-", "this", ".", "bottom", "]", ",", "lineWidth", ")", ";", "}" ]
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
23,487
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, fontSize = pInt(axisTitleOptions.style.fontSize || 12), // the position in the length direction of the axis alongAxis = { low: margin + (horiz ? 0 : axisLength), middle: margin + axisLength / 2, high: margin + (horiz ? axisLength : 0) }[axisTitleOptions.align], // the position in the perpendicular direction of the axis offAxis = (horiz ? axisTop + this.height : axisLeft) + (horiz ? 1 : -1) * // horizontal axis reverses the margin (opposite ? -1 : 1) * // so does opposite axes this.axisTitleMargin + (this.side === 2 ? fontSize : 0); return { x: horiz ? alongAxis : offAxis + (opposite ? this.width : 0) + offset + (axisTitleOptions.x || 0), // x y: horiz ? offAxis - (opposite ? this.height : 0) + offset : alongAxis + (axisTitleOptions.y || 0) // y }; }
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, fontSize = pInt(axisTitleOptions.style.fontSize || 12), // the position in the length direction of the axis alongAxis = { low: margin + (horiz ? 0 : axisLength), middle: margin + axisLength / 2, high: margin + (horiz ? axisLength : 0) }[axisTitleOptions.align], // the position in the perpendicular direction of the axis offAxis = (horiz ? axisTop + this.height : axisLeft) + (horiz ? 1 : -1) * // horizontal axis reverses the margin (opposite ? -1 : 1) * // so does opposite axes this.axisTitleMargin + (this.side === 2 ? fontSize : 0); return { x: horiz ? alongAxis : offAxis + (opposite ? this.width : 0) + offset + (axisTitleOptions.x || 0), // x y: horiz ? offAxis - (opposite ? this.height : 0) + offset : alongAxis + (axisTitleOptions.y || 0) // y }; }
[ "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", ",", "fontSize", "=", "pInt", "(", "axisTitleOptions", ".", "style", ".", "fontSize", "||", "12", ")", ",", "// the position in the length direction of the axis", "alongAxis", "=", "{", "low", ":", "margin", "+", "(", "horiz", "?", "0", ":", "axisLength", ")", ",", "middle", ":", "margin", "+", "axisLength", "/", "2", ",", "high", ":", "margin", "+", "(", "horiz", "?", "axisLength", ":", "0", ")", "}", "[", "axisTitleOptions", ".", "align", "]", ",", "// the position in the perpendicular direction of the axis", "offAxis", "=", "(", "horiz", "?", "axisTop", "+", "this", ".", "height", ":", "axisLeft", ")", "+", "(", "horiz", "?", "1", ":", "-", "1", ")", "*", "// horizontal axis reverses the margin", "(", "opposite", "?", "-", "1", ":", "1", ")", "*", "// so does opposite axes", "this", ".", "axisTitleMargin", "+", "(", "this", ".", "side", "===", "2", "?", "fontSize", ":", "0", ")", ";", "return", "{", "x", ":", "horiz", "?", "alongAxis", ":", "offAxis", "+", "(", "opposite", "?", "this", ".", "width", ":", "0", ")", "+", "offset", "+", "(", "axisTitleOptions", ".", "x", "||", "0", ")", ",", "// x", "y", ":", "horiz", "?", "offAxis", "-", "(", "opposite", "?", "this", ".", "height", ":", "0", ")", "+", "offset", ":", "alongAxis", "+", "(", "axisTitleOptions", ".", "y", "||", "0", ")", "// y", "}", ";", "}" ]
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
23,488
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", "]", ".", "setStackedPoints", "(", ")", ";", "}", "// Loop up again to compute percent stack", "if", "(", "this", ".", "usePercentage", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "series", ".", "length", ";", "i", "++", ")", "{", "series", "[", "i", "]", ".", "setPercentStacks", "(", ")", ";", "}", "}", "}", "}" ]
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
23,489
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 the mouse if (this.followPointer && mouseEvent) { if (mouseEvent.chartX === UNDEFINED) { mouseEvent = chart.pointer.normalize(mouseEvent); } ret = [ mouseEvent.chartX - chart.plotLeft, mouseEvent.chartY - plotTop ]; } // When shared, use the average position if (!ret) { each(points, function (point) { yAxis = point.series.yAxis; plotX += point.plotX; plotY += (point.plotLow ? (point.plotLow + point.plotHigh) / 2 : point.plotY) + (!inverted && yAxis ? yAxis.top - plotTop : 0); // #1151 }); plotX /= points.length; plotY /= points.length; ret = [ inverted ? chart.plotWidth - plotY : plotX, this.shared && !inverted && points.length > 1 && mouseEvent ? mouseEvent.chartY - plotTop : // place shared tooltip next to the mouse (#424) inverted ? chart.plotHeight - plotX : plotY ]; } return map(ret, mathRound); }
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 the mouse if (this.followPointer && mouseEvent) { if (mouseEvent.chartX === UNDEFINED) { mouseEvent = chart.pointer.normalize(mouseEvent); } ret = [ mouseEvent.chartX - chart.plotLeft, mouseEvent.chartY - plotTop ]; } // When shared, use the average position if (!ret) { each(points, function (point) { yAxis = point.series.yAxis; plotX += point.plotX; plotY += (point.plotLow ? (point.plotLow + point.plotHigh) / 2 : point.plotY) + (!inverted && yAxis ? yAxis.top - plotTop : 0); // #1151 }); plotX /= points.length; plotY /= points.length; ret = [ inverted ? chart.plotWidth - plotY : plotX, this.shared && !inverted && points.length > 1 && mouseEvent ? mouseEvent.chartY - plotTop : // place shared tooltip next to the mouse (#424) inverted ? chart.plotHeight - plotX : plotY ]; } return map(ret, mathRound); }
[ "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 the mouse", "if", "(", "this", ".", "followPointer", "&&", "mouseEvent", ")", "{", "if", "(", "mouseEvent", ".", "chartX", "===", "UNDEFINED", ")", "{", "mouseEvent", "=", "chart", ".", "pointer", ".", "normalize", "(", "mouseEvent", ")", ";", "}", "ret", "=", "[", "mouseEvent", ".", "chartX", "-", "chart", ".", "plotLeft", ",", "mouseEvent", ".", "chartY", "-", "plotTop", "]", ";", "}", "// When shared, use the average position", "if", "(", "!", "ret", ")", "{", "each", "(", "points", ",", "function", "(", "point", ")", "{", "yAxis", "=", "point", ".", "series", ".", "yAxis", ";", "plotX", "+=", "point", ".", "plotX", ";", "plotY", "+=", "(", "point", ".", "plotLow", "?", "(", "point", ".", "plotLow", "+", "point", ".", "plotHigh", ")", "/", "2", ":", "point", ".", "plotY", ")", "+", "(", "!", "inverted", "&&", "yAxis", "?", "yAxis", ".", "top", "-", "plotTop", ":", "0", ")", ";", "// #1151", "}", ")", ";", "plotX", "/=", "points", ".", "length", ";", "plotY", "/=", "points", ".", "length", ";", "ret", "=", "[", "inverted", "?", "chart", ".", "plotWidth", "-", "plotY", ":", "plotX", ",", "this", ".", "shared", "&&", "!", "inverted", "&&", "points", ".", "length", ">", "1", "&&", "mouseEvent", "?", "mouseEvent", ".", "chartY", "-", "plotTop", ":", "// place shared tooltip next to the mouse (#424)", "inverted", "?", "chart", ".", "plotHeight", "-", "plotX", ":", "plotY", "]", ";", "}", "return", "map", "(", "ret", ",", "mathRound", ")", ";", "}" ]
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
23,490
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 + chart.plotTop ); }
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 + chart.plotTop ); }
[ "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", "+", "chart", ".", "plotTop", ")", ";", "}" ]
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
23,491
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (e) { var chart = this.chart; return chart.inverted ? chart.plotHeight + chart.plotTop - e.chartY : e.chartX - chart.plotLeft; }
javascript
function (e) { var chart = this.chart; return chart.inverted ? chart.plotHeight + chart.plotTop - e.chartY : e.chartX - chart.plotLeft; }
[ "function", "(", "e", ")", "{", "var", "chart", "=", "this", ".", "chart", ";", "return", "chart", ".", "inverted", "?", "chart", ".", "plotHeight", "+", "chart", ".", "plotTop", "-", "e", ".", "chartY", ":", "e", ".", "chartX", "-", "chart", ".", "plotLeft", ";", "}" ]
Return the index in the tooltipPoints array, corresponding to pixel position in the plot area.
[ "Return", "the", "index", "in", "the", "tooltipPoints", "array", "corresponding", "to", "pixel", "position", "in", "the", "plot", "area", "." ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9116-L9121
23,492
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (attribs, clip) { var chart = this.chart, seriesAttribs; // Scale each series each(chart.series, function (series) { seriesAttribs = attribs || series.getPlotBox(); // #1701 if (series.xAxis && series.xAxis.zoomEnabled) { series.group.attr(seriesAttribs); if (series.markerGroup) { series.markerGroup.attr(seriesAttribs); series.markerGroup.clip(clip ? chart.clipRect : null); } if (series.dataLabelsGroup) { series.dataLabelsGroup.attr(seriesAttribs); } } }); // Clip chart.clipRect.attr(clip || chart.clipBox); }
javascript
function (attribs, clip) { var chart = this.chart, seriesAttribs; // Scale each series each(chart.series, function (series) { seriesAttribs = attribs || series.getPlotBox(); // #1701 if (series.xAxis && series.xAxis.zoomEnabled) { series.group.attr(seriesAttribs); if (series.markerGroup) { series.markerGroup.attr(seriesAttribs); series.markerGroup.clip(clip ? chart.clipRect : null); } if (series.dataLabelsGroup) { series.dataLabelsGroup.attr(seriesAttribs); } } }); // Clip chart.clipRect.attr(clip || chart.clipBox); }
[ "function", "(", "attribs", ",", "clip", ")", "{", "var", "chart", "=", "this", ".", "chart", ",", "seriesAttribs", ";", "// Scale each series", "each", "(", "chart", ".", "series", ",", "function", "(", "series", ")", "{", "seriesAttribs", "=", "attribs", "||", "series", ".", "getPlotBox", "(", ")", ";", "// #1701", "if", "(", "series", ".", "xAxis", "&&", "series", ".", "xAxis", ".", "zoomEnabled", ")", "{", "series", ".", "group", ".", "attr", "(", "seriesAttribs", ")", ";", "if", "(", "series", ".", "markerGroup", ")", "{", "series", ".", "markerGroup", ".", "attr", "(", "seriesAttribs", ")", ";", "series", ".", "markerGroup", ".", "clip", "(", "clip", "?", "chart", ".", "clipRect", ":", "null", ")", ";", "}", "if", "(", "series", ".", "dataLabelsGroup", ")", "{", "series", ".", "dataLabelsGroup", ".", "attr", "(", "seriesAttribs", ")", ";", "}", "}", "}", ")", ";", "// Clip", "chart", ".", "clipRect", ".", "attr", "(", "clip", "||", "chart", ".", "clipBox", ")", ";", "}" ]
Scale series groups to a certain scale and translation
[ "Scale", "series", "groups", "to", "a", "certain", "scale", "and", "translation" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9245-L9267
23,493
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (e) { var self = this, chart = self.chart, pinchDown = self.pinchDown, followTouchMove = chart.tooltip && chart.tooltip.options.followTouchMove, touches = e.touches, touchesLength = touches.length, lastValidTouch = self.lastValidTouch, zoomHor = self.zoomHor || self.pinchHor, zoomVert = self.zoomVert || self.pinchVert, hasZoom = zoomHor || zoomVert, selectionMarker = self.selectionMarker, transform = {}, fireClickEvent = touchesLength === 1 && ((self.inClass(e.target, PREFIX + 'tracker') && chart.runTrackerClick) || chart.runChartClick), clip = {}; // On touch devices, only proceed to trigger click if a handler is defined if ((hasZoom || followTouchMove) && !fireClickEvent) { e.preventDefault(); } // Normalize each touch map(touches, function (e) { return self.normalize(e); }); // Register the touch start position if (e.type === 'touchstart') { each(touches, function (e, i) { pinchDown[i] = { chartX: e.chartX, chartY: e.chartY }; }); lastValidTouch.x = [pinchDown[0].chartX, pinchDown[1] && pinchDown[1].chartX]; lastValidTouch.y = [pinchDown[0].chartY, pinchDown[1] && pinchDown[1].chartY]; // Identify the data bounds in pixels each(chart.axes, function (axis) { if (axis.zoomEnabled) { var bounds = chart.bounds[axis.horiz ? 'h' : 'v'], minPixelPadding = axis.minPixelPadding, min = axis.toPixels(axis.dataMin), max = axis.toPixels(axis.dataMax), absMin = mathMin(min, max), absMax = mathMax(min, max); // Store the bounds for use in the touchmove handler bounds.min = mathMin(axis.pos, absMin - minPixelPadding); bounds.max = mathMax(axis.pos + axis.len, absMax + minPixelPadding); } }); // Event type is touchmove, handle panning and pinching } else if (pinchDown.length) { // can be 0 when releasing, if touchend fires first // Set the marker if (!selectionMarker) { self.selectionMarker = selectionMarker = extend({ destroy: noop }, chart.plotBox); } if (zoomHor) { self.pinchTranslateDirection(true, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); } if (zoomVert) { self.pinchTranslateDirection(false, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); } self.hasPinched = hasZoom; // Scale and translate the groups to provide visual feedback during pinching self.scaleGroups(transform, clip); // Optionally move the tooltip on touchmove if (!hasZoom && followTouchMove && touchesLength === 1) { this.runPointActions(self.normalize(e)); } } }
javascript
function (e) { var self = this, chart = self.chart, pinchDown = self.pinchDown, followTouchMove = chart.tooltip && chart.tooltip.options.followTouchMove, touches = e.touches, touchesLength = touches.length, lastValidTouch = self.lastValidTouch, zoomHor = self.zoomHor || self.pinchHor, zoomVert = self.zoomVert || self.pinchVert, hasZoom = zoomHor || zoomVert, selectionMarker = self.selectionMarker, transform = {}, fireClickEvent = touchesLength === 1 && ((self.inClass(e.target, PREFIX + 'tracker') && chart.runTrackerClick) || chart.runChartClick), clip = {}; // On touch devices, only proceed to trigger click if a handler is defined if ((hasZoom || followTouchMove) && !fireClickEvent) { e.preventDefault(); } // Normalize each touch map(touches, function (e) { return self.normalize(e); }); // Register the touch start position if (e.type === 'touchstart') { each(touches, function (e, i) { pinchDown[i] = { chartX: e.chartX, chartY: e.chartY }; }); lastValidTouch.x = [pinchDown[0].chartX, pinchDown[1] && pinchDown[1].chartX]; lastValidTouch.y = [pinchDown[0].chartY, pinchDown[1] && pinchDown[1].chartY]; // Identify the data bounds in pixels each(chart.axes, function (axis) { if (axis.zoomEnabled) { var bounds = chart.bounds[axis.horiz ? 'h' : 'v'], minPixelPadding = axis.minPixelPadding, min = axis.toPixels(axis.dataMin), max = axis.toPixels(axis.dataMax), absMin = mathMin(min, max), absMax = mathMax(min, max); // Store the bounds for use in the touchmove handler bounds.min = mathMin(axis.pos, absMin - minPixelPadding); bounds.max = mathMax(axis.pos + axis.len, absMax + minPixelPadding); } }); // Event type is touchmove, handle panning and pinching } else if (pinchDown.length) { // can be 0 when releasing, if touchend fires first // Set the marker if (!selectionMarker) { self.selectionMarker = selectionMarker = extend({ destroy: noop }, chart.plotBox); } if (zoomHor) { self.pinchTranslateDirection(true, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); } if (zoomVert) { self.pinchTranslateDirection(false, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); } self.hasPinched = hasZoom; // Scale and translate the groups to provide visual feedback during pinching self.scaleGroups(transform, clip); // Optionally move the tooltip on touchmove if (!hasZoom && followTouchMove && touchesLength === 1) { this.runPointActions(self.normalize(e)); } } }
[ "function", "(", "e", ")", "{", "var", "self", "=", "this", ",", "chart", "=", "self", ".", "chart", ",", "pinchDown", "=", "self", ".", "pinchDown", ",", "followTouchMove", "=", "chart", ".", "tooltip", "&&", "chart", ".", "tooltip", ".", "options", ".", "followTouchMove", ",", "touches", "=", "e", ".", "touches", ",", "touchesLength", "=", "touches", ".", "length", ",", "lastValidTouch", "=", "self", ".", "lastValidTouch", ",", "zoomHor", "=", "self", ".", "zoomHor", "||", "self", ".", "pinchHor", ",", "zoomVert", "=", "self", ".", "zoomVert", "||", "self", ".", "pinchVert", ",", "hasZoom", "=", "zoomHor", "||", "zoomVert", ",", "selectionMarker", "=", "self", ".", "selectionMarker", ",", "transform", "=", "{", "}", ",", "fireClickEvent", "=", "touchesLength", "===", "1", "&&", "(", "(", "self", ".", "inClass", "(", "e", ".", "target", ",", "PREFIX", "+", "'tracker'", ")", "&&", "chart", ".", "runTrackerClick", ")", "||", "chart", ".", "runChartClick", ")", ",", "clip", "=", "{", "}", ";", "// On touch devices, only proceed to trigger click if a handler is defined", "if", "(", "(", "hasZoom", "||", "followTouchMove", ")", "&&", "!", "fireClickEvent", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "}", "// Normalize each touch", "map", "(", "touches", ",", "function", "(", "e", ")", "{", "return", "self", ".", "normalize", "(", "e", ")", ";", "}", ")", ";", "// Register the touch start position", "if", "(", "e", ".", "type", "===", "'touchstart'", ")", "{", "each", "(", "touches", ",", "function", "(", "e", ",", "i", ")", "{", "pinchDown", "[", "i", "]", "=", "{", "chartX", ":", "e", ".", "chartX", ",", "chartY", ":", "e", ".", "chartY", "}", ";", "}", ")", ";", "lastValidTouch", ".", "x", "=", "[", "pinchDown", "[", "0", "]", ".", "chartX", ",", "pinchDown", "[", "1", "]", "&&", "pinchDown", "[", "1", "]", ".", "chartX", "]", ";", "lastValidTouch", ".", "y", "=", "[", "pinchDown", "[", "0", "]", ".", "chartY", ",", "pinchDown", "[", "1", "]", "&&", "pinchDown", "[", "1", "]", ".", "chartY", "]", ";", "// Identify the data bounds in pixels", "each", "(", "chart", ".", "axes", ",", "function", "(", "axis", ")", "{", "if", "(", "axis", ".", "zoomEnabled", ")", "{", "var", "bounds", "=", "chart", ".", "bounds", "[", "axis", ".", "horiz", "?", "'h'", ":", "'v'", "]", ",", "minPixelPadding", "=", "axis", ".", "minPixelPadding", ",", "min", "=", "axis", ".", "toPixels", "(", "axis", ".", "dataMin", ")", ",", "max", "=", "axis", ".", "toPixels", "(", "axis", ".", "dataMax", ")", ",", "absMin", "=", "mathMin", "(", "min", ",", "max", ")", ",", "absMax", "=", "mathMax", "(", "min", ",", "max", ")", ";", "// Store the bounds for use in the touchmove handler", "bounds", ".", "min", "=", "mathMin", "(", "axis", ".", "pos", ",", "absMin", "-", "minPixelPadding", ")", ";", "bounds", ".", "max", "=", "mathMax", "(", "axis", ".", "pos", "+", "axis", ".", "len", ",", "absMax", "+", "minPixelPadding", ")", ";", "}", "}", ")", ";", "// Event type is touchmove, handle panning and pinching", "}", "else", "if", "(", "pinchDown", ".", "length", ")", "{", "// can be 0 when releasing, if touchend fires first", "// Set the marker", "if", "(", "!", "selectionMarker", ")", "{", "self", ".", "selectionMarker", "=", "selectionMarker", "=", "extend", "(", "{", "destroy", ":", "noop", "}", ",", "chart", ".", "plotBox", ")", ";", "}", "if", "(", "zoomHor", ")", "{", "self", ".", "pinchTranslateDirection", "(", "true", ",", "pinchDown", ",", "touches", ",", "transform", ",", "selectionMarker", ",", "clip", ",", "lastValidTouch", ")", ";", "}", "if", "(", "zoomVert", ")", "{", "self", ".", "pinchTranslateDirection", "(", "false", ",", "pinchDown", ",", "touches", ",", "transform", ",", "selectionMarker", ",", "clip", ",", "lastValidTouch", ")", ";", "}", "self", ".", "hasPinched", "=", "hasZoom", ";", "// Scale and translate the groups to provide visual feedback during pinching", "self", ".", "scaleGroups", "(", "transform", ",", "clip", ")", ";", "// Optionally move the tooltip on touchmove", "if", "(", "!", "hasZoom", "&&", "followTouchMove", "&&", "touchesLength", "===", "1", ")", "{", "this", ".", "runPointActions", "(", "self", ".", "normalize", "(", "e", ")", ")", ";", "}", "}", "}" ]
Handle touch events with two touches
[ "Handle", "touch", "events", "with", "two", "touches" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9351-L9433
23,494
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (e) { var chart = this.chart; // Record the start position chart.mouseIsDown = e.type; chart.cancelClick = false; chart.mouseDownX = this.mouseDownX = e.chartX; chart.mouseDownY = this.mouseDownY = e.chartY; }
javascript
function (e) { var chart = this.chart; // Record the start position chart.mouseIsDown = e.type; chart.cancelClick = false; chart.mouseDownX = this.mouseDownX = e.chartX; chart.mouseDownY = this.mouseDownY = e.chartY; }
[ "function", "(", "e", ")", "{", "var", "chart", "=", "this", ".", "chart", ";", "// Record the start position", "chart", ".", "mouseIsDown", "=", "e", ".", "type", ";", "chart", ".", "cancelClick", "=", "false", ";", "chart", ".", "mouseDownX", "=", "this", ".", "mouseDownX", "=", "e", ".", "chartX", ";", "chart", ".", "mouseDownY", "=", "this", ".", "mouseDownY", "=", "e", ".", "chartY", ";", "}" ]
Start a drag operation
[ "Start", "a", "drag", "operation" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9438-L9446
23,495
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (e) { var chart = this.chart, chartOptions = chart.options.chart, chartX = e.chartX, chartY = e.chartY, zoomHor = this.zoomHor, zoomVert = this.zoomVert, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, clickedInside, size, mouseDownX = this.mouseDownX, mouseDownY = this.mouseDownY; // If the mouse is outside the plot area, adjust to cooordinates // inside to prevent the selection marker from going outside if (chartX < plotLeft) { chartX = plotLeft; } else if (chartX > plotLeft + plotWidth) { chartX = plotLeft + plotWidth; } if (chartY < plotTop) { chartY = plotTop; } else if (chartY > plotTop + plotHeight) { chartY = plotTop + plotHeight; } // determine if the mouse has moved more than 10px this.hasDragged = Math.sqrt( Math.pow(mouseDownX - chartX, 2) + Math.pow(mouseDownY - chartY, 2) ); if (this.hasDragged > 10) { clickedInside = chart.isInsidePlot(mouseDownX - plotLeft, mouseDownY - plotTop); // make a selection if (chart.hasCartesianSeries && (this.zoomX || this.zoomY) && clickedInside) { if (!this.selectionMarker) { this.selectionMarker = chart.renderer.rect( plotLeft, plotTop, zoomHor ? 1 : plotWidth, zoomVert ? 1 : plotHeight, 0 ) .attr({ fill: chartOptions.selectionMarkerFill || 'rgba(69,114,167,0.25)', zIndex: 7 }) .add(); } } // adjust the width of the selection marker if (this.selectionMarker && zoomHor) { size = chartX - mouseDownX; this.selectionMarker.attr({ width: mathAbs(size), x: (size > 0 ? 0 : size) + mouseDownX }); } // adjust the height of the selection marker if (this.selectionMarker && zoomVert) { size = chartY - mouseDownY; this.selectionMarker.attr({ height: mathAbs(size), y: (size > 0 ? 0 : size) + mouseDownY }); } // panning if (clickedInside && !this.selectionMarker && chartOptions.panning) { chart.pan(e, chartOptions.panning); } } }
javascript
function (e) { var chart = this.chart, chartOptions = chart.options.chart, chartX = e.chartX, chartY = e.chartY, zoomHor = this.zoomHor, zoomVert = this.zoomVert, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, clickedInside, size, mouseDownX = this.mouseDownX, mouseDownY = this.mouseDownY; // If the mouse is outside the plot area, adjust to cooordinates // inside to prevent the selection marker from going outside if (chartX < plotLeft) { chartX = plotLeft; } else if (chartX > plotLeft + plotWidth) { chartX = plotLeft + plotWidth; } if (chartY < plotTop) { chartY = plotTop; } else if (chartY > plotTop + plotHeight) { chartY = plotTop + plotHeight; } // determine if the mouse has moved more than 10px this.hasDragged = Math.sqrt( Math.pow(mouseDownX - chartX, 2) + Math.pow(mouseDownY - chartY, 2) ); if (this.hasDragged > 10) { clickedInside = chart.isInsidePlot(mouseDownX - plotLeft, mouseDownY - plotTop); // make a selection if (chart.hasCartesianSeries && (this.zoomX || this.zoomY) && clickedInside) { if (!this.selectionMarker) { this.selectionMarker = chart.renderer.rect( plotLeft, plotTop, zoomHor ? 1 : plotWidth, zoomVert ? 1 : plotHeight, 0 ) .attr({ fill: chartOptions.selectionMarkerFill || 'rgba(69,114,167,0.25)', zIndex: 7 }) .add(); } } // adjust the width of the selection marker if (this.selectionMarker && zoomHor) { size = chartX - mouseDownX; this.selectionMarker.attr({ width: mathAbs(size), x: (size > 0 ? 0 : size) + mouseDownX }); } // adjust the height of the selection marker if (this.selectionMarker && zoomVert) { size = chartY - mouseDownY; this.selectionMarker.attr({ height: mathAbs(size), y: (size > 0 ? 0 : size) + mouseDownY }); } // panning if (clickedInside && !this.selectionMarker && chartOptions.panning) { chart.pan(e, chartOptions.panning); } } }
[ "function", "(", "e", ")", "{", "var", "chart", "=", "this", ".", "chart", ",", "chartOptions", "=", "chart", ".", "options", ".", "chart", ",", "chartX", "=", "e", ".", "chartX", ",", "chartY", "=", "e", ".", "chartY", ",", "zoomHor", "=", "this", ".", "zoomHor", ",", "zoomVert", "=", "this", ".", "zoomVert", ",", "plotLeft", "=", "chart", ".", "plotLeft", ",", "plotTop", "=", "chart", ".", "plotTop", ",", "plotWidth", "=", "chart", ".", "plotWidth", ",", "plotHeight", "=", "chart", ".", "plotHeight", ",", "clickedInside", ",", "size", ",", "mouseDownX", "=", "this", ".", "mouseDownX", ",", "mouseDownY", "=", "this", ".", "mouseDownY", ";", "// If the mouse is outside the plot area, adjust to cooordinates", "// inside to prevent the selection marker from going outside", "if", "(", "chartX", "<", "plotLeft", ")", "{", "chartX", "=", "plotLeft", ";", "}", "else", "if", "(", "chartX", ">", "plotLeft", "+", "plotWidth", ")", "{", "chartX", "=", "plotLeft", "+", "plotWidth", ";", "}", "if", "(", "chartY", "<", "plotTop", ")", "{", "chartY", "=", "plotTop", ";", "}", "else", "if", "(", "chartY", ">", "plotTop", "+", "plotHeight", ")", "{", "chartY", "=", "plotTop", "+", "plotHeight", ";", "}", "// determine if the mouse has moved more than 10px", "this", ".", "hasDragged", "=", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "mouseDownX", "-", "chartX", ",", "2", ")", "+", "Math", ".", "pow", "(", "mouseDownY", "-", "chartY", ",", "2", ")", ")", ";", "if", "(", "this", ".", "hasDragged", ">", "10", ")", "{", "clickedInside", "=", "chart", ".", "isInsidePlot", "(", "mouseDownX", "-", "plotLeft", ",", "mouseDownY", "-", "plotTop", ")", ";", "// make a selection", "if", "(", "chart", ".", "hasCartesianSeries", "&&", "(", "this", ".", "zoomX", "||", "this", ".", "zoomY", ")", "&&", "clickedInside", ")", "{", "if", "(", "!", "this", ".", "selectionMarker", ")", "{", "this", ".", "selectionMarker", "=", "chart", ".", "renderer", ".", "rect", "(", "plotLeft", ",", "plotTop", ",", "zoomHor", "?", "1", ":", "plotWidth", ",", "zoomVert", "?", "1", ":", "plotHeight", ",", "0", ")", ".", "attr", "(", "{", "fill", ":", "chartOptions", ".", "selectionMarkerFill", "||", "'rgba(69,114,167,0.25)'", ",", "zIndex", ":", "7", "}", ")", ".", "add", "(", ")", ";", "}", "}", "// adjust the width of the selection marker", "if", "(", "this", ".", "selectionMarker", "&&", "zoomHor", ")", "{", "size", "=", "chartX", "-", "mouseDownX", ";", "this", ".", "selectionMarker", ".", "attr", "(", "{", "width", ":", "mathAbs", "(", "size", ")", ",", "x", ":", "(", "size", ">", "0", "?", "0", ":", "size", ")", "+", "mouseDownX", "}", ")", ";", "}", "// adjust the height of the selection marker", "if", "(", "this", ".", "selectionMarker", "&&", "zoomVert", ")", "{", "size", "=", "chartY", "-", "mouseDownY", ";", "this", ".", "selectionMarker", ".", "attr", "(", "{", "height", ":", "mathAbs", "(", "size", ")", ",", "y", ":", "(", "size", ">", "0", "?", "0", ":", "size", ")", "+", "mouseDownY", "}", ")", ";", "}", "// panning", "if", "(", "clickedInside", "&&", "!", "this", ".", "selectionMarker", "&&", "chartOptions", ".", "panning", ")", "{", "chart", ".", "pan", "(", "e", ",", "chartOptions", ".", "panning", ")", ";", "}", "}", "}" ]
Perform a drag operation in response to a mousemove event while the mouse is down
[ "Perform", "a", "drag", "operation", "in", "response", "to", "a", "mousemove", "event", "while", "the", "mouse", "is", "down" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9451-L9530
23,496
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (element, className) { var elemClassName; while (element) { elemClassName = attr(element, 'class'); if (elemClassName) { if (elemClassName.indexOf(className) !== -1) { return true; } else if (elemClassName.indexOf(PREFIX + 'container') !== -1) { return false; } } element = element.parentNode; } }
javascript
function (element, className) { var elemClassName; while (element) { elemClassName = attr(element, 'class'); if (elemClassName) { if (elemClassName.indexOf(className) !== -1) { return true; } else if (elemClassName.indexOf(PREFIX + 'container') !== -1) { return false; } } element = element.parentNode; } }
[ "function", "(", "element", ",", "className", ")", "{", "var", "elemClassName", ";", "while", "(", "element", ")", "{", "elemClassName", "=", "attr", "(", "element", ",", "'class'", ")", ";", "if", "(", "elemClassName", ")", "{", "if", "(", "elemClassName", ".", "indexOf", "(", "className", ")", "!==", "-", "1", ")", "{", "return", "true", ";", "}", "else", "if", "(", "elemClassName", ".", "indexOf", "(", "PREFIX", "+", "'container'", ")", "!==", "-", "1", ")", "{", "return", "false", ";", "}", "}", "element", "=", "element", ".", "parentNode", ";", "}", "}" ]
Utility to detect whether an element has, or has a parent with, a specific class name. Used on detection of tracker objects and on deciding whether hovering the tooltip should cause the active series to mouse out.
[ "Utility", "to", "detect", "whether", "an", "element", "has", "or", "has", "a", "parent", "with", "a", "specific", "class", "name", ".", "Used", "on", "detection", "of", "tracker", "objects", "and", "on", "deciding", "whether", "hovering", "the", "tooltip", "should", "cause", "the", "active", "series", "to", "mouse", "out", "." ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9665-L9678
23,497
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function () { var legend = this, legendGroup = legend.group, box = legend.box; if (box) { legend.box = box.destroy(); } if (legendGroup) { legend.group = legendGroup.destroy(); } }
javascript
function () { var legend = this, legendGroup = legend.group, box = legend.box; if (box) { legend.box = box.destroy(); } if (legendGroup) { legend.group = legendGroup.destroy(); } }
[ "function", "(", ")", "{", "var", "legend", "=", "this", ",", "legendGroup", "=", "legend", ".", "group", ",", "box", "=", "legend", ".", "box", ";", "if", "(", "box", ")", "{", "legend", ".", "box", "=", "box", ".", "destroy", "(", ")", ";", "}", "if", "(", "legendGroup", ")", "{", "legend", ".", "group", "=", "legendGroup", ".", "destroy", "(", ")", ";", "}", "}" ]
Destroys the legend.
[ "Destroys", "the", "legend", "." ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L9987-L9999
23,498
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function () { var options = this.options, padding = this.padding, titleOptions = options.title, titleHeight = 0, bBox; if (titleOptions.text) { if (!this.title) { this.title = this.chart.renderer.label(titleOptions.text, padding - 3, padding - 4, null, null, null, null, null, 'legend-title') .attr({ zIndex: 1 }) .css(titleOptions.style) .add(this.group); } bBox = this.title.getBBox(); titleHeight = bBox.height; this.offsetWidth = bBox.width; // #1717 this.contentGroup.attr({ translateY: titleHeight }); } this.titleHeight = titleHeight; }
javascript
function () { var options = this.options, padding = this.padding, titleOptions = options.title, titleHeight = 0, bBox; if (titleOptions.text) { if (!this.title) { this.title = this.chart.renderer.label(titleOptions.text, padding - 3, padding - 4, null, null, null, null, null, 'legend-title') .attr({ zIndex: 1 }) .css(titleOptions.style) .add(this.group); } bBox = this.title.getBBox(); titleHeight = bBox.height; this.offsetWidth = bBox.width; // #1717 this.contentGroup.attr({ translateY: titleHeight }); } this.titleHeight = titleHeight; }
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ",", "padding", "=", "this", ".", "padding", ",", "titleOptions", "=", "options", ".", "title", ",", "titleHeight", "=", "0", ",", "bBox", ";", "if", "(", "titleOptions", ".", "text", ")", "{", "if", "(", "!", "this", ".", "title", ")", "{", "this", ".", "title", "=", "this", ".", "chart", ".", "renderer", ".", "label", "(", "titleOptions", ".", "text", ",", "padding", "-", "3", ",", "padding", "-", "4", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "'legend-title'", ")", ".", "attr", "(", "{", "zIndex", ":", "1", "}", ")", ".", "css", "(", "titleOptions", ".", "style", ")", ".", "add", "(", "this", ".", "group", ")", ";", "}", "bBox", "=", "this", ".", "title", ".", "getBBox", "(", ")", ";", "titleHeight", "=", "bBox", ".", "height", ";", "this", ".", "offsetWidth", "=", "bBox", ".", "width", ";", "// #1717", "this", ".", "contentGroup", ".", "attr", "(", "{", "translateY", ":", "titleHeight", "}", ")", ";", "}", "this", ".", "titleHeight", "=", "titleHeight", ";", "}" ]
Render the legend title on top of the legend
[ "Render", "the", "legend", "title", "on", "top", "of", "the", "legend" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L10030-L10050
23,499
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/highcharts.src.js
function (userOptions, callback) { // Handle regular options var options, seriesOptions = userOptions.series; // skip merging data points to increase performance userOptions.series = null; options = merge(defaultOptions, userOptions); // do the merge options.series = userOptions.series = seriesOptions; // set back the series data var optionsChart = options.chart; // Create margin & spacing array this.margin = this.splashArray('margin', optionsChart); this.spacing = this.splashArray('spacing', optionsChart); var chartEvents = optionsChart.events; //this.runChartClick = chartEvents && !!chartEvents.click; this.bounds = { h: {}, v: {} }; // Pixel data bounds for touch zoom this.callback = callback; this.isResizing = 0; this.options = options; //chartTitleOptions = UNDEFINED; //chartSubtitleOptions = UNDEFINED; this.axes = []; this.series = []; this.hasCartesianSeries = optionsChart.showAxes; //this.axisOffset = UNDEFINED; //this.maxTicks = UNDEFINED; // handle the greatest amount of ticks on grouped axes //this.inverted = UNDEFINED; //this.loadingShown = UNDEFINED; //this.container = UNDEFINED; //this.chartWidth = UNDEFINED; //this.chartHeight = UNDEFINED; //this.marginRight = UNDEFINED; //this.marginBottom = UNDEFINED; //this.containerWidth = UNDEFINED; //this.containerHeight = UNDEFINED; //this.oldChartWidth = UNDEFINED; //this.oldChartHeight = UNDEFINED; //this.renderTo = UNDEFINED; //this.renderToClone = UNDEFINED; //this.spacingBox = UNDEFINED //this.legend = UNDEFINED; // Elements //this.chartBackground = UNDEFINED; //this.plotBackground = UNDEFINED; //this.plotBGImage = UNDEFINED; //this.plotBorder = UNDEFINED; //this.loadingDiv = UNDEFINED; //this.loadingSpan = UNDEFINED; var chart = this, eventType; // Add the chart to the global lookup chart.index = charts.length; charts.push(chart); // Set up auto resize if (optionsChart.reflow !== false) { addEvent(chart, 'load', function () { chart.initReflow(); }); } // Chart event handlers if (chartEvents) { for (eventType in chartEvents) { addEvent(chart, eventType, chartEvents[eventType]); } } chart.xAxis = []; chart.yAxis = []; // Expose methods and variables chart.animation = useCanVG ? false : pick(optionsChart.animation, true); chart.pointCount = 0; chart.counters = new ChartCounters(); chart.firstRender(); }
javascript
function (userOptions, callback) { // Handle regular options var options, seriesOptions = userOptions.series; // skip merging data points to increase performance userOptions.series = null; options = merge(defaultOptions, userOptions); // do the merge options.series = userOptions.series = seriesOptions; // set back the series data var optionsChart = options.chart; // Create margin & spacing array this.margin = this.splashArray('margin', optionsChart); this.spacing = this.splashArray('spacing', optionsChart); var chartEvents = optionsChart.events; //this.runChartClick = chartEvents && !!chartEvents.click; this.bounds = { h: {}, v: {} }; // Pixel data bounds for touch zoom this.callback = callback; this.isResizing = 0; this.options = options; //chartTitleOptions = UNDEFINED; //chartSubtitleOptions = UNDEFINED; this.axes = []; this.series = []; this.hasCartesianSeries = optionsChart.showAxes; //this.axisOffset = UNDEFINED; //this.maxTicks = UNDEFINED; // handle the greatest amount of ticks on grouped axes //this.inverted = UNDEFINED; //this.loadingShown = UNDEFINED; //this.container = UNDEFINED; //this.chartWidth = UNDEFINED; //this.chartHeight = UNDEFINED; //this.marginRight = UNDEFINED; //this.marginBottom = UNDEFINED; //this.containerWidth = UNDEFINED; //this.containerHeight = UNDEFINED; //this.oldChartWidth = UNDEFINED; //this.oldChartHeight = UNDEFINED; //this.renderTo = UNDEFINED; //this.renderToClone = UNDEFINED; //this.spacingBox = UNDEFINED //this.legend = UNDEFINED; // Elements //this.chartBackground = UNDEFINED; //this.plotBackground = UNDEFINED; //this.plotBGImage = UNDEFINED; //this.plotBorder = UNDEFINED; //this.loadingDiv = UNDEFINED; //this.loadingSpan = UNDEFINED; var chart = this, eventType; // Add the chart to the global lookup chart.index = charts.length; charts.push(chart); // Set up auto resize if (optionsChart.reflow !== false) { addEvent(chart, 'load', function () { chart.initReflow(); }); } // Chart event handlers if (chartEvents) { for (eventType in chartEvents) { addEvent(chart, eventType, chartEvents[eventType]); } } chart.xAxis = []; chart.yAxis = []; // Expose methods and variables chart.animation = useCanVG ? false : pick(optionsChart.animation, true); chart.pointCount = 0; chart.counters = new ChartCounters(); chart.firstRender(); }
[ "function", "(", "userOptions", ",", "callback", ")", "{", "// Handle regular options", "var", "options", ",", "seriesOptions", "=", "userOptions", ".", "series", ";", "// skip merging data points to increase performance", "userOptions", ".", "series", "=", "null", ";", "options", "=", "merge", "(", "defaultOptions", ",", "userOptions", ")", ";", "// do the merge", "options", ".", "series", "=", "userOptions", ".", "series", "=", "seriesOptions", ";", "// set back the series data", "var", "optionsChart", "=", "options", ".", "chart", ";", "// Create margin & spacing array", "this", ".", "margin", "=", "this", ".", "splashArray", "(", "'margin'", ",", "optionsChart", ")", ";", "this", ".", "spacing", "=", "this", ".", "splashArray", "(", "'spacing'", ",", "optionsChart", ")", ";", "var", "chartEvents", "=", "optionsChart", ".", "events", ";", "//this.runChartClick = chartEvents && !!chartEvents.click;", "this", ".", "bounds", "=", "{", "h", ":", "{", "}", ",", "v", ":", "{", "}", "}", ";", "// Pixel data bounds for touch zoom", "this", ".", "callback", "=", "callback", ";", "this", ".", "isResizing", "=", "0", ";", "this", ".", "options", "=", "options", ";", "//chartTitleOptions = UNDEFINED;", "//chartSubtitleOptions = UNDEFINED;", "this", ".", "axes", "=", "[", "]", ";", "this", ".", "series", "=", "[", "]", ";", "this", ".", "hasCartesianSeries", "=", "optionsChart", ".", "showAxes", ";", "//this.axisOffset = UNDEFINED;", "//this.maxTicks = UNDEFINED; // handle the greatest amount of ticks on grouped axes", "//this.inverted = UNDEFINED;", "//this.loadingShown = UNDEFINED;", "//this.container = UNDEFINED;", "//this.chartWidth = UNDEFINED;", "//this.chartHeight = UNDEFINED;", "//this.marginRight = UNDEFINED;", "//this.marginBottom = UNDEFINED;", "//this.containerWidth = UNDEFINED;", "//this.containerHeight = UNDEFINED;", "//this.oldChartWidth = UNDEFINED;", "//this.oldChartHeight = UNDEFINED;", "//this.renderTo = UNDEFINED;", "//this.renderToClone = UNDEFINED;", "//this.spacingBox = UNDEFINED", "//this.legend = UNDEFINED;", "// Elements", "//this.chartBackground = UNDEFINED;", "//this.plotBackground = UNDEFINED;", "//this.plotBGImage = UNDEFINED;", "//this.plotBorder = UNDEFINED;", "//this.loadingDiv = UNDEFINED;", "//this.loadingSpan = UNDEFINED;", "var", "chart", "=", "this", ",", "eventType", ";", "// Add the chart to the global lookup", "chart", ".", "index", "=", "charts", ".", "length", ";", "charts", ".", "push", "(", "chart", ")", ";", "// Set up auto resize", "if", "(", "optionsChart", ".", "reflow", "!==", "false", ")", "{", "addEvent", "(", "chart", ",", "'load'", ",", "function", "(", ")", "{", "chart", ".", "initReflow", "(", ")", ";", "}", ")", ";", "}", "// Chart event handlers", "if", "(", "chartEvents", ")", "{", "for", "(", "eventType", "in", "chartEvents", ")", "{", "addEvent", "(", "chart", ",", "eventType", ",", "chartEvents", "[", "eventType", "]", ")", ";", "}", "}", "chart", ".", "xAxis", "=", "[", "]", ";", "chart", ".", "yAxis", "=", "[", "]", ";", "// Expose methods and variables", "chart", ".", "animation", "=", "useCanVG", "?", "false", ":", "pick", "(", "optionsChart", ".", "animation", ",", "true", ")", ";", "chart", ".", "pointCount", "=", "0", ";", "chart", ".", "counters", "=", "new", "ChartCounters", "(", ")", ";", "chart", ".", "firstRender", "(", ")", ";", "}" ]
Initialize the chart
[ "Initialize", "the", "chart" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L10527-L10616