repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
gmac/sass-thematic
lib/thematic.js
function() { if (typeof this.varsData !== 'string') { if (!this.varsFile) throw 'No theme variables file specified.'; this.varsFile = path.resolve(this.cwd, this.varsFile); this.varsData = fs.readFileSync(this.varsFile, 'utf-8'); } }
javascript
function() { if (typeof this.varsData !== 'string') { if (!this.varsFile) throw 'No theme variables file specified.'; this.varsFile = path.resolve(this.cwd, this.varsFile); this.varsData = fs.readFileSync(this.varsFile, 'utf-8'); } }
[ "function", "(", ")", "{", "if", "(", "typeof", "this", ".", "varsData", "!==", "'string'", ")", "{", "if", "(", "!", "this", ".", "varsFile", ")", "throw", "'No theme variables file specified.'", ";", "this", ".", "varsFile", "=", "path", ".", "resolve", ...
Loads theme variables into the thematic instance.
[ "Loads", "theme", "variables", "into", "the", "thematic", "instance", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L170-L176
train
gmac/sass-thematic
lib/thematic.js
function(source) { if (typeof source === 'object') { this.ast = source; } else if (typeof source === 'string') { // JSON source: if (isJSON(source)) { this.ast = JSON.parse(source); } // Sass source: else { this.ast = gonzales.parse(source, {syntax: 'scss'...
javascript
function(source) { if (typeof source === 'object') { this.ast = source; } else if (typeof source === 'string') { // JSON source: if (isJSON(source)) { this.ast = JSON.parse(source); } // Sass source: else { this.ast = gonzales.parse(source, {syntax: 'scss'...
[ "function", "(", "source", ")", "{", "if", "(", "typeof", "source", "===", "'object'", ")", "{", "this", ".", "ast", "=", "source", ";", "}", "else", "if", "(", "typeof", "source", "===", "'string'", ")", "{", "// JSON source:", "if", "(", "isJSON", ...
Loads a source file into the renderer. @param {String|Object} source AST, JSON string, or Sass string. @returns {SassThematic} self reference.
[ "Loads", "a", "source", "file", "into", "the", "renderer", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L201-L220
train
gmac/sass-thematic
lib/thematic.js
function(opts) { var opts = opts || {}; this._template = !!(opts.hasOwnProperty('template') ? opts.template : this.template); this._treeRemoval = !!(opts.hasOwnProperty('treeRemoval') ? opts.treeRemoval : this.treeRemoval); this._varsRemoval = !!(opts.hasOwnProperty('varsRemoval') ? opts.varsRemoval : t...
javascript
function(opts) { var opts = opts || {}; this._template = !!(opts.hasOwnProperty('template') ? opts.template : this.template); this._treeRemoval = !!(opts.hasOwnProperty('treeRemoval') ? opts.treeRemoval : this.treeRemoval); this._varsRemoval = !!(opts.hasOwnProperty('varsRemoval') ? opts.varsRemoval : t...
[ "function", "(", "opts", ")", "{", "var", "opts", "=", "opts", "||", "{", "}", ";", "this", ".", "_template", "=", "!", "!", "(", "opts", ".", "hasOwnProperty", "(", "'template'", ")", "?", "opts", ".", "template", ":", "this", ".", "template", ")"...
Parses the Thematic AST instance. All non-themed rules and declarations will be eliminated by default. @param {Object} options for parsing: - disableTreeRemoval: true to prevent destructive tree pruning. - disableVarsRemoval: true to prevent destructive variables removal. - template: true for template parsing. @returns...
[ "Parses", "the", "Thematic", "AST", "instance", ".", "All", "non", "-", "themed", "rules", "and", "declarations", "will", "be", "eliminated", "by", "default", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L244-L251
train
gmac/sass-thematic
lib/thematic.js
function(parent) { function error(usage) { return new Error('Template theme fields are not permitted '+ usage +':\n>>> '+ Node.toString(parent)); } // Check for arguments implementation: if (parent.type === NodeType.ARGUMENTS) { throw error('as arguments'); } // Check for interpola...
javascript
function(parent) { function error(usage) { return new Error('Template theme fields are not permitted '+ usage +':\n>>> '+ Node.toString(parent)); } // Check for arguments implementation: if (parent.type === NodeType.ARGUMENTS) { throw error('as arguments'); } // Check for interpola...
[ "function", "(", "parent", ")", "{", "function", "error", "(", "usage", ")", "{", "return", "new", "Error", "(", "'Template theme fields are not permitted '", "+", "usage", "+", "':\\n>>> '", "+", "Node", ".", "toString", "(", "parent", ")", ")", ";", "}", ...
Validates the usage context for a template field. Template fields are post-processed values, therefore may not be used in preprocessed functions, operations, or interpolations. @private
[ "Validates", "the", "usage", "context", "for", "a", "template", "field", ".", "Template", "fields", "are", "post", "-", "processed", "values", "therefore", "may", "not", "be", "used", "in", "preprocessed", "functions", "operations", "or", "interpolations", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L425-L446
train
gmac/sass-thematic
lib/thematic.js
function(field) { if (this.vars.hasOwnProperty(field)) { if (!this.usage.hasOwnProperty(field)) { this.usage[field] = 0; } this.usage[field]++; } }
javascript
function(field) { if (this.vars.hasOwnProperty(field)) { if (!this.usage.hasOwnProperty(field)) { this.usage[field] = 0; } this.usage[field]++; } }
[ "function", "(", "field", ")", "{", "if", "(", "this", ".", "vars", ".", "hasOwnProperty", "(", "field", ")", ")", "{", "if", "(", "!", "this", ".", "usage", ".", "hasOwnProperty", "(", "field", ")", ")", "{", "this", ".", "usage", "[", "field", ...
Tracks field names used within the source, and keeps a running tally of their use count. @param {String} name of field to report on.
[ "Tracks", "field", "names", "used", "within", "the", "source", "and", "keeps", "a", "running", "tally", "of", "their", "use", "count", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L453-L460
train
gmac/sass-thematic
lib/thematic.js
function(field) { if (this._template) { var match = field.match(this.fieldRegex); return match && this.vars.hasOwnProperty(match[1]); } return false; }
javascript
function(field) { if (this._template) { var match = field.match(this.fieldRegex); return match && this.vars.hasOwnProperty(match[1]); } return false; }
[ "function", "(", "field", ")", "{", "if", "(", "this", ".", "_template", ")", "{", "var", "match", "=", "field", ".", "match", "(", "this", ".", "fieldRegex", ")", ";", "return", "match", "&&", "this", ".", "vars", ".", "hasOwnProperty", "(", "match"...
Validates the formatting of a template field, and checks for its name in the vars mapping table.
[ "Validates", "the", "formatting", "of", "a", "template", "field", "and", "checks", "for", "its", "name", "in", "the", "vars", "mapping", "table", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L466-L472
train
gmac/sass-thematic
lib/thematic.js
function(opts, done) { if (typeof opts !== 'object') { done = opts; opts = null; } validateCallback(done); this.parse(opts); this.renderCSS(done); return this; }
javascript
function(opts, done) { if (typeof opts !== 'object') { done = opts; opts = null; } validateCallback(done); this.parse(opts); this.renderCSS(done); return this; }
[ "function", "(", "opts", ",", "done", ")", "{", "if", "(", "typeof", "opts", "!==", "'object'", ")", "{", "done", "=", "opts", ";", "opts", "=", "null", ";", "}", "validateCallback", "(", "done", ")", ";", "this", ".", "parse", "(", "opts", ")", ...
Renders flat CSS from pruned theme source. @param {Function} callback function to run on completion. @returns {SassThematic} self reference.
[ "Renders", "flat", "CSS", "from", "pruned", "theme", "source", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L479-L488
train
gmac/sass-thematic
lib/thematic.js
function(done) { var isSync = (typeof done !== 'function'); var sass = require('node-sass'); var opts = this.sassCSSOptions(); if (isSync) { try { return sass.renderSync(opts).css.toString(); } catch (err) { throw formatSassError(err, opts.data); } } sass.rend...
javascript
function(done) { var isSync = (typeof done !== 'function'); var sass = require('node-sass'); var opts = this.sassCSSOptions(); if (isSync) { try { return sass.renderSync(opts).css.toString(); } catch (err) { throw formatSassError(err, opts.data); } } sass.rend...
[ "function", "(", "done", ")", "{", "var", "isSync", "=", "(", "typeof", "done", "!==", "'function'", ")", ";", "var", "sass", "=", "require", "(", "'node-sass'", ")", ";", "var", "opts", "=", "this", ".", "sassCSSOptions", "(", ")", ";", "if", "(", ...
Low-level implementation of CSS rendering. @param {Function} callback for asynchronous rendering. @returns {String|undefined} rendered CSS string (sync) or undefined (async). @private
[ "Low", "-", "level", "implementation", "of", "CSS", "rendering", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L521-L538
train
gmac/sass-thematic
lib/thematic.js
function(opts, done) { if (typeof opts !== 'object') { done = opts; opts = {}; } validateCallback(done); opts.template = true; this.parse(opts); this.renderTemplate(done); return this; }
javascript
function(opts, done) { if (typeof opts !== 'object') { done = opts; opts = {}; } validateCallback(done); opts.template = true; this.parse(opts); this.renderTemplate(done); return this; }
[ "function", "(", "opts", ",", "done", ")", "{", "if", "(", "typeof", "opts", "!==", "'object'", ")", "{", "done", "=", "opts", ";", "opts", "=", "{", "}", ";", "}", "validateCallback", "(", "done", ")", ";", "opts", ".", "template", "=", "true", ...
Renders a flat CSS template with interpolation fields. @param {Function} callback function to run on completion. @returns {SassThematic} self reference.
[ "Renders", "a", "flat", "CSS", "template", "with", "interpolation", "fields", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L545-L555
train
gmac/sass-thematic
lib/thematic.js
function(done) { var isSync = (typeof done !== 'function'); var sass = require('node-sass'); var opts = this.sassTemplateOptions(); var self = this; if (isSync) { try { var result = sass.renderSync(opts); return this.fieldIdentifiersToInterpolations(result.css.toString()); ...
javascript
function(done) { var isSync = (typeof done !== 'function'); var sass = require('node-sass'); var opts = this.sassTemplateOptions(); var self = this; if (isSync) { try { var result = sass.renderSync(opts); return this.fieldIdentifiersToInterpolations(result.css.toString()); ...
[ "function", "(", "done", ")", "{", "var", "isSync", "=", "(", "typeof", "done", "!==", "'function'", ")", ";", "var", "sass", "=", "require", "(", "'node-sass'", ")", ";", "var", "opts", "=", "this", ".", "sassTemplateOptions", "(", ")", ";", "var", ...
Low-level implementation of template rendering. @param {Function} callback for asynchronous rendering. @returns {String|undefined} rendered template string (sync) or undefined (async). @private
[ "Low", "-", "level", "implementation", "of", "template", "rendering", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L590-L609
train
gmac/sass-thematic
lib/thematic.js
function(sass) { var match; while ((match = this.fieldRegexAll.exec(sass)) !== null) { if (this.vars.hasOwnProperty(match[1])) { this._addFieldUsage(match[1]); } } return this; }
javascript
function(sass) { var match; while ((match = this.fieldRegexAll.exec(sass)) !== null) { if (this.vars.hasOwnProperty(match[1])) { this._addFieldUsage(match[1]); } } return this; }
[ "function", "(", "sass", ")", "{", "var", "match", ";", "while", "(", "(", "match", "=", "this", ".", "fieldRegexAll", ".", "exec", "(", "sass", ")", ")", "!==", "null", ")", "{", "if", "(", "this", ".", "vars", ".", "hasOwnProperty", "(", "match",...
Counts the usage of all field identifiers in the source text. Field counts are reported into the parser's usage table. @param {String} sass string to count field usage in.
[ "Counts", "the", "usage", "of", "all", "field", "identifiers", "in", "the", "source", "text", ".", "Field", "counts", "are", "reported", "into", "the", "parser", "s", "usage", "table", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L616-L624
train
gmac/sass-thematic
lib/thematic.js
formatSassError
function formatSassError(err, data) { // Generate three-line preview around the error: var preview = data.split('\n'); preview = preview.slice(Math.max(0, err.line-2), Math.min(err.line+1, preview.length-1)); preview = preview.map(function(src) { return '>>> '+ src }); preview.unshift(err.message); var err...
javascript
function formatSassError(err, data) { // Generate three-line preview around the error: var preview = data.split('\n'); preview = preview.slice(Math.max(0, err.line-2), Math.min(err.line+1, preview.length-1)); preview = preview.map(function(src) { return '>>> '+ src }); preview.unshift(err.message); var err...
[ "function", "formatSassError", "(", "err", ",", "data", ")", "{", "// Generate three-line preview around the error:", "var", "preview", "=", "data", ".", "split", "(", "'\\n'", ")", ";", "preview", "=", "preview", ".", "slice", "(", "Math", ".", "max", "(", ...
Format Sass error for better contextual reporting.
[ "Format", "Sass", "error", "for", "better", "contextual", "reporting", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/thematic.js#L710-L721
train
gmac/sass-thematic
lib/ast.js
function(base) { for (var i=1; i < arguments.length; i++) { var ext = arguments[i]; for (var key in ext) { if (ext.hasOwnProperty(key)) base[key] = ext[key]; } } return base; }
javascript
function(base) { for (var i=1; i < arguments.length; i++) { var ext = arguments[i]; for (var key in ext) { if (ext.hasOwnProperty(key)) base[key] = ext[key]; } } return base; }
[ "function", "(", "base", ")", "{", "for", "(", "var", "i", "=", "1", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "var", "ext", "=", "arguments", "[", "i", "]", ";", "for", "(", "var", "key", "in", "ext", ")", "{", "...
Merge properties from one or more objects onto a base object. @param {Object} base object to receive merged properties. @param {...Object} mixin objects to extend onto base.
[ "Merge", "properties", "from", "one", "or", "more", "objects", "onto", "a", "base", "object", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L16-L24
train
gmac/sass-thematic
lib/ast.js
function(opts) { return this.extend(gonzales.createNode({ type: 'stylesheet', syntax: 'scss', content: [], start: {line: 1, column: 1}, end: {line: 1, column: 1} }), opts || {}); }
javascript
function(opts) { return this.extend(gonzales.createNode({ type: 'stylesheet', syntax: 'scss', content: [], start: {line: 1, column: 1}, end: {line: 1, column: 1} }), opts || {}); }
[ "function", "(", "opts", ")", "{", "return", "this", ".", "extend", "(", "gonzales", ".", "createNode", "(", "{", "type", ":", "'stylesheet'", ",", "syntax", ":", "'scss'", ",", "content", ":", "[", "]", ",", "start", ":", "{", "line", ":", "1", ",...
Creates a new empty Gonzales stylesheet node. @param {Object} options to extend onto the new node.
[ "Creates", "a", "new", "empty", "Gonzales", "stylesheet", "node", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L30-L38
train
gmac/sass-thematic
lib/ast.js
function(parentFile, importedFile) { if (parentFile.includedFiles.indexOf(importedFile.file) < 0) { // Add imported file reference: parentFile.includedFiles.push(importedFile.file); // Add all of imported file's imports: for (var i=0; i < importedFile.includedFiles.length; i++) { va...
javascript
function(parentFile, importedFile) { if (parentFile.includedFiles.indexOf(importedFile.file) < 0) { // Add imported file reference: parentFile.includedFiles.push(importedFile.file); // Add all of imported file's imports: for (var i=0; i < importedFile.includedFiles.length; i++) { va...
[ "function", "(", "parentFile", ",", "importedFile", ")", "{", "if", "(", "parentFile", ".", "includedFiles", ".", "indexOf", "(", "importedFile", ".", "file", ")", "<", "0", ")", "{", "// Add imported file reference:", "parentFile", ".", "includedFiles", ".", ...
Maps included files from an import onto its parent.
[ "Maps", "included", "files", "from", "an", "import", "onto", "its", "parent", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L56-L69
train
gmac/sass-thematic
lib/ast.js
function(file) { if (!AST.cache) { return; } else if (typeof file === 'string') { if (!AST.cache[file]) AST.cache[file] = null; } else if (file.isParsed() && !file.timestamp) { file.timestamp = Date.now(); AST.cache[file.file] = file; } }
javascript
function(file) { if (!AST.cache) { return; } else if (typeof file === 'string') { if (!AST.cache[file]) AST.cache[file] = null; } else if (file.isParsed() && !file.timestamp) { file.timestamp = Date.now(); AST.cache[file.file] = file; } }
[ "function", "(", "file", ")", "{", "if", "(", "!", "AST", ".", "cache", ")", "{", "return", ";", "}", "else", "if", "(", "typeof", "file", "===", "'string'", ")", "{", "if", "(", "!", "AST", ".", "cache", "[", "file", "]", ")", "AST", ".", "c...
Writes a file into the cache of parsed files. File paths may be submitted to expand the file graph, even if we don't have a valid file yet to fill the node.
[ "Writes", "a", "file", "into", "the", "cache", "of", "parsed", "files", ".", "File", "paths", "may", "be", "submitted", "to", "expand", "the", "file", "graph", "even", "if", "we", "don", "t", "have", "a", "valid", "file", "yet", "to", "fill", "the", ...
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L76-L87
train
gmac/sass-thematic
lib/ast.js
Importer
function Importer(opts) { var self = this; opts = opts || {}; EventEmitter.call(this); this.cwd = opts.cwd ? path.resolve(opts.cwd) : process.cwd(); this.file = opts.file ? path.resolve(opts.cwd, opts.file) : this.cwd; this.data = opts.data; this.includePaths = opts.includePaths || []; // Map all inclu...
javascript
function Importer(opts) { var self = this; opts = opts || {}; EventEmitter.call(this); this.cwd = opts.cwd ? path.resolve(opts.cwd) : process.cwd(); this.file = opts.file ? path.resolve(opts.cwd, opts.file) : this.cwd; this.data = opts.data; this.includePaths = opts.includePaths || []; // Map all inclu...
[ "function", "Importer", "(", "opts", ")", "{", "var", "self", "=", "this", ";", "opts", "=", "opts", "||", "{", "}", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "cwd", "=", "opts", ".", "cwd", "?", "path", ".", "resolve"...
File Importer Primary engine for managing and resolving file imports. Manages options and serves as a central cache for resolved files. Also the primary event bus for messaging file import actions.
[ "File", "Importer", "Primary", "engine", "for", "managing", "and", "resolving", "file", "imports", ".", "Manages", "options", "and", "serves", "as", "a", "central", "cache", "for", "resolved", "files", ".", "Also", "the", "primary", "event", "bus", "for", "m...
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L97-L110
train
gmac/sass-thematic
lib/ast.js
function(done) { this.async = true; var self = this; function finish(err, file) { var hasCallback = (typeof done === 'function'); if (err && !hasCallback) return self.emit('error', err); if (err) return done(err); done(null, file); } if (this.data) { this.createFile(t...
javascript
function(done) { this.async = true; var self = this; function finish(err, file) { var hasCallback = (typeof done === 'function'); if (err && !hasCallback) return self.emit('error', err); if (err) return done(err); done(null, file); } if (this.data) { this.createFile(t...
[ "function", "(", "done", ")", "{", "this", ".", "async", "=", "true", ";", "var", "self", "=", "this", ";", "function", "finish", "(", "err", ",", "file", ")", "{", "var", "hasCallback", "=", "(", "typeof", "done", "===", "'function'", ")", ";", "i...
Runs the importer config asynchronously.
[ "Runs", "the", "importer", "config", "asynchronously", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L119-L140
train
gmac/sass-thematic
lib/ast.js
function() { this.async = false; var file; if (this.data) { file = this.createFile(this.file, this.uri, this.file, this.data); } else { file = this.resolveSync(this.file, this.cwd); } return file.parse(); }
javascript
function() { this.async = false; var file; if (this.data) { file = this.createFile(this.file, this.uri, this.file, this.data); } else { file = this.resolveSync(this.file, this.cwd); } return file.parse(); }
[ "function", "(", ")", "{", "this", ".", "async", "=", "false", ";", "var", "file", ";", "if", "(", "this", ".", "data", ")", "{", "file", "=", "this", ".", "createFile", "(", "this", ".", "file", ",", "this", ".", "uri", ",", "this", ".", "file...
Runs the importer config synchronously.
[ "Runs", "the", "importer", "config", "synchronously", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L145-L156
train
gmac/sass-thematic
lib/ast.js
File
function File(filepath, data, importer) { this.file = filepath; this.data = data; this.importer = importer; this.includedFiles = []; this._cb = []; _.cacheFile(filepath); }
javascript
function File(filepath, data, importer) { this.file = filepath; this.data = data; this.importer = importer; this.includedFiles = []; this._cb = []; _.cacheFile(filepath); }
[ "function", "File", "(", "filepath", ",", "data", ",", "importer", ")", "{", "this", ".", "file", "=", "filepath", ";", "this", ".", "data", "=", "data", ";", "this", ".", "importer", "=", "importer", ";", "this", ".", "includedFiles", "=", "[", "]",...
File Handler for parsing loaded file data into an AST. Parsing resolves import statements, thus may request additional files.
[ "File", "Handler", "for", "parsing", "loaded", "file", "data", "into", "an", "AST", ".", "Parsing", "resolves", "import", "statements", "thus", "may", "request", "additional", "files", "." ]
a887c15b98ec2c45452340a9bc26c5321add034a
https://github.com/gmac/sass-thematic/blob/a887c15b98ec2c45452340a9bc26c5321add034a/lib/ast.js#L267-L274
train
roofstock/ember-cli-data-export
vendor/xlsx-0.10.8.js
sectorify
function sectorify(file, ssz) { var nsectors = Math.ceil(file.length/ssz)-1; var sectors = new Array(nsectors); for(var i=1; i < nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz); sectors[nsectors-1] = file.slice(nsectors*ssz); return sectors; }
javascript
function sectorify(file, ssz) { var nsectors = Math.ceil(file.length/ssz)-1; var sectors = new Array(nsectors); for(var i=1; i < nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz); sectors[nsectors-1] = file.slice(nsectors*ssz); return sectors; }
[ "function", "sectorify", "(", "file", ",", "ssz", ")", "{", "var", "nsectors", "=", "Math", ".", "ceil", "(", "file", ".", "length", "/", "ssz", ")", "-", "1", ";", "var", "sectors", "=", "new", "Array", "(", "nsectors", ")", ";", "for", "(", "va...
Break the file up into sectors
[ "Break", "the", "file", "up", "into", "sectors" ]
93eda5cf4e40092e69fb702acdfc51ef82bac4c4
https://github.com/roofstock/ember-cli-data-export/blob/93eda5cf4e40092e69fb702acdfc51ef82bac4c4/vendor/xlsx-0.10.8.js#L1154-L1160
train
respectTheCode/node-caspar-cg
lib/xml2json.js
makePath
function makePath(object, path, index) { index = index || 0; var obj; if (path.length > index + 1) { obj = object[path[index]]; // we always want the last object in an array if (_.isArray(obj)) obj = _.last(obj); makePath(obj, path, index + 1); } else { obj = object[path[index]]; if (!obj)...
javascript
function makePath(object, path, index) { index = index || 0; var obj; if (path.length > index + 1) { obj = object[path[index]]; // we always want the last object in an array if (_.isArray(obj)) obj = _.last(obj); makePath(obj, path, index + 1); } else { obj = object[path[index]]; if (!obj)...
[ "function", "makePath", "(", "object", ",", "path", ",", "index", ")", "{", "index", "=", "index", "||", "0", ";", "var", "obj", ";", "if", "(", "path", ".", "length", ">", "index", "+", "1", ")", "{", "obj", "=", "object", "[", "path", "[", "i...
helper function to prepare a path for values this will convert a node into an array if it already exists
[ "helper", "function", "to", "prepare", "a", "path", "for", "values", "this", "will", "convert", "a", "node", "into", "an", "array", "if", "it", "already", "exists" ]
8b71bf587b1c44d65f24030c75bd4763ad5d038f
https://github.com/respectTheCode/node-caspar-cg/blob/8b71bf587b1c44d65f24030c75bd4763ad5d038f/lib/xml2json.js#L18-L45
train
respectTheCode/node-caspar-cg
lib/xml2json.js
setValueForPath
function setValueForPath(object, path, value, index) { index = index || 0; if (path.length > index + 1) { var obj = object[path[index]]; // we always want the last object in an array if (_.isArray(obj)) obj = _.last(obj); setValueForPath(obj, path, value, index + 1); } else { // found the object...
javascript
function setValueForPath(object, path, value, index) { index = index || 0; if (path.length > index + 1) { var obj = object[path[index]]; // we always want the last object in an array if (_.isArray(obj)) obj = _.last(obj); setValueForPath(obj, path, value, index + 1); } else { // found the object...
[ "function", "setValueForPath", "(", "object", ",", "path", ",", "value", ",", "index", ")", "{", "index", "=", "index", "||", "0", ";", "if", "(", "path", ".", "length", ">", "index", "+", "1", ")", "{", "var", "obj", "=", "object", "[", "path", ...
helper function to set the value of a path
[ "helper", "function", "to", "set", "the", "value", "of", "a", "path" ]
8b71bf587b1c44d65f24030c75bd4763ad5d038f
https://github.com/respectTheCode/node-caspar-cg/blob/8b71bf587b1c44d65f24030c75bd4763ad5d038f/lib/xml2json.js#L48-L62
train
kesla/sort-json
app/overwrite.js
overwriteFile
function overwriteFile(path, options) { let fileContent = null; let newData = null; try { fileContent = fs.readFileSync(path, 'utf8'); newData = visit(JSON.parse(fileContent), options); } catch (e) { console.error('Failed to retrieve json object from file'); throw e; } let indent; if (o...
javascript
function overwriteFile(path, options) { let fileContent = null; let newData = null; try { fileContent = fs.readFileSync(path, 'utf8'); newData = visit(JSON.parse(fileContent), options); } catch (e) { console.error('Failed to retrieve json object from file'); throw e; } let indent; if (o...
[ "function", "overwriteFile", "(", "path", ",", "options", ")", "{", "let", "fileContent", "=", "null", ";", "let", "newData", "=", "null", ";", "try", "{", "fileContent", "=", "fs", ".", "readFileSync", "(", "path", ",", "'utf8'", ")", ";", "newData", ...
Overwrite file with sorted json @param {String} path - absolutePath @param {Object} [options = {}] - optional params @returns {*}
[ "Overwrite", "file", "with", "sorted", "json" ]
81648138ac8edcf0c1967445e6c6f5cefa434bf4
https://github.com/kesla/sort-json/blob/81648138ac8edcf0c1967445e6c6f5cefa434bf4/app/overwrite.js#L15-L49
train
kesla/sort-json
app/overwrite.js
overwrite
function overwrite(absolutePaths, options) { const paths = Array.isArray(absolutePaths) ? absolutePaths : [absolutePaths]; const results = paths.map(path => overwriteFile(path, options)); return results.length > 1 ? results : results[0]; }
javascript
function overwrite(absolutePaths, options) { const paths = Array.isArray(absolutePaths) ? absolutePaths : [absolutePaths]; const results = paths.map(path => overwriteFile(path, options)); return results.length > 1 ? results : results[0]; }
[ "function", "overwrite", "(", "absolutePaths", ",", "options", ")", "{", "const", "paths", "=", "Array", ".", "isArray", "(", "absolutePaths", ")", "?", "absolutePaths", ":", "[", "absolutePaths", "]", ";", "const", "results", "=", "paths", ".", "map", "("...
Sorts the files json with the visit function and then overwrites the file with sorted json @see visit @param {String|Array} absolutePaths - String: Absolute path to json file to sort and overwrite Array: Absolute paths to json files to sort and overwrite @param {Object} [options = {}] - Optional parameters obj...
[ "Sorts", "the", "files", "json", "with", "the", "visit", "function", "and", "then", "overwrites", "the", "file", "with", "sorted", "json" ]
81648138ac8edcf0c1967445e6c6f5cefa434bf4
https://github.com/kesla/sort-json/blob/81648138ac8edcf0c1967445e6c6f5cefa434bf4/app/overwrite.js#L59-L63
train
kesla/sort-json
app/visit.js
visit
function visit(old, options) { const sortOptions = options || {}; const ignoreCase = sortOptions.ignoreCase || false; const reverse = sortOptions.reverse || false; const depth = sortOptions.depth || Infinity; const level = sortOptions.level || 1; const processing = level <= depth; if (typeof (old) !== '...
javascript
function visit(old, options) { const sortOptions = options || {}; const ignoreCase = sortOptions.ignoreCase || false; const reverse = sortOptions.reverse || false; const depth = sortOptions.depth || Infinity; const level = sortOptions.level || 1; const processing = level <= depth; if (typeof (old) !== '...
[ "function", "visit", "(", "old", ",", "options", ")", "{", "const", "sortOptions", "=", "options", "||", "{", "}", ";", "const", "ignoreCase", "=", "sortOptions", ".", "ignoreCase", "||", "false", ";", "const", "reverse", "=", "sortOptions", ".", "reverse"...
Sorts the keys on objects @param {*} old - An object to sort the keys of, if not object just returns whatever was given @param {Object} [sortOptions = {}] - optional parameters @param [options.reverse = false] - When sorting keys, converts all keys to lowercase so that capita...
[ "Sorts", "the", "keys", "on", "objects" ]
81648138ac8edcf0c1967445e6c6f5cefa434bf4
https://github.com/kesla/sort-json/blob/81648138ac8edcf0c1967445e6c6f5cefa434bf4/app/visit.js#L14-L46
train
jsreport/jsreport-sample-template
samples/Orders/orders-script/content.js
fetchOrders
function fetchOrders() { return new Promise((resolve, reject) => { https.get('https://services.odata.org/V4/Northwind/Northwind.svc/Orders', (result) => { var str = ''; result.on('data', (b) => str += b); result.on('error', reject); result.on('end', ()...
javascript
function fetchOrders() { return new Promise((resolve, reject) => { https.get('https://services.odata.org/V4/Northwind/Northwind.svc/Orders', (result) => { var str = ''; result.on('data', (b) => str += b); result.on('error', reject); result.on('end', ()...
[ "function", "fetchOrders", "(", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "https", ".", "get", "(", "'https://services.odata.org/V4/Northwind/Northwind.svc/Orders'", ",", "(", "result", ")", "=>", "{", "var", "st...
call remote http rest api
[ "call", "remote", "http", "rest", "api" ]
54973fcd2cbbb69549015c324a3bea615612e4a3
https://github.com/jsreport/jsreport-sample-template/blob/54973fcd2cbbb69549015c324a3bea615612e4a3/samples/Orders/orders-script/content.js#L5-L15
train
jsreport/jsreport-sample-template
samples/Orders/orders-script/content.js
prepareDataSource
async function prepareDataSource() { const orders = await fetchOrders() const ordersByShipCountry = orders.reduce((a, v) => { a[v.ShipCountry] = a[v.ShipCountry] || [] a[v.ShipCountry].push(v) return a }, {}) return Object.keys(ordersByShipCountry).map((country) => { con...
javascript
async function prepareDataSource() { const orders = await fetchOrders() const ordersByShipCountry = orders.reduce((a, v) => { a[v.ShipCountry] = a[v.ShipCountry] || [] a[v.ShipCountry].push(v) return a }, {}) return Object.keys(ordersByShipCountry).map((country) => { con...
[ "async", "function", "prepareDataSource", "(", ")", "{", "const", "orders", "=", "await", "fetchOrders", "(", ")", "const", "ordersByShipCountry", "=", "orders", ".", "reduce", "(", "(", "a", ",", "v", ")", "=>", "{", "a", "[", "v", ".", "ShipCountry", ...
group the data for report
[ "group", "the", "data", "for", "report" ]
54973fcd2cbbb69549015c324a3bea615612e4a3
https://github.com/jsreport/jsreport-sample-template/blob/54973fcd2cbbb69549015c324a3bea615612e4a3/samples/Orders/orders-script/content.js#L18-L48
train
dhershman1/tap-junit
src/serialize.js
buildFailureParams
function buildFailureParams (test) { const opts = test.error.operator ? { type: test.error.operator, message: test.raw } : { message: test.raw } if (test.error.raw && test.error.stack) { return [ opts, ` --- ${test.error.raw} ${test.error.stack} --- ` ] } ...
javascript
function buildFailureParams (test) { const opts = test.error.operator ? { type: test.error.operator, message: test.raw } : { message: test.raw } if (test.error.raw && test.error.stack) { return [ opts, ` --- ${test.error.raw} ${test.error.stack} --- ` ] } ...
[ "function", "buildFailureParams", "(", "test", ")", "{", "const", "opts", "=", "test", ".", "error", ".", "operator", "?", "{", "type", ":", "test", ".", "error", ".", "operator", ",", "message", ":", "test", ".", "raw", "}", ":", "{", "message", ":"...
Gathers information from the test object to build out the proper arguments for creating the failure element @function @private @param {Object} test The primary test results object @returns {Array} An array with the proper arguments to use
[ "Gathers", "information", "from", "the", "test", "object", "to", "build", "out", "the", "proper", "arguments", "for", "creating", "the", "failure", "element" ]
07efbf9125f1bfe69e70208ac149abc1fd3625b2
https://github.com/dhershman1/tap-junit/blob/07efbf9125f1bfe69e70208ac149abc1fd3625b2/src/serialize.js#L11-L29
train
reg-viz/x-img-diff-js
demo/wasm-util.js
fetchAndInstantiate
function fetchAndInstantiate(url, importObject) { return fetch(url).then(response => response.arrayBuffer() ).then(bytes => WebAssembly.instantiate(bytes, importObject) ).then(results => results.instance ); }
javascript
function fetchAndInstantiate(url, importObject) { return fetch(url).then(response => response.arrayBuffer() ).then(bytes => WebAssembly.instantiate(bytes, importObject) ).then(results => results.instance ); }
[ "function", "fetchAndInstantiate", "(", "url", ",", "importObject", ")", "{", "return", "fetch", "(", "url", ")", ".", "then", "(", "response", "=>", "response", ".", "arrayBuffer", "(", ")", ")", ".", "then", "(", "bytes", "=>", "WebAssembly", ".", "ins...
This library function fetches the wasm module at 'url', instantiates it with the given 'importObject', and returns the instantiated object instance
[ "This", "library", "function", "fetches", "the", "wasm", "module", "at", "url", "instantiates", "it", "with", "the", "given", "importObject", "and", "returns", "the", "instantiated", "object", "instance" ]
e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9
https://github.com/reg-viz/x-img-diff-js/blob/e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9/demo/wasm-util.js#L6-L14
train
reg-viz/x-img-diff-js
demo/wasm-util.js
openDatabase
function openDatabase() { return new Promise((resolve, reject) => { var request = indexedDB.open(dbName, dbVersion); request.onerror = reject.bind(null, 'Error opening wasm cache database'); request.onsuccess = () => { resolve(request.result) }; request.onupgradeneeded = event => { v...
javascript
function openDatabase() { return new Promise((resolve, reject) => { var request = indexedDB.open(dbName, dbVersion); request.onerror = reject.bind(null, 'Error opening wasm cache database'); request.onsuccess = () => { resolve(request.result) }; request.onupgradeneeded = event => { v...
[ "function", "openDatabase", "(", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "var", "request", "=", "indexedDB", ".", "open", "(", "dbName", ",", "dbVersion", ")", ";", "request", ".", "onerror", "=", "reje...
This helper function Promise-ifies the operation of opening an IndexedDB database and clearing out the cache when the version changes.
[ "This", "helper", "function", "Promise", "-", "ifies", "the", "operation", "of", "opening", "an", "IndexedDB", "database", "and", "clearing", "out", "the", "cache", "when", "the", "version", "changes", "." ]
e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9
https://github.com/reg-viz/x-img-diff-js/blob/e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9/demo/wasm-util.js#L31-L46
train
reg-viz/x-img-diff-js
demo/wasm-util.js
lookupInDatabase
function lookupInDatabase(db) { return new Promise((resolve, reject) => { var store = db.transaction([storeName]).objectStore(storeName); var request = store.get(url); request.onerror = reject.bind(null, `Error getting wasm module ${url}`); request.onsuccess = event => { if (request....
javascript
function lookupInDatabase(db) { return new Promise((resolve, reject) => { var store = db.transaction([storeName]).objectStore(storeName); var request = store.get(url); request.onerror = reject.bind(null, `Error getting wasm module ${url}`); request.onsuccess = event => { if (request....
[ "function", "lookupInDatabase", "(", "db", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "var", "store", "=", "db", ".", "transaction", "(", "[", "storeName", "]", ")", ".", "objectStore", "(", "storeName", "...
This helper function Promise-ifies the operation of looking up 'url' in the given IDBDatabase.
[ "This", "helper", "function", "Promise", "-", "ifies", "the", "operation", "of", "looking", "up", "url", "in", "the", "given", "IDBDatabase", "." ]
e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9
https://github.com/reg-viz/x-img-diff-js/blob/e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9/demo/wasm-util.js#L50-L62
train
reg-viz/x-img-diff-js
demo/wasm-util.js
storeInDatabase
function storeInDatabase(db, module) { var store = db.transaction([storeName], 'readwrite').objectStore(storeName); try { var request = store.put(module, url); request.onerror = err => { console.log(`Failed to store in wasm cache: ${err}`) }; request.onsuccess = err => { console.log(`Successfu...
javascript
function storeInDatabase(db, module) { var store = db.transaction([storeName], 'readwrite').objectStore(storeName); try { var request = store.put(module, url); request.onerror = err => { console.log(`Failed to store in wasm cache: ${err}`) }; request.onsuccess = err => { console.log(`Successfu...
[ "function", "storeInDatabase", "(", "db", ",", "module", ")", "{", "var", "store", "=", "db", ".", "transaction", "(", "[", "storeName", "]", ",", "'readwrite'", ")", ".", "objectStore", "(", "storeName", ")", ";", "try", "{", "var", "request", "=", "s...
This helper function fires off an async operation to store the given wasm Module in the given IDBDatabase.
[ "This", "helper", "function", "fires", "off", "an", "async", "operation", "to", "store", "the", "given", "wasm", "Module", "in", "the", "given", "IDBDatabase", "." ]
e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9
https://github.com/reg-viz/x-img-diff-js/blob/e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9/demo/wasm-util.js#L66-L76
train
reg-viz/x-img-diff-js
demo/wasm-util.js
fetchAndInstantiate
function fetchAndInstantiate() { return fetch(url).then(response => response.arrayBuffer() ).then(buffer => WebAssembly.instantiate(buffer, importObject) ) }
javascript
function fetchAndInstantiate() { return fetch(url).then(response => response.arrayBuffer() ).then(buffer => WebAssembly.instantiate(buffer, importObject) ) }
[ "function", "fetchAndInstantiate", "(", ")", "{", "return", "fetch", "(", "url", ")", ".", "then", "(", "response", "=>", "response", ".", "arrayBuffer", "(", ")", ")", ".", "then", "(", "buffer", "=>", "WebAssembly", ".", "instantiate", "(", "buffer", "...
This helper function fetches 'url', compiles it into a Module, instantiates the Module with the given import object.
[ "This", "helper", "function", "fetches", "url", "compiles", "it", "into", "a", "Module", "instantiates", "the", "Module", "with", "the", "given", "import", "object", "." ]
e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9
https://github.com/reg-viz/x-img-diff-js/blob/e46c52beaae58fb5fcbe4ee95c89f2c070c3f1f9/demo/wasm-util.js#L80-L86
train
aheckmann/mpromise
lib/promise.js
Promise
function Promise(back) { this.emitter = new EventEmitter(); this.emitted = {}; this.ended = false; if ('function' == typeof back) this.onResolve(back); }
javascript
function Promise(back) { this.emitter = new EventEmitter(); this.emitted = {}; this.ended = false; if ('function' == typeof back) this.onResolve(back); }
[ "function", "Promise", "(", "back", ")", "{", "this", ".", "emitter", "=", "new", "EventEmitter", "(", ")", ";", "this", ".", "emitted", "=", "{", "}", ";", "this", ".", "ended", "=", "false", ";", "if", "(", "'function'", "==", "typeof", "back", "...
Promise constructor. _NOTE: The success and failure event names can be overridden by setting `Promise.SUCCESS` and `Promise.FAILURE` respectively._ @param {Function} back a function that accepts `fn(err, ...){}` as signature @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemit...
[ "Promise", "constructor", "." ]
c6a3e3bc5e9205f699a5388aa88659529cb9b56b
https://github.com/aheckmann/mpromise/blob/c6a3e3bc5e9205f699a5388aa88659529cb9b56b/lib/promise.js#L25-L31
train
mercadolibre/tiny.js
modules/pointerEvents.js
function (root) { var current = root.prototype ? root.prototype.addEventListener : root.addEventListener; var customAddEventListener = function (name, func, capture) { // Branch when a PointerXXX is used if (supportedEventsNames.indexOf(name) !== -1) { setTouchAw...
javascript
function (root) { var current = root.prototype ? root.prototype.addEventListener : root.addEventListener; var customAddEventListener = function (name, func, capture) { // Branch when a PointerXXX is used if (supportedEventsNames.indexOf(name) !== -1) { setTouchAw...
[ "function", "(", "root", ")", "{", "var", "current", "=", "root", ".", "prototype", "?", "root", ".", "prototype", ".", "addEventListener", ":", "root", ".", "addEventListener", ";", "var", "customAddEventListener", "=", "function", "(", "name", ",", "func",...
Intercept addEventListener calls by changing the prototype
[ "Intercept", "addEventListener", "calls", "by", "changing", "the", "prototype" ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/pointerEvents.js#L320-L341
train
mercadolibre/tiny.js
modules/pointerEvents.js
function (root) { var current = root.prototype ? root.prototype.removeEventListener : root.removeEventListener; var customRemoveEventListener = function (name, func, capture) { // Release when a PointerXXX is used if (supportedEventsNames.indexOf(name) !== -1) { ...
javascript
function (root) { var current = root.prototype ? root.prototype.removeEventListener : root.removeEventListener; var customRemoveEventListener = function (name, func, capture) { // Release when a PointerXXX is used if (supportedEventsNames.indexOf(name) !== -1) { ...
[ "function", "(", "root", ")", "{", "var", "current", "=", "root", ".", "prototype", "?", "root", ".", "prototype", ".", "removeEventListener", ":", "root", ".", "removeEventListener", ";", "var", "customRemoveEventListener", "=", "function", "(", "name", ",", ...
Intercept removeEventListener calls by changing the prototype
[ "Intercept", "removeEventListener", "calls", "by", "changing", "the", "prototype" ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/pointerEvents.js#L344-L364
train
mercadolibre/tiny.js
modules/pointerEvents.js
pointerDown
function pointerDown(e) { // don't register an activePointer if more than one touch is active. var singleFinger = e.pointerType === POINTER_TYPE_MOUSE || e.pointerType === POINTER_TYPE_PEN || (e.pointerType === POINTER_TYPE_TOUCH && e.isPrimary); if (!isScrolling && sing...
javascript
function pointerDown(e) { // don't register an activePointer if more than one touch is active. var singleFinger = e.pointerType === POINTER_TYPE_MOUSE || e.pointerType === POINTER_TYPE_PEN || (e.pointerType === POINTER_TYPE_TOUCH && e.isPrimary); if (!isScrolling && sing...
[ "function", "pointerDown", "(", "e", ")", "{", "// don't register an activePointer if more than one touch is active.", "var", "singleFinger", "=", "e", ".", "pointerType", "===", "POINTER_TYPE_MOUSE", "||", "e", ".", "pointerType", "===", "POINTER_TYPE_PEN", "||", "(", ...
Handles the 'pointerdown' event from pointerEvents polyfill or native PointerEvents when supported. @private @param {MouseEvent|PointerEvent} e Event.
[ "Handles", "the", "pointerdown", "event", "from", "pointerEvents", "polyfill", "or", "native", "PointerEvents", "when", "supported", "." ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/pointerEvents.js#L681-L697
train
mercadolibre/tiny.js
modules/pointerEvents.js
pointerUp
function pointerUp(e) { // Does our event is the same as the activePointer set by pointerdown? if (activePointer && activePointer.id === e.pointerId) { // Have we moved too much? if (Math.abs(activePointer.x - (e.x || e.pageX)) < 5 && Math.abs(activePointer.y - (e...
javascript
function pointerUp(e) { // Does our event is the same as the activePointer set by pointerdown? if (activePointer && activePointer.id === e.pointerId) { // Have we moved too much? if (Math.abs(activePointer.x - (e.x || e.pageX)) < 5 && Math.abs(activePointer.y - (e...
[ "function", "pointerUp", "(", "e", ")", "{", "// Does our event is the same as the activePointer set by pointerdown?", "if", "(", "activePointer", "&&", "activePointer", ".", "id", "===", "e", ".", "pointerId", ")", "{", "// Have we moved too much?", "if", "(", "Math", ...
Handles the 'pointerup' event from pointerEvents polyfill or native PointerEvents when supported. @private @param {MouseEvent|PointerEvent} e Event.
[ "Handles", "the", "pointerup", "event", "from", "pointerEvents", "polyfill", "or", "native", "PointerEvents", "when", "supported", "." ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/pointerEvents.js#L715-L730
train
mercadolibre/tiny.js
modules/pointerEvents.js
makePointertapEvent
function makePointertapEvent(sourceEvent) { var evt = document.createEvent('MouseEvents'); var newTarget = document.elementFromPoint(sourceEvent.clientX, sourceEvent.clientY); // According to the MDN docs if the specified point is outside the visible bounds of the document // or either ...
javascript
function makePointertapEvent(sourceEvent) { var evt = document.createEvent('MouseEvents'); var newTarget = document.elementFromPoint(sourceEvent.clientX, sourceEvent.clientY); // According to the MDN docs if the specified point is outside the visible bounds of the document // or either ...
[ "function", "makePointertapEvent", "(", "sourceEvent", ")", "{", "var", "evt", "=", "document", ".", "createEvent", "(", "'MouseEvents'", ")", ";", "var", "newTarget", "=", "document", ".", "elementFromPoint", "(", "sourceEvent", ".", "clientX", ",", "sourceEven...
Creates the pointertap event that is not part of standard. @private @param {MouseEvent|PointerEvent} sourceEvent An event to use as a base for pointertap.
[ "Creates", "the", "pointertap", "event", "that", "is", "not", "part", "of", "standard", "." ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/pointerEvents.js#L738-L757
train
apparatus/Kafkaesque
lib/kafkaesque.js
function() { _cbt = require('./cbt')(); _options = options || {}; // apply defaults // the min bytes of an incoming reply _options.minBytes = _options.minBytes || 1; // the max bytes of an incoming reply _options.maxBytes = _options.maxBytes || 1024 * 1024; // the group the client wi...
javascript
function() { _cbt = require('./cbt')(); _options = options || {}; // apply defaults // the min bytes of an incoming reply _options.minBytes = _options.minBytes || 1; // the max bytes of an incoming reply _options.maxBytes = _options.maxBytes || 1024 * 1024; // the group the client wi...
[ "function", "(", ")", "{", "_cbt", "=", "require", "(", "'./cbt'", ")", "(", ")", ";", "_options", "=", "options", "||", "{", "}", ";", "// apply defaults", "// the min bytes of an incoming reply", "_options", ".", "minBytes", "=", "_options", ".", "minBytes",...
construct the kafka clients
[ "construct", "the", "kafka", "clients" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/kafkaesque.js#L310-L358
train
apparatus/Kafkaesque
lib/kafkaesque.js
function (cb) { _metaBroker.tearUp(function (err) { if (!err) { _metaBroker.connected = true; } cb(err); }); }
javascript
function (cb) { _metaBroker.tearUp(function (err) { if (!err) { _metaBroker.connected = true; } cb(err); }); }
[ "function", "(", "cb", ")", "{", "_metaBroker", ".", "tearUp", "(", "function", "(", "err", ")", "{", "if", "(", "!", "err", ")", "{", "_metaBroker", ".", "connected", "=", "true", ";", "}", "cb", "(", "err", ")", ";", "}", ")", ";", "}" ]
connect this kafkaesque instance to the meta broker
[ "connect", "this", "kafkaesque", "instance", "to", "the", "meta", "broker" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/kafkaesque.js#L406-L413
train
apparatus/Kafkaesque
lib/kafkaesque.js
function(params, cb) { cb = cb || _noop; assert(params.topic); _metaBroker.metadata([params.topic], function(err, cluster) { cluster.topics.forEach(function(topic) { _partitions[topic.topicName] = topic.partitions; }); cb(err, cluster); }); }
javascript
function(params, cb) { cb = cb || _noop; assert(params.topic); _metaBroker.metadata([params.topic], function(err, cluster) { cluster.topics.forEach(function(topic) { _partitions[topic.topicName] = topic.partitions; }); cb(err, cluster); }); }
[ "function", "(", "params", ",", "cb", ")", "{", "cb", "=", "cb", "||", "_noop", ";", "assert", "(", "params", ".", "topic", ")", ";", "_metaBroker", ".", "metadata", "(", "[", "params", ".", "topic", "]", ",", "function", "(", "err", ",", "cluster"...
make a metadata request to the kafka cluster params: topic - the topic name, required
[ "make", "a", "metadata", "request", "to", "the", "kafka", "cluster" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/kafkaesque.js#L495-L506
train
apparatus/Kafkaesque
lib/kafkaesque.js
function() { if (_polling) { _closing = true; setTimeout(function() { if( _closing) { _.each(_brokers, function(broker) { broker.tearDown(); }); } }, _options.maxWait); } else { _.each(_brokers, function(broker) { broker.tearDow...
javascript
function() { if (_polling) { _closing = true; setTimeout(function() { if( _closing) { _.each(_brokers, function(broker) { broker.tearDown(); }); } }, _options.maxWait); } else { _.each(_brokers, function(broker) { broker.tearDow...
[ "function", "(", ")", "{", "if", "(", "_polling", ")", "{", "_closing", "=", "true", ";", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "_closing", ")", "{", "_", ".", "each", "(", "_brokers", ",", "function", "(", "broker", ")", "{", ...
end all polls and teardown all connections to kafka
[ "end", "all", "polls", "and", "teardown", "all", "connections", "to", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/kafkaesque.js#L771-L787
train
mercadolibre/tiny.js
modules/cookies.js
set
function set(key, value, options) { options = typeof options ==='object' ? options : { expires: options }; let expires = options.expires != null ? options.expires : defaults.expires; if (typeof expires === 'string' && expires !== '') { expires = new Date(expires); } else if (typeof expires ===...
javascript
function set(key, value, options) { options = typeof options ==='object' ? options : { expires: options }; let expires = options.expires != null ? options.expires : defaults.expires; if (typeof expires === 'string' && expires !== '') { expires = new Date(expires); } else if (typeof expires ===...
[ "function", "set", "(", "key", ",", "value", ",", "options", ")", "{", "options", "=", "typeof", "options", "===", "'object'", "?", "options", ":", "{", "expires", ":", "options", "}", ";", "let", "expires", "=", "options", ".", "expires", "!=", "null"...
Then `key` contains an object with keys and values for cookies, `value` contains the options object.
[ "Then", "key", "contains", "an", "object", "with", "keys", "and", "values", "for", "cookies", "value", "contains", "the", "options", "object", "." ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/cookies.js#L35-L66
train
apparatus/Kafkaesque
lib/api.js
function(topics, cb) { var correlationId = _cbt.put(metaResponse(cb)); var msg = envelope(meta.encode() .correlation(correlationId) .client(_options.clientId) .topics(topics) .end()); sendMsg(msg, cor...
javascript
function(topics, cb) { var correlationId = _cbt.put(metaResponse(cb)); var msg = envelope(meta.encode() .correlation(correlationId) .client(_options.clientId) .topics(topics) .end()); sendMsg(msg, cor...
[ "function", "(", "topics", ",", "cb", ")", "{", "var", "correlationId", "=", "_cbt", ".", "put", "(", "metaResponse", "(", "cb", ")", ")", ";", "var", "msg", "=", "envelope", "(", "meta", ".", "encode", "(", ")", ".", "correlation", "(", "correlation...
write a metadata request to kafka, storing the callback. topics: array of topics to retreive information on cb: callback
[ "write", "a", "metadata", "request", "to", "kafka", "storing", "the", "callback", "." ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L81-L89
train
apparatus/Kafkaesque
lib/api.js
function(params, messages, cb) { var correlationId = _cbt.put(prodResponse(cb)); var msg = envelope(prod.encode() .correlation(correlationId) .client(_options.clientId) .timeout() .topic(params.topic) ...
javascript
function(params, messages, cb) { var correlationId = _cbt.put(prodResponse(cb)); var msg = envelope(prod.encode() .correlation(correlationId) .client(_options.clientId) .timeout() .topic(params.topic) ...
[ "function", "(", "params", ",", "messages", ",", "cb", ")", "{", "var", "correlationId", "=", "_cbt", ".", "put", "(", "prodResponse", "(", "cb", ")", ")", ";", "var", "msg", "=", "envelope", "(", "prod", ".", "encode", "(", ")", ".", "correlation", ...
write a produce request to kafka params: topic: the topic to write to partition: the partition to write to messages: an array of messages to write to kafkia, messages may be - a string - an array of string - an array of objects of the form {key: ..., value: ...} if key value pairs exist the key will be written to kaf...
[ "write", "a", "produce", "request", "to", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L107-L118
train
apparatus/Kafkaesque
lib/api.js
function(params, cb) { var correlationId = _cbt.put(fetchResponse(cb)); var msg = envelope(fech.encode() .correlation(correlationId) .client(_options.clientId) .maxWait(params.maxWait) .minBytes(params.mi...
javascript
function(params, cb) { var correlationId = _cbt.put(fetchResponse(cb)); var msg = envelope(fech.encode() .correlation(correlationId) .client(_options.clientId) .maxWait(params.maxWait) .minBytes(params.mi...
[ "function", "(", "params", ",", "cb", ")", "{", "var", "correlationId", "=", "_cbt", ".", "put", "(", "fetchResponse", "(", "cb", ")", ")", ";", "var", "msg", "=", "envelope", "(", "fech", ".", "encode", "(", ")", ".", "correlation", "(", "correlatio...
write a fetch request to kafka params: topic: the topic to write to partition: the partition to write to offset: the offset to fetch from maxWait: the maximum wait time in ms minBytes: the minimum number of bytes that should be available before a response is sent
[ "write", "a", "fetch", "request", "to", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L132-L145
train
apparatus/Kafkaesque
lib/api.js
function(params, cb) { var correlationId = _cbt.put(offsetResponse(cb)); var msg = envelope(off.encode() .correlation(correlationId) .client(_options.clientId) .replica() .topic(params.topic) ...
javascript
function(params, cb) { var correlationId = _cbt.put(offsetResponse(cb)); var msg = envelope(off.encode() .correlation(correlationId) .client(_options.clientId) .replica() .topic(params.topic) ...
[ "function", "(", "params", ",", "cb", ")", "{", "var", "correlationId", "=", "_cbt", ".", "put", "(", "offsetResponse", "(", "cb", ")", ")", ";", "var", "msg", "=", "envelope", "(", "off", ".", "encode", "(", ")", ".", "correlation", "(", "correlatio...
request the latest offset from kafka i.e. the OLD offset api, not commit / fetch
[ "request", "the", "latest", "offset", "from", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L154-L166
train
apparatus/Kafkaesque
lib/api.js
function(params, cb) { var correlationId = _cbt.put(offFetchResponse(cb)); var msg = envelope(offFetch.encode(params.fetchFromCoordinator ? 1 : 0) .correlation(correlationId) .client(_options.clientId) .group(params.gro...
javascript
function(params, cb) { var correlationId = _cbt.put(offFetchResponse(cb)); var msg = envelope(offFetch.encode(params.fetchFromCoordinator ? 1 : 0) .correlation(correlationId) .client(_options.clientId) .group(params.gro...
[ "function", "(", "params", ",", "cb", ")", "{", "var", "correlationId", "=", "_cbt", ".", "put", "(", "offFetchResponse", "(", "cb", ")", ")", ";", "var", "msg", "=", "envelope", "(", "offFetch", ".", "encode", "(", "params", ".", "fetchFromCoordinator",...
write an offset request to kafka params: group: the consumer group id topic: the topic to commit on partition: the partition to commit on
[ "write", "an", "offset", "request", "to", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L177-L187
train
apparatus/Kafkaesque
lib/api.js
function(params, cb) { var correlationId = _cbt.put(offCommitResponse(cb)); var msg = envelope(offCommit.encode() .correlation(correlationId) .client(_options.clientId) .group(params.group) ...
javascript
function(params, cb) { var correlationId = _cbt.put(offCommitResponse(cb)); var msg = envelope(offCommit.encode() .correlation(correlationId) .client(_options.clientId) .group(params.group) ...
[ "function", "(", "params", ",", "cb", ")", "{", "var", "correlationId", "=", "_cbt", ".", "put", "(", "offCommitResponse", "(", "cb", ")", ")", ";", "var", "msg", "=", "envelope", "(", "offCommit", ".", "encode", "(", ")", ".", "correlation", "(", "c...
write a commit request to kafka params: group: the consumer group id topic: the topic to commit on partition: the partition to commit on offset: the offset to commit
[ "write", "a", "commit", "request", "to", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L199-L213
train
apparatus/Kafkaesque
lib/api.js
function(cb) { // return early if already connected if (_socket) { return cb(null, {host: _options.host, port: _options.port}); } _socket = net.createConnection(_options.port, _options.host); _socket.on('connect', function() { if (cb) { cb(null, {host: _options.host, port: _opt...
javascript
function(cb) { // return early if already connected if (_socket) { return cb(null, {host: _options.host, port: _options.port}); } _socket = net.createConnection(_options.port, _options.host); _socket.on('connect', function() { if (cb) { cb(null, {host: _options.host, port: _opt...
[ "function", "(", "cb", ")", "{", "// return early if already connected", "if", "(", "_socket", ")", "{", "return", "cb", "(", "null", ",", "{", "host", ":", "_options", ".", "host", ",", "port", ":", "_options", ".", "port", "}", ")", ";", "}", "_socke...
tearup the connection to kafka
[ "tearup", "the", "connection", "to", "kafka" ]
fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b
https://github.com/apparatus/Kafkaesque/blob/fa9a63f1f711e86bfc776d58ea44d91a8fb4a50b/lib/api.js#L364-L419
train
mercadolibre/tiny.js
modules/support.js
animationEnd
function animationEnd() { let el = document.createElement('tiny'); let animEndEventNames = { WebkitAnimation : 'webkitAnimationEnd', MozAnimation : 'animationend', OAnimation : 'oAnimationEnd oanimationend', animation : 'animationend' }; for (let name in a...
javascript
function animationEnd() { let el = document.createElement('tiny'); let animEndEventNames = { WebkitAnimation : 'webkitAnimationEnd', MozAnimation : 'animationend', OAnimation : 'oAnimationEnd oanimationend', animation : 'animationend' }; for (let name in a...
[ "function", "animationEnd", "(", ")", "{", "let", "el", "=", "document", ".", "createElement", "(", "'tiny'", ")", ";", "let", "animEndEventNames", "=", "{", "WebkitAnimation", ":", "'webkitAnimationEnd'", ",", "MozAnimation", ":", "'animationend'", ",", "OAnima...
Checks for the CSS Animations support @function @private
[ "Checks", "for", "the", "CSS", "Animations", "support" ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/support.js#L94-L113
train
mercadolibre/tiny.js
modules/offset.js
getFixedParent
function getFixedParent (el) { let currentParent = el.offsetParent, parent; while (parent === undefined) { if (currentParent === null) { parent = null; break; } if (css(currentParent, 'position') !== 'fixed') { currentParent = currentParent....
javascript
function getFixedParent (el) { let currentParent = el.offsetParent, parent; while (parent === undefined) { if (currentParent === null) { parent = null; break; } if (css(currentParent, 'position') !== 'fixed') { currentParent = currentParent....
[ "function", "getFixedParent", "(", "el", ")", "{", "let", "currentParent", "=", "el", ".", "offsetParent", ",", "parent", ";", "while", "(", "parent", "===", "undefined", ")", "{", "if", "(", "currentParent", "===", "null", ")", "{", "parent", "=", "null...
Get the current parentNode with the 'fixed' position. @private @param {HTMLElement} el A given HTMLElement. @returns {HTMLElement}
[ "Get", "the", "current", "parentNode", "with", "the", "fixed", "position", "." ]
10fad8be21abdbec23642be77ad64f449711a40d
https://github.com/mercadolibre/tiny.js/blob/10fad8be21abdbec23642be77ad64f449711a40d/modules/offset.js#L38-L57
train
gangachris/ng-validators
src/helpers.js
function (name, value, options) { if (options) { return validator[name](value, options) ? null : (_a = {}, _a[name] = { valid: false }, _a); } return validator[name](value) ? null : (_b = {}, _b[name] = { valid: false },...
javascript
function (name, value, options) { if (options) { return validator[name](value, options) ? null : (_a = {}, _a[name] = { valid: false }, _a); } return validator[name](value) ? null : (_b = {}, _b[name] = { valid: false },...
[ "function", "(", "name", ",", "value", ",", "options", ")", "{", "if", "(", "options", ")", "{", "return", "validator", "[", "name", "]", "(", "value", ",", "options", ")", "?", "null", ":", "(", "_a", "=", "{", "}", ",", "_a", "[", "name", "]"...
Wrapper for calling validator js functions @param {any} name name of the validator to be called e.g isEmail @param {any} value value passed from the abstract control @param {any} options optional parameters @returns
[ "Wrapper", "for", "calling", "validator", "js", "functions" ]
00bee20fbe26bc59cc4182f7971ecbda8e491dca
https://github.com/gangachris/ng-validators/blob/00bee20fbe26bc59cc4182f7971ecbda8e491dca/src/helpers.js#L12-L26
train
gangachris/ng-validators
src/helpers.js
getParamValidator
function getParamValidator(name) { return function (options) { return function (c) { return getValidator(name, c.value != null ? c.value : '', options); }; }; }
javascript
function getParamValidator(name) { return function (options) { return function (c) { return getValidator(name, c.value != null ? c.value : '', options); }; }; }
[ "function", "getParamValidator", "(", "name", ")", "{", "return", "function", "(", "options", ")", "{", "return", "function", "(", "c", ")", "{", "return", "getValidator", "(", "name", ",", "c", ".", "value", "!=", "null", "?", "c", ".", "value", ":", ...
Gets the validators with parameter. Parameters are optional since some validators do not require them @export @param {string} name name of the validator @returns angular form validator @export @param {string} name @returns
[ "Gets", "the", "validators", "with", "parameter", ".", "Parameters", "are", "optional", "since", "some", "validators", "do", "not", "require", "them" ]
00bee20fbe26bc59cc4182f7971ecbda8e491dca
https://github.com/gangachris/ng-validators/blob/00bee20fbe26bc59cc4182f7971ecbda8e491dca/src/helpers.js#L42-L48
train
AlgoTrader/betfair-sports-api
lib/emulator_market.js
placeBets
function placeBets() { // check input bets list var error; for ( var i = 0; i < req.request.bets.length; ++i) { var desc = req.request.bets[i]; error = checkPlaceBetItem(self, desc); // console.log('EMU bet', desc, "error", error); if (error) ...
javascript
function placeBets() { // check input bets list var error; for ( var i = 0; i < req.request.bets.length; ++i) { var desc = req.request.bets[i]; error = checkPlaceBetItem(self, desc); // console.log('EMU bet', desc, "error", error); if (error) ...
[ "function", "placeBets", "(", ")", "{", "// check input bets list", "var", "error", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "req", ".", "request", ".", "bets", ".", "length", ";", "++", "i", ")", "{", "var", "desc", "=", "req", ".", ...
place bets, the function is delayed to simulate slow network
[ "place", "bets", "the", "function", "is", "delayed", "to", "simulate", "slow", "network" ]
196093a9711b268e9f8b1892e71c1aa070492747
https://github.com/AlgoTrader/betfair-sports-api/blob/196093a9711b268e9f8b1892e71c1aa070492747/lib/emulator_market.js#L375-L439
train
AlgoTrader/betfair-sports-api
lib/emulator_market.js
cancelBets
function cancelBets() { // check request bets list var error; for ( var i = 0; i < req.request.bets.length; ++i) { var desc = req.request.bets[i]; error = checkCancelBetItem(self, desc); // console.log('EMU bet', desc, "error", error); if (error) ...
javascript
function cancelBets() { // check request bets list var error; for ( var i = 0; i < req.request.bets.length; ++i) { var desc = req.request.bets[i]; error = checkCancelBetItem(self, desc); // console.log('EMU bet', desc, "error", error); if (error) ...
[ "function", "cancelBets", "(", ")", "{", "// check request bets list", "var", "error", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "req", ".", "request", ".", "bets", ".", "length", ";", "++", "i", ")", "{", "var", "desc", "=", "req", "."...
cancel bets, the function is delayed to simulate slow network
[ "cancel", "bets", "the", "function", "is", "delayed", "to", "simulate", "slow", "network" ]
196093a9711b268e9f8b1892e71c1aa070492747
https://github.com/AlgoTrader/betfair-sports-api/blob/196093a9711b268e9f8b1892e71c1aa070492747/lib/emulator_market.js#L471-L511
train
AlgoTrader/betfair-sports-api
lib/emulator_market.js
checkPlaceBetItem
function checkPlaceBetItem(self, desc) { if (desc.asianLineId !== '0' || desc.betCategoryType !== 'E') return 'UNKNOWN_ERROR'; if (desc.betPersistenceType !== 'NONE' && desc.betPersistenceType !== 'IP') return 'INVALID_PERSISTENCE'; if (desc.betType !== 'B' && desc.betType !== 'L') ...
javascript
function checkPlaceBetItem(self, desc) { if (desc.asianLineId !== '0' || desc.betCategoryType !== 'E') return 'UNKNOWN_ERROR'; if (desc.betPersistenceType !== 'NONE' && desc.betPersistenceType !== 'IP') return 'INVALID_PERSISTENCE'; if (desc.betType !== 'B' && desc.betType !== 'L') ...
[ "function", "checkPlaceBetItem", "(", "self", ",", "desc", ")", "{", "if", "(", "desc", ".", "asianLineId", "!==", "'0'", "||", "desc", ".", "betCategoryType", "!==", "'E'", ")", "return", "'UNKNOWN_ERROR'", ";", "if", "(", "desc", ".", "betPersistenceType",...
Check a single bet item from placeBets bets list
[ "Check", "a", "single", "bet", "item", "from", "placeBets", "bets", "list" ]
196093a9711b268e9f8b1892e71c1aa070492747
https://github.com/AlgoTrader/betfair-sports-api/blob/196093a9711b268e9f8b1892e71c1aa070492747/lib/emulator_market.js#L519-L544
train
mattbornski/libphonenumber
lib/closure/goog/net/streams/jsonstreamparser.js
skipWhitespace
function skipWhitespace() { while (i < input.length) { if (isWhitespace(input[i])) { i++; parser.pos_++; continue; } break; } }
javascript
function skipWhitespace() { while (i < input.length) { if (isWhitespace(input[i])) { i++; parser.pos_++; continue; } break; } }
[ "function", "skipWhitespace", "(", ")", "{", "while", "(", "i", "<", "input", ".", "length", ")", "{", "if", "(", "isWhitespace", "(", "input", "[", "i", "]", ")", ")", "{", "i", "++", ";", "parser", ".", "pos_", "++", ";", "continue", ";", "}", ...
Skip as many whitespaces as possible, and increments current index of stream to next available char.
[ "Skip", "as", "many", "whitespaces", "as", "possible", "and", "increments", "current", "index", "of", "stream", "to", "next", "available", "char", "." ]
8e5b827ca1a9ddd0d5e7722436ec987897e85bda
https://github.com/mattbornski/libphonenumber/blob/8e5b827ca1a9ddd0d5e7722436ec987897e85bda/lib/closure/goog/net/streams/jsonstreamparser.js#L287-L296
train
yahoo/context-parser
src/context-parser.js
DisableIEConditionalComments
function DisableIEConditionalComments(state, i){ if (state === htmlState.STATE_COMMENT && this.input[i] === ']' && this.input[i+1] === '>') { // for lazy conversion this._convertString2Array(); this.input.splice(i + 1, 0, ' '); this.inputLen++; } }
javascript
function DisableIEConditionalComments(state, i){ if (state === htmlState.STATE_COMMENT && this.input[i] === ']' && this.input[i+1] === '>') { // for lazy conversion this._convertString2Array(); this.input.splice(i + 1, 0, ' '); this.inputLen++; } }
[ "function", "DisableIEConditionalComments", "(", "state", ",", "i", ")", "{", "if", "(", "state", "===", "htmlState", ".", "STATE_COMMENT", "&&", "this", ".", "input", "[", "i", "]", "===", "']'", "&&", "this", ".", "input", "[", "i", "+", "1", "]", ...
remove IE conditional comments
[ "remove", "IE", "conditional", "comments" ]
6ad21fdcf242b2c2f6eb70281bbf6425a05122c1
https://github.com/yahoo/context-parser/blob/6ad21fdcf242b2c2f6eb70281bbf6425a05122c1/src/context-parser.js#L967-L975
train
appscot/sails-orientdb
lib/associations.js
function (collectionIdentity) { if (!collectionIdentity) return; var schema = connectionObject.collections[collectionIdentity].attributes; if(!schema) return 'id'; var key; for(key in schema){ if(schema[key].primaryKey) return key; } retu...
javascript
function (collectionIdentity) { if (!collectionIdentity) return; var schema = connectionObject.collections[collectionIdentity].attributes; if(!schema) return 'id'; var key; for(key in schema){ if(schema[key].primaryKey) return key; } retu...
[ "function", "(", "collectionIdentity", ")", "{", "if", "(", "!", "collectionIdentity", ")", "return", ";", "var", "schema", "=", "connectionObject", ".", "collections", "[", "collectionIdentity", "]", ".", "attributes", ";", "if", "(", "!", "schema", ")", "r...
Look up the name of the primary key field for the collection with the specified identity. @param {String} collectionIdentity @return {String}
[ "Look", "up", "the", "name", "of", "the", "primary", "key", "field", "for", "the", "collection", "with", "the", "specified", "identity", "." ]
2a902f08b097a813c45ccb0e23835a29611e979e
https://github.com/appscot/sails-orientdb/blob/2a902f08b097a813c45ccb0e23835a29611e979e/lib/associations.js#L336-L349
train
eggjs/egg-jsonp
app/extend/application.js
securityAssert
function securityAssert(ctx) { // all disabled. don't need check if (!csrfEnable && !validateReferrer) return; // pass referrer check const referrer = ctx.get('referrer'); if (validateReferrer && validateReferrer(referrer)) return; if (csrfEnable && validateCsrf(ctx)) return; ...
javascript
function securityAssert(ctx) { // all disabled. don't need check if (!csrfEnable && !validateReferrer) return; // pass referrer check const referrer = ctx.get('referrer'); if (validateReferrer && validateReferrer(referrer)) return; if (csrfEnable && validateCsrf(ctx)) return; ...
[ "function", "securityAssert", "(", "ctx", ")", "{", "// all disabled. don't need check", "if", "(", "!", "csrfEnable", "&&", "!", "validateReferrer", ")", "return", ";", "// pass referrer check", "const", "referrer", "=", "ctx", ".", "get", "(", "'referrer'", ")",...
jsonp request security check, pass if 1. hit referrer white list 2. or pass csrf check 3. both check are disabled @param {Context} ctx request context
[ "jsonp", "request", "security", "check", "pass", "if" ]
f19c6436be1b3a71127b342ad07dbb1bac861efe
https://github.com/eggjs/egg-jsonp/blob/f19c6436be1b3a71127b342ad07dbb1bac861efe/app/extend/application.js#L38-L51
train
appscot/sails-orientdb
lib/adapter.js
function(conn, cb) { log.debug('teardown:', conn); /* istanbul ignore if: standard waterline-adapter code */ if ( typeof conn == 'function') { cb = conn; conn = null; } /* istanbul ignore if: standard waterline-adapter code */ if (!conn) { connections = {}; ...
javascript
function(conn, cb) { log.debug('teardown:', conn); /* istanbul ignore if: standard waterline-adapter code */ if ( typeof conn == 'function') { cb = conn; conn = null; } /* istanbul ignore if: standard waterline-adapter code */ if (!conn) { connections = {}; ...
[ "function", "(", "conn", ",", "cb", ")", "{", "log", ".", "debug", "(", "'teardown:'", ",", "conn", ")", ";", "/* istanbul ignore if: standard waterline-adapter code */", "if", "(", "typeof", "conn", "==", "'function'", ")", "{", "cb", "=", "conn", ";", "con...
Teardown a Connection Fired when a model is unregistered, typically when the server is killed. Useful for tearing-down remaining open connections, etc. @param {Function} cb [description] @return {[type]} [description]
[ "Teardown", "a", "Connection" ]
2a902f08b097a813c45ccb0e23835a29611e979e
https://github.com/appscot/sails-orientdb/blob/2a902f08b097a813c45ccb0e23835a29611e979e/lib/adapter.js#L187-L204
train
appscot/sails-orientdb
lib/adapter.js
function(connection, collection, object, cb) { utils.removeCircularReferences(object); if (cb) { cb(object); } return object; }
javascript
function(connection, collection, object, cb) { utils.removeCircularReferences(object); if (cb) { cb(object); } return object; }
[ "function", "(", "connection", ",", "collection", ",", "object", ",", "cb", ")", "{", "utils", ".", "removeCircularReferences", "(", "object", ")", ";", "if", "(", "cb", ")", "{", "cb", "(", "object", ")", ";", "}", "return", "object", ";", "}" ]
Remove Circular References Replaces circular references with `id` when one is available, otherwise it replaces the object with string '[Circular]' @param {Object} connection @param {Object} collection @param {Object} object @param {Object} cb
[ "Remove", "Circular", "References" ]
2a902f08b097a813c45ccb0e23835a29611e979e
https://github.com/appscot/sails-orientdb/blob/2a902f08b097a813c45ccb0e23835a29611e979e/lib/adapter.js#L463-L469
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(node, highlighter) { this.div.classList.add('MJX_LiveRegion_Show'); var rect = node.getBoundingClientRect(); var bot = rect.bottom + 10 + window.pageYOffset; var left = rect.left + window.pageXOffset; this.div.style.top = bot + 'px'; this.div.style.left = left + 'px'; ...
javascript
function(node, highlighter) { this.div.classList.add('MJX_LiveRegion_Show'); var rect = node.getBoundingClientRect(); var bot = rect.bottom + 10 + window.pageYOffset; var left = rect.left + window.pageXOffset; this.div.style.top = bot + 'px'; this.div.style.left = left + 'px'; ...
[ "function", "(", "node", ",", "highlighter", ")", "{", "this", ".", "div", ".", "classList", ".", "add", "(", "'MJX_LiveRegion_Show'", ")", ";", "var", "rect", "=", "node", ".", "getBoundingClientRect", "(", ")", ";", "var", "bot", "=", "rect", ".", "b...
Shows the live region as a subtitle of a node.
[ "Shows", "the", "live", "region", "as", "a", "subtitle", "of", "a", "node", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L184-L194
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(type) { var element = MathJax.HTML.Element( 'div', {className: 'MJX_LiveRegion'}); element.setAttribute('aria-live', type); return element; }
javascript
function(type) { var element = MathJax.HTML.Element( 'div', {className: 'MJX_LiveRegion'}); element.setAttribute('aria-live', type); return element; }
[ "function", "(", "type", ")", "{", "var", "element", "=", "MathJax", ".", "HTML", ".", "Element", "(", "'div'", ",", "{", "className", ":", "'MJX_LiveRegion'", "}", ")", ";", "element", ".", "setAttribute", "(", "'aria-live'", ",", "type", ")", ";", "r...
Creates a live region with a particular type.
[ "Creates", "a", "live", "region", "with", "a", "particular", "type", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L239-L244
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function() { if (!Assistive.getOption('speech')) return; LiveRegion.announced = true; MathJax.Ajax.Styles(LiveRegion.styles); var div = LiveRegion.Create('polite'); document.body.appendChild(div); LiveRegion.Update(div, LiveRegion.ANNOUNCE); setTimeout(function() {document.body...
javascript
function() { if (!Assistive.getOption('speech')) return; LiveRegion.announced = true; MathJax.Ajax.Styles(LiveRegion.styles); var div = LiveRegion.Create('polite'); document.body.appendChild(div); LiveRegion.Update(div, LiveRegion.ANNOUNCE); setTimeout(function() {document.body...
[ "function", "(", ")", "{", "if", "(", "!", "Assistive", ".", "getOption", "(", "'speech'", ")", ")", "return", ";", "LiveRegion", ".", "announced", "=", "true", ";", "MathJax", ".", "Ajax", ".", "Styles", "(", "LiveRegion", ".", "styles", ")", ";", "...
Speaks the announce string.
[ "Speaks", "the", "announce", "string", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L259-L267
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(msg) { if (!Assistive.hook) return; var script = document.getElementById(msg[1]); if (script && script.id) { var jax = MathJax.Hub.getJaxFor(script.id); if (jax && jax.enriched) { Explorer.StateChange(script.id, jax); Explorer.liveRegion.Add(); Ex...
javascript
function(msg) { if (!Assistive.hook) return; var script = document.getElementById(msg[1]); if (script && script.id) { var jax = MathJax.Hub.getJaxFor(script.id); if (jax && jax.enriched) { Explorer.StateChange(script.id, jax); Explorer.liveRegion.Add(); Ex...
[ "function", "(", "msg", ")", "{", "if", "(", "!", "Assistive", ".", "hook", ")", "return", ";", "var", "script", "=", "document", ".", "getElementById", "(", "msg", "[", "1", "]", ")", ";", "if", "(", "script", "&&", "script", ".", "id", ")", "{"...
Registers new Maths and adds a key event if it is enriched.
[ "Registers", "new", "Maths", "and", "adds", "a", "key", "event", "if", "it", "is", "enriched", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L297-L308
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(jax) { Explorer.RemoveHook(); Explorer.hook = MathJax.Hub.Register.MessageHook( 'End Math', function(message) { var newid = message[1].id + '-Frame'; var math = document.getElementById(newid); if (jax && newid === Explorer.expanded) { Expl...
javascript
function(jax) { Explorer.RemoveHook(); Explorer.hook = MathJax.Hub.Register.MessageHook( 'End Math', function(message) { var newid = message[1].id + '-Frame'; var math = document.getElementById(newid); if (jax && newid === Explorer.expanded) { Expl...
[ "function", "(", "jax", ")", "{", "Explorer", ".", "RemoveHook", "(", ")", ";", "Explorer", ".", "hook", "=", "MathJax", ".", "Hub", ".", "Register", ".", "MessageHook", "(", "'End Math'", ",", "function", "(", "message", ")", "{", "var", "newid", "=",...
Add hook to run at End Math to restart walking on an expansion element.
[ "Add", "hook", "to", "run", "at", "End", "Math", "to", "restart", "walking", "on", "an", "expansion", "element", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L328-L340
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function() { if (Explorer.hook) { MathJax.Hub.UnRegister.MessageHook(Explorer.hook); Explorer.hook = null; } }
javascript
function() { if (Explorer.hook) { MathJax.Hub.UnRegister.MessageHook(Explorer.hook); Explorer.hook = null; } }
[ "function", "(", ")", "{", "if", "(", "Explorer", ".", "hook", ")", "{", "MathJax", ".", "Hub", ".", "UnRegister", ".", "MessageHook", "(", "Explorer", ".", "hook", ")", ";", "Explorer", ".", "hook", "=", "null", ";", "}", "}" ]
Remove and unregister the explorer hook.
[ "Remove", "and", "unregister", "the", "explorer", "hook", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L344-L349
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(script) { var id = script.id + '-Frame'; var sibling = script.previousSibling; if (!sibling) return; var math = sibling.id !== id ? sibling.firstElementChild : sibling; Explorer.AddAria(math); Explorer.AddMouseEvents(math); if (math.className === 'MathJax_MathML') { ...
javascript
function(script) { var id = script.id + '-Frame'; var sibling = script.previousSibling; if (!sibling) return; var math = sibling.id !== id ? sibling.firstElementChild : sibling; Explorer.AddAria(math); Explorer.AddMouseEvents(math); if (math.className === 'MathJax_MathML') { ...
[ "function", "(", "script", ")", "{", "var", "id", "=", "script", ".", "id", "+", "'-Frame'", ";", "var", "sibling", "=", "script", ".", "previousSibling", ";", "if", "(", "!", "sibling", ")", "return", ";", "var", "math", "=", "sibling", ".", "id", ...
Adds a key event to an enriched jax.
[ "Adds", "a", "key", "event", "to", "an", "enriched", "jax", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L359-L397
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(math) { var id = math.id; var jax = MathJax.Hub.getJaxFor(id); var mathml = jax.root.toMathML(); if (!math.getAttribute('haslabel')) { Explorer.AddMathLabel(mathml, id); } if (math.getAttribute('hasspeech')) return; switch (Assistive.getOption('generation')) { ...
javascript
function(math) { var id = math.id; var jax = MathJax.Hub.getJaxFor(id); var mathml = jax.root.toMathML(); if (!math.getAttribute('haslabel')) { Explorer.AddMathLabel(mathml, id); } if (math.getAttribute('hasspeech')) return; switch (Assistive.getOption('generation')) { ...
[ "function", "(", "math", ")", "{", "var", "id", "=", "math", ".", "id", ";", "var", "jax", "=", "MathJax", ".", "Hub", ".", "getJaxFor", "(", "id", ")", ";", "var", "mathml", "=", "jax", ".", "root", ".", "toMathML", "(", ")", ";", "if", "(", ...
Add speech output.
[ "Add", "speech", "output", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L401-L423
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(mathml, id) { Explorer.MakeSpeechTask( mathml, id, sre.TreeSpeechGenerator, function(math, speech) {math.setAttribute('hasspeech', 'true');}, 5); }
javascript
function(mathml, id) { Explorer.MakeSpeechTask( mathml, id, sre.TreeSpeechGenerator, function(math, speech) {math.setAttribute('hasspeech', 'true');}, 5); }
[ "function", "(", "mathml", ",", "id", ")", "{", "Explorer", ".", "MakeSpeechTask", "(", "mathml", ",", "id", ",", "sre", ".", "TreeSpeechGenerator", ",", "function", "(", "math", ",", "speech", ")", "{", "math", ".", "setAttribute", "(", "'hasspeech'", "...
Adds speech strings to the node using a web worker.
[ "Adds", "speech", "strings", "to", "the", "node", "using", "a", "web", "worker", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L434-L438
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(mathml, id) { Explorer.MakeSpeechTask( mathml, id, sre.SummarySpeechGenerator, function(math, speech) { math.setAttribute('haslabel', 'true'); math.setAttribute('aria-label', speech);}, 5); }
javascript
function(mathml, id) { Explorer.MakeSpeechTask( mathml, id, sre.SummarySpeechGenerator, function(math, speech) { math.setAttribute('haslabel', 'true'); math.setAttribute('aria-label', speech);}, 5); }
[ "function", "(", "mathml", ",", "id", ")", "{", "Explorer", ".", "MakeSpeechTask", "(", "mathml", ",", "id", ",", "sre", ".", "SummarySpeechGenerator", ",", "function", "(", "math", ",", "speech", ")", "{", "math", ".", "setAttribute", "(", "'haslabel'", ...
Attaches the Math expression as an aria label.
[ "Attaches", "the", "Math", "expression", "as", "an", "aria", "label", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L442-L449
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(mathml, id, constructor, onSpeech, time) { var messageID = Explorer.AddMessage(); setTimeout(function() { var speechGenerator = new constructor(); var math = document.getElementById(id); var dummy = new sre.DummyWalker( math, speechGenerator, Explorer.highlighter...
javascript
function(mathml, id, constructor, onSpeech, time) { var messageID = Explorer.AddMessage(); setTimeout(function() { var speechGenerator = new constructor(); var math = document.getElementById(id); var dummy = new sre.DummyWalker( math, speechGenerator, Explorer.highlighter...
[ "function", "(", "mathml", ",", "id", ",", "constructor", ",", "onSpeech", ",", "time", ")", "{", "var", "messageID", "=", "Explorer", ".", "AddMessage", "(", ")", ";", "setTimeout", "(", "function", "(", ")", "{", "var", "speechGenerator", "=", "new", ...
The actual speech task generator.
[ "The", "actual", "speech", "task", "generator", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L453-L466
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(event) { if (event.keyCode === KEY.ESCAPE) { if (!Explorer.walker) return; Explorer.RemoveHook(); Explorer.DeactivateWalker(); FALSE(event); return; } // If walker is active we redirect there. if (Explorer.walker && Explorer.walker.isActive()) { ...
javascript
function(event) { if (event.keyCode === KEY.ESCAPE) { if (!Explorer.walker) return; Explorer.RemoveHook(); Explorer.DeactivateWalker(); FALSE(event); return; } // If walker is active we redirect there. if (Explorer.walker && Explorer.walker.isActive()) { ...
[ "function", "(", "event", ")", "{", "if", "(", "event", ".", "keyCode", "===", "KEY", ".", "ESCAPE", ")", "{", "if", "(", "!", "Explorer", ".", "walker", ")", "return", ";", "Explorer", ".", "RemoveHook", "(", ")", ";", "Explorer", ".", "DeactivateWa...
Event execution on keydown. Subsumes the same method of MathEvents.
[ "Event", "execution", "on", "keydown", ".", "Subsumes", "the", "same", "method", "of", "MathEvents", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L470-L520
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function(node) { sre.HighlighterFactory.addEvents( node, {'mouseover': Explorer.MouseOver, 'mouseout': Explorer.MouseOut}, {renderer: MathJax.Hub.outputJax['jax/mml'][0].id, browser: MathJax.Hub.Browser.name} ); }
javascript
function(node) { sre.HighlighterFactory.addEvents( node, {'mouseover': Explorer.MouseOver, 'mouseout': Explorer.MouseOut}, {renderer: MathJax.Hub.outputJax['jax/mml'][0].id, browser: MathJax.Hub.Browser.name} ); }
[ "function", "(", "node", ")", "{", "sre", ".", "HighlighterFactory", ".", "addEvents", "(", "node", ",", "{", "'mouseover'", ":", "Explorer", ".", "MouseOver", ",", "'mouseout'", ":", "Explorer", ".", "MouseOut", "}", ",", "{", "renderer", ":", "MathJax", ...
Adds mouse events to maction items in an enriched jax.
[ "Adds", "mouse", "events", "to", "maction", "items", "in", "an", "enriched", "jax", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L532-L540
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function() { Explorer.liveRegion.Clear(); Explorer.liveRegion.Hide(); Explorer.Unhighlight(); Explorer.currentHighlight = null; Explorer.walker.deactivate(); Explorer.walker = null; }
javascript
function() { Explorer.liveRegion.Clear(); Explorer.liveRegion.Hide(); Explorer.Unhighlight(); Explorer.currentHighlight = null; Explorer.walker.deactivate(); Explorer.walker = null; }
[ "function", "(", ")", "{", "Explorer", ".", "liveRegion", ".", "Clear", "(", ")", ";", "Explorer", ".", "liveRegion", ".", "Hide", "(", ")", ";", "Explorer", ".", "Unhighlight", "(", ")", ";", "Explorer", ".", "currentHighlight", "=", "null", ";", "Exp...
Deactivates the walker.
[ "Deactivates", "the", "walker", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L618-L625
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function() { Explorer.Reset(); var speechItems = ['Subtitles', 'Generation']; speechItems.forEach( function(x) { var item = MathJax.Menu.menu.FindId('Accessibility', x); if (item) { item.disabled = !item.disabled; }}); Explorer.Regenera...
javascript
function() { Explorer.Reset(); var speechItems = ['Subtitles', 'Generation']; speechItems.forEach( function(x) { var item = MathJax.Menu.menu.FindId('Accessibility', x); if (item) { item.disabled = !item.disabled; }}); Explorer.Regenera...
[ "function", "(", ")", "{", "Explorer", ".", "Reset", "(", ")", ";", "var", "speechItems", "=", "[", "'Subtitles'", ",", "'Generation'", "]", ";", "speechItems", ".", "forEach", "(", "function", "(", "x", ")", "{", "var", "item", "=", "MathJax", ".", ...
Toggle speech output.
[ "Toggle", "speech", "output", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L652-L662
train
zorkow/speech-rule-engine
resources/www/scripts/explorer.js
function() { for (var i = 0, all = MathJax.Hub.getAllJax(), jax; jax = all[i]; i++) { var math = document.getElementById(jax.inputID + '-Frame'); if (math) { math.removeAttribute('hasSpeech'); Explorer.AddSpeech(math); } } }
javascript
function() { for (var i = 0, all = MathJax.Hub.getAllJax(), jax; jax = all[i]; i++) { var math = document.getElementById(jax.inputID + '-Frame'); if (math) { math.removeAttribute('hasSpeech'); Explorer.AddSpeech(math); } } }
[ "function", "(", ")", "{", "for", "(", "var", "i", "=", "0", ",", "all", "=", "MathJax", ".", "Hub", ".", "getAllJax", "(", ")", ",", "jax", ";", "jax", "=", "all", "[", "i", "]", ";", "i", "++", ")", "{", "var", "math", "=", "document", "....
Regenerates speech.
[ "Regenerates", "speech", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/explorer.js#L666-L674
train
zorkow/speech-rule-engine
resources/www/scripts/semantic-enrich.js
function (jax,id,script) { delete jax.enriched; if (this.config.disabled) return; try { this.running = true; var mml = sre.Enrich.semanticMathmlSync(jax.root.toMathML()); jax.root = MathJax.InputJax.MathML.Parse.prototype.MakeMML(mml); jax.root.inputID = script.id; jax.enriched...
javascript
function (jax,id,script) { delete jax.enriched; if (this.config.disabled) return; try { this.running = true; var mml = sre.Enrich.semanticMathmlSync(jax.root.toMathML()); jax.root = MathJax.InputJax.MathML.Parse.prototype.MakeMML(mml); jax.root.inputID = script.id; jax.enriched...
[ "function", "(", "jax", ",", "id", ",", "script", ")", "{", "delete", "jax", ".", "enriched", ";", "if", "(", "this", ".", "config", ".", "disabled", ")", "return", ";", "try", "{", "this", ".", "running", "=", "true", ";", "var", "mml", "=", "sr...
If we are not disabled, Get the enriched MathML and parse it into the jax root. Mark the jax as enriched.
[ "If", "we", "are", "not", "disabled", "Get", "the", "enriched", "MathML", "and", "parse", "it", "into", "the", "jax", "root", ".", "Mark", "the", "jax", "as", "enriched", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/semantic-enrich.js#L52-L66
train
zorkow/speech-rule-engine
resources/www/scripts/semantic-enrich.js
function (update,menu) { this.config.disabled = false; if (update) MathJax.Hub.Queue(["Reprocess",MathJax.Hub]); }
javascript
function (update,menu) { this.config.disabled = false; if (update) MathJax.Hub.Queue(["Reprocess",MathJax.Hub]); }
[ "function", "(", "update", ",", "menu", ")", "{", "this", ".", "config", ".", "disabled", "=", "false", ";", "if", "(", "update", ")", "MathJax", ".", "Hub", ".", "Queue", "(", "[", "\"Reprocess\"", ",", "MathJax", ".", "Hub", "]", ")", ";", "}" ]
Functions to enable and disabled enrichment.
[ "Functions", "to", "enable", "and", "disabled", "enrichment", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/semantic-enrich.js#L70-L73
train
zorkow/speech-rule-engine
resources/www/scripts/accessibility-menu.js
function() { var items = Array(this.modules.length); for (var i = 0, module; module = this.modules[i]; i++) items[i] = module.placeHolder; var menu = MENU.FindId('Accessibility'); if (menu) { items.unshift(ITEM.RULE()); menu.submenu.items.push.apply(menu.submenu.items,items); ...
javascript
function() { var items = Array(this.modules.length); for (var i = 0, module; module = this.modules[i]; i++) items[i] = module.placeHolder; var menu = MENU.FindId('Accessibility'); if (menu) { items.unshift(ITEM.RULE()); menu.submenu.items.push.apply(menu.submenu.items,items); ...
[ "function", "(", ")", "{", "var", "items", "=", "Array", "(", "this", ".", "modules", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ",", "module", ";", "module", "=", "this", ".", "modules", "[", "i", "]", ";", "i", "++", ")", "i...
Attaches the menu items;
[ "Attaches", "the", "menu", "items", ";" ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/accessibility-menu.js#L67-L91
train
rofrischmann/react-look
scripts/preparePackages.js
copyLICENSE
function copyLICENSE(pkg) { fs.copy(__dirname + '/../LICENSE', __dirname + '/../packages/' + pkg + '/LICENSE', err => { errorOnFail(err) console.log('LICENSE was successfully copied into the ' + pkg + ' package.') }) }
javascript
function copyLICENSE(pkg) { fs.copy(__dirname + '/../LICENSE', __dirname + '/../packages/' + pkg + '/LICENSE', err => { errorOnFail(err) console.log('LICENSE was successfully copied into the ' + pkg + ' package.') }) }
[ "function", "copyLICENSE", "(", "pkg", ")", "{", "fs", ".", "copy", "(", "__dirname", "+", "'/../LICENSE'", ",", "__dirname", "+", "'/../packages/'", "+", "pkg", "+", "'/LICENSE'", ",", "err", "=>", "{", "errorOnFail", "(", "err", ")", "console", ".", "l...
Copies LICENSE into a pgk subfolder
[ "Copies", "LICENSE", "into", "a", "pgk", "subfolder" ]
bcc01653328e6298ae46af14c91958874e8baf92
https://github.com/rofrischmann/react-look/blob/bcc01653328e6298ae46af14c91958874e8baf92/scripts/preparePackages.js#L17-L22
train
rofrischmann/react-look
scripts/preparePackages.js
updateVersion
function updateVersion(pkg) { fs.readFile(__dirname + '/../package.json', 'utf8', (err, data) => { errorOnFail(err) const globalVersion = JSON.parse(data).version fs.readFile(__dirname + '/../packages/' + pkg + '/package.json', (err, data) => { errorOnFail(err) const packageJSON = JSON.parse...
javascript
function updateVersion(pkg) { fs.readFile(__dirname + '/../package.json', 'utf8', (err, data) => { errorOnFail(err) const globalVersion = JSON.parse(data).version fs.readFile(__dirname + '/../packages/' + pkg + '/package.json', (err, data) => { errorOnFail(err) const packageJSON = JSON.parse...
[ "function", "updateVersion", "(", "pkg", ")", "{", "fs", ".", "readFile", "(", "__dirname", "+", "'/../package.json'", ",", "'utf8'", ",", "(", "err", ",", "data", ")", "=>", "{", "errorOnFail", "(", "err", ")", "const", "globalVersion", "=", "JSON", "."...
Updates the package.json version of a given pkg with the global package.json version
[ "Updates", "the", "package", ".", "json", "version", "of", "a", "given", "pkg", "with", "the", "global", "package", ".", "json", "version" ]
bcc01653328e6298ae46af14c91958874e8baf92
https://github.com/rofrischmann/react-look/blob/bcc01653328e6298ae46af14c91958874e8baf92/scripts/preparePackages.js#L26-L55
train
zorkow/speech-rule-engine
src/semantic_tree/semantic_node.js
function(tag, nodes) { var xmlNodes = nodes.map(function(x) {return x.xml(xml, opt_brief);}); var tagNode = xml.createElementNS('', tag); for (var i = 0, child; child = xmlNodes[i]; i++) { tagNode.appendChild(child); } return tagNode; }
javascript
function(tag, nodes) { var xmlNodes = nodes.map(function(x) {return x.xml(xml, opt_brief);}); var tagNode = xml.createElementNS('', tag); for (var i = 0, child; child = xmlNodes[i]; i++) { tagNode.appendChild(child); } return tagNode; }
[ "function", "(", "tag", ",", "nodes", ")", "{", "var", "xmlNodes", "=", "nodes", ".", "map", "(", "function", "(", "x", ")", "{", "return", "x", ".", "xml", "(", "xml", ",", "opt_brief", ")", ";", "}", ")", ";", "var", "tagNode", "=", "xml", "....
Translates a list of nodes into XML representation. @param {string} tag Name of the enclosing tag. @param {!Array.<!sre.SemanticNode>} nodes A list of nodes. @return {Node} An XML representation of the node list.
[ "Translates", "a", "list", "of", "nodes", "into", "XML", "representation", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/src/semantic_tree/semantic_node.js#L144-L151
train
zorkow/speech-rule-engine
resources/www/scripts/auto-collapse.js
function (element) { if (this.config.disabled) return; this.GetContainerWidths(element); var jax = HUB.getAllJax(element); var state = {collapse: [], jax: jax, m: jax.length, i: 0, changed:false}; return this.collapseState(state); }
javascript
function (element) { if (this.config.disabled) return; this.GetContainerWidths(element); var jax = HUB.getAllJax(element); var state = {collapse: [], jax: jax, m: jax.length, i: 0, changed:false}; return this.collapseState(state); }
[ "function", "(", "element", ")", "{", "if", "(", "this", ".", "config", ".", "disabled", ")", "return", ";", "this", ".", "GetContainerWidths", "(", "element", ")", ";", "var", "jax", "=", "HUB", ".", "getAllJax", "(", "element", ")", ";", "var", "st...
Find math that is too wide and collapse it.
[ "Find", "math", "that", "is", "too", "wide", "and", "collapse", "it", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/auto-collapse.js#L158-L164
train
zorkow/speech-rule-engine
resources/www/scripts/auto-collapse.js
function (SRE,state) { var w = SRE.width, m = w, M = 1000000; for (var j = SRE.action.length-1; j >= 0; j--) { var action = SRE.action[j], selection = action.selection; if (w > SRE.cwidth) { action.selection = 1; m = action.SREwidth; M = w; } else { acti...
javascript
function (SRE,state) { var w = SRE.width, m = w, M = 1000000; for (var j = SRE.action.length-1; j >= 0; j--) { var action = SRE.action[j], selection = action.selection; if (w > SRE.cwidth) { action.selection = 1; m = action.SREwidth; M = w; } else { acti...
[ "function", "(", "SRE", ",", "state", ")", "{", "var", "w", "=", "SRE", ".", "width", ",", "m", "=", "w", ",", "M", "=", "1000000", ";", "for", "(", "var", "j", "=", "SRE", ".", "action", ".", "length", "-", "1", ";", "j", ">=", "0", ";", ...
Find the actions that need to be collapsed to acheive the correct width, and retain the sizes that would cause the equation to be expanded or collapsed further.
[ "Find", "the", "actions", "that", "need", "to", "be", "collapsed", "to", "acheive", "the", "correct", "width", "and", "retain", "the", "sizes", "that", "would", "cause", "the", "equation", "to", "be", "expanded", "or", "collapsed", "further", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/auto-collapse.js#L189-L207
train
zorkow/speech-rule-engine
resources/www/scripts/auto-collapse.js
function (jax,state) { if (!jax.root.SRE.actionWidths) { MathJax.OutputJax[jax.outputJax].getMetrics(jax); try {this.computeActionWidths(jax)} catch (err) { if (!err.restart) throw err; return MathJax.Callback.After(["collapseState",this,state],err.restart); } s...
javascript
function (jax,state) { if (!jax.root.SRE.actionWidths) { MathJax.OutputJax[jax.outputJax].getMetrics(jax); try {this.computeActionWidths(jax)} catch (err) { if (!err.restart) throw err; return MathJax.Callback.After(["collapseState",this,state],err.restart); } s...
[ "function", "(", "jax", ",", "state", ")", "{", "if", "(", "!", "jax", ".", "root", ".", "SRE", ".", "actionWidths", ")", "{", "MathJax", ".", "OutputJax", "[", "jax", ".", "outputJax", "]", ".", "getMetrics", "(", "jax", ")", ";", "try", "{", "t...
Get the widths of the different collapsings, trapping any restarts, and restarting the process when the event has occurred.
[ "Get", "the", "widths", "of", "the", "different", "collapsings", "trapping", "any", "restarts", "and", "restarting", "the", "process", "when", "the", "event", "has", "occurred", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/auto-collapse.js#L214-L224
train
zorkow/speech-rule-engine
resources/www/scripts/auto-collapse.js
function (jax) { var SRE = jax.root.SRE, actions = SRE.action, j, state = {}; SRE.width = jax.sreGetRootWidth(state); for (j = actions.length-1; j >= 0; j--) actions[j].selection = 2; for (j = actions.length-1; j >= 0; j--) { var action = actions[j]; if (action.SREwidth == null) ...
javascript
function (jax) { var SRE = jax.root.SRE, actions = SRE.action, j, state = {}; SRE.width = jax.sreGetRootWidth(state); for (j = actions.length-1; j >= 0; j--) actions[j].selection = 2; for (j = actions.length-1; j >= 0; j--) { var action = actions[j]; if (action.SREwidth == null) ...
[ "function", "(", "jax", ")", "{", "var", "SRE", "=", "jax", ".", "root", ".", "SRE", ",", "actions", "=", "SRE", ".", "action", ",", "j", ",", "state", "=", "{", "}", ";", "SRE", ".", "width", "=", "jax", ".", "sreGetRootWidth", "(", "state", "...
Compute the action widths by collapsing each maction, and recording the width of the complete equation.
[ "Compute", "the", "action", "widths", "by", "collapsing", "each", "maction", "and", "recording", "the", "width", "of", "the", "complete", "equation", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/auto-collapse.js#L229-L241
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml,id) { var child = this.FindChild(mml,id); return (child ? child.data.join("") : "?"); }
javascript
function (mml,id) { var child = this.FindChild(mml,id); return (child ? child.data.join("") : "?"); }
[ "function", "(", "mml", ",", "id", ")", "{", "var", "child", "=", "this", ".", "FindChild", "(", "mml", ",", "id", ")", ";", "return", "(", "child", "?", "child", ".", "data", ".", "join", "(", "\"\"", ")", ":", "\"?\"", ")", ";", "}" ]
Locate child node and return its text
[ "Locate", "child", "node", "and", "return", "its", "text" ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L303-L306
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml) { this.UncollapseChild(mml,1); if (mml.complexity > this.COLLAPSE.fenced) { if (mml.attr["data-semantic-role"] === "leftright") { var marker = mml.data[0].data.join("") + mml.data[mml.data.length-1].data.join(""); mml = this.MakeAction(this.Marker(marker),mml); ...
javascript
function (mml) { this.UncollapseChild(mml,1); if (mml.complexity > this.COLLAPSE.fenced) { if (mml.attr["data-semantic-role"] === "leftright") { var marker = mml.data[0].data.join("") + mml.data[mml.data.length-1].data.join(""); mml = this.MakeAction(this.Marker(marker),mml); ...
[ "function", "(", "mml", ")", "{", "this", ".", "UncollapseChild", "(", "mml", ",", "1", ")", ";", "if", "(", "mml", ".", "complexity", ">", "this", ".", "COLLAPSE", ".", "fenced", ")", "{", "if", "(", "mml", ".", "attr", "[", "\"data-semantic-role\""...
For fenced elements, if the contents are collapsed, collapse the fence instead.
[ "For", "fenced", "elements", "if", "the", "contents", "are", "collapsed", "collapse", "the", "fence", "instead", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L336-L345
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml) { this.UncollapseChild(mml,0); if (mml.complexity > this.COLLAPSE.sqrt) mml = this.MakeAction(this.Marker(this.MARKER.sqrt),mml); return mml; }
javascript
function (mml) { this.UncollapseChild(mml,0); if (mml.complexity > this.COLLAPSE.sqrt) mml = this.MakeAction(this.Marker(this.MARKER.sqrt),mml); return mml; }
[ "function", "(", "mml", ")", "{", "this", ".", "UncollapseChild", "(", "mml", ",", "0", ")", ";", "if", "(", "mml", ".", "complexity", ">", "this", ".", "COLLAPSE", ".", "sqrt", ")", "mml", "=", "this", ".", "MakeAction", "(", "this", ".", "Marker"...
For sqrt elements, if the contents are collapsed, collapse the sqrt instead.
[ "For", "sqrt", "elements", "if", "the", "contents", "are", "collapsed", "collapse", "the", "sqrt", "instead", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L364-L369
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml) { if (this.SplitAttribute(mml,"children").length === 1) { var child = (mml.data.length === 1 && mml.data[0].inferred ? mml.data[0] : mml); if (child.data[0] && child.data[0].collapsible) { // // Move menclose into the maction element // var m...
javascript
function (mml) { if (this.SplitAttribute(mml,"children").length === 1) { var child = (mml.data.length === 1 && mml.data[0].inferred ? mml.data[0] : mml); if (child.data[0] && child.data[0].collapsible) { // // Move menclose into the maction element // var m...
[ "function", "(", "mml", ")", "{", "if", "(", "this", ".", "SplitAttribute", "(", "mml", ",", "\"children\"", ")", ".", "length", "===", "1", ")", "{", "var", "child", "=", "(", "mml", ".", "data", ".", "length", "===", "1", "&&", "mml", ".", "dat...
For enclose, include enclosure in collapsed child, if any
[ "For", "enclose", "include", "enclosure", "in", "collapsed", "child", "if", "any" ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L380-L394
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml) { if (mml.complexity > this.COLLAPSE.bigop || mml.data[0].type !== "mo") { var id = this.SplitAttribute(mml,"content").pop(); var op = Collapsible.FindChildText(mml,id); mml = this.MakeAction(this.Marker(op),mml); } return mml; }
javascript
function (mml) { if (mml.complexity > this.COLLAPSE.bigop || mml.data[0].type !== "mo") { var id = this.SplitAttribute(mml,"content").pop(); var op = Collapsible.FindChildText(mml,id); mml = this.MakeAction(this.Marker(op),mml); } return mml; }
[ "function", "(", "mml", ")", "{", "if", "(", "mml", ".", "complexity", ">", "this", ".", "COLLAPSE", ".", "bigop", "||", "mml", ".", "data", "[", "0", "]", ".", "type", "!==", "\"mo\"", ")", "{", "var", "id", "=", "this", ".", "SplitAttribute", "...
For bigops, get the character to use from the largeop at its core.
[ "For", "bigops", "get", "the", "character", "to", "use", "from", "the", "largeop", "at", "its", "core", "." ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L399-L406
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml) { if (mml.complexity > this.COLLAPSE.relseq) { var content = this.SplitAttribute(mml,"content"); var marker = Collapsible.FindChildText(mml,content[0]); if (content.length > 1) marker += "\u22EF"; mml = this.MakeAction(this.Marker(marker),mml); } return m...
javascript
function (mml) { if (mml.complexity > this.COLLAPSE.relseq) { var content = this.SplitAttribute(mml,"content"); var marker = Collapsible.FindChildText(mml,content[0]); if (content.length > 1) marker += "\u22EF"; mml = this.MakeAction(this.Marker(marker),mml); } return m...
[ "function", "(", "mml", ")", "{", "if", "(", "mml", ".", "complexity", ">", "this", ".", "COLLAPSE", ".", "relseq", ")", "{", "var", "content", "=", "this", ".", "SplitAttribute", "(", "mml", ",", "\"content\"", ")", ";", "var", "marker", "=", "Colla...
For multirel and relseq, use proper symbol
[ "For", "multirel", "and", "relseq", "use", "proper", "symbol" ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L419-L427
train
zorkow/speech-rule-engine
resources/www/scripts/collapsible.js
function (mml) { this.UncollapseChild(mml,0,2); if (mml.complexity > this.COLLAPSE.superscript) mml = this.MakeAction(this.Marker(this.MARKER.superscript),mml); return mml; }
javascript
function (mml) { this.UncollapseChild(mml,0,2); if (mml.complexity > this.COLLAPSE.superscript) mml = this.MakeAction(this.Marker(this.MARKER.superscript),mml); return mml; }
[ "function", "(", "mml", ")", "{", "this", ".", "UncollapseChild", "(", "mml", ",", "0", ",", "2", ")", ";", "if", "(", "mml", ".", "complexity", ">", "this", ".", "COLLAPSE", ".", "superscript", ")", "mml", "=", "this", ".", "MakeAction", "(", "thi...
Include super- and subscripts into a collapsed base
[ "Include", "super", "-", "and", "subscripts", "into", "a", "collapsed", "base" ]
d4d9dc9c6b4144897b60a90177d116e9d3777d71
https://github.com/zorkow/speech-rule-engine/blob/d4d9dc9c6b4144897b60a90177d116e9d3777d71/resources/www/scripts/collapsible.js#L440-L445
train
Runnable/ponos
examples/basic-worker.js
basicWorker
function basicWorker (job) { return Promise.try(() => { const tid = getNamespace('ponos').get('tid') if (!job.message) { throw new WorkerStopError('message is required', { tid: tid }) } console.log(`hello world: ${job.message}. tid: ${tid}`) }) }
javascript
function basicWorker (job) { return Promise.try(() => { const tid = getNamespace('ponos').get('tid') if (!job.message) { throw new WorkerStopError('message is required', { tid: tid }) } console.log(`hello world: ${job.message}. tid: ${tid}`) }) }
[ "function", "basicWorker", "(", "job", ")", "{", "return", "Promise", ".", "try", "(", "(", ")", "=>", "{", "const", "tid", "=", "getNamespace", "(", "'ponos'", ")", ".", "get", "(", "'tid'", ")", "if", "(", "!", "job", ".", "message", ")", "{", ...
A simple worker that will publish a message to a queue. @param {object} job Object describing the job. @param {string} job.queue Queue on which the message will be published. @returns {promise} Resolved when the message is put on the queue.
[ "A", "simple", "worker", "that", "will", "publish", "a", "message", "to", "a", "queue", "." ]
af60007557fb5164b4d49e995e2c294927f67df1
https://github.com/Runnable/ponos/blob/af60007557fb5164b4d49e995e2c294927f67df1/examples/basic-worker.js#L15-L23
train
moay/afterglow
vendor/videojs/plugins/Youtube.js
function(){ var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg'; try { var image = new Image(); image.onload = function(){ // Onload may still be called if YouTube returns the 120x90 error thumbnail if('naturalHeight' in image){ ...
javascript
function(){ var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg'; try { var image = new Image(); image.onload = function(){ // Onload may still be called if YouTube returns the 120x90 error thumbnail if('naturalHeight' in image){ ...
[ "function", "(", ")", "{", "var", "uri", "=", "'https://img.youtube.com/vi/'", "+", "this", ".", "url", ".", "videoId", "+", "'/maxresdefault.jpg'", ";", "try", "{", "var", "image", "=", "new", "Image", "(", ")", ";", "image", ".", "onload", "=", "functi...
Tries to get the highest resolution thumbnail available for the video
[ "Tries", "to", "get", "the", "highest", "resolution", "thumbnail", "available", "for", "the", "video" ]
a7fbc889a18188147fcd8418c5d3bb801608b9a7
https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/plugins/Youtube.js#L628-L650
train