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
eblanshey/safenet
src/request.js
prepareResponse
function prepareResponse(response) { Safe.log('Received response: ', response); return response.text().then(function(text) { // If we get a 2xx... Safe.log('Launcher returned status '+response.status); if (response.ok) { // If not an authorized request, or not encrypted, no decryption necessary ...
javascript
function prepareResponse(response) { Safe.log('Received response: ', response); return response.text().then(function(text) { // If we get a 2xx... Safe.log('Launcher returned status '+response.status); if (response.ok) { // If not an authorized request, or not encrypted, no decryption necessary ...
[ "function", "prepareResponse", "(", "response", ")", "{", "Safe", ".", "log", "(", "'Received response: '", ",", "response", ")", ";", "return", "response", ".", "text", "(", ")", ".", "then", "(", "function", "(", "text", ")", "{", "// If we get a 2xx...", ...
If request was with auth token, returned data is encrypted, otherwise it's plain ol' json
[ "If", "request", "was", "with", "auth", "token", "returned", "data", "is", "encrypted", "otherwise", "it", "s", "plain", "ol", "json" ]
8438251bf0999b43f39c231df299b05d01dd4618
https://github.com/eblanshey/safenet/blob/8438251bf0999b43f39c231df299b05d01dd4618/src/request.js#L130-L166
train
eblanshey/safenet
src/request.js
parseSafeMessage
function parseSafeMessage(message, status) { if (typeof message === 'object') { return {status: message.errorCode, message: message.description}; } else { return {status: status, message: message}; } }
javascript
function parseSafeMessage(message, status) { if (typeof message === 'object') { return {status: message.errorCode, message: message.description}; } else { return {status: status, message: message}; } }
[ "function", "parseSafeMessage", "(", "message", ",", "status", ")", "{", "if", "(", "typeof", "message", "===", "'object'", ")", "{", "return", "{", "status", ":", "message", ".", "errorCode", ",", "message", ":", "message", ".", "description", "}", ";", ...
Sometimes the message returns is an object with a 'description' and 'errorCode' property @param message
[ "Sometimes", "the", "message", "returns", "is", "an", "object", "with", "a", "description", "and", "errorCode", "property" ]
8438251bf0999b43f39c231df299b05d01dd4618
https://github.com/eblanshey/safenet/blob/8438251bf0999b43f39c231df299b05d01dd4618/src/request.js#L214-L220
train
recidive/prana
prana.js
function(next) { if (!extension[type] || typeof extension[type] !== 'function') { return next(); } // Invoke type hook implemetation. extension[type](result, function(error, newItems) { if (error) { return next(error); } utils.extend(...
javascript
function(next) { if (!extension[type] || typeof extension[type] !== 'function') { return next(); } // Invoke type hook implemetation. extension[type](result, function(error, newItems) { if (error) { return next(error); } utils.extend(...
[ "function", "(", "next", ")", "{", "if", "(", "!", "extension", "[", "type", "]", "||", "typeof", "extension", "[", "type", "]", "!==", "'function'", ")", "{", "return", "next", "(", ")", ";", "}", "// Invoke type hook implemetation.", "extension", "[", ...
The callback that will receive and process.
[ "The", "callback", "that", "will", "receive", "and", "process", "." ]
e2900c01d3c8ea73bbb8f8f4155cf76ad3c95b63
https://github.com/recidive/prana/blob/e2900c01d3c8ea73bbb8f8f4155cf76ad3c95b63/prana.js#L320-L335
train
jhermsmeier/node-chs
lib/chs.js
CHS
function CHS( cylinder, head, sector ) { if( !(this instanceof CHS) ) return new CHS( cylinder, head, sector ) if( Buffer.isBuffer( cylinder ) ) return CHS.fromBuffer( cylinder ) /** @type {Number} Cylinder */ this.cylinder = cylinder & 0x03FF /** @type {Number} Head */ this.head = head & 0xFF ...
javascript
function CHS( cylinder, head, sector ) { if( !(this instanceof CHS) ) return new CHS( cylinder, head, sector ) if( Buffer.isBuffer( cylinder ) ) return CHS.fromBuffer( cylinder ) /** @type {Number} Cylinder */ this.cylinder = cylinder & 0x03FF /** @type {Number} Head */ this.head = head & 0xFF ...
[ "function", "CHS", "(", "cylinder", ",", "head", ",", "sector", ")", "{", "if", "(", "!", "(", "this", "instanceof", "CHS", ")", ")", "return", "new", "CHS", "(", "cylinder", ",", "head", ",", "sector", ")", "if", "(", "Buffer", ".", "isBuffer", "(...
Cylinder-Head-Sector Address @constructor @param {(Number|Buffer)} [cylinder=1023] @param {Number} [head=254] @param {Number} [sector=63]
[ "Cylinder", "-", "Head", "-", "Sector", "Address" ]
f6fd45d01beb5e19890c287e206ba75ff4e18084
https://github.com/jhermsmeier/node-chs/blob/f6fd45d01beb5e19890c287e206ba75ff4e18084/lib/chs.js#L8-L23
train
jhermsmeier/node-chs
lib/chs.js
function( target ) { target.cylinder = this.cylinder target.head = this.head target.sector = this.sector return target }
javascript
function( target ) { target.cylinder = this.cylinder target.head = this.head target.sector = this.sector return target }
[ "function", "(", "target", ")", "{", "target", ".", "cylinder", "=", "this", ".", "cylinder", "target", ".", "head", "=", "this", ".", "head", "target", ".", "sector", "=", "this", ".", "sector", "return", "target", "}" ]
Copy this address to a target address @param {CHS} target @return {CHS}
[ "Copy", "this", "address", "to", "a", "target", "address" ]
f6fd45d01beb5e19890c287e206ba75ff4e18084
https://github.com/jhermsmeier/node-chs/blob/f6fd45d01beb5e19890c287e206ba75ff4e18084/lib/chs.js#L108-L116
train
jhermsmeier/node-chs
lib/chs.js
function( buffer, offset ) { if( !Buffer.isBuffer( buffer ) ) throw new TypeError( 'Value must be a buffer' ) offset = offset || 0 return this.fromNumber( buffer.readUIntLE( offset, 3 ) ) }
javascript
function( buffer, offset ) { if( !Buffer.isBuffer( buffer ) ) throw new TypeError( 'Value must be a buffer' ) offset = offset || 0 return this.fromNumber( buffer.readUIntLE( offset, 3 ) ) }
[ "function", "(", "buffer", ",", "offset", ")", "{", "if", "(", "!", "Buffer", ".", "isBuffer", "(", "buffer", ")", ")", "throw", "new", "TypeError", "(", "'Value must be a buffer'", ")", "offset", "=", "offset", "||", "0", "return", "this", ".", "fromNum...
Parse a given Buffer @param {Buffer} buffer @param {Number} [offset=0] @return {CHS}
[ "Parse", "a", "given", "Buffer" ]
f6fd45d01beb5e19890c287e206ba75ff4e18084
https://github.com/jhermsmeier/node-chs/blob/f6fd45d01beb5e19890c287e206ba75ff4e18084/lib/chs.js#L124-L133
train
rtm/upward
src/Ify.js
compose
function compose(...fns) { return function(x) { return fns.reduceRight((result, val) => val(result), x); }; }
javascript
function compose(...fns) { return function(x) { return fns.reduceRight((result, val) => val(result), x); }; }
[ "function", "compose", "(", "...", "fns", ")", "{", "return", "function", "(", "x", ")", "{", "return", "fns", ".", "reduceRight", "(", "(", "result", ",", "val", ")", "=>", "val", "(", "result", ")", ",", "x", ")", ";", "}", ";", "}" ]
Compose functions, calling from right to left.
[ "Compose", "functions", "calling", "from", "right", "to", "left", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L13-L17
train
rtm/upward
src/Ify.js
tickify
function tickify(fn, {delay} = {}) { delay = delay || 10; return function() { return setTimeout(() => fn.apply(this, arguments), delay); }; }
javascript
function tickify(fn, {delay} = {}) { delay = delay || 10; return function() { return setTimeout(() => fn.apply(this, arguments), delay); }; }
[ "function", "tickify", "(", "fn", ",", "{", "delay", "}", "=", "{", "}", ")", "{", "delay", "=", "delay", "||", "10", ";", "return", "function", "(", ")", "{", "return", "setTimeout", "(", "(", ")", "=>", "fn", ".", "apply", "(", "this", ",", "...
Create a function which runs on next tick.
[ "Create", "a", "function", "which", "runs", "on", "next", "tick", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L20-L25
train
rtm/upward
src/Ify.js
memoify
function memoify(fn, {hash, cache} = {}) { hash = hash || identify; cache = cache = {}; function memoified(...args) { var key = hash(...args); return key in cache ? cache[key] : cache[key] = fn.call(this, ...args); } memoified.clear = () => cache = {}; return memoified; }
javascript
function memoify(fn, {hash, cache} = {}) { hash = hash || identify; cache = cache = {}; function memoified(...args) { var key = hash(...args); return key in cache ? cache[key] : cache[key] = fn.call(this, ...args); } memoified.clear = () => cache = {}; return memoified; }
[ "function", "memoify", "(", "fn", ",", "{", "hash", ",", "cache", "}", "=", "{", "}", ")", "{", "hash", "=", "hash", "||", "identify", ";", "cache", "=", "cache", "=", "{", "}", ";", "function", "memoified", "(", "...", "args", ")", "{", "var", ...
Make a function which memozies its result.
[ "Make", "a", "function", "which", "memozies", "its", "result", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L58-L67
train
rtm/upward
src/Ify.js
logify
function logify(fn) { return function() { console.log("entering", fn.name); var ret = fn.apply(this, arguments); console.log("leaving", fn.name); return ret; }; }
javascript
function logify(fn) { return function() { console.log("entering", fn.name); var ret = fn.apply(this, arguments); console.log("leaving", fn.name); return ret; }; }
[ "function", "logify", "(", "fn", ")", "{", "return", "function", "(", ")", "{", "console", ".", "log", "(", "\"entering\"", ",", "fn", ".", "name", ")", ";", "var", "ret", "=", "fn", ".", "apply", "(", "this", ",", "arguments", ")", ";", "console",...
Make a version of the function which logs entry and exit.
[ "Make", "a", "version", "of", "the", "function", "which", "logs", "entry", "and", "exit", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L103-L110
train
rtm/upward
src/Ify.js
onceify
function onceify(f) { var ran, ret; return function() { return ran ? ret : (ran=true, ret=f.apply(this,arguments)); }; }
javascript
function onceify(f) { var ran, ret; return function() { return ran ? ret : (ran=true, ret=f.apply(this,arguments)); }; }
[ "function", "onceify", "(", "f", ")", "{", "var", "ran", ",", "ret", ";", "return", "function", "(", ")", "{", "return", "ran", "?", "ret", ":", "(", "ran", "=", "true", ",", "ret", "=", "f", ".", "apply", "(", "this", ",", "arguments", ")", ")...
Make create a version of a function which runs just once on first call. Returns same value on succeeding calls.
[ "Make", "create", "a", "version", "of", "a", "function", "which", "runs", "just", "once", "on", "first", "call", ".", "Returns", "same", "value", "on", "succeeding", "calls", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L126-L131
train
rtm/upward
src/Ify.js
wrapify
function wrapify(fn, before = noop, after = noop) { return function(...args) { before.call(this); var ret = fn.call(this, ...args); after.call(this); return ret; }; }
javascript
function wrapify(fn, before = noop, after = noop) { return function(...args) { before.call(this); var ret = fn.call(this, ...args); after.call(this); return ret; }; }
[ "function", "wrapify", "(", "fn", ",", "before", "=", "noop", ",", "after", "=", "noop", ")", "{", "return", "function", "(", "...", "args", ")", "{", "before", ".", "call", "(", "this", ")", ";", "var", "ret", "=", "fn", ".", "call", "(", "this"...
Create a function with a prelude and postlude.
[ "Create", "a", "function", "with", "a", "prelude", "and", "postlude", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L148-L155
train
rtm/upward
src/Ify.js
parseBody
function parseBody(fn){ //get arguments to function as array of strings var body=fn.body=fn.body|| //cache result in `body` property of function fn.toString() //get string version of function .replace(/\/\/.*$|\/\*[\s\S]*?\*\//mg, '') //strip comments .replace(/^\s*$/mg, '') ...
javascript
function parseBody(fn){ //get arguments to function as array of strings var body=fn.body=fn.body|| //cache result in `body` property of function fn.toString() //get string version of function .replace(/\/\/.*$|\/\*[\s\S]*?\*\//mg, '') //strip comments .replace(/^\s*$/mg, '') ...
[ "function", "parseBody", "(", "fn", ")", "{", "//get arguments to function as array of strings", "var", "body", "=", "fn", ".", "body", "=", "fn", ".", "body", "||", "//cache result in `body` property of function", "fn", ".", "toString", "(", ")", "//get string versio...
Return function body.
[ "Return", "function", "body", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ify.js#L182-L192
train
gwicke/nodegrind
nodegrind.js
convertProfNode
function convertProfNode (node) { var res = { functionName: node.functionName, lineNumber: node.lineNumber, callUID: node.callUid, hitCount: node.selfSamplesCount, url: node.scriptName, children: [] }; for (var i = 0; i < node.childrenCount; i++) { res.children.push(convertProfNode(node.getChild(i))); ...
javascript
function convertProfNode (node) { var res = { functionName: node.functionName, lineNumber: node.lineNumber, callUID: node.callUid, hitCount: node.selfSamplesCount, url: node.scriptName, children: [] }; for (var i = 0; i < node.childrenCount; i++) { res.children.push(convertProfNode(node.getChild(i))); ...
[ "function", "convertProfNode", "(", "node", ")", "{", "var", "res", "=", "{", "functionName", ":", "node", ".", "functionName", ",", "lineNumber", ":", "node", ".", "lineNumber", ",", "callUID", ":", "node", ".", "callUid", ",", "hitCount", ":", "node", ...
Simplistic V8 CPU profiler wrapper, WIP Usage: npm install v8-profiler var profiler = require('./profiler'); profiler.start('parse'); <some computation> var prof = profiler.stop('parse'); fs.writeFileSync('parse.cpuprofile', JSON.stringify(prof)); Now you can load parse.cpuprofile into chrome, or (much nicer) conver...
[ "Simplistic", "V8", "CPU", "profiler", "wrapper", "WIP" ]
de40c14eda8f81c345519a805e9e3c3a5ebc4e61
https://github.com/gwicke/nodegrind/blob/de40c14eda8f81c345519a805e9e3c3a5ebc4e61/nodegrind.js#L55-L68
train
gwicke/nodegrind
nodegrind.js
writeProfile
function writeProfile() { var format; if (/\.cpuprofile$/.test(argv.o)) { format = 'cpuprofile'; } var prof = stopCPU('global', format); fs.writeFileSync(argv.o, prof); var fname = JSON.stringify(argv.o); console.warn('Profile written to', fname + '\nTry `kcachegrind',...
javascript
function writeProfile() { var format; if (/\.cpuprofile$/.test(argv.o)) { format = 'cpuprofile'; } var prof = stopCPU('global', format); fs.writeFileSync(argv.o, prof); var fname = JSON.stringify(argv.o); console.warn('Profile written to', fname + '\nTry `kcachegrind',...
[ "function", "writeProfile", "(", ")", "{", "var", "format", ";", "if", "(", "/", "\\.cpuprofile$", "/", ".", "test", "(", "argv", ".", "o", ")", ")", "{", "format", "=", "'cpuprofile'", ";", "}", "var", "prof", "=", "stopCPU", "(", "'global'", ",", ...
Stop profiling in an exit handler so that we properly handle async code
[ "Stop", "profiling", "in", "an", "exit", "handler", "so", "that", "we", "properly", "handle", "async", "code" ]
de40c14eda8f81c345519a805e9e3c3a5ebc4e61
https://github.com/gwicke/nodegrind/blob/de40c14eda8f81c345519a805e9e3c3a5ebc4e61/nodegrind.js#L115-L127
train
intervolga/bembh-loader
lib/walk-bemjson.js
walkBemJson
function walkBemJson(bemJson, cb) { let result; if (Array.isArray(bemJson)) { result = []; bemJson.forEach((childBemJson, i) => { result[i] = walkBemJson(childBemJson, cb); }); } else if (bemJson instanceof Object) { result = {}; Object.keys(bemJson).forEach((key) => { result[key]...
javascript
function walkBemJson(bemJson, cb) { let result; if (Array.isArray(bemJson)) { result = []; bemJson.forEach((childBemJson, i) => { result[i] = walkBemJson(childBemJson, cb); }); } else if (bemJson instanceof Object) { result = {}; Object.keys(bemJson).forEach((key) => { result[key]...
[ "function", "walkBemJson", "(", "bemJson", ",", "cb", ")", "{", "let", "result", ";", "if", "(", "Array", ".", "isArray", "(", "bemJson", ")", ")", "{", "result", "=", "[", "]", ";", "bemJson", ".", "forEach", "(", "(", "childBemJson", ",", "i", ")...
Walks thru BemJson recursively and invokes callback on each string value @param {Object|Array|String} bemJson @param {Function} cb @return {Object|Array|String}
[ "Walks", "thru", "BemJson", "recursively", "and", "invokes", "callback", "on", "each", "string", "value" ]
24d599ccdb395fa2d9f70a205676134e48fc4f12
https://github.com/intervolga/bembh-loader/blob/24d599ccdb395fa2d9f70a205676134e48fc4f12/lib/walk-bemjson.js#L8-L26
train
nicktindall/cyclon.p2p-rtc-client
lib/AdapterJsRTCObjectFactory.js
AdapterJsRTCObjectFactory
function AdapterJsRTCObjectFactory(logger) { Utils.checkArguments(arguments, 1); this.createIceServers = function (urls, username, password) { if (typeof(createIceServers) !== "undefined") { return createIceServers(urls, username, password); } else { logger.erro...
javascript
function AdapterJsRTCObjectFactory(logger) { Utils.checkArguments(arguments, 1); this.createIceServers = function (urls, username, password) { if (typeof(createIceServers) !== "undefined") { return createIceServers(urls, username, password); } else { logger.erro...
[ "function", "AdapterJsRTCObjectFactory", "(", "logger", ")", "{", "Utils", ".", "checkArguments", "(", "arguments", ",", "1", ")", ";", "this", ".", "createIceServers", "=", "function", "(", "urls", ",", "username", ",", "password", ")", "{", "if", "(", "t...
An RTC Object factory that works in Firefox and Chrome when adapter.js is present adapter.js can be downloaded from: https://github.com/GoogleChrome/webrtc/blob/master/samples/web/js/adapter.js
[ "An", "RTC", "Object", "factory", "that", "works", "in", "Firefox", "and", "Chrome", "when", "adapter", ".", "js", "is", "present" ]
eb586ce288a6ad7e1b221280825037e855b03904
https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/AdapterJsRTCObjectFactory.js#L11-L54
train
YYago/summarybuilder
builder.js
onlySmHere
function onlySmHere(jsonFileName,isIndent,outFileName){ if (fs.existsSync(jsonFileName)) { var fcount = JSON.parse(fs.readFileSync(jsonFileName)); var foooo = []; if(fs.existsSync('SUMMARY.md')){ fcount = lodash.without(fcount,...haslisted.hasListed('SUMMARY.md')); } ...
javascript
function onlySmHere(jsonFileName,isIndent,outFileName){ if (fs.existsSync(jsonFileName)) { var fcount = JSON.parse(fs.readFileSync(jsonFileName)); var foooo = []; if(fs.existsSync('SUMMARY.md')){ fcount = lodash.without(fcount,...haslisted.hasListed('SUMMARY.md')); } ...
[ "function", "onlySmHere", "(", "jsonFileName", ",", "isIndent", ",", "outFileName", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "jsonFileName", ")", ")", "{", "var", "fcount", "=", "JSON", ".", "parse", "(", "fs", ".", "readFileSync", "(", "jsonFi...
for gulp Run only in the specified folder @param {string} jsonFileName The path of the JSON file.It's better to be created by the plugin: gulp-filelist. @param {boolean} isIndent indent? If'true'will be indented. @param {string} outFileName Like this: 'a.md',Any you wanted if you sure it can be read.
[ "for", "gulp", "Run", "only", "in", "the", "specified", "folder" ]
0fa24d478cd9fff6a8fb638b7ffbb5fc4bd0c704
https://github.com/YYago/summarybuilder/blob/0fa24d478cd9fff6a8fb638b7ffbb5fc4bd0c704/builder.js#L79-L155
train
loverly/awesome-automata
lib/State.js
State
function State(config) { this._ = require('lodash'); this._name = config.name; this._isInitial = config.isInitial; this._isTerminal = config.isTerminal; this._outgoingTransitions = config.outgoingTransitions; this.accept = config.accept; this._validateConfig(config); // Transform any value-based tra...
javascript
function State(config) { this._ = require('lodash'); this._name = config.name; this._isInitial = config.isInitial; this._isTerminal = config.isTerminal; this._outgoingTransitions = config.outgoingTransitions; this.accept = config.accept; this._validateConfig(config); // Transform any value-based tra...
[ "function", "State", "(", "config", ")", "{", "this", ".", "_", "=", "require", "(", "'lodash'", ")", ";", "this", ".", "_name", "=", "config", ".", "name", ";", "this", ".", "_isInitial", "=", "config", ".", "isInitial", ";", "this", ".", "_isTermin...
Represents an automata or state within a Finite State Machine. Provides mechanisms for
[ "Represents", "an", "automata", "or", "state", "within", "a", "Finite", "State", "Machine", "." ]
06ad9b26da9025a1cb1754a4eaa0277d728968e4
https://github.com/loverly/awesome-automata/blob/06ad9b26da9025a1cb1754a4eaa0277d728968e4/lib/State.js#L6-L29
train
bumbu/website-visual-diff
src/index.js
removeDir
function removeDir(dirPath, cleanOnly) { var files; try { files = fs.readdirSync(dirPath); } catch(e) { return; } if (files.length > 0) { for (var i = 0; i < files.length; i++) { var filePath = path.join(dirPath, files[i]); if (fs.statSync(filePath).isFile()) fs.unlinkSync(fi...
javascript
function removeDir(dirPath, cleanOnly) { var files; try { files = fs.readdirSync(dirPath); } catch(e) { return; } if (files.length > 0) { for (var i = 0; i < files.length; i++) { var filePath = path.join(dirPath, files[i]); if (fs.statSync(filePath).isFile()) fs.unlinkSync(fi...
[ "function", "removeDir", "(", "dirPath", ",", "cleanOnly", ")", "{", "var", "files", ";", "try", "{", "files", "=", "fs", ".", "readdirSync", "(", "dirPath", ")", ";", "}", "catch", "(", "e", ")", "{", "return", ";", "}", "if", "(", "files", ".", ...
Removes a directory and its cotents If cleanOnly is true then only the contents are removed @param {String} dirPath @param {boolean} cleanOnly
[ "Removes", "a", "directory", "and", "its", "cotents", "If", "cleanOnly", "is", "true", "then", "only", "the", "contents", "are", "removed" ]
b0903bcf55117f3903e69058b4e42f6b2b025e0d
https://github.com/bumbu/website-visual-diff/blob/b0903bcf55117f3903e69058b4e42f6b2b025e0d/src/index.js#L86-L106
train
bumbu/website-visual-diff
src/index.js
loadAndSaveShoots
function loadAndSaveShoots(settings, folderPath) { var promisesPool = []; var semaphore = new Semaphore({rooms: 6}); settings.pages.forEach((page) => { settings.sizes.forEach((size) => { promisesPool.push(semaphore.add(() => { return new Promise((resolve, reject) => { console.log(`S...
javascript
function loadAndSaveShoots(settings, folderPath) { var promisesPool = []; var semaphore = new Semaphore({rooms: 6}); settings.pages.forEach((page) => { settings.sizes.forEach((size) => { promisesPool.push(semaphore.add(() => { return new Promise((resolve, reject) => { console.log(`S...
[ "function", "loadAndSaveShoots", "(", "settings", ",", "folderPath", ")", "{", "var", "promisesPool", "=", "[", "]", ";", "var", "semaphore", "=", "new", "Semaphore", "(", "{", "rooms", ":", "6", "}", ")", ";", "settings", ".", "pages", ".", "forEach", ...
Creates screenshots based on provided settings and saves them into provided folder @param {Object} settings @param {String} folderPath @return {Promise}
[ "Creates", "screenshots", "based", "on", "provided", "settings", "and", "saves", "them", "into", "provided", "folder" ]
b0903bcf55117f3903e69058b4e42f6b2b025e0d
https://github.com/bumbu/website-visual-diff/blob/b0903bcf55117f3903e69058b4e42f6b2b025e0d/src/index.js#L151-L206
train
sosout/vssr
lib/app/store.js
getModule
function getModule (filename) { const file = files(filename) const module = file.default || file if (module.commit) { throw new Error('[vssr] <%= dir.store %>/' + filename.replace('./', '') + ' should export a method which returns a Vuex instance.') } if (module.state && typeof module.state !== 'function'...
javascript
function getModule (filename) { const file = files(filename) const module = file.default || file if (module.commit) { throw new Error('[vssr] <%= dir.store %>/' + filename.replace('./', '') + ' should export a method which returns a Vuex instance.') } if (module.state && typeof module.state !== 'function'...
[ "function", "getModule", "(", "filename", ")", "{", "const", "file", "=", "files", "(", "filename", ")", "const", "module", "=", "file", ".", "default", "||", "file", "if", "(", "module", ".", "commit", ")", "{", "throw", "new", "Error", "(", "'[vssr] ...
Dynamically require module
[ "Dynamically", "require", "module" ]
1cb1e21b15aa6aa761356fe0eb8618a099c9e215
https://github.com/sosout/vssr/blob/1cb1e21b15aa6aa761356fe0eb8618a099c9e215/lib/app/store.js#L89-L99
train
tidoust/fetch-filecache-for-crawling
fetch-filecache.js
filenamify
function filenamify(url) { let res = filenamifyUrl(url); if (res.length >= 60) { res = res.substr(0, 60) + '-md5-' + crypto.createHash('md5').update(url, 'utf8').digest('hex'); } return res; }
javascript
function filenamify(url) { let res = filenamifyUrl(url); if (res.length >= 60) { res = res.substr(0, 60) + '-md5-' + crypto.createHash('md5').update(url, 'utf8').digest('hex'); } return res; }
[ "function", "filenamify", "(", "url", ")", "{", "let", "res", "=", "filenamifyUrl", "(", "url", ")", ";", "if", "(", "res", ".", "length", ">=", "60", ")", "{", "res", "=", "res", ".", "substr", "(", "0", ",", "60", ")", "+", "'-md5-'", "+", "c...
Wrapper around the filenamify library to handle lengthy URLs. By default filenamify truncates the result to 100 characters, but that may not be enough to distinguish between cache entries. When string is too long, replace the end by an MD5 checksum. Note we keep the beginning from filenamify because it remains somewh...
[ "Wrapper", "around", "the", "filenamify", "library", "to", "handle", "lengthy", "URLs", "." ]
f93106df67421dcb6d169e1c7ea4338eb01b4a11
https://github.com/tidoust/fetch-filecache-for-crawling/blob/f93106df67421dcb6d169e1c7ea4338eb01b4a11/fetch-filecache.js#L55-L63
train
tidoust/fetch-filecache-for-crawling
fetch-filecache.js
hasExpired
function hasExpired(headers, refresh) { if (!headers) { log('response is not in cache'); return true; } if (refresh === 'force') { log('response in cache but refresh requested'); return true; } if (refresh === 'never') { log('response in cache and considered to be alway...
javascript
function hasExpired(headers, refresh) { if (!headers) { log('response is not in cache'); return true; } if (refresh === 'force') { log('response in cache but refresh requested'); return true; } if (refresh === 'never') { log('response in cache and considered to be alway...
[ "function", "hasExpired", "(", "headers", ",", "refresh", ")", "{", "if", "(", "!", "headers", ")", "{", "log", "(", "'response is not in cache'", ")", ";", "return", "true", ";", "}", "if", "(", "refresh", "===", "'force'", ")", "{", "log", "(", "'res...
Look at HTTP headers, current time and refresh strategy to determine whether cached content has expired @function @param {Object} headers HTTP headers received last time @param {String|Integer} refresh Refresh strategy @return {Boolean} true if cached content has expired (or does not exist), false when it can still be...
[ "Look", "at", "HTTP", "headers", "current", "time", "and", "refresh", "strategy", "to", "determine", "whether", "cached", "content", "has", "expired" ]
f93106df67421dcb6d169e1c7ea4338eb01b4a11
https://github.com/tidoust/fetch-filecache-for-crawling/blob/f93106df67421dcb6d169e1c7ea4338eb01b4a11/fetch-filecache.js#L146-L231
train
tidoust/fetch-filecache-for-crawling
fetch-filecache.js
addPendingFetch
function addPendingFetch(url) { let resolve = null; let reject = null; let promise = new Promise((innerResolve, innerReject) => { resolve = innerResolve; reject = innerReject; }); pendingFetches[url] = { promise, resolve, reject }; }
javascript
function addPendingFetch(url) { let resolve = null; let reject = null; let promise = new Promise((innerResolve, innerReject) => { resolve = innerResolve; reject = innerReject; }); pendingFetches[url] = { promise, resolve, reject }; }
[ "function", "addPendingFetch", "(", "url", ")", "{", "let", "resolve", "=", "null", ";", "let", "reject", "=", "null", ";", "let", "promise", "=", "new", "Promise", "(", "(", "innerResolve", ",", "innerReject", ")", "=>", "{", "resolve", "=", "innerResol...
Create a pending fetch promise and keep controls over that promise so that the code may resolve or reject it through calls to resolvePendingFetch and rejectPendingFetch functions
[ "Create", "a", "pending", "fetch", "promise", "and", "keep", "controls", "over", "that", "promise", "so", "that", "the", "code", "may", "resolve", "or", "reject", "it", "through", "calls", "to", "resolvePendingFetch", "and", "rejectPendingFetch", "functions" ]
f93106df67421dcb6d169e1c7ea4338eb01b4a11
https://github.com/tidoust/fetch-filecache-for-crawling/blob/f93106df67421dcb6d169e1c7ea4338eb01b4a11/fetch-filecache.js#L273-L281
train
tidoust/fetch-filecache-for-crawling
fetch-filecache.js
fetchWithRetry
async function fetchWithRetry(url, options, remainingAttempts) { try { return await baseFetch(url, options); } catch (err) { if (remainingAttempts <= 0) throw err; log('fetch attempt failed, sleep and try again'); await sleep(2000 + Math.floor(Math.random() * 8000)); ...
javascript
async function fetchWithRetry(url, options, remainingAttempts) { try { return await baseFetch(url, options); } catch (err) { if (remainingAttempts <= 0) throw err; log('fetch attempt failed, sleep and try again'); await sleep(2000 + Math.floor(Math.random() * 8000)); ...
[ "async", "function", "fetchWithRetry", "(", "url", ",", "options", ",", "remainingAttempts", ")", "{", "try", "{", "return", "await", "baseFetch", "(", "url", ",", "options", ")", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "remainingAttempts", "...
To overcome transient network errors, we'll fetch the same URL again a few times before we surrender when a network error occurs, letting a few seconds elapse between attempts
[ "To", "overcome", "transient", "network", "errors", "we", "ll", "fetch", "the", "same", "URL", "again", "a", "few", "times", "before", "we", "surrender", "when", "a", "network", "error", "occurs", "letting", "a", "few", "seconds", "elapse", "between", "attem...
f93106df67421dcb6d169e1c7ea4338eb01b4a11
https://github.com/tidoust/fetch-filecache-for-crawling/blob/f93106df67421dcb6d169e1c7ea4338eb01b4a11/fetch-filecache.js#L375-L385
train
stevenvelozo/stricture
source/Stricture-Run-Prepare.js
function(pModel) { // First create a "lookup" of primary keys that point back to tables console.log('--> ... creating contextual Index ==> Table lookups ...'); var tmpIndices = {}; for(var tmpTable in pModel.Tables) { for (var j = 0; j < pModel.Tables[tmpTable].Columns.length; j++) { if (pModel.Tables[tmpTa...
javascript
function(pModel) { // First create a "lookup" of primary keys that point back to tables console.log('--> ... creating contextual Index ==> Table lookups ...'); var tmpIndices = {}; for(var tmpTable in pModel.Tables) { for (var j = 0; j < pModel.Tables[tmpTable].Columns.length; j++) { if (pModel.Tables[tmpTa...
[ "function", "(", "pModel", ")", "{", "// First create a \"lookup\" of primary keys that point back to tables", "console", ".", "log", "(", "'--> ... creating contextual Index ==> Table lookups ...'", ")", ";", "var", "tmpIndices", "=", "{", "}", ";", "for", "(", "var", "t...
Generate a lookup object that contains the identity key pointing to a table name
[ "Generate", "a", "lookup", "object", "that", "contains", "the", "identity", "key", "pointing", "to", "a", "table", "name" ]
467610baee0551881a8a453f7e496148b9304706
https://github.com/stevenvelozo/stricture/blob/467610baee0551881a8a453f7e496148b9304706/source/Stricture-Run-Prepare.js#L13-L31
train
rtm/upward
src/Obj.js
_delete
function _delete(name) { observers[name].unobserve(); delete observers[name]; delete u [name]; delete shadow [name]; }
javascript
function _delete(name) { observers[name].unobserve(); delete observers[name]; delete u [name]; delete shadow [name]; }
[ "function", "_delete", "(", "name", ")", "{", "observers", "[", "name", "]", ".", "unobserve", "(", ")", ";", "delete", "observers", "[", "name", "]", ";", "delete", "u", "[", "name", "]", ";", "delete", "shadow", "[", "name", "]", ";", "}" ]
Delete a property. Unobserve it, delete shadow and proxy entries.
[ "Delete", "a", "property", ".", "Unobserve", "it", "delete", "shadow", "and", "proxy", "entries", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Obj.js#L74-L79
train
rtm/upward
src/Obj.js
add
function add(name) { function set(v) { var oldValue = shadow[name]; if (oldValue === v) return; o[name] = v; notifier.notify({type: 'update', object: u, name, oldValue}); shadow[name] = oldValue.change(v); } // When property on upwardable object is accessed, report it and ret...
javascript
function add(name) { function set(v) { var oldValue = shadow[name]; if (oldValue === v) return; o[name] = v; notifier.notify({type: 'update', object: u, name, oldValue}); shadow[name] = oldValue.change(v); } // When property on upwardable object is accessed, report it and ret...
[ "function", "add", "(", "name", ")", "{", "function", "set", "(", "v", ")", "{", "var", "oldValue", "=", "shadow", "[", "name", "]", ";", "if", "(", "oldValue", "===", "v", ")", "return", ";", "o", "[", "name", "]", "=", "v", ";", "notifier", "...
Add a property. Set up getter and setter, Observe. Populate shadow.
[ "Add", "a", "property", ".", "Set", "up", "getter", "and", "setter", "Observe", ".", "Populate", "shadow", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Obj.js#L87-L111
train
rtm/upward
src/Obj.js
objectObserver
function objectObserver(changes) { changes.forEach(({type, name}) => { switch (type) { case 'add': o[name] = u[name]; break; case 'delete': delete o[name]; break; } }); }
javascript
function objectObserver(changes) { changes.forEach(({type, name}) => { switch (type) { case 'add': o[name] = u[name]; break; case 'delete': delete o[name]; break; } }); }
[ "function", "objectObserver", "(", "changes", ")", "{", "changes", ".", "forEach", "(", "(", "{", "type", ",", "name", "}", ")", "=>", "{", "switch", "(", "type", ")", "{", "case", "'add'", ":", "o", "[", "name", "]", "=", "u", "[", "name", "]", ...
Observer to handle new or deleted properties on the object. Pass through to underlying object, which will cause the right things to happen.
[ "Observer", "to", "handle", "new", "or", "deleted", "properties", "on", "the", "object", ".", "Pass", "through", "to", "underlying", "object", "which", "will", "cause", "the", "right", "things", "to", "happen", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Obj.js#L115-L122
train
boylesoftware/x2node-common
index.js
buildMessageBuilder
function buildMessageBuilder(section) { const logOptions = process.env.X2_LOG || ''; const msgBuilder = new Array(); if (!/(^|,)nots(,|$)/i.test(logOptions)) msgBuilder.push(() => (new Date()).toISOString()); if (!/(^|,)nopid(,|$)/i.test(logOptions)) msgBuilder.push(() => String(process.pid)); let m; con...
javascript
function buildMessageBuilder(section) { const logOptions = process.env.X2_LOG || ''; const msgBuilder = new Array(); if (!/(^|,)nots(,|$)/i.test(logOptions)) msgBuilder.push(() => (new Date()).toISOString()); if (!/(^|,)nopid(,|$)/i.test(logOptions)) msgBuilder.push(() => String(process.pid)); let m; con...
[ "function", "buildMessageBuilder", "(", "section", ")", "{", "const", "logOptions", "=", "process", ".", "env", ".", "X2_LOG", "||", "''", ";", "const", "msgBuilder", "=", "new", "Array", "(", ")", ";", "if", "(", "!", "/", "(^|,)nots(,|$)", "/", "i", ...
Build message build functions list. @private @param {string} [section] Debug log section, nothing if error log. @returns {Array.<function>} Message builder functions.
[ "Build", "message", "build", "functions", "list", "." ]
2ddb0672b4294395ddbdc60bff13263db9f0beae
https://github.com/boylesoftware/x2node-common/blob/2ddb0672b4294395ddbdc60bff13263db9f0beae/index.js#L133-L156
train
rtm/upward
src/Css.js
makeSheet
function makeSheet(scope) { var style = document.createElement('style'); document.head.appendChild(style); var sheet = style.sheet; if (scope) { style.setAttribute('scoped', "scoped"); if (!scopedSupported) { scope.dataset[scopedStyleIdsProp] = (scope.dataset[scopedStyleIdsProp] || "") + " " + ...
javascript
function makeSheet(scope) { var style = document.createElement('style'); document.head.appendChild(style); var sheet = style.sheet; if (scope) { style.setAttribute('scoped', "scoped"); if (!scopedSupported) { scope.dataset[scopedStyleIdsProp] = (scope.dataset[scopedStyleIdsProp] || "") + " " + ...
[ "function", "makeSheet", "(", "scope", ")", "{", "var", "style", "=", "document", ".", "createElement", "(", "'style'", ")", ";", "document", ".", "head", ".", "appendChild", "(", "style", ")", ";", "var", "sheet", "=", "style", ".", "sheet", ";", "if"...
Create a new stylesheet, optionally scoped to a DOM element.
[ "Create", "a", "new", "stylesheet", "optionally", "scoped", "to", "a", "DOM", "element", "." ]
82495c34f70c9a4336a3b34cc6781e5662324c03
https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Css.js#L38-L52
train
openactive/skos.js
src/skos.js
Concept
function Concept(concept) { if (!(concept.prefLabel && concept.id && concept.type === 'Concept')) { throw new Error('Invalid concept: "' + concept.id + '"'); } this.id = concept.id; this.prefLabel = concept.prefLabel; this.altLabel = concept.altLabel; this.hiddenLabel = concept.hiddenLabel; this.defin...
javascript
function Concept(concept) { if (!(concept.prefLabel && concept.id && concept.type === 'Concept')) { throw new Error('Invalid concept: "' + concept.id + '"'); } this.id = concept.id; this.prefLabel = concept.prefLabel; this.altLabel = concept.altLabel; this.hiddenLabel = concept.hiddenLabel; this.defin...
[ "function", "Concept", "(", "concept", ")", "{", "if", "(", "!", "(", "concept", ".", "prefLabel", "&&", "concept", ".", "id", "&&", "concept", ".", "type", "===", "'Concept'", ")", ")", "{", "throw", "new", "Error", "(", "'Invalid concept: \"'", "+", ...
Concept class. A wrapper for the SKOS Concept JSON object @constructor @param {Object} concept - A Concept JSON object
[ "Concept", "class", "." ]
1bdc88eb004924f8279dac541af0374fa692fda9
https://github.com/openactive/skos.js/blob/1bdc88eb004924f8279dac541af0374fa692fda9/src/skos.js#L316-L331
train
eblanshey/safenet
src/api/auth.js
function () { // Get stored auth data. var stored = this.storage.get(); // If nothing stored, proceed with new authorization if (!stored) { this.log('No auth data stored, starting authorization from scratch...'); return this.auth.authorize(); } // Otherwise, set the auth data on th...
javascript
function () { // Get stored auth data. var stored = this.storage.get(); // If nothing stored, proceed with new authorization if (!stored) { this.log('No auth data stored, starting authorization from scratch...'); return this.auth.authorize(); } // Otherwise, set the auth data on th...
[ "function", "(", ")", "{", "// Get stored auth data.", "var", "stored", "=", "this", ".", "storage", ".", "get", "(", ")", ";", "// If nothing stored, proceed with new authorization", "if", "(", "!", "stored", ")", "{", "this", ".", "log", "(", "'No auth data st...
Call this method in order to authenticate with SAFE, using either previous authentication or new. @returns {Promise}
[ "Call", "this", "method", "in", "order", "to", "authenticate", "with", "SAFE", "using", "either", "previous", "authentication", "or", "new", "." ]
8438251bf0999b43f39c231df299b05d01dd4618
https://github.com/eblanshey/safenet/blob/8438251bf0999b43f39c231df299b05d01dd4618/src/api/auth.js#L12-L33
train
eblanshey/safenet
src/api/auth.js
function () { this.log('Authorizing...'); // Generate new asymmetric key pair and nonce, e.g. public-key encryption var asymKeys = nacl.box.keyPair(), asymNonce = nacl.randomBytes(nacl.box.nonceLength); // The payload for the request var authPayload = { app: this.app, publicKey...
javascript
function () { this.log('Authorizing...'); // Generate new asymmetric key pair and nonce, e.g. public-key encryption var asymKeys = nacl.box.keyPair(), asymNonce = nacl.randomBytes(nacl.box.nonceLength); // The payload for the request var authPayload = { app: this.app, publicKey...
[ "function", "(", ")", "{", "this", ".", "log", "(", "'Authorizing...'", ")", ";", "// Generate new asymmetric key pair and nonce, e.g. public-key encryption", "var", "asymKeys", "=", "nacl", ".", "box", ".", "keyPair", "(", ")", ",", "asymNonce", "=", "nacl", ".",...
Requests authorization from the safe launcher. @returns {*}
[ "Requests", "authorization", "from", "the", "safe", "launcher", "." ]
8438251bf0999b43f39c231df299b05d01dd4618
https://github.com/eblanshey/safenet/blob/8438251bf0999b43f39c231df299b05d01dd4618/src/api/auth.js#L39-L80
train
eblanshey/safenet
src/api/auth.js
function () { this.log('Checking if authorized...'); return this.Request.get('/auth').auth().execute() // let's use our own function here, that resolve true or false, // rather than throwing an error if invalid token .then(function () { this.log('Authorized'); return true; ...
javascript
function () { this.log('Checking if authorized...'); return this.Request.get('/auth').auth().execute() // let's use our own function here, that resolve true or false, // rather than throwing an error if invalid token .then(function () { this.log('Authorized'); return true; ...
[ "function", "(", ")", "{", "this", ".", "log", "(", "'Checking if authorized...'", ")", ";", "return", "this", ".", "Request", ".", "get", "(", "'/auth'", ")", ".", "auth", "(", ")", ".", "execute", "(", ")", "// let's use our own function here, that resolve t...
Checks if we're authenticated on the SAFE network @returns {*}
[ "Checks", "if", "we", "re", "authenticated", "on", "the", "SAFE", "network" ]
8438251bf0999b43f39c231df299b05d01dd4618
https://github.com/eblanshey/safenet/blob/8438251bf0999b43f39c231df299b05d01dd4618/src/api/auth.js#L86-L108
train
eblanshey/safenet
src/api/auth.js
function () { this.log('Deauthorizing...'); return this.Request.delete('/auth').auth().execute() .then(function (response) { // Clear auth data from storage upon deauthorization this.storage.clear(); clearAuthData.call(this); this.log('Deauthorized and cleared from storage...
javascript
function () { this.log('Deauthorizing...'); return this.Request.delete('/auth').auth().execute() .then(function (response) { // Clear auth data from storage upon deauthorization this.storage.clear(); clearAuthData.call(this); this.log('Deauthorized and cleared from storage...
[ "function", "(", ")", "{", "this", ".", "log", "(", "'Deauthorizing...'", ")", ";", "return", "this", ".", "Request", ".", "delete", "(", "'/auth'", ")", ".", "auth", "(", ")", ".", "execute", "(", ")", ".", "then", "(", "function", "(", "response", ...
Deauthorizes you from the launcher, and removed saved auth data from storage. @returns {*}
[ "Deauthorizes", "you", "from", "the", "launcher", "and", "removed", "saved", "auth", "data", "from", "storage", "." ]
8438251bf0999b43f39c231df299b05d01dd4618
https://github.com/eblanshey/safenet/blob/8438251bf0999b43f39c231df299b05d01dd4618/src/api/auth.js#L114-L126
train
milankinen/stanga
examples/04-bmi-counter/index.js
model
function model(M, prop) { const bmiLens = L( prop, // if we don't have <prop> property yet, then use these default values L.defaults({weight: 80, height: 180}), // add "read-only" bmi property to our BMI model that is derived from weight and height L.augment({bmi: ({weight: w, height: h}) => Math....
javascript
function model(M, prop) { const bmiLens = L( prop, // if we don't have <prop> property yet, then use these default values L.defaults({weight: 80, height: 180}), // add "read-only" bmi property to our BMI model that is derived from weight and height L.augment({bmi: ({weight: w, height: h}) => Math....
[ "function", "model", "(", "M", ",", "prop", ")", "{", "const", "bmiLens", "=", "L", "(", "prop", ",", "// if we don't have <prop> property yet, then use these default values", "L", ".", "defaults", "(", "{", "weight", ":", "80", ",", "height", ":", "180", "}",...
Let's define the model function so that it takes the parent state and property containing the BMI counter state. We are making this BMI model as a separate function so that we could re-use it if needed
[ "Let", "s", "define", "the", "model", "function", "so", "that", "it", "takes", "the", "parent", "state", "and", "property", "containing", "the", "BMI", "counter", "state", ".", "We", "are", "making", "this", "BMI", "model", "as", "a", "separate", "function...
82f293c73162c997d138cb468992699df0c74180
https://github.com/milankinen/stanga/blob/82f293c73162c997d138cb468992699df0c74180/examples/04-bmi-counter/index.js#L11-L20
train
pjdietz/rester-client
src/parser.js
beginsWith
function beginsWith(haystack, needles) { let needle; for (let i = 0, u = needles.length; i < u; ++i) { needle = needles[i]; if (haystack.substr(0, needle.length) === needle) { return true; } } return false; }
javascript
function beginsWith(haystack, needles) { let needle; for (let i = 0, u = needles.length; i < u; ++i) { needle = needles[i]; if (haystack.substr(0, needle.length) === needle) { return true; } } return false; }
[ "function", "beginsWith", "(", "haystack", ",", "needles", ")", "{", "let", "needle", ";", "for", "(", "let", "i", "=", "0", ",", "u", "=", "needles", ".", "length", ";", "i", "<", "u", ";", "++", "i", ")", "{", "needle", "=", "needles", "[", "...
Tests if a string begins with any of the string in the array of needles. @param {string} haystack String to test @param {string[]} needles Array of string to look for @return {boolean} True indicates the string begins with one of the needles.
[ "Tests", "if", "a", "string", "begins", "with", "any", "of", "the", "string", "in", "the", "array", "of", "needles", "." ]
00ffcedffc858fcc0cfd3fa7f55aeab3d11e13c9
https://github.com/pjdietz/rester-client/blob/00ffcedffc858fcc0cfd3fa7f55aeab3d11e13c9/src/parser.js#L374-L383
train
pjdietz/rester-client
src/parser.js
mergeQuery
function mergeQuery(path, newQuery) { let parsed, properties, query, queryString; // Return the original path if the query to merge is empty. if (Object.keys(newQuery).length === 0) { return path; } // Parse the original path. parsed = url.parse(path, true); // Merge the queries to f...
javascript
function mergeQuery(path, newQuery) { let parsed, properties, query, queryString; // Return the original path if the query to merge is empty. if (Object.keys(newQuery).length === 0) { return path; } // Parse the original path. parsed = url.parse(path, true); // Merge the queries to f...
[ "function", "mergeQuery", "(", "path", ",", "newQuery", ")", "{", "let", "parsed", ",", "properties", ",", "query", ",", "queryString", ";", "// Return the original path if the query to merge is empty.", "if", "(", "Object", ".", "keys", "(", "newQuery", ")", ".",...
Merge additional query parameters onto an existing request path and return the combined path + query @param {string} path Request path, with or without a query @param {Object} newQuery Query parameters to merge @return {string} New path with query parameters merged
[ "Merge", "additional", "query", "parameters", "onto", "an", "existing", "request", "path", "and", "return", "the", "combined", "path", "+", "query" ]
00ffcedffc858fcc0cfd3fa7f55aeab3d11e13c9
https://github.com/pjdietz/rester-client/blob/00ffcedffc858fcc0cfd3fa7f55aeab3d11e13c9/src/parser.js#L417-L435
train
alexindigo/batcher
lib/run_function.js
runSync
function runSync(context, func, callback) { var result , requiresContext = isArrowFunction(func) ; try { if (requiresContext) { result = func.call(null, context); } else { result = func.call(context); } } catch (ex) { // pass error as error-first callback ...
javascript
function runSync(context, func, callback) { var result , requiresContext = isArrowFunction(func) ; try { if (requiresContext) { result = func.call(null, context); } else { result = func.call(context); } } catch (ex) { // pass error as error-first callback ...
[ "function", "runSync", "(", "context", ",", "func", ",", "callback", ")", "{", "var", "result", ",", "requiresContext", "=", "isArrowFunction", "(", "func", ")", ";", "try", "{", "if", "(", "requiresContext", ")", "{", "result", "=", "func", ".", "call",...
Wraps synchronous function with common interface @param {object} context - context to invoke within @param {function} func - function to execute @param {Function} callback - invoke after function is finished executing @returns {void}
[ "Wraps", "synchronous", "function", "with", "common", "interface" ]
73d9c8c994f915688db0627ea3b4854ead771138
https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/run_function.js#L55-L81
train
alexindigo/batcher
lib/run_function.js
runAsync
function runAsync(context, func, callback) { var result , requiresContext = isArrowFunction(func) ; if (requiresContext) { result = func.call(null, context, callback); } else { result = func.call(context, callback); } return result; }
javascript
function runAsync(context, func, callback) { var result , requiresContext = isArrowFunction(func) ; if (requiresContext) { result = func.call(null, context, callback); } else { result = func.call(context, callback); } return result; }
[ "function", "runAsync", "(", "context", ",", "func", ",", "callback", ")", "{", "var", "result", ",", "requiresContext", "=", "isArrowFunction", "(", "func", ")", ";", "if", "(", "requiresContext", ")", "{", "result", "=", "func", ".", "call", "(", "null...
Wraps asynchronous function with common interface @param {object} context - context to invoke within @param {function} func - function to execute @param {Function} callback - invoke after function is finished executing @returns {void}
[ "Wraps", "asynchronous", "function", "with", "common", "interface" ]
73d9c8c994f915688db0627ea3b4854ead771138
https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/run_function.js#L91-L107
train
alexindigo/batcher
lib/run_function.js
async
function async(func) { function wrapper() { var context = this; var args = arguments; process.nextTick(function() { func.apply(context, args); }); } return wrapper; }
javascript
function async(func) { function wrapper() { var context = this; var args = arguments; process.nextTick(function() { func.apply(context, args); }); } return wrapper; }
[ "function", "async", "(", "func", ")", "{", "function", "wrapper", "(", ")", "{", "var", "context", "=", "this", ";", "var", "args", "=", "arguments", ";", "process", ".", "nextTick", "(", "function", "(", ")", "{", "func", ".", "apply", "(", "contex...
Makes sure provided function invoked in real async way @param {function} func - function to invoke wrap @returns {function} - async-supplemented callback function
[ "Makes", "sure", "provided", "function", "invoked", "in", "real", "async", "way" ]
73d9c8c994f915688db0627ea3b4854ead771138
https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/run_function.js#L115-L128
train
noflo/noflo-seriously
vendor/seriously.js
traceSources
function traceSources(node, original) { var i, source, sources; if (!(node instanceof EffectNode) && !(node instanceof TransformNode)) { return false; } sources = node.sources; for (i in sources) { if (sources.hasOwnProperty(i)) { source = sources[i]; if (source === original...
javascript
function traceSources(node, original) { var i, source, sources; if (!(node instanceof EffectNode) && !(node instanceof TransformNode)) { return false; } sources = node.sources; for (i in sources) { if (sources.hasOwnProperty(i)) { source = sources[i]; if (source === original...
[ "function", "traceSources", "(", "node", ",", "original", ")", "{", "var", "i", ",", "source", ",", "sources", ";", "if", "(", "!", "(", "node", "instanceof", "EffectNode", ")", "&&", "!", "(", "node", "instanceof", "TransformNode", ")", ")", "{", "ret...
trace back all sources to make sure we're not making a cyclical connection
[ "trace", "back", "all", "sources", "to", "make", "sure", "we", "re", "not", "making", "a", "cyclical", "connection" ]
51ce8ab5237a144bb433c8118db2371886135ff1
https://github.com/noflo/noflo-seriously/blob/51ce8ab5237a144bb433c8118db2371886135ff1/vendor/seriously.js#L1178-L1200
train
noflo/noflo-seriously
vendor/seriously.js
makePolygonsArray
function makePolygonsArray(poly) { if (!poly || !poly.length || !Array.isArray(poly)) { return []; } if (!Array.isArray(poly[0])) { return [poly]; } if (Array.isArray(poly[0]) && !isNaN(poly[0][0])) { return [poly]; } return poly; }
javascript
function makePolygonsArray(poly) { if (!poly || !poly.length || !Array.isArray(poly)) { return []; } if (!Array.isArray(poly[0])) { return [poly]; } if (Array.isArray(poly[0]) && !isNaN(poly[0][0])) { return [poly]; } return poly; }
[ "function", "makePolygonsArray", "(", "poly", ")", "{", "if", "(", "!", "poly", "||", "!", "poly", ".", "length", "||", "!", "Array", ".", "isArray", "(", "poly", ")", ")", "{", "return", "[", "]", ";", "}", "if", "(", "!", "Array", ".", "isArray...
detect whether it's multiple polygons or what
[ "detect", "whether", "it", "s", "multiple", "polygons", "or", "what" ]
51ce8ab5237a144bb433c8118db2371886135ff1
https://github.com/noflo/noflo-seriously/blob/51ce8ab5237a144bb433c8118db2371886135ff1/vendor/seriously.js#L1918-L1932
train
mikesamuel/module-keys
lib/relpath.js
longestCommonPathPrefix
function longestCommonPathPrefix(stra, strb) { const minlen = min(stra.length, strb.length); let common = 0; let lastSep = -1; for (; common < minlen; ++common) { const chr = stra[common]; if (chr !== strb[common]) { break; } if (chr === sep) { lastSep = common; } } if (commo...
javascript
function longestCommonPathPrefix(stra, strb) { const minlen = min(stra.length, strb.length); let common = 0; let lastSep = -1; for (; common < minlen; ++common) { const chr = stra[common]; if (chr !== strb[common]) { break; } if (chr === sep) { lastSep = common; } } if (commo...
[ "function", "longestCommonPathPrefix", "(", "stra", ",", "strb", ")", "{", "const", "minlen", "=", "min", "(", "stra", ".", "length", ",", "strb", ".", "length", ")", ";", "let", "common", "=", "0", ";", "let", "lastSep", "=", "-", "1", ";", "for", ...
Longest common prefix that ends on a path element boundary. Each input is assumed to end with an implicit path separator.
[ "Longest", "common", "prefix", "that", "ends", "on", "a", "path", "element", "boundary", ".", "Each", "input", "is", "assumed", "to", "end", "with", "an", "implicit", "path", "separator", "." ]
39100b07d143af3f77a0bec519a92634d5173dd6
https://github.com/mikesamuel/module-keys/blob/39100b07d143af3f77a0bec519a92634d5173dd6/lib/relpath.js#L94-L114
train
mikesamuel/module-keys
lib/relpath.js
relpath
function relpath(basePath, absPath) { let base = dedot(basePath); let abs = dedot(absPath); // Find the longest common prefix that ends with a separator. const commonPrefix = longestCommonPathPrefix(base, abs); // Remove the common path elements. base = apply(substring, base, [ commonPrefix ]); abs = appl...
javascript
function relpath(basePath, absPath) { let base = dedot(basePath); let abs = dedot(absPath); // Find the longest common prefix that ends with a separator. const commonPrefix = longestCommonPathPrefix(base, abs); // Remove the common path elements. base = apply(substring, base, [ commonPrefix ]); abs = appl...
[ "function", "relpath", "(", "basePath", ",", "absPath", ")", "{", "let", "base", "=", "dedot", "(", "basePath", ")", ";", "let", "abs", "=", "dedot", "(", "absPath", ")", ";", "// Find the longest common prefix that ends with a separator.", "const", "commonPrefix"...
A path to absFile relative to base. This is a string transform so is independent of the symlink and hardlink structure of the file-system. @param {string} base an absolute path @param {string} absPath an absolute path @return {string} a relative path that starts with '.' such that {@code path.join(base, output) === ab...
[ "A", "path", "to", "absFile", "relative", "to", "base", ".", "This", "is", "a", "string", "transform", "so", "is", "independent", "of", "the", "symlink", "and", "hardlink", "structure", "of", "the", "file", "-", "system", "." ]
39100b07d143af3f77a0bec519a92634d5173dd6
https://github.com/mikesamuel/module-keys/blob/39100b07d143af3f77a0bec519a92634d5173dd6/lib/relpath.js#L127-L148
train
nicktindall/cyclon.p2p-rtc-client
lib/SocketFactory.js
createOptionsForServerSpec
function createOptionsForServerSpec(serverSpec) { var options = { forceNew: true, // Make a new connection each time reconnection: false // Don't try and reconnect automatically }; // If the server spec contains a socketResource setting we use // that otherwise leave t...
javascript
function createOptionsForServerSpec(serverSpec) { var options = { forceNew: true, // Make a new connection each time reconnection: false // Don't try and reconnect automatically }; // If the server spec contains a socketResource setting we use // that otherwise leave t...
[ "function", "createOptionsForServerSpec", "(", "serverSpec", ")", "{", "var", "options", "=", "{", "forceNew", ":", "true", ",", "// Make a new connection each time", "reconnection", ":", "false", "// Don't try and reconnect automatically", "}", ";", "// If the server spec ...
Create the socket.io options for the specified server
[ "Create", "the", "socket", ".", "io", "options", "for", "the", "specified", "server" ]
eb586ce288a6ad7e1b221280825037e855b03904
https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/SocketFactory.js#L20-L32
train
reelyactive/chickadee
lib/chickadee.js
Chickadee
function Chickadee(options) { var self = this; options = options || {}; self.associations = options.associationManager || new associationManager(options); self.routes = { "/associations": require('./routes/associations'), "/contextat": require('./routes/contextat'), "/context...
javascript
function Chickadee(options) { var self = this; options = options || {}; self.associations = options.associationManager || new associationManager(options); self.routes = { "/associations": require('./routes/associations'), "/contextat": require('./routes/contextat'), "/context...
[ "function", "Chickadee", "(", "options", ")", "{", "var", "self", "=", "this", ";", "options", "=", "options", "||", "{", "}", ";", "self", ".", "associations", "=", "options", ".", "associationManager", "||", "new", "associationManager", "(", "options", "...
Chickadee Class Hyperlocal context associations store and API. @param {Object} options The options as a JSON object. @constructor
[ "Chickadee", "Class", "Hyperlocal", "context", "associations", "store", "and", "API", "." ]
1f65c2d369694d93796aae63318fa76326275120
https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/chickadee.js#L20-L35
train
reelyactive/chickadee
lib/chickadee.js
convertOptionsParamsToIds
function convertOptionsParamsToIds(req, instance, options, callback) { var err; if(options.id) { var isValidID = reelib.identifier.isValid(options.id); if(!isValidID) { err = 'Invalid id'; } options.ids = [options.id]; delete options.id; callback(err); } else if(options.directory)...
javascript
function convertOptionsParamsToIds(req, instance, options, callback) { var err; if(options.id) { var isValidID = reelib.identifier.isValid(options.id); if(!isValidID) { err = 'Invalid id'; } options.ids = [options.id]; delete options.id; callback(err); } else if(options.directory)...
[ "function", "convertOptionsParamsToIds", "(", "req", ",", "instance", ",", "options", ",", "callback", ")", "{", "var", "err", ";", "if", "(", "options", ".", "id", ")", "{", "var", "isValidID", "=", "reelib", ".", "identifier", ".", "isValid", "(", "opt...
Convert the id, directory or tags within options to ids. @param {Object} req The request which originated this function call. @param {Chickadee} instance The given chickadee instance. @param {Object} options The given options. @param {callback} callback Function to call on completion.
[ "Convert", "the", "id", "directory", "or", "tags", "within", "options", "to", "ids", "." ]
1f65c2d369694d93796aae63318fa76326275120
https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/chickadee.js#L274-L302
train
zbjornson/gcloud-trace
src/trace.js
hex
function hex(n) { return crypto.randomBytes(Math.ceil(n / 2)).toString('hex').slice(0, n); }
javascript
function hex(n) { return crypto.randomBytes(Math.ceil(n / 2)).toString('hex').slice(0, n); }
[ "function", "hex", "(", "n", ")", "{", "return", "crypto", ".", "randomBytes", "(", "Math", ".", "ceil", "(", "n", "/", "2", ")", ")", ".", "toString", "(", "'hex'", ")", ".", "slice", "(", "0", ",", "n", ")", ";", "}" ]
Generates a random hex string of the provided length.
[ "Generates", "a", "random", "hex", "string", "of", "the", "provided", "length", "." ]
aa1224316d4f675a59552ae4eb50a9bd69200ba4
https://github.com/zbjornson/gcloud-trace/blob/aa1224316d4f675a59552ae4eb50a9bd69200ba4/src/trace.js#L62-L64
train
gallactic/gallactickeys
lib/gallactickeys.js
exportKs
function exportKs (password, privateKey, salt, iv, type, option = {}) { if (!password || !privateKey || !type) { throw new Error('Missing parameter! Make sure password, privateKey and type provided') } if (!crypto.isPrivateKey(privateKey)) { throw new Error('given Private Key is not a valid Private Key s...
javascript
function exportKs (password, privateKey, salt, iv, type, option = {}) { if (!password || !privateKey || !type) { throw new Error('Missing parameter! Make sure password, privateKey and type provided') } if (!crypto.isPrivateKey(privateKey)) { throw new Error('given Private Key is not a valid Private Key s...
[ "function", "exportKs", "(", "password", ",", "privateKey", ",", "salt", ",", "iv", ",", "type", ",", "option", "=", "{", "}", ")", "{", "if", "(", "!", "password", "||", "!", "privateKey", "||", "!", "type", ")", "{", "throw", "new", "Error", "(",...
PRIVATE METHODS helper function to export keystore
[ "PRIVATE", "METHODS", "helper", "function", "to", "export", "keystore" ]
51a61ca29583e17b5f3325a3d73f1d7e09e4b758
https://github.com/gallactic/gallactickeys/blob/51a61ca29583e17b5f3325a3d73f1d7e09e4b758/lib/gallactickeys.js#L148-L164
train
gallactic/gallactickeys
lib/gallactickeys.js
verifyAndDecrypt
function verifyAndDecrypt(derivedKey, iv, ciphertext, algo, mac) { if (typeof algo !== 'string') { throw new Error('Cipher method is invalid. Unable to proceed') } var key; if (crypto.createMac(derivedKey, ciphertext) !== mac) { throw new Error('message authentication code mismatch'); } key = deriv...
javascript
function verifyAndDecrypt(derivedKey, iv, ciphertext, algo, mac) { if (typeof algo !== 'string') { throw new Error('Cipher method is invalid. Unable to proceed') } var key; if (crypto.createMac(derivedKey, ciphertext) !== mac) { throw new Error('message authentication code mismatch'); } key = deriv...
[ "function", "verifyAndDecrypt", "(", "derivedKey", ",", "iv", ",", "ciphertext", ",", "algo", ",", "mac", ")", "{", "if", "(", "typeof", "algo", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Cipher method is invalid. Unable to proceed'", ")", "}...
verify that message authentication codes match, then decrypt
[ "verify", "that", "message", "authentication", "codes", "match", "then", "decrypt" ]
51a61ca29583e17b5f3325a3d73f1d7e09e4b758
https://github.com/gallactic/gallactickeys/blob/51a61ca29583e17b5f3325a3d73f1d7e09e4b758/lib/gallactickeys.js#L167-L179
train
oliversalzburg/absync
gulpfile.js
buildJs
function buildJs() { // Construct a stream for the JS sources of our plugin, don't read file contents when compiling TypeScript. var sourceStream = gulp.src( config.Sources.Scripts, { cwd : config.WorkingDirectory, read : true } ); return sourceStream .pipe( jscs() ) .pipe( jscs.reporter() ) .pipe( jsVa...
javascript
function buildJs() { // Construct a stream for the JS sources of our plugin, don't read file contents when compiling TypeScript. var sourceStream = gulp.src( config.Sources.Scripts, { cwd : config.WorkingDirectory, read : true } ); return sourceStream .pipe( jscs() ) .pipe( jscs.reporter() ) .pipe( jsVa...
[ "function", "buildJs", "(", ")", "{", "// Construct a stream for the JS sources of our plugin, don't read file contents when compiling TypeScript.", "var", "sourceStream", "=", "gulp", ".", "src", "(", "config", ".", "Sources", ".", "Scripts", ",", "{", "cwd", ":", "confi...
Core JS resource builder.
[ "Core", "JS", "resource", "builder", "." ]
13807648d513c77008951446cfa1b334a2ab2ccf
https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/gulpfile.js#L37-L82
train
pdehaan/fetch-subreddit
index.js
_fetchSubreddit
function _fetchSubreddit(subreddit) { const reducer = (prev, {data: {url}}) => prev.push(url) && prev; const jsonUri = `https://www.reddit.com/r/${subreddit}/.json`; return fetch(jsonUri) .then((res) => res.json()) .then((res) => res.data.children.reduce(reducer, [])) .then((urls) => ({subreddit, urls...
javascript
function _fetchSubreddit(subreddit) { const reducer = (prev, {data: {url}}) => prev.push(url) && prev; const jsonUri = `https://www.reddit.com/r/${subreddit}/.json`; return fetch(jsonUri) .then((res) => res.json()) .then((res) => res.data.children.reduce(reducer, [])) .then((urls) => ({subreddit, urls...
[ "function", "_fetchSubreddit", "(", "subreddit", ")", "{", "const", "reducer", "=", "(", "prev", ",", "{", "data", ":", "{", "url", "}", "}", ")", "=>", "prev", ".", "push", "(", "url", ")", "&&", "prev", ";", "const", "jsonUri", "=", "`", "${", ...
Internal method to fetch the JSON feed and extract the URLs. @private @param {String} subreddit Subreddit name to fetch JSON feed for. @return {Object} An object containing the subreddit name as a key, and links as a nested array.
[ "Internal", "method", "to", "fetch", "the", "JSON", "feed", "and", "extract", "the", "URLs", "." ]
1a34d5b4bc7015f5a1c3f0d3403b7c88d67e8b74
https://github.com/pdehaan/fetch-subreddit/blob/1a34d5b4bc7015f5a1c3f0d3403b7c88d67e8b74/index.js#L31-L38
train
pdehaan/fetch-subreddit
index.js
_fetchRandomSubreddit
function _fetchRandomSubreddit(count=1, subreddit='random', fetchOpts={}) { const _fetchSubredditUrl = (subreddit, fetchOpts) => { return fetch(`https://www.reddit.com/r/${subreddit}`, fetchOpts) .then(({url}) => { return { json: `${url}.json`, name: getSubredditName(url), ...
javascript
function _fetchRandomSubreddit(count=1, subreddit='random', fetchOpts={}) { const _fetchSubredditUrl = (subreddit, fetchOpts) => { return fetch(`https://www.reddit.com/r/${subreddit}`, fetchOpts) .then(({url}) => { return { json: `${url}.json`, name: getSubredditName(url), ...
[ "function", "_fetchRandomSubreddit", "(", "count", "=", "1", ",", "subreddit", "=", "'random'", ",", "fetchOpts", "=", "{", "}", ")", "{", "const", "_fetchSubredditUrl", "=", "(", "subreddit", ",", "fetchOpts", ")", "=>", "{", "return", "fetch", "(", "`", ...
Proxy method that creates an array of subreddit promises to fetch. @private @param {Number} count The number of random subreddits to fetch. Default: 1 @param {String} subreddit Random subreddit generator. Either "random' or "randnsfw" (depending on if yuo want NSFW results). Default: "random" (safe for work) @pa...
[ "Proxy", "method", "that", "creates", "an", "array", "of", "subreddit", "promises", "to", "fetch", "." ]
1a34d5b4bc7015f5a1c3f0d3403b7c88d67e8b74
https://github.com/pdehaan/fetch-subreddit/blob/1a34d5b4bc7015f5a1c3f0d3403b7c88d67e8b74/index.js#L87-L102
train
pdehaan/fetch-subreddit
index.js
getSubredditName
function getSubredditName(url) { try { // This will throw a `TypeError: Cannot read property 'Symbol(Symbol.iterator)' of null` if the RegExp fails. const [input, name] = new RegExp('^https?://(?:www.)?reddit.com/r/(.*?)/?$').exec(url); return name; } catch (err) { return null; } }
javascript
function getSubredditName(url) { try { // This will throw a `TypeError: Cannot read property 'Symbol(Symbol.iterator)' of null` if the RegExp fails. const [input, name] = new RegExp('^https?://(?:www.)?reddit.com/r/(.*?)/?$').exec(url); return name; } catch (err) { return null; } }
[ "function", "getSubredditName", "(", "url", ")", "{", "try", "{", "// This will throw a `TypeError: Cannot read property 'Symbol(Symbol.iterator)' of null` if the RegExp fails.", "const", "[", "input", ",", "name", "]", "=", "new", "RegExp", "(", "'^https?://(?:www.)?reddit.com...
Extracts a subreddit name from a URL using sketchy RegExp. @param {String} url A fully qualified URL. @return {String} The name of a subreddit. For example: "knitting"
[ "Extracts", "a", "subreddit", "name", "from", "a", "URL", "using", "sketchy", "RegExp", "." ]
1a34d5b4bc7015f5a1c3f0d3403b7c88d67e8b74
https://github.com/pdehaan/fetch-subreddit/blob/1a34d5b4bc7015f5a1c3f0d3403b7c88d67e8b74/index.js#L110-L118
train
sadiqhabib/tinymce-dist
tinymce.full.js
relativePosition
function relativePosition(rect, targetRect, rel) { var x, y, w, h, targetW, targetH; x = targetRect.x; y = targetRect.y; w = rect.w; h = rect.h; targetW = targetRect.w; targetH = targetRect.h; rel = (rel || '').split(''); if (rel[0] === 'b') { y += target...
javascript
function relativePosition(rect, targetRect, rel) { var x, y, w, h, targetW, targetH; x = targetRect.x; y = targetRect.y; w = rect.w; h = rect.h; targetW = targetRect.w; targetH = targetRect.h; rel = (rel || '').split(''); if (rel[0] === 'b') { y += target...
[ "function", "relativePosition", "(", "rect", ",", "targetRect", ",", "rel", ")", "{", "var", "x", ",", "y", ",", "w", ",", "h", ",", "targetW", ",", "targetH", ";", "x", "=", "targetRect", ".", "x", ";", "y", "=", "targetRect", ".", "y", ";", "w"...
Returns the rect positioned based on the relative position name to the target rect. @method relativePosition @param {Rect} rect Source rect to modify into a new rect. @param {Rect} targetRect Rect to move relative to based on the rel option. @param {String} rel Relative position. For example: tr-bl.
[ "Returns", "the", "rect", "positioned", "based", "on", "the", "relative", "position", "name", "to", "the", "target", "rect", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L119-L164
train
sadiqhabib/tinymce-dist
tinymce.full.js
inflate
function inflate(rect, w, h) { return create(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2); }
javascript
function inflate(rect, w, h) { return create(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2); }
[ "function", "inflate", "(", "rect", ",", "w", ",", "h", ")", "{", "return", "create", "(", "rect", ".", "x", "-", "w", ",", "rect", ".", "y", "-", "h", ",", "rect", ".", "w", "+", "w", "*", "2", ",", "rect", ".", "h", "+", "h", "*", "2", ...
Inflates the rect in all directions. @method inflate @param {Rect} rect Rect to expand. @param {Number} w Relative width to expand by. @param {Number} h Relative height to expand by. @return {Rect} New expanded rect.
[ "Inflates", "the", "rect", "in", "all", "directions", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L199-L201
train
sadiqhabib/tinymce-dist
tinymce.full.js
intersect
function intersect(rect, cropRect) { var x1, y1, x2, y2; x1 = max(rect.x, cropRect.x); y1 = max(rect.y, cropRect.y); x2 = min(rect.x + rect.w, cropRect.x + cropRect.w); y2 = min(rect.y + rect.h, cropRect.y + cropRect.h); if (x2 - x1 < 0 || y2 - y1 < 0) { return null; ...
javascript
function intersect(rect, cropRect) { var x1, y1, x2, y2; x1 = max(rect.x, cropRect.x); y1 = max(rect.y, cropRect.y); x2 = min(rect.x + rect.w, cropRect.x + cropRect.w); y2 = min(rect.y + rect.h, cropRect.y + cropRect.h); if (x2 - x1 < 0 || y2 - y1 < 0) { return null; ...
[ "function", "intersect", "(", "rect", ",", "cropRect", ")", "{", "var", "x1", ",", "y1", ",", "x2", ",", "y2", ";", "x1", "=", "max", "(", "rect", ".", "x", ",", "cropRect", ".", "x", ")", ";", "y1", "=", "max", "(", "rect", ".", "y", ",", ...
Returns the intersection of the specified rectangles. @method intersect @param {Rect} rect The first rectangle to compare. @param {Rect} cropRect The second rectangle to compare. @return {Rect} The intersection of the two rectangles or null if they don't intersect.
[ "Returns", "the", "intersection", "of", "the", "specified", "rectangles", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L211-L224
train
sadiqhabib/tinymce-dist
tinymce.full.js
clamp
function clamp(rect, clampRect, fixedSize) { var underflowX1, underflowY1, overflowX2, overflowY2, x1, y1, x2, y2, cx2, cy2; x1 = rect.x; y1 = rect.y; x2 = rect.x + rect.w; y2 = rect.y + rect.h; cx2 = clampRect.x + clampRect.w; cy2 = clampRect.y + clampRect.h; u...
javascript
function clamp(rect, clampRect, fixedSize) { var underflowX1, underflowY1, overflowX2, overflowY2, x1, y1, x2, y2, cx2, cy2; x1 = rect.x; y1 = rect.y; x2 = rect.x + rect.w; y2 = rect.y + rect.h; cx2 = clampRect.x + clampRect.w; cy2 = clampRect.y + clampRect.h; u...
[ "function", "clamp", "(", "rect", ",", "clampRect", ",", "fixedSize", ")", "{", "var", "underflowX1", ",", "underflowY1", ",", "overflowX2", ",", "overflowY2", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "cx2", ",", "cy2", ";", "x1", "=", "rect"...
Returns a rect clamped within the specified clamp rect. This forces the rect to be inside the clamp rect. @method clamp @param {Rect} rect Rectangle to force within clamp rect. @param {Rect} clampRect Rectable to force within. @param {Boolean} fixedSize True/false if size should be fixed. @return {Rect} Clamped rect.
[ "Returns", "a", "rect", "clamped", "within", "the", "specified", "clamp", "rect", ".", "This", "forces", "the", "rect", "to", "be", "inside", "the", "clamp", "rect", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L236-L266
train
sadiqhabib/tinymce-dist
tinymce.full.js
fromClientRect
function fromClientRect(clientRect) { return create(clientRect.left, clientRect.top, clientRect.width, clientRect.height); }
javascript
function fromClientRect(clientRect) { return create(clientRect.left, clientRect.top, clientRect.width, clientRect.height); }
[ "function", "fromClientRect", "(", "clientRect", ")", "{", "return", "create", "(", "clientRect", ".", "left", ",", "clientRect", ".", "top", ",", "clientRect", ".", "width", ",", "clientRect", ".", "height", ")", ";", "}" ]
Creates a new rectangle object form a clientRects object. @method fromClientRect @param {ClientRect} clientRect DOM ClientRect object. @return {Rect} New rectangle object.
[ "Creates", "a", "new", "rectangle", "object", "form", "a", "clientRects", "object", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L289-L291
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (callback, element) { if (requestAnimationFramePromise) { requestAnimationFramePromise.then(callback); return; } requestAnimationFramePromise = new Promise(function (resolve) { if (!element) { element = document.body; } req...
javascript
function (callback, element) { if (requestAnimationFramePromise) { requestAnimationFramePromise.then(callback); return; } requestAnimationFramePromise = new Promise(function (resolve) { if (!element) { element = document.body; } req...
[ "function", "(", "callback", ",", "element", ")", "{", "if", "(", "requestAnimationFramePromise", ")", "{", "requestAnimationFramePromise", ".", "then", "(", "callback", ")", ";", "return", ";", "}", "requestAnimationFramePromise", "=", "new", "Promise", "(", "f...
Requests an animation frame and fallbacks to a timeout on older browsers. @method requestAnimationFrame @param {function} callback Callback to execute when a new frame is available. @param {DOMElement} element Optional element to scope it to.
[ "Requests", "an", "animation", "frame", "and", "fallbacks", "to", "a", "timeout", "on", "older", "browsers", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L602-L615
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (editor, callback, time) { var timer; timer = wrappedSetInterval(function () { if (!editor.removed) { callback(); } else { clearInterval(timer); } }, time); return timer; }
javascript
function (editor, callback, time) { var timer; timer = wrappedSetInterval(function () { if (!editor.removed) { callback(); } else { clearInterval(timer); } }, time); return timer; }
[ "function", "(", "editor", ",", "callback", ",", "time", ")", "{", "var", "timer", ";", "timer", "=", "wrappedSetInterval", "(", "function", "(", ")", "{", "if", "(", "!", "editor", ".", "removed", ")", "{", "callback", "(", ")", ";", "}", "else", ...
Sets an interval timer it's similar to setInterval except that it checks if the editor instance is still alive when the callback gets executed. @method setEditorInterval @param {function} callback Callback to execute when interval time runs out. @param {Number} time Optional time to wait before the callback is execute...
[ "Sets", "an", "interval", "timer", "it", "s", "similar", "to", "setInterval", "except", "that", "it", "checks", "if", "the", "editor", "instance", "is", "still", "alive", "when", "the", "callback", "gets", "executed", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L664-L676
train
sadiqhabib/tinymce-dist
tinymce.full.js
addEvent
function addEvent(target, name, callback, capture) { if (target.addEventListener) { target.addEventListener(name, callback, capture || false); } else if (target.attachEvent) { target.attachEvent('on' + name, callback); } }
javascript
function addEvent(target, name, callback, capture) { if (target.addEventListener) { target.addEventListener(name, callback, capture || false); } else if (target.attachEvent) { target.attachEvent('on' + name, callback); } }
[ "function", "addEvent", "(", "target", ",", "name", ",", "callback", ",", "capture", ")", "{", "if", "(", "target", ".", "addEventListener", ")", "{", "target", ".", "addEventListener", "(", "name", ",", "callback", ",", "capture", "||", "false", ")", ";...
Binds a native event to a callback on the speified target.
[ "Binds", "a", "native", "event", "to", "a", "callback", "on", "the", "speified", "target", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L935-L941
train
sadiqhabib/tinymce-dist
tinymce.full.js
removeEvent
function removeEvent(target, name, callback, capture) { if (target.removeEventListener) { target.removeEventListener(name, callback, capture || false); } else if (target.detachEvent) { target.detachEvent('on' + name, callback); } }
javascript
function removeEvent(target, name, callback, capture) { if (target.removeEventListener) { target.removeEventListener(name, callback, capture || false); } else if (target.detachEvent) { target.detachEvent('on' + name, callback); } }
[ "function", "removeEvent", "(", "target", ",", "name", ",", "callback", ",", "capture", ")", "{", "if", "(", "target", ".", "removeEventListener", ")", "{", "target", ".", "removeEventListener", "(", "name", ",", "callback", ",", "capture", "||", "false", ...
Unbinds a native event callback on the specified target.
[ "Unbinds", "a", "native", "event", "callback", "on", "the", "specified", "target", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L946-L952
train
sadiqhabib/tinymce-dist
tinymce.full.js
getTargetFromShadowDom
function getTargetFromShadowDom(event, defaultTarget) { var path, target = defaultTarget; // When target element is inside Shadow DOM we need to take first element from path // otherwise we'll get Shadow Root parent, not actual target element // Normalize target for WebComponents v0 implementa...
javascript
function getTargetFromShadowDom(event, defaultTarget) { var path, target = defaultTarget; // When target element is inside Shadow DOM we need to take first element from path // otherwise we'll get Shadow Root parent, not actual target element // Normalize target for WebComponents v0 implementa...
[ "function", "getTargetFromShadowDom", "(", "event", ",", "defaultTarget", ")", "{", "var", "path", ",", "target", "=", "defaultTarget", ";", "// When target element is inside Shadow DOM we need to take first element from path", "// otherwise we'll get Shadow Root parent, not actual t...
Gets the event target based on shadow dom properties like path and deepPath.
[ "Gets", "the", "event", "target", "based", "on", "shadow", "dom", "properties", "like", "path", "and", "deepPath", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L957-L978
train
sadiqhabib/tinymce-dist
tinymce.full.js
fix
function fix(originalEvent, data) { var name, event = data || {}, undef; // Dummy function that gets replaced on the delegation state functions function returnFalse() { return false; } // Dummy function that gets replaced on the delegation state functions function returnTru...
javascript
function fix(originalEvent, data) { var name, event = data || {}, undef; // Dummy function that gets replaced on the delegation state functions function returnFalse() { return false; } // Dummy function that gets replaced on the delegation state functions function returnTru...
[ "function", "fix", "(", "originalEvent", ",", "data", ")", "{", "var", "name", ",", "event", "=", "data", "||", "{", "}", ",", "undef", ";", "// Dummy function that gets replaced on the delegation state functions", "function", "returnFalse", "(", ")", "{", "return...
Normalizes a native event object or just adds the event specific methods on a custom event.
[ "Normalizes", "a", "native", "event", "object", "or", "just", "adds", "the", "event", "specific", "methods", "on", "a", "custom", "event", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L983-L1074
train
sadiqhabib/tinymce-dist
tinymce.full.js
is
function is(obj, type) { if (!type) { return obj !== undefined; } if (type == 'array' && Arr.isArray(obj)) { return true; } return typeof obj == type; }
javascript
function is(obj, type) { if (!type) { return obj !== undefined; } if (type == 'array' && Arr.isArray(obj)) { return true; } return typeof obj == type; }
[ "function", "is", "(", "obj", ",", "type", ")", "{", "if", "(", "!", "type", ")", "{", "return", "obj", "!==", "undefined", ";", "}", "if", "(", "type", "==", "'array'", "&&", "Arr", ".", "isArray", "(", "obj", ")", ")", "{", "return", "true", ...
Checks if a object is of a specific type for example an array. @method is @param {Object} obj Object to check type of. @param {string} type Optional type to check for. @return {Boolean} true/false if the object is of the specified type.
[ "Checks", "if", "a", "object", "is", "of", "a", "specific", "type", "for", "example", "an", "array", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L3767-L3777
train
sadiqhabib/tinymce-dist
tinymce.full.js
create
function create(s, p, root) { var self = this, sp, ns, cn, scn, c, de = 0; // Parse : <prefix> <class>:<super class> s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name // Create namespace for new class ns = self.createNS(s[3].replace...
javascript
function create(s, p, root) { var self = this, sp, ns, cn, scn, c, de = 0; // Parse : <prefix> <class>:<super class> s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name // Create namespace for new class ns = self.createNS(s[3].replace...
[ "function", "create", "(", "s", ",", "p", ",", "root", ")", "{", "var", "self", "=", "this", ",", "sp", ",", "ns", ",", "cn", ",", "scn", ",", "c", ",", "de", "=", "0", ";", "// Parse : <prefix> <class>:<super class>", "s", "=", "/", "^((static) )?([...
Creates a class, subclass or static singleton. More details on this method can be found in the Wiki. @method create @param {String} s Class name, inheritance and prefix. @param {Object} p Collection of methods to add to the class. @param {Object} root Optional root object defaults to the global window object. @example...
[ "Creates", "a", "class", "subclass", "or", "static", "singleton", ".", "More", "details", "on", "this", "method", "can", "be", "found", "in", "the", "Wiki", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L3866-L3950
train
sadiqhabib/tinymce-dist
tinymce.full.js
walk
function walk(o, f, n, s) { s = s || this; if (o) { if (n) { o = o[n]; } Arr.each(o, function (o, i) { if (f.call(s, o, i, n) === false) { return false; } walk(o, f, n, s); }); } }
javascript
function walk(o, f, n, s) { s = s || this; if (o) { if (n) { o = o[n]; } Arr.each(o, function (o, i) { if (f.call(s, o, i, n) === false) { return false; } walk(o, f, n, s); }); } }
[ "function", "walk", "(", "o", ",", "f", ",", "n", ",", "s", ")", "{", "s", "=", "s", "||", "this", ";", "if", "(", "o", ")", "{", "if", "(", "n", ")", "{", "o", "=", "o", "[", "n", "]", ";", "}", "Arr", ".", "each", "(", "o", ",", "...
Executed the specified function for each item in a object tree. @method walk @param {Object} o Object tree to walk though. @param {function} f Function to call for each item. @param {String} n Optional name of collection inside the objects to walk for example childNodes. @param {String} s Optional scope to execute the...
[ "Executed", "the", "specified", "function", "for", "each", "item", "in", "a", "object", "tree", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L3980-L3996
train
sadiqhabib/tinymce-dist
tinymce.full.js
createNS
function createNS(n, o) { var i, v; o = o || window; n = n.split('.'); for (i = 0; i < n.length; i++) { v = n[i]; if (!o[v]) { o[v] = {}; } o = o[v]; } return o; }
javascript
function createNS(n, o) { var i, v; o = o || window; n = n.split('.'); for (i = 0; i < n.length; i++) { v = n[i]; if (!o[v]) { o[v] = {}; } o = o[v]; } return o; }
[ "function", "createNS", "(", "n", ",", "o", ")", "{", "var", "i", ",", "v", ";", "o", "=", "o", "||", "window", ";", "n", "=", "n", ".", "split", "(", "'.'", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "n", ".", "length", ";", "...
Creates a namespace on a specific object. @method createNS @param {String} n Namespace to create for example a.b.c.d. @param {Object} o Optional object to add namespace to, defaults to window. @return {Object} New namespace object the last item in path. @example // Create some namespace tinymce.createNS('tinymce.somep...
[ "Creates", "a", "namespace", "on", "a", "specific", "object", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4016-L4033
train
sadiqhabib/tinymce-dist
tinymce.full.js
resolve
function resolve(n, o) { var i, l; o = o || window; n = n.split('.'); for (i = 0, l = n.length; i < l; i++) { o = o[n[i]]; if (!o) { break; } } return o; }
javascript
function resolve(n, o) { var i, l; o = o || window; n = n.split('.'); for (i = 0, l = n.length; i < l; i++) { o = o[n[i]]; if (!o) { break; } } return o; }
[ "function", "resolve", "(", "n", ",", "o", ")", "{", "var", "i", ",", "l", ";", "o", "=", "o", "||", "window", ";", "n", "=", "n", ".", "split", "(", "'.'", ")", ";", "for", "(", "i", "=", "0", ",", "l", "=", "n", ".", "length", ";", "i...
Resolves a string and returns the object from a specific structure. @method resolve @param {String} n Path to resolve for example a.b.c.d. @param {Object} o Optional object to search though, defaults to window. @return {Object} Last object in path or null if it couldn't be resolved. @example // Resolve a path into an ...
[ "Resolves", "a", "string", "and", "returns", "the", "object", "from", "a", "specific", "structure", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4046-L4061
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (selector, context) { var self = this, match, node; if (!selector) { return self; } if (selector.nodeType) { self.context = self[0] = selector; self.length = 1; return self; } if (context && context.nodeType) { ...
javascript
function (selector, context) { var self = this, match, node; if (!selector) { return self; } if (selector.nodeType) { self.context = self[0] = selector; self.length = 1; return self; } if (context && context.nodeType) { ...
[ "function", "(", "selector", ",", "context", ")", "{", "var", "self", "=", "this", ",", "match", ",", "node", ";", "if", "(", "!", "selector", ")", "{", "return", "self", ";", "}", "if", "(", "selector", ".", "nodeType", ")", "{", "self", ".", "c...
Constructs a new DomQuery instance with the specified selector or context. @constructor @method init @param {String/Array/DomQuery} selector Optional CSS selector/Array or array like object or HTML string. @param {Document/Element} context Optional context to search in.
[ "Constructs", "a", "new", "DomQuery", "instance", "with", "the", "specified", "selector", "or", "context", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4442-L4505
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (items, sort) { var self = this, nodes, i; if (isString(items)) { return self.add(DomQuery(items)); } if (sort !== false) { nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); self.length = nodes.length; for (i = 0...
javascript
function (items, sort) { var self = this, nodes, i; if (isString(items)) { return self.add(DomQuery(items)); } if (sort !== false) { nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); self.length = nodes.length; for (i = 0...
[ "function", "(", "items", ",", "sort", ")", "{", "var", "self", "=", "this", ",", "nodes", ",", "i", ";", "if", "(", "isString", "(", "items", ")", ")", "{", "return", "self", ".", "add", "(", "DomQuery", "(", "items", ")", ")", ";", "}", "if",...
Adds new nodes to the set. @method add @param {Array/tinymce.core.dom.DomQuery} items Array of all nodes to add to set. @param {Boolean} sort Optional sort flag that enables sorting of elements. @return {tinymce.dom.DomQuery} New instance with nodes added.
[ "Adds", "new", "nodes", "to", "the", "set", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4525-L4543
train
sadiqhabib/tinymce-dist
tinymce.full.js
function () { var self = this, node, i = this.length; while (i--) { node = self[i]; Event.clean(node); if (node.parentNode) { node.parentNode.removeChild(node); } } return this; }
javascript
function () { var self = this, node, i = this.length; while (i--) { node = self[i]; Event.clean(node); if (node.parentNode) { node.parentNode.removeChild(node); } } return this; }
[ "function", "(", ")", "{", "var", "self", "=", "this", ",", "node", ",", "i", "=", "this", ".", "length", ";", "while", "(", "i", "--", ")", "{", "node", "=", "self", "[", "i", "]", ";", "Event", ".", "clean", "(", "node", ")", ";", "if", "...
Removes all nodes in set from the document. @method remove @return {tinymce.dom.DomQuery} Current set with the removed nodes.
[ "Removes", "all", "nodes", "in", "set", "from", "the", "document", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4735-L4748
train
sadiqhabib/tinymce-dist
tinymce.full.js
function () { var self = this, node, i = this.length; while (i--) { node = self[i]; while (node.firstChild) { node.removeChild(node.firstChild); } } return this; }
javascript
function () { var self = this, node, i = this.length; while (i--) { node = self[i]; while (node.firstChild) { node.removeChild(node.firstChild); } } return this; }
[ "function", "(", ")", "{", "var", "self", "=", "this", ",", "node", ",", "i", "=", "this", ".", "length", ";", "while", "(", "i", "--", ")", "{", "node", "=", "self", "[", "i", "]", ";", "while", "(", "node", ".", "firstChild", ")", "{", "nod...
Empties all elements in set. @method empty @return {tinymce.dom.DomQuery} Current set with the empty nodes.
[ "Empties", "all", "elements", "in", "set", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4756-L4767
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (value) { var self = this, i; if (isDefined(value)) { i = self.length; try { while (i--) { self[i].innerHTML = value; } } catch (ex) { // Workaround for "Unknown runtime error" when DIV is added to P on IE ...
javascript
function (value) { var self = this, i; if (isDefined(value)) { i = self.length; try { while (i--) { self[i].innerHTML = value; } } catch (ex) { // Workaround for "Unknown runtime error" when DIV is added to P on IE ...
[ "function", "(", "value", ")", "{", "var", "self", "=", "this", ",", "i", ";", "if", "(", "isDefined", "(", "value", ")", ")", "{", "i", "=", "self", ".", "length", ";", "try", "{", "while", "(", "i", "--", ")", "{", "self", "[", "i", "]", ...
Sets or gets the HTML of the current set or first set node. @method html @param {String} value Optional innerHTML value to set on each element. @return {tinymce.dom.DomQuery/String} Current set or the innerHTML of the first element.
[ "Sets", "or", "gets", "the", "HTML", "of", "the", "current", "set", "or", "first", "set", "node", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4776-L4795
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (value) { var self = this, i; if (isDefined(value)) { i = self.length; while (i--) { if ("innerText" in self[i]) { self[i].innerText = value; } else { self[0].textContent = value; } } retur...
javascript
function (value) { var self = this, i; if (isDefined(value)) { i = self.length; while (i--) { if ("innerText" in self[i]) { self[i].innerText = value; } else { self[0].textContent = value; } } retur...
[ "function", "(", "value", ")", "{", "var", "self", "=", "this", ",", "i", ";", "if", "(", "isDefined", "(", "value", ")", ")", "{", "i", "=", "self", ".", "length", ";", "while", "(", "i", "--", ")", "{", "if", "(", "\"innerText\"", "in", "self...
Sets or gets the text of the current set or first set node. @method text @param {String} value Optional innerText value to set on each element. @return {tinymce.dom.DomQuery/String} Current set or the innerText of the first element.
[ "Sets", "or", "gets", "the", "text", "of", "the", "current", "set", "or", "first", "set", "node", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4804-L4821
train
sadiqhabib/tinymce-dist
tinymce.full.js
function () { var self = this; if (self[0] && self[0].parentNode) { return domManipulate(self, arguments, function (node) { this.parentNode.insertBefore(node, this); }); } return self; }
javascript
function () { var self = this; if (self[0] && self[0].parentNode) { return domManipulate(self, arguments, function (node) { this.parentNode.insertBefore(node, this); }); } return self; }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "if", "(", "self", "[", "0", "]", "&&", "self", "[", "0", "]", ".", "parentNode", ")", "{", "return", "domManipulate", "(", "self", ",", "arguments", ",", "function", "(", "node", ")", "...
Adds the specified elements before current set nodes. @method before @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add before to each element in set. @return {tinymce.dom.DomQuery} Current set.
[ "Adds", "the", "specified", "elements", "before", "current", "set", "nodes", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4862-L4872
train
sadiqhabib/tinymce-dist
tinymce.full.js
function () { var self = this; if (self[0] && self[0].parentNode) { return domManipulate(self, arguments, function (node) { this.parentNode.insertBefore(node, this.nextSibling); }, true); } return self; }
javascript
function () { var self = this; if (self[0] && self[0].parentNode) { return domManipulate(self, arguments, function (node) { this.parentNode.insertBefore(node, this.nextSibling); }, true); } return self; }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "if", "(", "self", "[", "0", "]", "&&", "self", "[", "0", "]", ".", "parentNode", ")", "{", "return", "domManipulate", "(", "self", ",", "arguments", ",", "function", "(", "node", ")", "...
Adds the specified elements after current set nodes. @method after @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add after to each element in set. @return {tinymce.dom.DomQuery} Current set.
[ "Adds", "the", "specified", "elements", "after", "current", "set", "nodes", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L4881-L4891
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (className, state) { var self = this; // Functions are not supported if (typeof className != 'string') { return self; } if (className.indexOf(' ') !== -1) { each(className.split(' '), function () { self.toggleClass(this, state); ...
javascript
function (className, state) { var self = this; // Functions are not supported if (typeof className != 'string') { return self; } if (className.indexOf(' ') !== -1) { each(className.split(' '), function () { self.toggleClass(this, state); ...
[ "function", "(", "className", ",", "state", ")", "{", "var", "self", "=", "this", ";", "// Functions are not supported", "if", "(", "typeof", "className", "!=", "'string'", ")", "{", "return", "self", ";", "}", "if", "(", "className", ".", "indexOf", "(", ...
Toggles the specified class name on the current set elements. @method toggleClass @param {String} className Class name to add/remove. @param {Boolean} state Optional state to toggle on/off. @return {tinymce.dom.DomQuery} Current set.
[ "Toggles", "the", "specified", "class", "name", "on", "the", "current", "set", "elements", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L5026-L5056
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (name) { return this.each(function () { if (typeof name == 'object') { Event.fire(this, name.type, name); } else { Event.fire(this, name); } }); }
javascript
function (name) { return this.each(function () { if (typeof name == 'object') { Event.fire(this, name.type, name); } else { Event.fire(this, name); } }); }
[ "function", "(", "name", ")", "{", "return", "this", ".", "each", "(", "function", "(", ")", "{", "if", "(", "typeof", "name", "==", "'object'", ")", "{", "Event", ".", "fire", "(", "this", ",", "name", ".", "type", ",", "name", ")", ";", "}", ...
Triggers the specified event by name or event object. @method trigger @param {String/Object} name Name of the event to trigger or event object. @return {tinymce.dom.DomQuery} Current set.
[ "Triggers", "the", "specified", "event", "by", "name", "or", "event", "object", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L5116-L5124
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (selector) { var i, l, ret = []; for (i = 0, l = this.length; i < l; i++) { DomQuery.find(selector, this[i], ret); } return DomQuery(ret); }
javascript
function (selector) { var i, l, ret = []; for (i = 0, l = this.length; i < l; i++) { DomQuery.find(selector, this[i], ret); } return DomQuery(ret); }
[ "function", "(", "selector", ")", "{", "var", "i", ",", "l", ",", "ret", "=", "[", "]", ";", "for", "(", "i", "=", "0", ",", "l", "=", "this", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "DomQuery", ".", "find", "(", "sel...
Finds elements by the specified selector for each element in set. @method find @param {String} selector Selector to find elements by. @return {tinymce.dom.DomQuery} Set with matches elements.
[ "Finds", "elements", "by", "the", "specified", "selector", "for", "each", "element", "in", "set", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L5196-L5204
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (selector) { if (typeof selector == 'function') { return DomQuery(grep(this.toArray(), function (item, i) { return selector(i, item); })); } return DomQuery(DomQuery.filter(selector, this.toArray())); }
javascript
function (selector) { if (typeof selector == 'function') { return DomQuery(grep(this.toArray(), function (item, i) { return selector(i, item); })); } return DomQuery(DomQuery.filter(selector, this.toArray())); }
[ "function", "(", "selector", ")", "{", "if", "(", "typeof", "selector", "==", "'function'", ")", "{", "return", "DomQuery", "(", "grep", "(", "this", ".", "toArray", "(", ")", ",", "function", "(", "item", ",", "i", ")", "{", "return", "selector", "(...
Filters the current set with the specified selector. @method filter @param {String/function} selector Selector to filter elements by. @return {tinymce.dom.DomQuery} Set with filtered elements.
[ "Filters", "the", "current", "set", "with", "the", "specified", "selector", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L5213-L5221
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (selector) { var result = []; if (selector instanceof DomQuery) { selector = selector[0]; } this.each(function (i, node) { while (node) { if (typeof selector == 'string' && DomQuery(node).is(selector)) { result.push(node); ...
javascript
function (selector) { var result = []; if (selector instanceof DomQuery) { selector = selector[0]; } this.each(function (i, node) { while (node) { if (typeof selector == 'string' && DomQuery(node).is(selector)) { result.push(node); ...
[ "function", "(", "selector", ")", "{", "var", "result", "=", "[", "]", ";", "if", "(", "selector", "instanceof", "DomQuery", ")", "{", "selector", "=", "selector", "[", "0", "]", ";", "}", "this", ".", "each", "(", "function", "(", "i", ",", "node"...
Gets the current node or any parent matching the specified selector. @method closest @param {String/Element/tinymce.dom.DomQuery} selector Selector or element to find. @return {tinymce.dom.DomQuery} Set with closest elements.
[ "Gets", "the", "current", "node", "or", "any", "parent", "matching", "the", "specified", "selector", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L5230-L5252
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (node) { return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes); }
javascript
function (node) { return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes); }
[ "function", "(", "node", ")", "{", "return", "Tools", ".", "toArray", "(", "(", "node", ".", "nodeName", "===", "\"iframe\"", "?", "node", ".", "contentDocument", "||", "node", ".", "contentWindow", ".", "document", ":", "node", ")", ".", "childNodes", "...
Returns all child nodes matching the optional selector. @method contents @param {Element/tinymce.dom.DomQuery} node Node to get the contents of. @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
[ "Returns", "all", "child", "nodes", "matching", "the", "optional", "selector", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L5539-L5541
train
sadiqhabib/tinymce-dist
tinymce.full.js
nativeDecode
function nativeDecode(text) { var elm; elm = document.createElement("div"); elm.innerHTML = text; return elm.textContent || elm.innerText || text; }
javascript
function nativeDecode(text) { var elm; elm = document.createElement("div"); elm.innerHTML = text; return elm.textContent || elm.innerText || text; }
[ "function", "nativeDecode", "(", "text", ")", "{", "var", "elm", ";", "elm", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "elm", ".", "innerHTML", "=", "text", ";", "return", "elm", ".", "textContent", "||", "elm", ".", "innerText", ...
Decodes text by using the browser
[ "Decodes", "text", "by", "using", "the", "browser" ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L6339-L6346
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (text, attr) { return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { // Multi byte sequence convert it to a single entity if (chr.length > 1) { return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';'...
javascript
function (text, attr) { return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { // Multi byte sequence convert it to a single entity if (chr.length > 1) { return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';'...
[ "function", "(", "text", ",", "attr", ")", "{", "return", "text", ".", "replace", "(", "attr", "?", "attrsCharsRegExp", ":", "textCharsRegExp", ",", "function", "(", "chr", ")", "{", "// Multi byte sequence convert it to a single entity", "if", "(", "chr", ".", ...
Encodes the specified string using numeric entities. The core entities will be encoded as named ones but all non lower ascii characters will be encoded into numeric entities. @method encodeNumeric @param {String} text Text to encode. @param {Boolean} attr Optional flag to specify if the text is attribute contents. @re...
[ "Encodes", "the", "specified", "string", "using", "numeric", "entities", ".", "The", "core", "entities", "will", "be", "encoded", "as", "named", "ones", "but", "all", "non", "lower", "ascii", "characters", "will", "be", "encoded", "into", "numeric", "entities"...
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L6439-L6448
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (text) { return text.replace(entityRegExp, function (all, numeric) { if (numeric) { if (numeric.charAt(0).toLowerCase() === 'x') { numeric = parseInt(numeric.substr(1), 16); } else { numeric = parseInt(numeric, 10); } ...
javascript
function (text) { return text.replace(entityRegExp, function (all, numeric) { if (numeric) { if (numeric.charAt(0).toLowerCase() === 'x') { numeric = parseInt(numeric.substr(1), 16); } else { numeric = parseInt(numeric, 10); } ...
[ "function", "(", "text", ")", "{", "return", "text", ".", "replace", "(", "entityRegExp", ",", "function", "(", "all", ",", "numeric", ")", "{", "if", "(", "numeric", ")", "{", "if", "(", "numeric", ".", "charAt", "(", "0", ")", ".", "toLowerCase", ...
Decodes the specified string, this will replace entities with raw UTF characters. @method decode @param {String} text Text to entity decode. @return {String} Entity decoded string.
[ "Decodes", "the", "specified", "string", "this", "will", "replace", "entities", "with", "raw", "UTF", "characters", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L6523-L6544
train
sadiqhabib/tinymce-dist
tinymce.full.js
wait
function wait(testCallback, waitCallback) { if (!testCallback()) { // Wait for timeout if ((new Date().getTime()) - startTime < maxLoadTime) { Delay.setTimeout(waitCallback); } else { failed(); } } }
javascript
function wait(testCallback, waitCallback) { if (!testCallback()) { // Wait for timeout if ((new Date().getTime()) - startTime < maxLoadTime) { Delay.setTimeout(waitCallback); } else { failed(); } } }
[ "function", "wait", "(", "testCallback", ",", "waitCallback", ")", "{", "if", "(", "!", "testCallback", "(", ")", ")", "{", "// Wait for timeout", "if", "(", "(", "new", "Date", "(", ")", ".", "getTime", "(", ")", ")", "-", "startTime", "<", "maxLoadTi...
Calls the waitCallback until the test returns true or the timeout occurs
[ "Calls", "the", "waitCallback", "until", "the", "test", "returns", "true", "or", "the", "timeout", "occurs" ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7418-L7427
train
sadiqhabib/tinymce-dist
tinymce.full.js
waitForGeckoLinkLoaded
function waitForGeckoLinkLoaded() { wait(function () { try { // Accessing the cssRules will throw an exception until the CSS file is loaded var cssRules = style.sheet.cssRules; passed(); return !!cssRules; } catch (ex) { ...
javascript
function waitForGeckoLinkLoaded() { wait(function () { try { // Accessing the cssRules will throw an exception until the CSS file is loaded var cssRules = style.sheet.cssRules; passed(); return !!cssRules; } catch (ex) { ...
[ "function", "waitForGeckoLinkLoaded", "(", ")", "{", "wait", "(", "function", "(", ")", "{", "try", "{", "// Accessing the cssRules will throw an exception until the CSS file is loaded", "var", "cssRules", "=", "style", ".", "sheet", ".", "cssRules", ";", "passed", "(...
Workaround for older Geckos that doesn't have any onload event for StyleSheets
[ "Workaround", "for", "older", "Geckos", "that", "doesn", "t", "have", "any", "onload", "event", "for", "StyleSheets" ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7447-L7458
train
sadiqhabib/tinymce-dist
tinymce.full.js
DOMUtils
function DOMUtils(doc, settings) { var self = this, blockElementsMap; self.doc = doc; self.win = window; self.files = {}; self.counter = 0; self.stdMode = !isIE || doc.documentMode >= 8; self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode; self.styleS...
javascript
function DOMUtils(doc, settings) { var self = this, blockElementsMap; self.doc = doc; self.win = window; self.files = {}; self.counter = 0; self.stdMode = !isIE || doc.documentMode >= 8; self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode; self.styleS...
[ "function", "DOMUtils", "(", "doc", ",", "settings", ")", "{", "var", "self", "=", "this", ",", "blockElementsMap", ";", "self", ".", "doc", "=", "doc", ";", "self", ".", "win", "=", "window", ";", "self", ".", "files", "=", "{", "}", ";", "self", ...
Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class. @constructor @method DOMUtils @param {Document} doc Document reference to bind the utility class to. @param {settings} settings Optional settings collection.
[ "Constructs", "a", "new", "DOMUtils", "instance", ".", "Consult", "the", "Wiki", "for", "more", "details", "on", "settings", "etc", "for", "this", "class", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7668-L7720
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (win) { var doc, rootElm; win = !win ? this.win : win; doc = win.document; rootElm = this.boxModel ? doc.documentElement : doc.body; // Returns viewport size excluding scrollbars return { x: win.pageXOffset || rootElm.scrollLeft, y: win.page...
javascript
function (win) { var doc, rootElm; win = !win ? this.win : win; doc = win.document; rootElm = this.boxModel ? doc.documentElement : doc.body; // Returns viewport size excluding scrollbars return { x: win.pageXOffset || rootElm.scrollLeft, y: win.page...
[ "function", "(", "win", ")", "{", "var", "doc", ",", "rootElm", ";", "win", "=", "!", "win", "?", "this", ".", "win", ":", "win", ";", "doc", "=", "win", ".", "document", ";", "rootElm", "=", "this", ".", "boxModel", "?", "doc", ".", "documentEle...
Returns the viewport of the window. @method getViewPort @param {Window} win Optional window to get viewport of. @return {Object} Viewport object with fields x, y, w and h.
[ "Returns", "the", "viewport", "of", "the", "window", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7798-L7812
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (elm) { var self = this, pos, size; elm = self.get(elm); pos = self.getPos(elm); size = self.getSize(elm); return { x: pos.x, y: pos.y, w: size.w, h: size.h }; }
javascript
function (elm) { var self = this, pos, size; elm = self.get(elm); pos = self.getPos(elm); size = self.getSize(elm); return { x: pos.x, y: pos.y, w: size.w, h: size.h }; }
[ "function", "(", "elm", ")", "{", "var", "self", "=", "this", ",", "pos", ",", "size", ";", "elm", "=", "self", ".", "get", "(", "elm", ")", ";", "pos", "=", "self", ".", "getPos", "(", "elm", ")", ";", "size", "=", "self", ".", "getSize", "(...
Returns the rectangle for a specific element. @method getRect @param {Element/String} elm Element object or element ID to get rectangle from. @return {object} Rectangle for specified element object with x, y, w, h fields.
[ "Returns", "the", "rectangle", "for", "a", "specific", "element", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7821-L7832
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (elm) { var self = this, w, h; elm = self.get(elm); w = self.getStyle(elm, 'width'); h = self.getStyle(elm, 'height'); // Non pixel value, then force offset/clientWidth if (w.indexOf('px') === -1) { w = 0; } // Non pixel value, then f...
javascript
function (elm) { var self = this, w, h; elm = self.get(elm); w = self.getStyle(elm, 'width'); h = self.getStyle(elm, 'height'); // Non pixel value, then force offset/clientWidth if (w.indexOf('px') === -1) { w = 0; } // Non pixel value, then f...
[ "function", "(", "elm", ")", "{", "var", "self", "=", "this", ",", "w", ",", "h", ";", "elm", "=", "self", ".", "get", "(", "elm", ")", ";", "w", "=", "self", ".", "getStyle", "(", "elm", ",", "'width'", ")", ";", "h", "=", "self", ".", "ge...
Returns the size dimensions of the specified element. @method getSize @param {Element/String} elm Element object or element ID to get rectangle from. @return {object} Rectangle for specified element object with w, h fields.
[ "Returns", "the", "size", "dimensions", "of", "the", "specified", "element", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7841-L7862
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (node, selector, root, collect) { var self = this, selectorVal, result = []; node = self.get(node); collect = collect === undefined; // Default root on inline mode root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null); // Wrap n...
javascript
function (node, selector, root, collect) { var self = this, selectorVal, result = []; node = self.get(node); collect = collect === undefined; // Default root on inline mode root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null); // Wrap n...
[ "function", "(", "node", ",", "selector", ",", "root", ",", "collect", ")", "{", "var", "self", "=", "this", ",", "selectorVal", ",", "result", "=", "[", "]", ";", "node", "=", "self", ".", "get", "(", "node", ")", ";", "collect", "=", "collect", ...
Returns a node list of all parents matching the specified selector function or pattern. If the function then returns true indicating that it has found what it was looking for and that node will be collected. @method getParents @param {Node/String} node DOM node to search parents on or ID string. @param {function} sele...
[ "Returns", "a", "node", "list", "of", "all", "parents", "matching", "the", "specified", "selector", "function", "or", "pattern", ".", "If", "the", "function", "then", "returns", "true", "indicating", "that", "it", "has", "found", "what", "it", "was", "lookin...
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7890-L7931
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (elm) { var name; if (elm && this.doc && typeof elm == 'string') { name = elm; elm = this.doc.getElementById(elm); // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick if (elm && elm.i...
javascript
function (elm) { var name; if (elm && this.doc && typeof elm == 'string') { name = elm; elm = this.doc.getElementById(elm); // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick if (elm && elm.i...
[ "function", "(", "elm", ")", "{", "var", "name", ";", "if", "(", "elm", "&&", "this", ".", "doc", "&&", "typeof", "elm", "==", "'string'", ")", "{", "name", "=", "elm", ";", "elm", "=", "this", ".", "doc", ".", "getElementById", "(", "elm", ")", ...
Returns the specified element by ID or the input element if it isn't a string. @method get @param {String/Element} n Element id to look for or element to just pass though. @return {Element} Element matching the specified id or null if it wasn't found.
[ "Returns", "the", "specified", "element", "by", "ID", "or", "the", "input", "element", "if", "it", "isn", "t", "a", "string", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L7940-L7954
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (name, attrs, html) { return this.add(this.doc.createElement(name), name, attrs, html, 1); }
javascript
function (name, attrs, html) { return this.add(this.doc.createElement(name), name, attrs, html, 1); }
[ "function", "(", "name", ",", "attrs", ",", "html", ")", "{", "return", "this", ".", "add", "(", "this", ".", "doc", ".", "createElement", "(", "name", ")", ",", "name", ",", "attrs", ",", "html", ",", "1", ")", ";", "}" ]
Creates a new element. @method create @param {String} name Name of new element. @param {Object} attrs Optional object name/value collection with element attributes. @param {String} html Optional HTML string to set as inner HTML of the element. @return {Element} HTML DOM node element that got created. @example // Adds ...
[ "Creates", "a", "new", "element", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L8099-L8101
train
sadiqhabib/tinymce-dist
tinymce.full.js
function (name, attrs, html) { var outHtml = '', key; outHtml += '<' + name; for (key in attrs) { if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') { outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"'; } }...
javascript
function (name, attrs, html) { var outHtml = '', key; outHtml += '<' + name; for (key in attrs) { if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') { outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"'; } }...
[ "function", "(", "name", ",", "attrs", ",", "html", ")", "{", "var", "outHtml", "=", "''", ",", "key", ";", "outHtml", "+=", "'<'", "+", "name", ";", "for", "(", "key", "in", "attrs", ")", "{", "if", "(", "attrs", ".", "hasOwnProperty", "(", "key...
Creates HTML string for element. The element will be closed unless an empty inner HTML string is passed in. @method createHTML @param {String} name Name of new element. @param {Object} attrs Optional object name/value collection with element attributes. @param {String} html Optional HTML string to set as inner HTML of...
[ "Creates", "HTML", "string", "for", "element", ".", "The", "element", "will", "be", "closed", "unless", "an", "empty", "inner", "HTML", "string", "is", "passed", "in", "." ]
3acf1e4fe83a541988fdca20f2aaf4e6dce72512
https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L8115-L8132
train