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
josdejong/lossless-json
lib/parse.js
parseSymbol
function parseSymbol () { if (tokenType === TOKENTYPE.SYMBOL) { if (token === 'true') { getToken(); return true; } if (token === 'false') { getToken(); return false; } if (token === 'null') { getToken(); return null; } throw createSyntaxError('Unknown s...
javascript
function parseSymbol () { if (tokenType === TOKENTYPE.SYMBOL) { if (token === 'true') { getToken(); return true; } if (token === 'false') { getToken(); return false; } if (token === 'null') { getToken(); return null; } throw createSyntaxError('Unknown s...
[ "function", "parseSymbol", "(", ")", "{", "if", "(", "tokenType", "===", "TOKENTYPE", ".", "SYMBOL", ")", "{", "if", "(", "token", "===", "'true'", ")", "{", "getToken", "(", ")", ";", "return", "true", ";", "}", "if", "(", "token", "===", "'false'",...
Parse constants true, false, null @return {boolean | null}
[ "Parse", "constants", "true", "false", "null" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/parse.js#L451-L470
train
josdejong/lossless-json
lib/parse.js
parseCircular
function parseCircular(object) { // if circular references are disabled, just return the refs object if (!config().circularRefs) { return object; } let pointerPath = parsePointer(object.$ref); // validate whether the path corresponds with current stack for (let i = 0; i < pointerPath.length; i++) { ...
javascript
function parseCircular(object) { // if circular references are disabled, just return the refs object if (!config().circularRefs) { return object; } let pointerPath = parsePointer(object.$ref); // validate whether the path corresponds with current stack for (let i = 0; i < pointerPath.length; i++) { ...
[ "function", "parseCircular", "(", "object", ")", "{", "// if circular references are disabled, just return the refs object", "if", "(", "!", "config", "(", ")", ".", "circularRefs", ")", "{", "return", "object", ";", "}", "let", "pointerPath", "=", "parsePointer", "...
Resolve a circular reference. Throws an error if the path cannot be resolved @param {Object} object An object with a JSON Pointer URI fragment like {$ref: '#/foo/bar'} @return {Object | Array}
[ "Resolve", "a", "circular", "reference", ".", "Throws", "an", "error", "if", "the", "path", "cannot", "be", "resolved" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/parse.js#L500-L516
train
josdejong/lossless-json
lib/stringify.js
stringifyValue
function stringifyValue(value, replacer, space, indent) { // boolean, null, number, string, or date if (typeof value === 'boolean' || value instanceof Boolean || value === null || typeof value === 'number' || value instanceof Number || typeof value === 'string' || value instanceof String || ...
javascript
function stringifyValue(value, replacer, space, indent) { // boolean, null, number, string, or date if (typeof value === 'boolean' || value instanceof Boolean || value === null || typeof value === 'number' || value instanceof Number || typeof value === 'string' || value instanceof String || ...
[ "function", "stringifyValue", "(", "value", ",", "replacer", ",", "space", ",", "indent", ")", "{", "// boolean, null, number, string, or date", "if", "(", "typeof", "value", "===", "'boolean'", "||", "value", "instanceof", "Boolean", "||", "value", "===", "null",...
Stringify a value @param {*} value @param {function | Array.<string | number>} [replacer] @param {string} [space] @param {string} [indent] @return {string | undefined}
[ "Stringify", "a", "value" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/stringify.js#L72-L98
train
josdejong/lossless-json
lib/stringify.js
stringifyArray
function stringifyArray(array, replacer, space, indent) { let childIndent = space ? (indent + space) : undefined; let str = space ? '[\n' : '['; // check for circular reference if (isCircular(array)) { return stringifyCircular(array, replacer, space, indent); } // add this array to the stack const s...
javascript
function stringifyArray(array, replacer, space, indent) { let childIndent = space ? (indent + space) : undefined; let str = space ? '[\n' : '['; // check for circular reference if (isCircular(array)) { return stringifyCircular(array, replacer, space, indent); } // add this array to the stack const s...
[ "function", "stringifyArray", "(", "array", ",", "replacer", ",", "space", ",", "indent", ")", "{", "let", "childIndent", "=", "space", "?", "(", "indent", "+", "space", ")", ":", "undefined", ";", "let", "str", "=", "space", "?", "'[\\n'", ":", "'['",...
Stringify an array @param {Array} array @param {function | Array.<string | number>} [replacer] @param {string} [space] @param {string} [indent] @return {string}
[ "Stringify", "an", "array" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/stringify.js#L108-L150
train
josdejong/lossless-json
lib/stringify.js
stringifyObject
function stringifyObject(object, replacer, space, indent) { let childIndent = space ? (indent + space) : undefined; let first = true; let str = space ? '{\n' : '{'; if (typeof object.toJSON === 'function') { return stringify(object.toJSON(), replacer, space); } // check for circular reference if (is...
javascript
function stringifyObject(object, replacer, space, indent) { let childIndent = space ? (indent + space) : undefined; let first = true; let str = space ? '{\n' : '{'; if (typeof object.toJSON === 'function') { return stringify(object.toJSON(), replacer, space); } // check for circular reference if (is...
[ "function", "stringifyObject", "(", "object", ",", "replacer", ",", "space", ",", "indent", ")", "{", "let", "childIndent", "=", "space", "?", "(", "indent", "+", "space", ")", ":", "undefined", ";", "let", "first", "=", "true", ";", "let", "str", "=",...
Stringify an object @param {Object} object @param {function | Array.<string | number>} [replacer] @param {string} [space] @param {string} [indent] @return {string}
[ "Stringify", "an", "object" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/stringify.js#L160-L208
train
josdejong/lossless-json
lib/stringify.js
stringifyCircular
function stringifyCircular (value, replacer, space, indent) { if (!config().circularRefs) { throw new Error('Circular reference at "' + stringifyPointer(path) + '"'); } let pathIndex = stack.indexOf(value); let circular = { $ref: stringifyPointer(path.slice(0, pathIndex)) }; return stringifyObjec...
javascript
function stringifyCircular (value, replacer, space, indent) { if (!config().circularRefs) { throw new Error('Circular reference at "' + stringifyPointer(path) + '"'); } let pathIndex = stack.indexOf(value); let circular = { $ref: stringifyPointer(path.slice(0, pathIndex)) }; return stringifyObjec...
[ "function", "stringifyCircular", "(", "value", ",", "replacer", ",", "space", ",", "indent", ")", "{", "if", "(", "!", "config", "(", ")", ".", "circularRefs", ")", "{", "throw", "new", "Error", "(", "'Circular reference at \"'", "+", "stringifyPointer", "("...
Stringify a circular reference @param {Object | Array} value @param {function | Array.<string | number>} [replacer] @param {string} [space] @param {string} [indent] @return {string}
[ "Stringify", "a", "circular", "reference" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/stringify.js#L227-L239
train
josdejong/lossless-json
lib/stringify.js
includeProperty
function includeProperty (key, value, replacer) { return typeof value !== 'undefined' && typeof value !== 'function' && (!Array.isArray(replacer) || contains(replacer, key)); }
javascript
function includeProperty (key, value, replacer) { return typeof value !== 'undefined' && typeof value !== 'function' && (!Array.isArray(replacer) || contains(replacer, key)); }
[ "function", "includeProperty", "(", "key", ",", "value", ",", "replacer", ")", "{", "return", "typeof", "value", "!==", "'undefined'", "&&", "typeof", "value", "!==", "'function'", "&&", "(", "!", "Array", ".", "isArray", "(", "replacer", ")", "||", "conta...
Test whether to include a property in a stringified object or not. @param {string} key @param {*} value @param {function(key: string, value: *) | Array<string | number>} [replacer] @return {boolean}
[ "Test", "whether", "to", "include", "a", "property", "in", "a", "stringified", "object", "or", "not", "." ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/stringify.js#L248-L252
train
josdejong/lossless-json
lib/revive.js
reviveValue
function reviveValue (context, key, value, reviver) { if (Array.isArray(value)) { return reviver.call(context, key, reviveArray(value, reviver)); } else if (value && typeof value === 'object' && !value.isLosslessNumber) { // note the special case for LosslessNumber, // we don't want to iterate over th...
javascript
function reviveValue (context, key, value, reviver) { if (Array.isArray(value)) { return reviver.call(context, key, reviveArray(value, reviver)); } else if (value && typeof value === 'object' && !value.isLosslessNumber) { // note the special case for LosslessNumber, // we don't want to iterate over th...
[ "function", "reviveValue", "(", "context", ",", "key", ",", "value", ",", "reviver", ")", "{", "if", "(", "Array", ".", "isArray", "(", "value", ")", ")", "{", "return", "reviver", ".", "call", "(", "context", ",", "key", ",", "reviveArray", "(", "va...
Revive a value @param {Object | Array} context @param {string} key @param {*} value @param {function(key: string, value: *)} reviver @return {*}
[ "Revive", "a", "value" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/revive.js#L24-L36
train
josdejong/lossless-json
lib/revive.js
reviveObject
function reviveObject (object, reviver) { let revived = {}; for (let key in object) { if (object.hasOwnProperty(key)) { revived[key] = reviveValue(object, key, object[key], reviver); } } return revived; }
javascript
function reviveObject (object, reviver) { let revived = {}; for (let key in object) { if (object.hasOwnProperty(key)) { revived[key] = reviveValue(object, key, object[key], reviver); } } return revived; }
[ "function", "reviveObject", "(", "object", ",", "reviver", ")", "{", "let", "revived", "=", "{", "}", ";", "for", "(", "let", "key", "in", "object", ")", "{", "if", "(", "object", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "revived", "[", "k...
Revive the properties of an object @param {Object} object @param {function} reviver @return {Object}
[ "Revive", "the", "properties", "of", "an", "object" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/revive.js#L44-L54
train
josdejong/lossless-json
lib/revive.js
reviveArray
function reviveArray (array, reviver) { let revived = []; for (let i = 0; i < array.length; i++) { revived[i] = reviveValue(array, i + '', array[i], reviver); } return revived; }
javascript
function reviveArray (array, reviver) { let revived = []; for (let i = 0; i < array.length; i++) { revived[i] = reviveValue(array, i + '', array[i], reviver); } return revived; }
[ "function", "reviveArray", "(", "array", ",", "reviver", ")", "{", "let", "revived", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "revived", "[", "i", "]", "=", "reviveVa...
Revive the properties of an Array @param {Array} array @param {function} reviver @return {Array}
[ "Revive", "the", "properties", "of", "an", "Array" ]
ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd
https://github.com/josdejong/lossless-json/blob/ed6c201b37b5583d2c9c7a7d0b5fc1b3f01519bd/lib/revive.js#L62-L70
train
mblarsen/vue-browser-acl
index.js
commentNode
function commentNode(el, vnode) { const comment = document.createComment(' ') Object.defineProperty(comment, 'setAttribute', { value: () => undefined }) vnode.text = ' ' vnode.elm = comment vnode.isComment = true vnode.tag = undefined vnode.data.directives = undefined if (vnode.componentInstanc...
javascript
function commentNode(el, vnode) { const comment = document.createComment(' ') Object.defineProperty(comment, 'setAttribute', { value: () => undefined }) vnode.text = ' ' vnode.elm = comment vnode.isComment = true vnode.tag = undefined vnode.data.directives = undefined if (vnode.componentInstanc...
[ "function", "commentNode", "(", "el", ",", "vnode", ")", "{", "const", "comment", "=", "document", ".", "createComment", "(", "' '", ")", "Object", ".", "defineProperty", "(", "comment", ",", "'setAttribute'", ",", "{", "value", ":", "(", ")", "=>", "und...
Create comment node @private @author https://stackoverflow.com/questions/43003976/a-custom-directive-similar-to-v-if-in-vuejs#43543814
[ "Create", "comment", "node" ]
23323a43be269d91872bf124fa6e11488b079bb9
https://github.com/mblarsen/vue-browser-acl/blob/23323a43be269d91872bf124fa6e11488b079bb9/index.js#L175-L195
train
Moblox/mongo-xlsx
lib/mongo-xlsx.js
function(value, currentKeyArray) { var type = typeof value; var pushAnElement = function() { var access = currentKeyArray.reduce(buildColumnName); if (mongoModelMap[access]) { return; } mongoModelMap[access] = access; mongoModel.push({ displayName: access, access: access,...
javascript
function(value, currentKeyArray) { var type = typeof value; var pushAnElement = function() { var access = currentKeyArray.reduce(buildColumnName); if (mongoModelMap[access]) { return; } mongoModelMap[access] = access; mongoModel.push({ displayName: access, access: access,...
[ "function", "(", "value", ",", "currentKeyArray", ")", "{", "var", "type", "=", "typeof", "value", ";", "var", "pushAnElement", "=", "function", "(", ")", "{", "var", "access", "=", "currentKeyArray", ".", "reduce", "(", "buildColumnName", ")", ";", "if", ...
For quickly searching if value exist.
[ "For", "quickly", "searching", "if", "value", "exist", "." ]
805faae6fe4f2249ca3f9110317b8a480352480a
https://github.com/Moblox/mongo-xlsx/blob/805faae6fe4f2249ca3f9110317b8a480352480a/lib/mongo-xlsx.js#L18-L70
train
Inscryb/inscryb-markdown-editor
src/js/inscrybmde.js
toggleFullScreen
function toggleFullScreen(editor) { // Set fullscreen var cm = editor.codemirror; cm.setOption('fullScreen', !cm.getOption('fullScreen')); // Prevent scrolling on body during fullscreen active if (cm.getOption('fullScreen')) { saved_overflow = document.body.style.overflow; document...
javascript
function toggleFullScreen(editor) { // Set fullscreen var cm = editor.codemirror; cm.setOption('fullScreen', !cm.getOption('fullScreen')); // Prevent scrolling on body during fullscreen active if (cm.getOption('fullScreen')) { saved_overflow = document.body.style.overflow; document...
[ "function", "toggleFullScreen", "(", "editor", ")", "{", "// Set fullscreen", "var", "cm", "=", "editor", ".", "codemirror", ";", "cm", ".", "setOption", "(", "'fullScreen'", ",", "!", "cm", ".", "getOption", "(", "'fullScreen'", ")", ")", ";", "// Prevent s...
Toggle full screen of the editor.
[ "Toggle", "full", "screen", "of", "the", "editor", "." ]
76f1dad98625d778656fa5087313dab3f3368f8d
https://github.com/Inscryb/inscryb-markdown-editor/blob/76f1dad98625d778656fa5087313dab3f3368f8d/src/js/inscrybmde.js#L206-L247
train
Inscryb/inscryb-markdown-editor
src/js/inscrybmde.js
toggleSideBySide
function toggleSideBySide(editor) { var cm = editor.codemirror; var wrapper = cm.getWrapperElement(); var preview = wrapper.nextSibling; var toolbarButton = editor.toolbarElements['side-by-side']; var useSideBySideListener = false; if (/editor-preview-active-side/.test(preview.className)) { ...
javascript
function toggleSideBySide(editor) { var cm = editor.codemirror; var wrapper = cm.getWrapperElement(); var preview = wrapper.nextSibling; var toolbarButton = editor.toolbarElements['side-by-side']; var useSideBySideListener = false; if (/editor-preview-active-side/.test(preview.className)) { ...
[ "function", "toggleSideBySide", "(", "editor", ")", "{", "var", "cm", "=", "editor", ".", "codemirror", ";", "var", "wrapper", "=", "cm", ".", "getWrapperElement", "(", ")", ";", "var", "preview", "=", "wrapper", ".", "nextSibling", ";", "var", "toolbarBut...
Toggle side by side preview
[ "Toggle", "side", "by", "side", "preview" ]
76f1dad98625d778656fa5087313dab3f3368f8d
https://github.com/Inscryb/inscryb-markdown-editor/blob/76f1dad98625d778656fa5087313dab3f3368f8d/src/js/inscrybmde.js#L711-L766
train
thedillonb/http-shutdown
index.js
addShutdown
function addShutdown(server) { var connections = {}; var isShuttingDown = false; var connectionCounter = 0; function destroy(socket, force) { if (force || (socket._isIdle && isShuttingDown)) { socket.destroy(); delete connections[socket._connectionId]; } }; function onConnection(socket...
javascript
function addShutdown(server) { var connections = {}; var isShuttingDown = false; var connectionCounter = 0; function destroy(socket, force) { if (force || (socket._isIdle && isShuttingDown)) { socket.destroy(); delete connections[socket._connectionId]; } }; function onConnection(socket...
[ "function", "addShutdown", "(", "server", ")", "{", "var", "connections", "=", "{", "}", ";", "var", "isShuttingDown", "=", "false", ";", "var", "connectionCounter", "=", "0", ";", "function", "destroy", "(", "socket", ",", "force", ")", "{", "if", "(", ...
Adds shutdown functionaility to the `http.Server` object @param {http.Server} server The server to add shutdown functionaility to
[ "Adds", "shutdown", "functionaility", "to", "the", "http", ".", "Server", "object" ]
137da38b62d16a29abbfafe99b3a167cb0c192da
https://github.com/thedillonb/http-shutdown/blob/137da38b62d16a29abbfafe99b3a167cb0c192da/index.js#L14-L71
train
daviddias/webrtc-explorer
src/sig-server/routes-ws/index.js
join
function join (options) { if (options.peerId.length !== 12) { return this.emit('we-ready', new Error('Unvalid peerId length, must be 48 bits, received: ' + options.peerId).toString()) } if (peerTable[options.peerId]) { return this.emit('we-ready', new Error('peerId already exists').toString()) } pee...
javascript
function join (options) { if (options.peerId.length !== 12) { return this.emit('we-ready', new Error('Unvalid peerId length, must be 48 bits, received: ' + options.peerId).toString()) } if (peerTable[options.peerId]) { return this.emit('we-ready', new Error('peerId already exists').toString()) } pee...
[ "function", "join", "(", "options", ")", "{", "if", "(", "options", ".", "peerId", ".", "length", "!==", "12", ")", "{", "return", "this", ".", "emit", "(", "'we-ready'", ",", "new", "Error", "(", "'Unvalid peerId length, must be 48 bits, received: '", "+", ...
join this signaling server network
[ "join", "this", "signaling", "server", "network" ]
33ea3fd72712d0f356c7f73b5f8828490aa5417d
https://github.com/daviddias/webrtc-explorer/blob/33ea3fd72712d0f356c7f73b5f8828490aa5417d/src/sig-server/routes-ws/index.js#L25-L103
train
daviddias/webrtc-explorer
src/sig-server/routes-ws/index.js
notify
function notify () { const newId = options.peerId const peerIds = Object.keys(peerTable) // check for all the peers // if same id skip // if notify === false skip // check the first finger that matches the criteria for ideal or next to ideal peerIds.forEach((peerId) => { if (newId === ...
javascript
function notify () { const newId = options.peerId const peerIds = Object.keys(peerTable) // check for all the peers // if same id skip // if notify === false skip // check the first finger that matches the criteria for ideal or next to ideal peerIds.forEach((peerId) => { if (newId === ...
[ "function", "notify", "(", ")", "{", "const", "newId", "=", "options", ".", "peerId", "const", "peerIds", "=", "Object", ".", "keys", "(", "peerTable", ")", "// check for all the peers", "// if same id skip", "// if notify === false skip", "// check the first finger tha...
notify if to other peers if this new Peer is a best finger for them
[ "notify", "if", "to", "other", "peers", "if", "this", "new", "Peer", "is", "a", "best", "finger", "for", "them" ]
33ea3fd72712d0f356c7f73b5f8828490aa5417d
https://github.com/daviddias/webrtc-explorer/blob/33ea3fd72712d0f356c7f73b5f8828490aa5417d/src/sig-server/routes-ws/index.js#L58-L102
train
daviddias/webrtc-explorer
src/sig-server/routes-ws/index.js
updateFinger
function updateFinger (peerId, row) { var availablePeers = Object.keys(peerTable) availablePeers.splice(availablePeers.indexOf(peerId), 1) // if row hasn't been checked before if (!peerTable[peerId].fingers[row]) { peerTable[peerId].fingers[row] = { ideal: idealFinger(new Id(peerId), row).toHex(), ...
javascript
function updateFinger (peerId, row) { var availablePeers = Object.keys(peerTable) availablePeers.splice(availablePeers.indexOf(peerId), 1) // if row hasn't been checked before if (!peerTable[peerId].fingers[row]) { peerTable[peerId].fingers[row] = { ideal: idealFinger(new Id(peerId), row).toHex(), ...
[ "function", "updateFinger", "(", "peerId", ",", "row", ")", "{", "var", "availablePeers", "=", "Object", ".", "keys", "(", "peerTable", ")", "availablePeers", ".", "splice", "(", "availablePeers", ".", "indexOf", "(", "peerId", ")", ",", "1", ")", "// if r...
finds the best new Finger for the peerId's row 'row')
[ "finds", "the", "best", "new", "Finger", "for", "the", "peerId", "s", "row", "row", ")" ]
33ea3fd72712d0f356c7f73b5f8828490aa5417d
https://github.com/daviddias/webrtc-explorer/blob/33ea3fd72712d0f356c7f73b5f8828490aa5417d/src/sig-server/routes-ws/index.js#L106-L137
train
daviddias/webrtc-explorer
src/sig-server/routes-ws/index.js
forward
function forward (offer) { if (offer.answer) { peerTable[offer.srcId].socket .emit('we-handshake', offer) return } peerTable[offer.dstId].socket .emit('we-handshake', offer) }
javascript
function forward (offer) { if (offer.answer) { peerTable[offer.srcId].socket .emit('we-handshake', offer) return } peerTable[offer.dstId].socket .emit('we-handshake', offer) }
[ "function", "forward", "(", "offer", ")", "{", "if", "(", "offer", ".", "answer", ")", "{", "peerTable", "[", "offer", ".", "srcId", "]", ".", "socket", ".", "emit", "(", "'we-handshake'", ",", "offer", ")", "return", "}", "peerTable", "[", "offer", ...
forward an WebRTC offer to another peer
[ "forward", "an", "WebRTC", "offer", "to", "another", "peer" ]
33ea3fd72712d0f356c7f73b5f8828490aa5417d
https://github.com/daviddias/webrtc-explorer/blob/33ea3fd72712d0f356c7f73b5f8828490aa5417d/src/sig-server/routes-ws/index.js#L149-L157
train
daviddias/webrtc-explorer
src/explorer/index.js
connect
function connect (url, callback) { io = SocketIO.connect(url) io.on('connect', callback) }
javascript
function connect (url, callback) { io = SocketIO.connect(url) io.on('connect', callback) }
[ "function", "connect", "(", "url", ",", "callback", ")", "{", "io", "=", "SocketIO", ".", "connect", "(", "url", ")", "io", ".", "on", "(", "'connect'", ",", "callback", ")", "}" ]
connect to the sig-server
[ "connect", "to", "the", "sig", "-", "server" ]
33ea3fd72712d0f356c7f73b5f8828490aa5417d
https://github.com/daviddias/webrtc-explorer/blob/33ea3fd72712d0f356c7f73b5f8828490aa5417d/src/explorer/index.js#L119-L122
train
daviddias/webrtc-explorer
src/explorer/index.js
join
function join (callback) { log('connected to sig-server') io.emit('ss-join', { peerId: config.peerId.toHex(), notify: true }) io.on('we-update-finger', fingerTable.updateFinger(io)) io.on('we-handshake', channel.accept(io)) io.once('we-ready', callback) }
javascript
function join (callback) { log('connected to sig-server') io.emit('ss-join', { peerId: config.peerId.toHex(), notify: true }) io.on('we-update-finger', fingerTable.updateFinger(io)) io.on('we-handshake', channel.accept(io)) io.once('we-ready', callback) }
[ "function", "join", "(", "callback", ")", "{", "log", "(", "'connected to sig-server'", ")", "io", ".", "emit", "(", "'ss-join'", ",", "{", "peerId", ":", "config", ".", "peerId", ".", "toHex", "(", ")", ",", "notify", ":", "true", "}", ")", "io", "....
join the peerTable of the sig-server
[ "join", "the", "peerTable", "of", "the", "sig", "-", "server" ]
33ea3fd72712d0f356c7f73b5f8828490aa5417d
https://github.com/daviddias/webrtc-explorer/blob/33ea3fd72712d0f356c7f73b5f8828490aa5417d/src/explorer/index.js#L125-L135
train
zhaohaodang/vue-see
index.js
closest
function closest(el, fn) { return el && (fn(el) ? el : closest(el.parentNode, fn)); }
javascript
function closest(el, fn) { return el && (fn(el) ? el : closest(el.parentNode, fn)); }
[ "function", "closest", "(", "el", ",", "fn", ")", "{", "return", "el", "&&", "(", "fn", "(", "el", ")", "?", "el", ":", "closest", "(", "el", ".", "parentNode", ",", "fn", ")", ")", ";", "}" ]
find nearest parent element
[ "find", "nearest", "parent", "element" ]
8ba14d4c98024930cd80220daf3785be32c49781
https://github.com/zhaohaodang/vue-see/blob/8ba14d4c98024930cd80220daf3785be32c49781/index.js#L72-L74
train
bang88/typescript-react-intl
lib/index.js
main
function main(contents, options) { if (options === void 0) { options = { tagNames: [] }; } var sourceFile = ts.createSourceFile("file.ts", contents, ts.ScriptTarget.ES2015, /*setParentNodes */ false, ts.ScriptKind.TSX); var dm = findMethodCallsWithName(sourceFile, "defineMessages", extractMessagesForDe...
javascript
function main(contents, options) { if (options === void 0) { options = { tagNames: [] }; } var sourceFile = ts.createSourceFile("file.ts", contents, ts.ScriptTarget.ES2015, /*setParentNodes */ false, ts.ScriptKind.TSX); var dm = findMethodCallsWithName(sourceFile, "defineMessages", extractMessagesForDe...
[ "function", "main", "(", "contents", ",", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "{", "options", "=", "{", "tagNames", ":", "[", "]", "}", ";", "}", "var", "sourceFile", "=", "ts", ".", "createSourceFile", "(", "\"file.ts...
Parse tsx files
[ "Parse", "tsx", "files" ]
751b3036e0b3b1925e254d228818ec1a39363297
https://github.com/bang88/typescript-react-intl/blob/751b3036e0b3b1925e254d228818ec1a39363297/lib/index.js#L120-L137
train
bang88/typescript-react-intl
lib/index.js
getElementsMessages
function getElementsMessages(elements) { return elements .map(function (element) { var msg = {}; if (element.attributes) { element.attributes.properties.forEach(function (attr) { if (!ts.isJsxAttribute(attr) || !attr.initializer) { // Either Js...
javascript
function getElementsMessages(elements) { return elements .map(function (element) { var msg = {}; if (element.attributes) { element.attributes.properties.forEach(function (attr) { if (!ts.isJsxAttribute(attr) || !attr.initializer) { // Either Js...
[ "function", "getElementsMessages", "(", "elements", ")", "{", "return", "elements", ".", "map", "(", "function", "(", "element", ")", "{", "var", "msg", "=", "{", "}", ";", "if", "(", "element", ".", "attributes", ")", "{", "element", ".", "attributes", ...
convert JsxOpeningLikeElements to Message maps @param elements
[ "convert", "JsxOpeningLikeElements", "to", "Message", "maps" ]
751b3036e0b3b1925e254d228818ec1a39363297
https://github.com/bang88/typescript-react-intl/blob/751b3036e0b3b1925e254d228818ec1a39363297/lib/index.js#L142-L180
train
yahoohung/loopback-graphql-server
src/schema/query/viewer.js
getRelatedModelFields
function getRelatedModelFields(User) { const fields = {}; _.forEach(User.relations, (relation) => { const model = relation.modelTo; fields[_.lowerFirst(relation.name)] = { args: Object.assign({ where: { type: getType('JSON') }, ...
javascript
function getRelatedModelFields(User) { const fields = {}; _.forEach(User.relations, (relation) => { const model = relation.modelTo; fields[_.lowerFirst(relation.name)] = { args: Object.assign({ where: { type: getType('JSON') }, ...
[ "function", "getRelatedModelFields", "(", "User", ")", "{", "const", "fields", "=", "{", "}", ";", "_", ".", "forEach", "(", "User", ".", "relations", ",", "(", "relation", ")", "=>", "{", "const", "model", "=", "relation", ".", "modelTo", ";", "fields...
Adds fields of all relationed models @param {*} models
[ "Adds", "fields", "of", "all", "relationed", "models" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/query/viewer.js#L18-L46
train
yahoohung/loopback-graphql-server
src/schema/query/viewer.js
findUserFromAccessToken
function findUserFromAccessToken(accessToken, UserModel) { if (!accessToken) return null; return UserModel.findById(accessToken.userId).then((user) => { if (!user) return Promise.reject('No user with this access token was found.'); return Promise.resolve(user); }); }
javascript
function findUserFromAccessToken(accessToken, UserModel) { if (!accessToken) return null; return UserModel.findById(accessToken.userId).then((user) => { if (!user) return Promise.reject('No user with this access token was found.'); return Promise.resolve(user); }); }
[ "function", "findUserFromAccessToken", "(", "accessToken", ",", "UserModel", ")", "{", "if", "(", "!", "accessToken", ")", "return", "null", ";", "return", "UserModel", ".", "findById", "(", "accessToken", ".", "userId", ")", ".", "then", "(", "(", "user", ...
Finds a user from an access token @param {*} accessToken @param {*} UserModel
[ "Finds", "a", "user", "from", "an", "access", "token" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/query/viewer.js#L53-L61
train
yahoohung/loopback-graphql-server
src/schema/query/viewer.js
getMeField
function getMeField(User) { return { me: { type: getType(User.modelName), resolve: (obj, args, { app, req }) => { if (!req.accessToken) return null; return findUserFromAccessToken(req.accessToken, User); } } }; }
javascript
function getMeField(User) { return { me: { type: getType(User.modelName), resolve: (obj, args, { app, req }) => { if (!req.accessToken) return null; return findUserFromAccessToken(req.accessToken, User); } } }; }
[ "function", "getMeField", "(", "User", ")", "{", "return", "{", "me", ":", "{", "type", ":", "getType", "(", "User", ".", "modelName", ")", ",", "resolve", ":", "(", "obj", ",", "args", ",", "{", "app", ",", "req", "}", ")", "=>", "{", "if", "(...
Create a me field for a given user model @param {*} User
[ "Create", "a", "me", "field", "for", "a", "given", "user", "model" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/query/viewer.js#L67-L80
train
yahoohung/loopback-graphql-server
src/schema/ACLs/index.js
checkAccess
function checkAccess({ accessToken, id, model, method, options, ctx }) { return new Promise((resolve, reject) => { // ignore checking if does not enable auth if (model.app.isAuthEnabled) { if (!model.app.models.ACL) { console.log('ACL has not been setup, skipping ac...
javascript
function checkAccess({ accessToken, id, model, method, options, ctx }) { return new Promise((resolve, reject) => { // ignore checking if does not enable auth if (model.app.isAuthEnabled) { if (!model.app.models.ACL) { console.log('ACL has not been setup, skipping ac...
[ "function", "checkAccess", "(", "{", "accessToken", ",", "id", ",", "model", ",", "method", ",", "options", ",", "ctx", "}", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "// ignore checking if does not enable auth...
calls the check the ACLS on the model and return the access permission on method.
[ "calls", "the", "check", "the", "ACLS", "on", "the", "model", "and", "return", "the", "access", "permission", "on", "method", "." ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/ACLs/index.js#L2-L26
train
yahoohung/loopback-graphql-server
src/schema/utils/index.js
isRemoteMethodAllowed
function isRemoteMethodAllowed(method, allowedVerbs) { let httpArray = method.http; if (!_.isArray(method.http)) { httpArray = [method.http]; } const results = httpArray.map((item) => { const verb = item.verb; if (allowedVerbs && !_.includes(allowedVerbs, verb)) { ...
javascript
function isRemoteMethodAllowed(method, allowedVerbs) { let httpArray = method.http; if (!_.isArray(method.http)) { httpArray = [method.http]; } const results = httpArray.map((item) => { const verb = item.verb; if (allowedVerbs && !_.includes(allowedVerbs, verb)) { ...
[ "function", "isRemoteMethodAllowed", "(", "method", ",", "allowedVerbs", ")", "{", "let", "httpArray", "=", "method", ".", "http", ";", "if", "(", "!", "_", ".", "isArray", "(", "method", ".", "http", ")", ")", "{", "httpArray", "=", "[", "method", "."...
Checks if a given remote method allowed based on the allowed verbs @param {*} method @param {*} allowedVerbs
[ "Checks", "if", "a", "given", "remote", "method", "allowed", "based", "on", "the", "allowed", "verbs" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/utils/index.js#L25-L47
train
yahoohung/loopback-graphql-server
src/schema/utils/index.js
getRemoteMethodInput
function getRemoteMethodInput(method, isConnection = false) { const acceptingParams = {}; method.accepts.forEach((param) => { let paramType = ''; if (typeof param.type === 'object') { paramType = 'JSON'; } else if (!SCALARS[param.type.toLowerCase()]) { paramType ...
javascript
function getRemoteMethodInput(method, isConnection = false) { const acceptingParams = {}; method.accepts.forEach((param) => { let paramType = ''; if (typeof param.type === 'object') { paramType = 'JSON'; } else if (!SCALARS[param.type.toLowerCase()]) { paramType ...
[ "function", "getRemoteMethodInput", "(", "method", ",", "isConnection", "=", "false", ")", "{", "const", "acceptingParams", "=", "{", "}", ";", "method", ".", "accepts", ".", "forEach", "(", "(", "param", ")", "=>", "{", "let", "paramType", "=", "''", ";...
Extracts query params from a remote method @param {*} method
[ "Extracts", "query", "params", "from", "a", "remote", "method" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/utils/index.js#L53-L73
train
yahoohung/loopback-graphql-server
src/schema/utils/index.js
getRemoteMethodOutput
function getRemoteMethodOutput(method) { let returnType = 'JSON'; let list = false; if (method.returns && method.returns[0]) { if (!SCALARS[method.returns[0].type] && typeof method.returns[0].type !== 'object') { returnType = `${method.returns[0].type}`; } else { re...
javascript
function getRemoteMethodOutput(method) { let returnType = 'JSON'; let list = false; if (method.returns && method.returns[0]) { if (!SCALARS[method.returns[0].type] && typeof method.returns[0].type !== 'object') { returnType = `${method.returns[0].type}`; } else { re...
[ "function", "getRemoteMethodOutput", "(", "method", ")", "{", "let", "returnType", "=", "'JSON'", ";", "let", "list", "=", "false", ";", "if", "(", "method", ".", "returns", "&&", "method", ".", "returns", "[", "0", "]", ")", "{", "if", "(", "!", "SC...
Extracts query output fields from a remote method @param {*} method
[ "Extracts", "query", "output", "fields", "from", "a", "remote", "method" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/schema/utils/index.js#L79-L106
train
yahoohung/loopback-graphql-server
src/types/generateTypeDefs.js
mapRelation
function mapRelation(rel, modelName, relName) { let acceptingParams = Object.assign({}, { filter: { generated: false, type: 'JSON' } }, connectionArgs); types[modelName].meta.fields[relName] = { generated: true, meta: { relation: true, ...
javascript
function mapRelation(rel, modelName, relName) { let acceptingParams = Object.assign({}, { filter: { generated: false, type: 'JSON' } }, connectionArgs); types[modelName].meta.fields[relName] = { generated: true, meta: { relation: true, ...
[ "function", "mapRelation", "(", "rel", ",", "modelName", ",", "relName", ")", "{", "let", "acceptingParams", "=", "Object", ".", "assign", "(", "{", "}", ",", "{", "filter", ":", "{", "generated", ":", "false", ",", "type", ":", "'JSON'", "}", "}", "...
Maps a relationship as a connection property to a given type @param {*} rel @param {*} modelName @param {*} relName
[ "Maps", "a", "relationship", "as", "a", "connection", "property", "to", "a", "given", "type" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/types/generateTypeDefs.js#L181-L235
train
yahoohung/loopback-graphql-server
src/types/generateTypeDefs.js
mapType
function mapType(model) { types[model.modelName] = { generated: false, name: model.modelName, meta: { category: 'TYPE', fields: {} } }; _.forEach(model.definition.properties, (property, key) => { mapProperty(model, property, model.modelName, k...
javascript
function mapType(model) { types[model.modelName] = { generated: false, name: model.modelName, meta: { category: 'TYPE', fields: {} } }; _.forEach(model.definition.properties, (property, key) => { mapProperty(model, property, model.modelName, k...
[ "function", "mapType", "(", "model", ")", "{", "types", "[", "model", ".", "modelName", "]", "=", "{", "generated", ":", "false", ",", "name", ":", "model", ".", "modelName", ",", "meta", ":", "{", "category", ":", "'TYPE'", ",", "fields", ":", "{", ...
Generates a definition for a single model type @param {*} model
[ "Generates", "a", "definition", "for", "a", "single", "model", "type" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/types/generateTypeDefs.js#L241-L258
train
yahoohung/loopback-graphql-server
src/types/generateTypeDefs.js
mapInputType
function mapInputType(model) { const modelName = `${model.modelName}Input`; types[modelName] = { generated: false, name: modelName, meta: { category: 'TYPE', input: true, fields: {} } }; _.forEach(model.definition.properties, (propert...
javascript
function mapInputType(model) { const modelName = `${model.modelName}Input`; types[modelName] = { generated: false, name: modelName, meta: { category: 'TYPE', input: true, fields: {} } }; _.forEach(model.definition.properties, (propert...
[ "function", "mapInputType", "(", "model", ")", "{", "const", "modelName", "=", "`", "${", "model", ".", "modelName", "}", "`", ";", "types", "[", "modelName", "]", "=", "{", "generated", ":", "false", ",", "name", ":", "modelName", ",", "meta", ":", ...
Generates a definition for a single model input type @param {*} model
[ "Generates", "a", "definition", "for", "a", "single", "model", "input", "type" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/types/generateTypeDefs.js#L264-L280
train
yahoohung/loopback-graphql-server
src/types/generateTypeDefs.js
generateTypeDefs
function generateTypeDefs(models) { types = Object.assign({}, types, getCustomTypeDefs()); _.forEach(models, (model) => { mapType(model); mapInputType(model); }); return types; }
javascript
function generateTypeDefs(models) { types = Object.assign({}, types, getCustomTypeDefs()); _.forEach(models, (model) => { mapType(model); mapInputType(model); }); return types; }
[ "function", "generateTypeDefs", "(", "models", ")", "{", "types", "=", "Object", ".", "assign", "(", "{", "}", ",", "types", ",", "getCustomTypeDefs", "(", ")", ")", ";", "_", ".", "forEach", "(", "models", ",", "(", "model", ")", "=>", "{", "mapType...
building all models types & relationships
[ "building", "all", "models", "types", "&", "relationships" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/types/generateTypeDefs.js#L300-L310
train
yahoohung/loopback-graphql-server
src/types/generateType.js
generateType
function generateType(name, def) { // const def = _.find(getTypeDefs(), (o, n) => n === name); if (!name || !def) { return null; } // If def doesnt have {generated: false} prop, then it is // already a type. Hence return it as is. if (def.generated !== false) { return def; } def = _.clone(def...
javascript
function generateType(name, def) { // const def = _.find(getTypeDefs(), (o, n) => n === name); if (!name || !def) { return null; } // If def doesnt have {generated: false} prop, then it is // already a type. Hence return it as is. if (def.generated !== false) { return def; } def = _.clone(def...
[ "function", "generateType", "(", "name", ",", "def", ")", "{", "// const def = _.find(getTypeDefs(), (o, n) => n === name);", "if", "(", "!", "name", "||", "!", "def", ")", "{", "return", "null", ";", "}", "// If def doesnt have {generated: false} prop, then it is", "//...
Dynamically generate type based on the definition in typeDefs @param {*} name @param {*} def Type definition
[ "Dynamically", "generate", "type", "based", "on", "the", "definition", "in", "typeDefs" ]
7a624b1480f4bde10090ba744ba7a0108e393be7
https://github.com/yahoohung/loopback-graphql-server/blob/7a624b1480f4bde10090ba744ba7a0108e393be7/src/types/generateType.js#L146-L178
train
ForthHub/forth
lib/word.js
take
function take (delimeter) { var start, last, res; last = this.last; start = this.ptr; while (true) { if (this.ptr > last) { // good part res = this.buf.slice(start, this.ptr); return res; } if (this.buf[this.ptr].search(delimeter) === 0) { ...
javascript
function take (delimeter) { var start, last, res; last = this.last; start = this.ptr; while (true) { if (this.ptr > last) { // good part res = this.buf.slice(start, this.ptr); return res; } if (this.buf[this.ptr].search(delimeter) === 0) { ...
[ "function", "take", "(", "delimeter", ")", "{", "var", "start", ",", "last", ",", "res", ";", "last", "=", "this", ".", "last", ";", "start", "=", "this", ".", "ptr", ";", "while", "(", "true", ")", "{", "if", "(", "this", ".", "ptr", ">", "las...
Parse characters ccc delimited by 'delimeter'
[ "Parse", "characters", "ccc", "delimited", "by", "delimeter" ]
5f07870d2d6a05ff3bc258192a14810cfaf84c6a
https://github.com/ForthHub/forth/blob/5f07870d2d6a05ff3bc258192a14810cfaf84c6a/lib/word.js#L86-L105
train
project-sunbird/sunbird-telemetry-sdk
js/dist/index.js
function () { var s = document.createElement('span') /* * We need this css as in some weird browser this * span elements shows up for a microSec which creates a * bad user experience */ s.style.position = 'absolute' s.style.left = '-9999px' ...
javascript
function () { var s = document.createElement('span') /* * We need this css as in some weird browser this * span elements shows up for a microSec which creates a * bad user experience */ s.style.position = 'absolute' s.style.left = '-9999px' ...
[ "function", "(", ")", "{", "var", "s", "=", "document", ".", "createElement", "(", "'span'", ")", "/*\n * We need this css as in some weird browser this\n * span elements shows up for a microSec which creates a\n * bad user experience\n */", "s", ...
creates a span where the fonts will be loaded
[ "creates", "a", "span", "where", "the", "fonts", "will", "be", "loaded" ]
7f77635ae1100199fa804039e6839b08722f51e0
https://github.com/project-sunbird/sunbird-telemetry-sdk/blob/7f77635ae1100199fa804039e6839b08722f51e0/js/dist/index.js#L995-L1022
train
project-sunbird/sunbird-telemetry-sdk
js/dist/index.js
function (fontToDetect, baseFont) { var s = createSpan() s.style.fontFamily = "'" + fontToDetect + "'," + baseFont return s }
javascript
function (fontToDetect, baseFont) { var s = createSpan() s.style.fontFamily = "'" + fontToDetect + "'," + baseFont return s }
[ "function", "(", "fontToDetect", ",", "baseFont", ")", "{", "var", "s", "=", "createSpan", "(", ")", "s", ".", "style", ".", "fontFamily", "=", "\"'\"", "+", "fontToDetect", "+", "\"',\"", "+", "baseFont", "return", "s", "}" ]
creates a span and load the font to detect and a base font for fallback
[ "creates", "a", "span", "and", "load", "the", "font", "to", "detect", "and", "a", "base", "font", "for", "fallback" ]
7f77635ae1100199fa804039e6839b08722f51e0
https://github.com/project-sunbird/sunbird-telemetry-sdk/blob/7f77635ae1100199fa804039e6839b08722f51e0/js/dist/index.js#L1025-L1029
train
project-sunbird/sunbird-telemetry-sdk
js/dist/index.js
function () { var spans = [] for (var index = 0, length = baseFonts.length; index < length; index++) { var s = createSpan() s.style.fontFamily = baseFonts[index] baseFontsDiv.appendChild(s) spans.push(s) } return spans }
javascript
function () { var spans = [] for (var index = 0, length = baseFonts.length; index < length; index++) { var s = createSpan() s.style.fontFamily = baseFonts[index] baseFontsDiv.appendChild(s) spans.push(s) } return spans }
[ "function", "(", ")", "{", "var", "spans", "=", "[", "]", "for", "(", "var", "index", "=", "0", ",", "length", "=", "baseFonts", ".", "length", ";", "index", "<", "length", ";", "index", "++", ")", "{", "var", "s", "=", "createSpan", "(", ")", ...
creates spans for the base fonts and adds them to baseFontsDiv
[ "creates", "spans", "for", "the", "base", "fonts", "and", "adds", "them", "to", "baseFontsDiv" ]
7f77635ae1100199fa804039e6839b08722f51e0
https://github.com/project-sunbird/sunbird-telemetry-sdk/blob/7f77635ae1100199fa804039e6839b08722f51e0/js/dist/index.js#L1032-L1041
train
project-sunbird/sunbird-telemetry-sdk
js/dist/index.js
function () { var spans = {} for (var i = 0, l = fontList.length; i < l; i++) { var fontSpans = [] for (var j = 0, numDefaultFonts = baseFonts.length; j < numDefaultFonts; j++) { var s = createSpanWithFonts(fontList[i], baseFonts[j]) fontsDiv.appendChild(s) ...
javascript
function () { var spans = {} for (var i = 0, l = fontList.length; i < l; i++) { var fontSpans = [] for (var j = 0, numDefaultFonts = baseFonts.length; j < numDefaultFonts; j++) { var s = createSpanWithFonts(fontList[i], baseFonts[j]) fontsDiv.appendChild(s) ...
[ "function", "(", ")", "{", "var", "spans", "=", "{", "}", "for", "(", "var", "i", "=", "0", ",", "l", "=", "fontList", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "fontSpans", "=", "[", "]", "for", "(", "var", "j", ...
creates spans for the fonts to detect and adds them to fontsDiv
[ "creates", "spans", "for", "the", "fonts", "to", "detect", "and", "adds", "them", "to", "fontsDiv" ]
7f77635ae1100199fa804039e6839b08722f51e0
https://github.com/project-sunbird/sunbird-telemetry-sdk/blob/7f77635ae1100199fa804039e6839b08722f51e0/js/dist/index.js#L1044-L1056
train
project-sunbird/sunbird-telemetry-sdk
js/dist/index.js
function (fontSpans) { var detected = false for (var i = 0; i < baseFonts.length; i++) { detected = (fontSpans[i].offsetWidth !== defaultWidth[baseFonts[i]] || fontSpans[i].offsetHeight !== defaultHeight[baseFonts[i]]) if (detected) { return detected } }...
javascript
function (fontSpans) { var detected = false for (var i = 0; i < baseFonts.length; i++) { detected = (fontSpans[i].offsetWidth !== defaultWidth[baseFonts[i]] || fontSpans[i].offsetHeight !== defaultHeight[baseFonts[i]]) if (detected) { return detected } }...
[ "function", "(", "fontSpans", ")", "{", "var", "detected", "=", "false", "for", "(", "var", "i", "=", "0", ";", "i", "<", "baseFonts", ".", "length", ";", "i", "++", ")", "{", "detected", "=", "(", "fontSpans", "[", "i", "]", ".", "offsetWidth", ...
checks if a font is available
[ "checks", "if", "a", "font", "is", "available" ]
7f77635ae1100199fa804039e6839b08722f51e0
https://github.com/project-sunbird/sunbird-telemetry-sdk/blob/7f77635ae1100199fa804039e6839b08722f51e0/js/dist/index.js#L1059-L1068
train
optimizely/optimizely-node
lib/services/model_factory.js
function(data) { // use the supplied constructor // This allows a user to pass in instance: function Audience() {} // and have the Audience() function return an instance of Audience var instance = new InstanceConstructor(); var instanceData = _.extend( {}, _.cloneDeep(confi...
javascript
function(data) { // use the supplied constructor // This allows a user to pass in instance: function Audience() {} // and have the Audience() function return an instance of Audience var instance = new InstanceConstructor(); var instanceData = _.extend( {}, _.cloneDeep(confi...
[ "function", "(", "data", ")", "{", "// use the supplied constructor", "// This allows a user to pass in instance: function Audience() {}", "// and have the Audience() function return an instance of Audience", "var", "instance", "=", "new", "InstanceConstructor", "(", ")", ";", "var",...
Creates a new object with the config.fields as the default values @param {Object=} data @return {Object}
[ "Creates", "a", "new", "object", "with", "the", "config", ".", "fields", "as", "the", "default", "values" ]
36a7a1f9163b5f6e302cee3268762d056cfb1f42
https://github.com/optimizely/optimizely-node/blob/36a7a1f9163b5f6e302cee3268762d056cfb1f42/lib/services/model_factory.js#L38-L51
train
optimizely/optimizely-node
lib/services/model_factory.js
function(instance) { var loadData = function(data) { return _.extend(instance, data); }; if (instance.id) { // do PUT save return api .one(config.entity, instance.id) .put(instance) .then(loadData, console.error); } else { // no id i...
javascript
function(instance) { var loadData = function(data) { return _.extend(instance, data); }; if (instance.id) { // do PUT save return api .one(config.entity, instance.id) .put(instance) .then(loadData, console.error); } else { // no id i...
[ "function", "(", "instance", ")", "{", "var", "loadData", "=", "function", "(", "data", ")", "{", "return", "_", ".", "extend", "(", "instance", ",", "data", ")", ";", "}", ";", "if", "(", "instance", ".", "id", ")", "{", "// do PUT save", "return", ...
Persists entity using rest API @param {Model} instance @return {Promise}
[ "Persists", "entity", "using", "rest", "API" ]
36a7a1f9163b5f6e302cee3268762d056cfb1f42
https://github.com/optimizely/optimizely-node/blob/36a7a1f9163b5f6e302cee3268762d056cfb1f42/lib/services/model_factory.js#L59-L82
train
optimizely/optimizely-node
lib/services/model_factory.js
function(entityId) { return api .one(config.entity, entityId) .get() .then(this.create, console.error); }
javascript
function(entityId) { return api .one(config.entity, entityId) .get() .then(this.create, console.error); }
[ "function", "(", "entityId", ")", "{", "return", "api", ".", "one", "(", "config", ".", "entity", ",", "entityId", ")", ".", "get", "(", ")", ".", "then", "(", "this", ".", "create", ",", "console", ".", "error", ")", ";", "}" ]
Fetch and return an entity @param entityId Id of Entity to fetch @returns {Deferred} Resolves to fetched Model instance
[ "Fetch", "and", "return", "an", "entity" ]
36a7a1f9163b5f6e302cee3268762d056cfb1f42
https://github.com/optimizely/optimizely-node/blob/36a7a1f9163b5f6e302cee3268762d056cfb1f42/lib/services/model_factory.js#L89-L94
train
optimizely/optimizely-node
lib/services/model_factory.js
function(filters) { filters = _.clone(filters || {}); var endpoint = api; if (config.parent && !filters[config.parent.key]) { throw new Error("fetchAll: must supply the parent.key as a filter to fetch all entities"); } if (config.parent) { endpoint.one(config.parent.entit...
javascript
function(filters) { filters = _.clone(filters || {}); var endpoint = api; if (config.parent && !filters[config.parent.key]) { throw new Error("fetchAll: must supply the parent.key as a filter to fetch all entities"); } if (config.parent) { endpoint.one(config.parent.entit...
[ "function", "(", "filters", ")", "{", "filters", "=", "_", ".", "clone", "(", "filters", "||", "{", "}", ")", ";", "var", "endpoint", "=", "api", ";", "if", "(", "config", ".", "parent", "&&", "!", "filters", "[", "config", ".", "parent", ".", "k...
Fetches all the entities that match the supplied filters If the model has a parent association than the parent.key must be supplied. @param {Object|undefined} filters (optional) @return {Deferred}
[ "Fetches", "all", "the", "entities", "that", "match", "the", "supplied", "filters", "If", "the", "model", "has", "a", "parent", "association", "than", "the", "parent", ".", "key", "must", "be", "supplied", "." ]
36a7a1f9163b5f6e302cee3268762d056cfb1f42
https://github.com/optimizely/optimizely-node/blob/36a7a1f9163b5f6e302cee3268762d056cfb1f42/lib/services/model_factory.js#L103-L125
train
optimizely/optimizely-node
lib/services/model_factory.js
function(instance) { if (!instance.id) { throw new Error("delete(): `id` must be defined"); } return api .one(config.entity, instance.id) .delete(); }
javascript
function(instance) { if (!instance.id) { throw new Error("delete(): `id` must be defined"); } return api .one(config.entity, instance.id) .delete(); }
[ "function", "(", "instance", ")", "{", "if", "(", "!", "instance", ".", "id", ")", "{", "throw", "new", "Error", "(", "\"delete(): `id` must be defined\"", ")", ";", "}", "return", "api", ".", "one", "(", "config", ".", "entity", ",", "instance", ".", ...
Makes an API request to delete the instance by id @param {Model} instance
[ "Makes", "an", "API", "request", "to", "delete", "the", "instance", "by", "id" ]
36a7a1f9163b5f6e302cee3268762d056cfb1f42
https://github.com/optimizely/optimizely-node/blob/36a7a1f9163b5f6e302cee3268762d056cfb1f42/lib/services/model_factory.js#L131-L139
train
tombatossals/angular-openlayers-directive
src/services/olHelpers.js
recursiveStyle
function recursiveStyle(data, styleName) { var style; if (!styleName) { styleName = 'style'; style = data; } else { style = data[styleName]; } //Instead of defining one style for the layer, we've been given a style function //to apply t...
javascript
function recursiveStyle(data, styleName) { var style; if (!styleName) { styleName = 'style'; style = data; } else { style = data[styleName]; } //Instead of defining one style for the layer, we've been given a style function //to apply t...
[ "function", "recursiveStyle", "(", "data", ",", "styleName", ")", "{", "var", "style", ";", "if", "(", "!", "styleName", ")", "{", "styleName", "=", "'style'", ";", "style", "=", "data", ";", "}", "else", "{", "style", "=", "data", "[", "styleName", ...
Parse the style tree calling the appropriate constructors. The keys in styleMap can be used and the OpenLayers constructors can be used directly.
[ "Parse", "the", "style", "tree", "calling", "the", "appropriate", "constructors", ".", "The", "keys", "in", "styleMap", "can", "be", "used", "and", "the", "OpenLayers", "constructors", "can", "be", "used", "directly", "." ]
ead60778361ff86fd8c39c58cab93b1ec80873fb
https://github.com/tombatossals/angular-openlayers-directive/blob/ead60778361ff86fd8c39c58cab93b1ec80873fb/src/services/olHelpers.js#L80-L139
train
juttle/juttle
lib/runtime/modules/math.js
function(seed) { if (!values.isNumber(seed)) { throw errors.typeErrorFunction('Math.seed', 'number', seed); } _random = seedrandom(seed); return null; }
javascript
function(seed) { if (!values.isNumber(seed)) { throw errors.typeErrorFunction('Math.seed', 'number', seed); } _random = seedrandom(seed); return null; }
[ "function", "(", "seed", ")", "{", "if", "(", "!", "values", ".", "isNumber", "(", "seed", ")", ")", "{", "throw", "errors", ".", "typeErrorFunction", "(", "'Math.seed'", ",", "'number'", ",", "seed", ")", ";", "}", "_random", "=", "seedrandom", "(", ...
juttle's global RNG
[ "juttle", "s", "global", "RNG" ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/modules/math.js#L37-L43
train
juttle/juttle
lib/compiler/optimize/optimize.js
optimize
function optimize(graph, Juttle) { var reads = _.where(graph.get_roots(), {type: 'ReadProc'}); _.each(reads, function(node) {optimize_read(node, graph, Juttle);}); }
javascript
function optimize(graph, Juttle) { var reads = _.where(graph.get_roots(), {type: 'ReadProc'}); _.each(reads, function(node) {optimize_read(node, graph, Juttle);}); }
[ "function", "optimize", "(", "graph", ",", "Juttle", ")", "{", "var", "reads", "=", "_", ".", "where", "(", "graph", ".", "get_roots", "(", ")", ",", "{", "type", ":", "'ReadProc'", "}", ")", ";", "_", ".", "each", "(", "reads", ",", "function", ...
The flowgraph processor that is the main entry point for optimization. For each read proc in the graph, there are various optimizations that can be performed depending on what the adapter supports and the specific program structure. To implement this support, traverse the flowgraph and check for the various patterns ...
[ "The", "flowgraph", "processor", "that", "is", "the", "main", "entry", "point", "for", "optimization", ".", "For", "each", "read", "proc", "in", "the", "graph", "there", "are", "various", "optimizations", "that", "can", "be", "performed", "depending", "on", ...
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/compiler/optimize/optimize.js#L100-L103
train
juttle/juttle
lib/compiler/ast-visitor.js
addVisitFunction
function addVisitFunction(type) { ASTVisitor.prototype['visit' + type] = function(node) { var self = this; var extraArgs = Array.prototype.slice.call(arguments, 1); if (DEBUG) { checkNode(node); } NODE_CHILDREN[type].forEach(function(property) { var ...
javascript
function addVisitFunction(type) { ASTVisitor.prototype['visit' + type] = function(node) { var self = this; var extraArgs = Array.prototype.slice.call(arguments, 1); if (DEBUG) { checkNode(node); } NODE_CHILDREN[type].forEach(function(property) { var ...
[ "function", "addVisitFunction", "(", "type", ")", "{", "ASTVisitor", ".", "prototype", "[", "'visit'", "+", "type", "]", "=", "function", "(", "node", ")", "{", "var", "self", "=", "this", ";", "var", "extraArgs", "=", "Array", ".", "prototype", ".", "...
END DEBUGGING FUNCTIONS
[ "END", "DEBUGGING", "FUNCTIONS" ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/compiler/ast-visitor.js#L188-L211
train
juttle/juttle
lib/compiler/flowgraph/implicit_views.js
implicit_views
function implicit_views(g, options) { var default_view = options.default_view || 'table'; var leaves = g.get_leaves(); var table; _.each(leaves, function(node) { if (!is_sink(node)) { table = g.add_node('View', default_view); g.add_edge(node, table); } }); }
javascript
function implicit_views(g, options) { var default_view = options.default_view || 'table'; var leaves = g.get_leaves(); var table; _.each(leaves, function(node) { if (!is_sink(node)) { table = g.add_node('View', default_view); g.add_edge(node, table); } }); }
[ "function", "implicit_views", "(", "g", ",", "options", ")", "{", "var", "default_view", "=", "options", ".", "default_view", "||", "'table'", ";", "var", "leaves", "=", "g", ".", "get_leaves", "(", ")", ";", "var", "table", ";", "_", ".", "each", "(",...
Generate a graph builder that adds an implicit sink of the given type to any branches of the graph that don't already end in a sink.
[ "Generate", "a", "graph", "builder", "that", "adds", "an", "implicit", "sink", "of", "the", "given", "type", "to", "any", "branches", "of", "the", "graph", "that", "don", "t", "already", "end", "in", "a", "sink", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/compiler/flowgraph/implicit_views.js#L8-L19
train
juttle/juttle
lib/errors.js
locate
function locate(fn, location) { try { return fn(); } catch (e) { if (e instanceof JuttleError && !e.info.location) { e.info.location = location; } throw e; } }
javascript
function locate(fn, location) { try { return fn(); } catch (e) { if (e instanceof JuttleError && !e.info.location) { e.info.location = location; } throw e; } }
[ "function", "locate", "(", "fn", ",", "location", ")", "{", "try", "{", "return", "fn", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "e", "instanceof", "JuttleError", "&&", "!", "e", ".", "info", ".", "location", ")", "{", "e", "...
Adds specified location to any Juttle exception thrown when executing specified function. If the function does not throw any exception, returns its result.
[ "Adds", "specified", "location", "to", "any", "Juttle", "exception", "thrown", "when", "executing", "specified", "function", ".", "If", "the", "function", "does", "not", "throw", "any", "exception", "returns", "its", "result", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/errors.js#L96-L106
train
juttle/juttle
lib/runtime/values.js
function(value) { switch (typeof value) { case 'boolean': return 'Boolean'; case 'number': return 'Number'; case 'string': return 'String'; case 'object': if (value === null) { ...
javascript
function(value) { switch (typeof value) { case 'boolean': return 'Boolean'; case 'number': return 'Number'; case 'string': return 'String'; case 'object': if (value === null) { ...
[ "function", "(", "value", ")", "{", "switch", "(", "typeof", "value", ")", "{", "case", "'boolean'", ":", "return", "'Boolean'", ";", "case", "'number'", ":", "return", "'Number'", ";", "case", "'string'", ":", "return", "'String'", ";", "case", "'object'"...
Returns a Juttle type represented by a JavaScript value. Throws an exception if the JavaScript value doesn't represent any Juttle type.
[ "Returns", "a", "Juttle", "type", "represented", "by", "a", "JavaScript", "value", ".", "Throws", "an", "exception", "if", "the", "JavaScript", "value", "doesn", "t", "represent", "any", "Juttle", "type", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/values.js#L99-L143
train
juttle/juttle
lib/runtime/values.js
function(a, b) { var self = this; function equalArrays(a, b) { if (a.length !== b.length) { return false; } var length = a.length; var i; for (i = 0; i < length; i++) { if (!self.equal(a[i], b[i])) { ...
javascript
function(a, b) { var self = this; function equalArrays(a, b) { if (a.length !== b.length) { return false; } var length = a.length; var i; for (i = 0; i < length; i++) { if (!self.equal(a[i], b[i])) { ...
[ "function", "(", "a", ",", "b", ")", "{", "var", "self", "=", "this", ";", "function", "equalArrays", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "length", "!==", "b", ".", "length", ")", "{", "return", "false", ";", "}", "var", "length"...
Determines whether two Juttle values are equal.
[ "Determines", "whether", "two", "Juttle", "values", "are", "equal", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/values.js#L290-L368
train
juttle/juttle
lib/runtime/values.js
function(value) { switch (values.typeOf(value)) { case 'Null': case 'Boolean': case 'String': case 'Number': return value; case 'RegExp': return String(value); case 'Date': case 'Duration': ...
javascript
function(value) { switch (values.typeOf(value)) { case 'Null': case 'Boolean': case 'String': case 'Number': return value; case 'RegExp': return String(value); case 'Date': case 'Duration': ...
[ "function", "(", "value", ")", "{", "switch", "(", "values", ".", "typeOf", "(", "value", ")", ")", "{", "case", "'Null'", ":", "case", "'Boolean'", ":", "case", "'String'", ":", "case", "'Number'", ":", "return", "value", ";", "case", "'RegExp'", ":",...
Returns a value that can be serialized to JSON.
[ "Returns", "a", "value", "that", "can", "be", "serialized", "to", "JSON", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/values.js#L371-L395
train
juttle/juttle
lib/runtime/values.js
function(value) { switch (values.typeOf(value)) { case 'Null': return { type: 'NullLiteral' }; case 'Boolean': return { type: 'BooleanLiteral', value: value }; case 'Number': if (value !== value) { return {...
javascript
function(value) { switch (values.typeOf(value)) { case 'Null': return { type: 'NullLiteral' }; case 'Boolean': return { type: 'BooleanLiteral', value: value }; case 'Number': if (value !== value) { return {...
[ "function", "(", "value", ")", "{", "switch", "(", "values", ".", "typeOf", "(", "value", ")", ")", "{", "case", "'Null'", ":", "return", "{", "type", ":", "'NullLiteral'", "}", ";", "case", "'Boolean'", ":", "return", "{", "type", ":", "'BooleanLitera...
Returns an AST corresponding to a Juttle value.
[ "Returns", "an", "AST", "corresponding", "to", "a", "Juttle", "value", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/values.js#L483-L537
train
juttle/juttle
lib/compiler/flowgraph/program_stats.js
extract_program_stats
function extract_program_stats(prog) { var stats = {}; var sources_array = source_stats(prog); stats.inputs = input_stats(prog); stats.input_total = count_procs(stats.inputs); stats.sources = sources_array; stats.source_total = sources_array.length; stats.reducers = reducer_stats(prog); ...
javascript
function extract_program_stats(prog) { var stats = {}; var sources_array = source_stats(prog); stats.inputs = input_stats(prog); stats.input_total = count_procs(stats.inputs); stats.sources = sources_array; stats.source_total = sources_array.length; stats.reducers = reducer_stats(prog); ...
[ "function", "extract_program_stats", "(", "prog", ")", "{", "var", "stats", "=", "{", "}", ";", "var", "sources_array", "=", "source_stats", "(", "prog", ")", ";", "stats", ".", "inputs", "=", "input_stats", "(", "prog", ")", ";", "stats", ".", "input_to...
Call this with a Program object
[ "Call", "this", "with", "a", "Program", "object" ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/compiler/flowgraph/program_stats.js#L161-L179
train
juttle/juttle
lib/runtime/adapters.js
loadAdapter
function loadAdapter(type, location) { var options = adapterConfig[type]; try { var modulePath = adapterModulePath(type, options); global.JuttleAdapterAPI = JuttleAdapterAPI; var start = new Date(); if (!options.builtin) { checkCompatible(type, modulePath, location...
javascript
function loadAdapter(type, location) { var options = adapterConfig[type]; try { var modulePath = adapterModulePath(type, options); global.JuttleAdapterAPI = JuttleAdapterAPI; var start = new Date(); if (!options.builtin) { checkCompatible(type, modulePath, location...
[ "function", "loadAdapter", "(", "type", ",", "location", ")", "{", "var", "options", "=", "adapterConfig", "[", "type", "]", ";", "try", "{", "var", "modulePath", "=", "adapterModulePath", "(", "type", ",", "options", ")", ";", "global", ".", "JuttleAdapte...
Load the adapter of the given type.
[ "Load", "the", "adapter", "of", "the", "given", "type", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/adapters.js#L62-L97
train
juttle/juttle
lib/runtime/adapters.js
checkCompatible
function checkCompatible(type, modulePath, location) { var adapterPackage = require(path.join(modulePath, 'package.json')); var adapterJuttleVersion = adapterPackage.juttleAdapterAPI; if (!adapterJuttleVersion) { throw errors.compileError('INCOMPATIBLE-ADAPTER', { type, adapt...
javascript
function checkCompatible(type, modulePath, location) { var adapterPackage = require(path.join(modulePath, 'package.json')); var adapterJuttleVersion = adapterPackage.juttleAdapterAPI; if (!adapterJuttleVersion) { throw errors.compileError('INCOMPATIBLE-ADAPTER', { type, adapt...
[ "function", "checkCompatible", "(", "type", ",", "modulePath", ",", "location", ")", "{", "var", "adapterPackage", "=", "require", "(", "path", ".", "join", "(", "modulePath", ",", "'package.json'", ")", ")", ";", "var", "adapterJuttleVersion", "=", "adapterPa...
Check whether the given adapter is compatible with this version of the juttle runtime by extracting the juttleAdapterAPI entry from the adapter's package.json and comparing it to the declared version of the API.
[ "Check", "whether", "the", "given", "adapter", "is", "compatible", "with", "this", "version", "of", "the", "juttle", "runtime", "by", "extracting", "the", "juttleAdapterAPI", "entry", "from", "the", "adapter", "s", "package", ".", "json", "and", "comparing", "...
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/adapters.js#L102-L122
train
juttle/juttle
lib/runtime/adapters.js
configure
function configure(config) { config = config || {}; logger.debug('configuring adapters', _.keys(config).join(',')); _.extend(adapterConfig, _.clone(config)); logger.debug('configuring builtin adapters'); _.each(BUILTIN_ADAPTERS, function(adapter) { adapterConfig[adapter] = { pat...
javascript
function configure(config) { config = config || {}; logger.debug('configuring adapters', _.keys(config).join(',')); _.extend(adapterConfig, _.clone(config)); logger.debug('configuring builtin adapters'); _.each(BUILTIN_ADAPTERS, function(adapter) { adapterConfig[adapter] = { pat...
[ "function", "configure", "(", "config", ")", "{", "config", "=", "config", "||", "{", "}", ";", "logger", ".", "debug", "(", "'configuring adapters'", ",", "_", ".", "keys", "(", "config", ")", ".", "join", "(", "','", ")", ")", ";", "_", ".", "ext...
Add configuration for the specified adapters but don't initialize them until they are actually used.
[ "Add", "configuration", "for", "the", "specified", "adapters", "but", "don", "t", "initialize", "them", "until", "they", "are", "actually", "used", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/adapters.js#L126-L138
train
juttle/juttle
lib/runtime/adapters.js
list
function list() { var adapters = []; _.each(adapterConfig, function(config, adapter) { var modulePath = adapterModulePath(adapter, config); var version, installPath, moduleName; var isBuiltin = BUILTIN_ADAPTERS.indexOf(adapter) !== -1; var loaded = true; if (isBuiltin) {...
javascript
function list() { var adapters = []; _.each(adapterConfig, function(config, adapter) { var modulePath = adapterModulePath(adapter, config); var version, installPath, moduleName; var isBuiltin = BUILTIN_ADAPTERS.indexOf(adapter) !== -1; var loaded = true; if (isBuiltin) {...
[ "function", "list", "(", ")", "{", "var", "adapters", "=", "[", "]", ";", "_", ".", "each", "(", "adapterConfig", ",", "function", "(", "config", ",", "adapter", ")", "{", "var", "modulePath", "=", "adapterModulePath", "(", "adapter", ",", "config", ")...
Return a list of all configured adapters and their versions.
[ "Return", "a", "list", "of", "all", "configured", "adapters", "and", "their", "versions", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/adapters.js#L141-L170
train
juttle/juttle
lib/runtime/procs/stoke/util.js
bound
function bound(val, min, max) { // trim the value to be within min..max (if min..max are specified) val = (min !== undefined)? Math.max(val, min) : val; val = (max !== undefined)? Math.min(val, max) : val; return val ; }
javascript
function bound(val, min, max) { // trim the value to be within min..max (if min..max are specified) val = (min !== undefined)? Math.max(val, min) : val; val = (max !== undefined)? Math.min(val, max) : val; return val ; }
[ "function", "bound", "(", "val", ",", "min", ",", "max", ")", "{", "// trim the value to be within min..max (if min..max are specified)", "val", "=", "(", "min", "!==", "undefined", ")", "?", "Math", ".", "max", "(", "val", ",", "min", ")", ":", "val", ";", ...
useful stuff for random timeseries.
[ "useful", "stuff", "for", "random", "timeseries", "." ]
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/procs/stoke/util.js#L16-L21
train
juttle/juttle
lib/runtime/procs/reduce.js
reduce
function reduce(options, params, location, program) { return options.every? new reduce_every(options, params, location, program) : new reduce_batch(options, params, location, program); }
javascript
function reduce(options, params, location, program) { return options.every? new reduce_every(options, params, location, program) : new reduce_batch(options, params, location, program); }
[ "function", "reduce", "(", "options", ",", "params", ",", "location", ",", "program", ")", "{", "return", "options", ".", "every", "?", "new", "reduce_every", "(", "options", ",", "params", ",", "location", ",", "program", ")", ":", "new", "reduce_batch", ...
juttle reduce. Whether you get a batch-driven reducer or a data-driven reducer with its own epochs is decided by the presence of an -every option to reduce.
[ "juttle", "reduce", ".", "Whether", "you", "get", "a", "batch", "-", "driven", "reducer", "or", "a", "data", "-", "driven", "reducer", "with", "its", "own", "epochs", "is", "decided", "by", "the", "presence", "of", "an", "-", "every", "option", "to", "...
21b49f96a0e0b2098de1673c3645a6cb673ea5a8
https://github.com/juttle/juttle/blob/21b49f96a0e0b2098de1673c3645a6cb673ea5a8/lib/runtime/procs/reduce.js#L353-L355
train
makinacorpus/Leaflet.Snap
leaflet.snap.js
function(e) { L.EditToolbar.Edit.prototype._enableLayerEdit.call(this, e); var layer = e.layer || e.target || e; if (!layer.snapediting) { if (layer.hasOwnProperty('_mRadius')) { if (layer.editing) { layer.editing._markerGroup.clearLayers(); ...
javascript
function(e) { L.EditToolbar.Edit.prototype._enableLayerEdit.call(this, e); var layer = e.layer || e.target || e; if (!layer.snapediting) { if (layer.hasOwnProperty('_mRadius')) { if (layer.editing) { layer.editing._markerGroup.clearLayers(); ...
[ "function", "(", "e", ")", "{", "L", ".", "EditToolbar", ".", "Edit", ".", "prototype", ".", "_enableLayerEdit", ".", "call", "(", "this", ",", "e", ")", ";", "var", "layer", "=", "e", ".", "layer", "||", "e", ".", "target", "||", "e", ";", "if",...
essentially, the idea here is that we're gonna find the currently instantiated L.Edit handler, figure out its type, get rid of it, and then replace it with a snapedit instead
[ "essentially", "the", "idea", "here", "is", "that", "we", "re", "gonna", "find", "the", "currently", "instantiated", "L", ".", "Edit", "handler", "figure", "out", "its", "type", "get", "rid", "of", "it", "and", "then", "replace", "it", "with", "a", "snap...
bdcc9a3554dd11c0f5bc22ede813db1e6e122327
https://github.com/makinacorpus/Leaflet.Snap/blob/bdcc9a3554dd11c0f5bc22ede813db1e6e122327/leaflet.snap.js#L467-L520
train
RReverser/mpegts
browser.js
nextFrame
function nextFrame() { if (currentVideo.paused || currentVideo.ended) { return; } context.drawImage(currentVideo, 0, 0); requestAnimationFrame(nextFrame); }
javascript
function nextFrame() { if (currentVideo.paused || currentVideo.ended) { return; } context.drawImage(currentVideo, 0, 0); requestAnimationFrame(nextFrame); }
[ "function", "nextFrame", "(", ")", "{", "if", "(", "currentVideo", ".", "paused", "||", "currentVideo", ".", "ended", ")", "{", "return", ";", "}", "context", ".", "drawImage", "(", "currentVideo", ",", "0", ",", "0", ")", ";", "requestAnimationFrame", "...
drawing new frame
[ "drawing", "new", "frame" ]
013ff8a03395b2404d3021d4b84be437ce683f56
https://github.com/RReverser/mpegts/blob/013ff8a03395b2404d3021d4b84be437ce683f56/browser.js#L21-L27
train
RReverser/mpegts
browser.js
getMore
function getMore() { var ajax = new XMLHttpRequest(); ajax.addEventListener('load', function () { var originals = this.responseText .split(/\r?\n/) .filter(RegExp.prototype.test.bind(/\.ts$/)) .map(resolveURL.bind(null, manifest)); originals = originals.slice(originals.lastIndexOf(lastOrigina...
javascript
function getMore() { var ajax = new XMLHttpRequest(); ajax.addEventListener('load', function () { var originals = this.responseText .split(/\r?\n/) .filter(RegExp.prototype.test.bind(/\.ts$/)) .map(resolveURL.bind(null, manifest)); originals = originals.slice(originals.lastIndexOf(lastOrigina...
[ "function", "getMore", "(", ")", "{", "var", "ajax", "=", "new", "XMLHttpRequest", "(", ")", ";", "ajax", ".", "addEventListener", "(", "'load'", ",", "function", "(", ")", "{", "var", "originals", "=", "this", ".", "responseText", ".", "split", "(", "...
loading more videos from manifest
[ "loading", "more", "videos", "from", "manifest" ]
013ff8a03395b2404d3021d4b84be437ce683f56
https://github.com/RReverser/mpegts/blob/013ff8a03395b2404d3021d4b84be437ce683f56/browser.js#L127-L149
train
akottr/dragtable
jquery.dragtable.js
function() { var i, j, col1, col2; var from = this.originalTable.startIndex; var to = this.originalTable.endIndex; /* Find children thead and tbody. * Only to process the immediate tr-children. Bugfix for inner tables */ var thtb = this.originalTable.el.children(); if (...
javascript
function() { var i, j, col1, col2; var from = this.originalTable.startIndex; var to = this.originalTable.endIndex; /* Find children thead and tbody. * Only to process the immediate tr-children. Bugfix for inner tables */ var thtb = this.originalTable.el.children(); if (...
[ "function", "(", ")", "{", "var", "i", ",", "j", ",", "col1", ",", "col2", ";", "var", "from", "=", "this", ".", "originalTable", ".", "startIndex", ";", "var", "to", "=", "this", ".", "originalTable", ".", "endIndex", ";", "/* Find children thead and tb...
bubble the moved col left or right
[ "bubble", "the", "moved", "col", "left", "or", "right" ]
e916264057bd495a6870bd576e756a179aec5c90
https://github.com/akottr/dragtable/blob/e916264057bd495a6870bd576e756a179aec5c90/jquery.dragtable.js#L117-L149
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/tokenizer.js
getTokensLength
function getTokensLength(tokens) { if (typeof tokens === 'string') { return tokens.length; } return tokens.reduce((acc, token) => { return acc + (token.length ? token.length : 0); }, 0); }
javascript
function getTokensLength(tokens) { if (typeof tokens === 'string') { return tokens.length; } return tokens.reduce((acc, token) => { return acc + (token.length ? token.length : 0); }, 0); }
[ "function", "getTokensLength", "(", "tokens", ")", "{", "if", "(", "typeof", "tokens", "===", "'string'", ")", "{", "return", "tokens", ".", "length", ";", "}", "return", "tokens", ".", "reduce", "(", "(", "acc", ",", "token", ")", "=>", "{", "return",...
getTokensLength - Function calculate tokens' length @param tokens @returns {Number}
[ "getTokensLength", "-", "Function", "calculate", "tokens", "length" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/tokenizer.js#L69-L76
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/tokenizer.js
getHeaderContent
function getHeaderContent(tokens, type, markup) { if (tokens[1].children.length === 0) { tokens[1].children.push(getEmptyText()); } else if (tokens[1].children[0].type !== 'text') { tokens[1].children.unshift(getEmptyText()); } const content = changeText(tokens[1].children, markup); return { type,...
javascript
function getHeaderContent(tokens, type, markup) { if (tokens[1].children.length === 0) { tokens[1].children.push(getEmptyText()); } else if (tokens[1].children[0].type !== 'text') { tokens[1].children.unshift(getEmptyText()); } const content = changeText(tokens[1].children, markup); return { type,...
[ "function", "getHeaderContent", "(", "tokens", ",", "type", ",", "markup", ")", "{", "if", "(", "tokens", "[", "1", "]", ".", "children", ".", "length", "===", "0", ")", "{", "tokens", "[", "1", "]", ".", "children", ".", "push", "(", "getEmptyText",...
getHeaderContent - Function create content for header-token @param tokens @param type @param markup @returns {{type: *, content}}
[ "getHeaderContent", "-", "Function", "create", "content", "for", "header", "-", "token" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/tokenizer.js#L105-L117
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/tokenizer.js
getBlockContent
function getBlockContent(tokens, type, markup, start = false) { const content = { type, content: processBlockTokens(tokens.slice(1, -1)), // eslint-disable-line markup }; if (start) { content.start = start; } return content; }
javascript
function getBlockContent(tokens, type, markup, start = false) { const content = { type, content: processBlockTokens(tokens.slice(1, -1)), // eslint-disable-line markup }; if (start) { content.start = start; } return content; }
[ "function", "getBlockContent", "(", "tokens", ",", "type", ",", "markup", ",", "start", "=", "false", ")", "{", "const", "content", "=", "{", "type", ",", "content", ":", "processBlockTokens", "(", "tokens", ".", "slice", "(", "1", ",", "-", "1", ")", ...
getBlockContent - Function returns block content @param tokens @param type @param markup @param start @returns {{type: *, content, markup: *}}
[ "getBlockContent", "-", "Function", "returns", "block", "content" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/tokenizer.js#L129-L139
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/tokenizer.js
getUrlToken
function getUrlToken({ tokens, intEmphasis, num }) { const urlContent = `(${getAttr(tokens[num].attrs, 'href')})`; const urlLength = urlContent.length; const punctuation1 = { type: "punctuation", content: "[", length: 1 }; const punctuation2 = { type: "punctuation", content: "]", lengt...
javascript
function getUrlToken({ tokens, intEmphasis, num }) { const urlContent = `(${getAttr(tokens[num].attrs, 'href')})`; const urlLength = urlContent.length; const punctuation1 = { type: "punctuation", content: "[", length: 1 }; const punctuation2 = { type: "punctuation", content: "]", lengt...
[ "function", "getUrlToken", "(", "{", "tokens", ",", "intEmphasis", ",", "num", "}", ")", "{", "const", "urlContent", "=", "`", "${", "getAttr", "(", "tokens", "[", "num", "]", ".", "attrs", ",", "'href'", ")", "}", "`", ";", "const", "urlLength", "="...
getUrlToken - Function create url-token @param tokens @param intEmphasis @param num @returns {{type: string, content: [null,null,null,null], length: *}}
[ "getUrlToken", "-", "Function", "create", "url", "-", "token" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/tokenizer.js#L246-L272
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/tokenizer.js
getEmphasisToken
function getEmphasisToken({ tokens, intEmphasis, currTag, num }) { const rawContent = joinArrString(_.flattenDeep([ tokens[num].markup, intEmphasis, tokens[num].markup ])); const contentLength = getTokensLength(rawContent); return { type: getEmphasisType(currTag), content: rawContent, le...
javascript
function getEmphasisToken({ tokens, intEmphasis, currTag, num }) { const rawContent = joinArrString(_.flattenDeep([ tokens[num].markup, intEmphasis, tokens[num].markup ])); const contentLength = getTokensLength(rawContent); return { type: getEmphasisType(currTag), content: rawContent, le...
[ "function", "getEmphasisToken", "(", "{", "tokens", ",", "intEmphasis", ",", "currTag", ",", "num", "}", ")", "{", "const", "rawContent", "=", "joinArrString", "(", "_", ".", "flattenDeep", "(", "[", "tokens", "[", "num", "]", ".", "markup", ",", "intEmp...
getEmphasisToken - Function create emphasis-token @param tokens @param intEmphasis @param currTag @param num @returns {{type, content, length}}
[ "getEmphasisToken", "-", "Function", "create", "emphasis", "-", "token" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/tokenizer.js#L284-L296
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/tokenizer.js
parseEmphasis
function parseEmphasis(tokens) { const newTokens = []; let i = 0; while (i < tokens.length) { if (typeof tokens[i] === 'string') { if (tokens[i] !== '') { newTokens.push(tokens[i]); } i++; } else { const currTag = tokens[i].type; if (INLINE_OPEN.indexOf(currTag) !== -...
javascript
function parseEmphasis(tokens) { const newTokens = []; let i = 0; while (i < tokens.length) { if (typeof tokens[i] === 'string') { if (tokens[i] !== '') { newTokens.push(tokens[i]); } i++; } else { const currTag = tokens[i].type; if (INLINE_OPEN.indexOf(currTag) !== -...
[ "function", "parseEmphasis", "(", "tokens", ")", "{", "const", "newTokens", "=", "[", "]", ";", "let", "i", "=", "0", ";", "while", "(", "i", "<", "tokens", ".", "length", ")", "{", "if", "(", "typeof", "tokens", "[", "i", "]", "===", "'string'", ...
parseEmphasis - Function parse inline and extract emphasis-tokens @param tokens @returns {Array}
[ "parseEmphasis", "-", "Function", "parse", "inline", "and", "extract", "emphasis", "-", "tokens" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/tokenizer.js#L305-L338
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
hasMarkOnChar
function hasMarkOnChar(character, mark) { const arrChars = character.marks.toJS(); const marksSize = arrChars.length; for (let i = 0; i < marksSize; i++) { if (arrChars[i].type === mark) { return true; } } return false; }
javascript
function hasMarkOnChar(character, mark) { const arrChars = character.marks.toJS(); const marksSize = arrChars.length; for (let i = 0; i < marksSize; i++) { if (arrChars[i].type === mark) { return true; } } return false; }
[ "function", "hasMarkOnChar", "(", "character", ",", "mark", ")", "{", "const", "arrChars", "=", "character", ".", "marks", ".", "toJS", "(", ")", ";", "const", "marksSize", "=", "arrChars", ".", "length", ";", "for", "(", "let", "i", "=", "0", ";", "...
Has the mark on a char @param character @param mark @returns {boolean}
[ "Has", "the", "mark", "on", "a", "char" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L61-L70
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
hasEmphasis
function hasEmphasis(mark, state) { const { startKey, endKey, startOffset, endOffset, texts } = state; if (startKey === endKey) { const focusText = texts.get(0).text; const textLength = focusText.length; if (texts.get(0).charsData) { const characters = texts.get(0).charsData.characters; // ...
javascript
function hasEmphasis(mark, state) { const { startKey, endKey, startOffset, endOffset, texts } = state; if (startKey === endKey) { const focusText = texts.get(0).text; const textLength = focusText.length; if (texts.get(0).charsData) { const characters = texts.get(0).charsData.characters; // ...
[ "function", "hasEmphasis", "(", "mark", ",", "state", ")", "{", "const", "{", "startKey", ",", "endKey", ",", "startOffset", ",", "endOffset", ",", "texts", "}", "=", "state", ";", "if", "(", "startKey", "===", "endKey", ")", "{", "const", "focusText", ...
The text has a wrapper in emphasis @param mark @param state @returns {boolean}
[ "The", "text", "has", "a", "wrapper", "in", "emphasis" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L79-L133
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
unionEmphasis
function unionEmphasis({ change, focusKey, characters, accent, text, startOffset, endOffset, markerLength }) { const leftEmphEdge = getLeftEmphEdge(accent, characters, startOffset); const rightEmphEdge = getRightEmphEdge(accent, characters, endOffset - 1, text.length); const leftMarker = text.substr(leftEmphEdge,...
javascript
function unionEmphasis({ change, focusKey, characters, accent, text, startOffset, endOffset, markerLength }) { const leftEmphEdge = getLeftEmphEdge(accent, characters, startOffset); const rightEmphEdge = getRightEmphEdge(accent, characters, endOffset - 1, text.length); const leftMarker = text.substr(leftEmphEdge,...
[ "function", "unionEmphasis", "(", "{", "change", ",", "focusKey", ",", "characters", ",", "accent", ",", "text", ",", "startOffset", ",", "endOffset", ",", "markerLength", "}", ")", "{", "const", "leftEmphEdge", "=", "getLeftEmphEdge", "(", "accent", ",", "c...
Both selection edges is on emphasis, delete all internal markers @param change @param focusKey @param characters @param text @param accent @param startOffset @param endOffset @param markerLength
[ "Both", "selection", "edges", "is", "on", "emphasis", "delete", "all", "internal", "markers" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L238-L258
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
wrapEmphasis
function wrapEmphasis(accent, state) { const marker = EMPHASIS[accent]; const markerLength = marker.length; const { startOffset, endOffset, focusText, texts } = state; const { text } = focusText; const focusKey = focusText.key; let change = state.change(); // #1 no selection if (startOffset === endOffs...
javascript
function wrapEmphasis(accent, state) { const marker = EMPHASIS[accent]; const markerLength = marker.length; const { startOffset, endOffset, focusText, texts } = state; const { text } = focusText; const focusKey = focusText.key; let change = state.change(); // #1 no selection if (startOffset === endOffs...
[ "function", "wrapEmphasis", "(", "accent", ",", "state", ")", "{", "const", "marker", "=", "EMPHASIS", "[", "accent", "]", ";", "const", "markerLength", "=", "marker", ".", "length", ";", "const", "{", "startOffset", ",", "endOffset", ",", "focusText", ","...
Wrap text with accent @param accent @param state
[ "Wrap", "text", "with", "accent" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L266-L321
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
hasBlock
function hasBlock(regExp, state) { const { focusText } = state; const focusedText = focusText.text; return regExp.test(focusedText); }
javascript
function hasBlock(regExp, state) { const { focusText } = state; const focusedText = focusText.text; return regExp.test(focusedText); }
[ "function", "hasBlock", "(", "regExp", ",", "state", ")", "{", "const", "{", "focusText", "}", "=", "state", ";", "const", "focusedText", "=", "focusText", ".", "text", ";", "return", "regExp", ".", "test", "(", "focusedText", ")", ";", "}" ]
Has block selected @param regExp - match regexp @param state - editor state
[ "Has", "block", "selected" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L418-L422
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
function(accent, state) { let text = accent === 'ul' ? '* ' : '1. '; if (hasMultiLineSelection(state)) { const { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = state.selection; const keys = []; let firstBefore, firstAfter, lastBefore, lastAfter; for ...
javascript
function(accent, state) { let text = accent === 'ul' ? '* ' : '1. '; if (hasMultiLineSelection(state)) { const { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = state.selection; const keys = []; let firstBefore, firstAfter, lastBefore, lastAfter; for ...
[ "function", "(", "accent", ",", "state", ")", "{", "let", "text", "=", "accent", "===", "'ul'", "?", "'* '", ":", "'1. '", ";", "if", "(", "hasMultiLineSelection", "(", "state", ")", ")", "{", "const", "{", "anchorKey", ",", "anchorOffset", ",", "focus...
Wrap text with list token @param {string} accent @param state - editor state @returns {Object} - state
[ "Wrap", "text", "with", "list", "token" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L568-L638
train
OpusCapita/react-markdown
src/client/components/PlainMarkdownInput/slate/transforms.js
function(accent, state) { if (hasMultiLineSelection(state)) { const { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = state.selection; const keys = []; let firstBefore, firstAfter, lastBefore, lastAfter; for (let i = 0; i < state.texts.size; i++) { ...
javascript
function(accent, state) { if (hasMultiLineSelection(state)) { const { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = state.selection; const keys = []; let firstBefore, firstAfter, lastBefore, lastAfter; for (let i = 0; i < state.texts.size; i++) { ...
[ "function", "(", "accent", ",", "state", ")", "{", "if", "(", "hasMultiLineSelection", "(", "state", ")", ")", "{", "const", "{", "anchorKey", ",", "anchorOffset", ",", "focusKey", ",", "focusOffset", ",", "isBackward", "}", "=", "state", ".", "selection",...
Unwrap text with list token @param {string} accent @param state - editor state @returns {Object} - state
[ "Unwrap", "text", "with", "list", "token" ]
77f977bd839bdf9c90b8f064179e44464860ae11
https://github.com/OpusCapita/react-markdown/blob/77f977bd839bdf9c90b8f064179e44464860ae11/src/client/components/PlainMarkdownInput/slate/transforms.js#L698-L744
train
nathanpeck/s3-upload-stream
lib/s3-upload-stream.js
Client
function Client(client) { if (this instanceof Client === false) { return new Client(client); } if (!client) { throw new Error('Must configure an S3 client before attempting to create an S3 upload stream.'); } this.cachedClient = client; }
javascript
function Client(client) { if (this instanceof Client === false) { return new Client(client); } if (!client) { throw new Error('Must configure an S3 client before attempting to create an S3 upload stream.'); } this.cachedClient = client; }
[ "function", "Client", "(", "client", ")", "{", "if", "(", "this", "instanceof", "Client", "===", "false", ")", "{", "return", "new", "Client", "(", "client", ")", ";", "}", "if", "(", "!", "client", ")", "{", "throw", "new", "Error", "(", "'Must conf...
Set the S3 client to be used for this upload.
[ "Set", "the", "S3", "client", "to", "be", "used", "for", "this", "upload", "." ]
cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4
https://github.com/nathanpeck/s3-upload-stream/blob/cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4/lib/s3-upload-stream.js#L5-L15
train
nathanpeck/s3-upload-stream
lib/s3-upload-stream.js
function (next) { // If this is the first part, and we're just starting, // but we have a multipartUploadID, then we're beginning // a resume and can fire the 'ready' event externally. if (multipartUploadID && !started) ws.emit('ready', multipartUploadID); started = true; if (pendingPar...
javascript
function (next) { // If this is the first part, and we're just starting, // but we have a multipartUploadID, then we're beginning // a resume and can fire the 'ready' event externally. if (multipartUploadID && !started) ws.emit('ready', multipartUploadID); started = true; if (pendingPar...
[ "function", "(", "next", ")", "{", "// If this is the first part, and we're just starting,", "// but we have a multipartUploadID, then we're beginning", "// a resume and can fire the 'ready' event externally.", "if", "(", "multipartUploadID", "&&", "!", "started", ")", "ws", ".", "...
Concurrently upload parts to S3.
[ "Concurrently", "upload", "parts", "to", "S3", "." ]
cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4
https://github.com/nathanpeck/s3-upload-stream/blob/cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4/lib/s3-upload-stream.js#L146-L195
train
nathanpeck/s3-upload-stream
lib/s3-upload-stream.js
function () { // Combine the buffers we've received and reset the list of buffers. var combinedBuffer = Buffer.concat(receivedBuffers, receivedBuffersLength); receivedBuffers.length = 0; // Trick to reset the array while keeping the original reference receivedBuffersLength = 0; if (combinedBuffer.l...
javascript
function () { // Combine the buffers we've received and reset the list of buffers. var combinedBuffer = Buffer.concat(receivedBuffers, receivedBuffersLength); receivedBuffers.length = 0; // Trick to reset the array while keeping the original reference receivedBuffersLength = 0; if (combinedBuffer.l...
[ "function", "(", ")", "{", "// Combine the buffers we've received and reset the list of buffers.", "var", "combinedBuffer", "=", "Buffer", ".", "concat", "(", "receivedBuffers", ",", "receivedBuffersLength", ")", ";", "receivedBuffers", ".", "length", "=", "0", ";", "//...
Take a list of received buffers and return a combined buffer that is exactly partSizeThreshold in size.
[ "Take", "a", "list", "of", "received", "buffers", "and", "return", "a", "combined", "buffer", "that", "is", "exactly", "partSizeThreshold", "in", "size", "." ]
cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4
https://github.com/nathanpeck/s3-upload-stream/blob/cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4/lib/s3-upload-stream.js#L205-L227
train
nathanpeck/s3-upload-stream
lib/s3-upload-stream.js
function (callback) { var partBuffer = preparePartBuffer(); var localPartNumber = partNumber; partNumber++; receivedSize += partBuffer.length; cachedClient.uploadPart( { Body: partBuffer, Bucket: destinationDetails.Bucket, Key: destinationDetails.Key, UploadId:...
javascript
function (callback) { var partBuffer = preparePartBuffer(); var localPartNumber = partNumber; partNumber++; receivedSize += partBuffer.length; cachedClient.uploadPart( { Body: partBuffer, Bucket: destinationDetails.Bucket, Key: destinationDetails.Key, UploadId:...
[ "function", "(", "callback", ")", "{", "var", "partBuffer", "=", "preparePartBuffer", "(", ")", ";", "var", "localPartNumber", "=", "partNumber", ";", "partNumber", "++", ";", "receivedSize", "+=", "partBuffer", ".", "length", ";", "cachedClient", ".", "upload...
Flush a part out to S3.
[ "Flush", "a", "part", "out", "to", "S3", "." ]
cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4
https://github.com/nathanpeck/s3-upload-stream/blob/cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4/lib/s3-upload-stream.js#L230-L263
train
nathanpeck/s3-upload-stream
lib/s3-upload-stream.js
function () { // There is a possibility that the incoming stream was empty, therefore the MPU never started // and cannot be finalized. if (multipartUploadID) { cachedClient.completeMultipartUpload( { Bucket: destinationDetails.Bucket, Key: destinationDetails.Key, ...
javascript
function () { // There is a possibility that the incoming stream was empty, therefore the MPU never started // and cannot be finalized. if (multipartUploadID) { cachedClient.completeMultipartUpload( { Bucket: destinationDetails.Bucket, Key: destinationDetails.Key, ...
[ "function", "(", ")", "{", "// There is a possibility that the incoming stream was empty, therefore the MPU never started", "// and cannot be finalized.", "if", "(", "multipartUploadID", ")", "{", "cachedClient", ".", "completeMultipartUpload", "(", "{", "Bucket", ":", "destinati...
Turn all the individual parts we uploaded to S3 into a finalized upload.
[ "Turn", "all", "the", "individual", "parts", "we", "uploaded", "to", "S3", "into", "a", "finalized", "upload", "." ]
cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4
https://github.com/nathanpeck/s3-upload-stream/blob/cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4/lib/s3-upload-stream.js#L296-L321
train
nathanpeck/s3-upload-stream
lib/s3-upload-stream.js
function (rootError) { cachedClient.abortMultipartUpload( { Bucket: destinationDetails.Bucket, Key: destinationDetails.Key, UploadId: multipartUploadID }, function (abortError) { if (abortError) ws.emit('error', rootError + '\n Additionally failed to abort...
javascript
function (rootError) { cachedClient.abortMultipartUpload( { Bucket: destinationDetails.Bucket, Key: destinationDetails.Key, UploadId: multipartUploadID }, function (abortError) { if (abortError) ws.emit('error', rootError + '\n Additionally failed to abort...
[ "function", "(", "rootError", ")", "{", "cachedClient", ".", "abortMultipartUpload", "(", "{", "Bucket", ":", "destinationDetails", ".", "Bucket", ",", "Key", ":", "destinationDetails", ".", "Key", ",", "UploadId", ":", "multipartUploadID", "}", ",", "function",...
When a fatal error occurs abort the multipart upload
[ "When", "a", "fatal", "error", "occurs", "abort", "the", "multipart", "upload" ]
cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4
https://github.com/nathanpeck/s3-upload-stream/blob/cf6b82d44426dfe06fb3e3de1af0db6fa7ecdfa4/lib/s3-upload-stream.js#L324-L338
train
Wildhoney/ngRangeSlider
dist/ng-range-slider.js
_reevaluateInputs
function _reevaluateInputs() { var inputElements = element.find('input'); $angular.forEach(inputElements, function forEach(inputElement, index) { inputElement = $angular.element(inputElement); inputElement.val(''); ...
javascript
function _reevaluateInputs() { var inputElements = element.find('input'); $angular.forEach(inputElements, function forEach(inputElement, index) { inputElement = $angular.element(inputElement); inputElement.val(''); ...
[ "function", "_reevaluateInputs", "(", ")", "{", "var", "inputElements", "=", "element", ".", "find", "(", "'input'", ")", ";", "$angular", ".", "forEach", "(", "inputElements", ",", "function", "forEach", "(", "inputElement", ",", "index", ")", "{", "inputEl...
Force the re-evaluation of the input slider values. @method _reevaluateInputs @return {void} @private
[ "Force", "the", "re", "-", "evaluation", "of", "the", "input", "slider", "values", "." ]
f5eafc1dea7523f4b2f135c92e1cfded1baaa267
https://github.com/Wildhoney/ngRangeSlider/blob/f5eafc1dea7523f4b2f135c92e1cfded1baaa267/dist/ng-range-slider.js#L140-L153
train
julienw/dollardom
legacy/$dom.legacy.js
_sel
function _sel(selector) { var f, out = []; if (typeof selector == "string") { while (selector != "") { f = selector.match(re_selector_fragment); if (f[0] == "") return null; out.push({ rel: f[1], tag: f[2], uTag...
javascript
function _sel(selector) { var f, out = []; if (typeof selector == "string") { while (selector != "") { f = selector.match(re_selector_fragment); if (f[0] == "") return null; out.push({ rel: f[1], tag: f[2], uTag...
[ "function", "_sel", "(", "selector", ")", "{", "var", "f", ",", "out", "=", "[", "]", ";", "if", "(", "typeof", "selector", "==", "\"string\"", ")", "{", "while", "(", "selector", "!=", "\"\"", ")", "{", "f", "=", "selector", ".", "match", "(", "...
_sel returns an array of simple selector fragment objects from the passed complex selector string
[ "_sel", "returns", "an", "array", "of", "simple", "selector", "fragment", "objects", "from", "the", "passed", "complex", "selector", "string" ]
59caa3e2d169e3de59dc9414f0023ceeec7ea782
https://github.com/julienw/dollardom/blob/59caa3e2d169e3de59dc9414f0023ceeec7ea782/legacy/$dom.legacy.js#L175-L189
train
julienw/dollardom
legacy/$dom.legacy.js
_isDescendant
function _isDescendant(elm, ancestor) { while ((elm = elm.parentNode) && elm != ancestor) { } return elm !== null; }
javascript
function _isDescendant(elm, ancestor) { while ((elm = elm.parentNode) && elm != ancestor) { } return elm !== null; }
[ "function", "_isDescendant", "(", "elm", ",", "ancestor", ")", "{", "while", "(", "(", "elm", "=", "elm", ".", "parentNode", ")", "&&", "elm", "!=", "ancestor", ")", "{", "}", "return", "elm", "!==", "null", ";", "}" ]
determines if the passed element is a descentand of anthor element
[ "determines", "if", "the", "passed", "element", "is", "a", "descentand", "of", "anthor", "element" ]
59caa3e2d169e3de59dc9414f0023ceeec7ea782
https://github.com/julienw/dollardom/blob/59caa3e2d169e3de59dc9414f0023ceeec7ea782/legacy/$dom.legacy.js#L193-L197
train
a1k0n/jsxm
trackview.js
drawText
function drawText(text, dx, dy, ctx) { var dx0 = dx; for (var i = 0; i < text.length; i++) { var n = text.charCodeAt(i); var sx = (n&63)*8; var sy = (n>>6)*10 + 56; var width = _fontwidths[n]; ctx.drawImage(fontimg, sx, sy, width, 10, dx, dy, width, 10); dx += width + 1; } return dx - dx...
javascript
function drawText(text, dx, dy, ctx) { var dx0 = dx; for (var i = 0; i < text.length; i++) { var n = text.charCodeAt(i); var sx = (n&63)*8; var sy = (n>>6)*10 + 56; var width = _fontwidths[n]; ctx.drawImage(fontimg, sx, sy, width, 10, dx, dy, width, 10); dx += width + 1; } return dx - dx...
[ "function", "drawText", "(", "text", ",", "dx", ",", "dy", ",", "ctx", ")", "{", "var", "dx0", "=", "dx", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "text", ".", "length", ";", "i", "++", ")", "{", "var", "n", "=", "text", ".", ...
draw FT2 proportional font text to a drawing context returns width rendered
[ "draw", "FT2", "proportional", "font", "text", "to", "a", "drawing", "context", "returns", "width", "rendered" ]
72f3c18b25ac547a8d2c1d95318b747fac371a2a
https://github.com/a1k0n/jsxm/blob/72f3c18b25ac547a8d2c1d95318b747fac371a2a/trackview.js#L60-L71
train
a1k0n/jsxm
xm.js
MixSilenceIntoBuf
function MixSilenceIntoBuf(ch, start, end, dataL, dataR) { var s = ch.filterstate[1]; if (isNaN(s)) { console.log("NaN filterstate?", ch.filterstate, ch.filter); return; } for (var i = start; i < end; i++) { if (Math.abs(s) < 1.526e-5) { // == 1/65536.0 s = 0; break; } dataL[i] ...
javascript
function MixSilenceIntoBuf(ch, start, end, dataL, dataR) { var s = ch.filterstate[1]; if (isNaN(s)) { console.log("NaN filterstate?", ch.filterstate, ch.filter); return; } for (var i = start; i < end; i++) { if (Math.abs(s) < 1.526e-5) { // == 1/65536.0 s = 0; break; } dataL[i] ...
[ "function", "MixSilenceIntoBuf", "(", "ch", ",", "start", ",", "end", ",", "dataL", ",", "dataR", ")", "{", "var", "s", "=", "ch", ".", "filterstate", "[", "1", "]", ";", "if", "(", "isNaN", "(", "s", ")", ")", "{", "console", ".", "log", "(", ...
This function gradually brings the channel back down to zero if it isn't already to avoid clicks and pops when samples end.
[ "This", "function", "gradually", "brings", "the", "channel", "back", "down", "to", "zero", "if", "it", "isn", "t", "already", "to", "avoid", "clicks", "and", "pops", "when", "samples", "end", "." ]
72f3c18b25ac547a8d2c1d95318b747fac371a2a
https://github.com/a1k0n/jsxm/blob/72f3c18b25ac547a8d2c1d95318b747fac371a2a/xm.js#L370-L392
train
postcss/postcss-custom-selectors
lib/transform-selectors-by-custom-selectors.js
transformSelector
function transformSelector(selector, customSelectors) { const transpiledSelectors = []; for (const index in selector.nodes) { const { value, nodes } = selector.nodes[index]; if (value in customSelectors) { for (const replacementSelector of customSelectors[value].nodes) { const selectorClone = selector.cl...
javascript
function transformSelector(selector, customSelectors) { const transpiledSelectors = []; for (const index in selector.nodes) { const { value, nodes } = selector.nodes[index]; if (value in customSelectors) { for (const replacementSelector of customSelectors[value].nodes) { const selectorClone = selector.cl...
[ "function", "transformSelector", "(", "selector", ",", "customSelectors", ")", "{", "const", "transpiledSelectors", "=", "[", "]", ";", "for", "(", "const", "index", "in", "selector", ".", "nodes", ")", "{", "const", "{", "value", ",", "nodes", "}", "=", ...
return custom pseudo selectors replaced with custom selectors
[ "return", "custom", "pseudo", "selectors", "replaced", "with", "custom", "selectors" ]
4a422f0eaba5b47fd53abe36e92f9092ad63858f
https://github.com/postcss/postcss-custom-selectors/blob/4a422f0eaba5b47fd53abe36e92f9092ad63858f/lib/transform-selectors-by-custom-selectors.js#L19-L54
train
enricostara/telegram.link
lib/utility.js
callService
function callService(service, emitter, channel, callback) { var argsValue = Array.prototype.slice.call(Array.prototype.slice.call(arguments)[4]); var callerFunc = arguments.callee.caller; var eventName = service.name || service._name; var callerArgNames = _retrieveArgumentNames(callerFunc); var prop...
javascript
function callService(service, emitter, channel, callback) { var argsValue = Array.prototype.slice.call(Array.prototype.slice.call(arguments)[4]); var callerFunc = arguments.callee.caller; var eventName = service.name || service._name; var callerArgNames = _retrieveArgumentNames(callerFunc); var prop...
[ "function", "callService", "(", "service", ",", "emitter", ",", "channel", ",", "callback", ")", "{", "var", "argsValue", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "argument...
Calls a service and infers the arguments by the caller function.
[ "Calls", "a", "service", "and", "infers", "the", "arguments", "by", "the", "caller", "function", "." ]
37c4a98f17d2311ee4335fdd42df497ff30a1153
https://github.com/enricostara/telegram.link/blob/37c4a98f17d2311ee4335fdd42df497ff30a1153/lib/utility.js#L10-L44
train
enricostara/telegram.link
lib/utility.js
createEventEmitterCallback
function createEventEmitterCallback(event, emitter) { return function (ex) { if (ex) { emitter.emit('error', ex); } else { var args = Array.prototype.slice.call(arguments); args[0] = event; emitter.emit.apply(emitter, args); if (event == 'e...
javascript
function createEventEmitterCallback(event, emitter) { return function (ex) { if (ex) { emitter.emit('error', ex); } else { var args = Array.prototype.slice.call(arguments); args[0] = event; emitter.emit.apply(emitter, args); if (event == 'e...
[ "function", "createEventEmitterCallback", "(", "event", ",", "emitter", ")", "{", "return", "function", "(", "ex", ")", "{", "if", "(", "ex", ")", "{", "emitter", ".", "emit", "(", "'error'", ",", "ex", ")", ";", "}", "else", "{", "var", "args", "=",...
Provides a callback function that emits the supplied event type or an error event.
[ "Provides", "a", "callback", "function", "that", "emits", "the", "supplied", "event", "type", "or", "an", "error", "event", "." ]
37c4a98f17d2311ee4335fdd42df497ff30a1153
https://github.com/enricostara/telegram.link/blob/37c4a98f17d2311ee4335fdd42df497ff30a1153/lib/utility.js#L51-L64
train
joewalker/gcli
gcli.js
startRepl
function startRepl() { var repl = require('repl'); var gcliEval = function(command, scope, file, callback) { // Why does node wrap the command in '(...)\n'? command = command.replace(/^\((.*)\n\)$/, function(all, part) { return part; }); if (command.length !== 0) { requisition.updateEx...
javascript
function startRepl() { var repl = require('repl'); var gcliEval = function(command, scope, file, callback) { // Why does node wrap the command in '(...)\n'? command = command.replace(/^\((.*)\n\)$/, function(all, part) { return part; }); if (command.length !== 0) { requisition.updateEx...
[ "function", "startRepl", "(", ")", "{", "var", "repl", "=", "require", "(", "'repl'", ")", ";", "var", "gcliEval", "=", "function", "(", "command", ",", "scope", ",", "file", ",", "callback", ")", "{", "// Why does node wrap the command in '(...)\\n'?", "comma...
Start a NodeJS REPL to execute commands
[ "Start", "a", "NodeJS", "REPL", "to", "execute", "commands" ]
672ddac06402c82c44b4e45fe9336347b9c810bb
https://github.com/joewalker/gcli/blob/672ddac06402c82c44b4e45fe9336347b9c810bb/gcli.js#L85-L105
train
joewalker/gcli
lib/gcli/commands/server/orion.js
function(input, source) { var output = input.toString(); if (source.path.match(/\.js$/)) { output = output.replace(/(["'](do not )?use strict[\"\'];)/, 'define(function(require, exports, module) {\n\n$1'); output += '\n\n});\n'; } return output; }
javascript
function(input, source) { var output = input.toString(); if (source.path.match(/\.js$/)) { output = output.replace(/(["'](do not )?use strict[\"\'];)/, 'define(function(require, exports, module) {\n\n$1'); output += '\n\n});\n'; } return output; }
[ "function", "(", "input", ",", "source", ")", "{", "var", "output", "=", "input", ".", "toString", "(", ")", ";", "if", "(", "source", ".", "path", ".", "match", "(", "/", "\\.js$", "/", ")", ")", "{", "output", "=", "output", ".", "replace", "("...
A filter to munge CommonJS headers
[ "A", "filter", "to", "munge", "CommonJS", "headers" ]
672ddac06402c82c44b4e45fe9336347b9c810bb
https://github.com/joewalker/gcli/blob/672ddac06402c82c44b4e45fe9336347b9c810bb/lib/gcli/commands/server/orion.js#L102-L112
train
joewalker/gcli
lib/gcli/util/fileparser.js
function(context, typed, options) { var matches = options.matches == null ? undefined : options.matches.source; var connector = context.system.connectors.get(); return GcliFront.create(connector).then(function(front) { return front.parseFile(typed, options.filetype, options.existing, matches).then(func...
javascript
function(context, typed, options) { var matches = options.matches == null ? undefined : options.matches.source; var connector = context.system.connectors.get(); return GcliFront.create(connector).then(function(front) { return front.parseFile(typed, options.filetype, options.existing, matches).then(func...
[ "function", "(", "context", ",", "typed", ",", "options", ")", "{", "var", "matches", "=", "options", ".", "matches", "==", "null", "?", "undefined", ":", "options", ".", "matches", ".", "source", ";", "var", "connector", "=", "context", ".", "system", ...
Implementation of parse for the web
[ "Implementation", "of", "parse", "for", "the", "web" ]
672ddac06402c82c44b4e45fe9336347b9c810bb
https://github.com/joewalker/gcli/blob/672ddac06402c82c44b4e45fe9336347b9c810bb/lib/gcli/util/fileparser.js#L59-L76
train
joewalker/gcli
lib/gcli/ui/view.js
function(element, clear) { // Strict check on the off-chance that we later think of other options // and want to replace 'clear' with an 'options' parameter, but want to // support backwards compat. if (clear === true) { util.clearElement(element); } element.appendChild(this...
javascript
function(element, clear) { // Strict check on the off-chance that we later think of other options // and want to replace 'clear' with an 'options' parameter, but want to // support backwards compat. if (clear === true) { util.clearElement(element); } element.appendChild(this...
[ "function", "(", "element", ",", "clear", ")", "{", "// Strict check on the off-chance that we later think of other options", "// and want to replace 'clear' with an 'options' parameter, but want to", "// support backwards compat.", "if", "(", "clear", "===", "true", ")", "{", "uti...
Run the template against the document to which element belongs. @param element The element to append the result to @param clear Set clear===true to remove all children of element
[ "Run", "the", "template", "against", "the", "document", "to", "which", "element", "belongs", "." ]
672ddac06402c82c44b4e45fe9336347b9c810bb
https://github.com/joewalker/gcli/blob/672ddac06402c82c44b4e45fe9336347b9c810bb/lib/gcli/ui/view.js#L61-L70
train
joewalker/gcli
lib/gcli/ui/view.js
function(document) { if (options.css) { util.importCss(options.css, document, options.cssId); } var child = host.toDom(document, options.html); domtemplate.template(child, options.data || {}, options.options || {}); return child; }
javascript
function(document) { if (options.css) { util.importCss(options.css, document, options.cssId); } var child = host.toDom(document, options.html); domtemplate.template(child, options.data || {}, options.options || {}); return child; }
[ "function", "(", "document", ")", "{", "if", "(", "options", ".", "css", ")", "{", "util", ".", "importCss", "(", "options", ".", "css", ",", "document", ",", "options", ".", "cssId", ")", ";", "}", "var", "child", "=", "host", ".", "toDom", "(", ...
Actually convert the view data into a DOM suitable to be appended to an element @param document to use in realizing the template
[ "Actually", "convert", "the", "view", "data", "into", "a", "DOM", "suitable", "to", "be", "appended", "to", "an", "element" ]
672ddac06402c82c44b4e45fe9336347b9c810bb
https://github.com/joewalker/gcli/blob/672ddac06402c82c44b4e45fe9336347b9c810bb/lib/gcli/ui/view.js#L77-L85
train