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
rung-tools/rung-cli
src/build.js
resolveOutputTarget
function resolveOutputTarget(customPath, filename) { const realPath = path.resolve('.', customPath); const getPath = tryCatch( realPath => fs.lstatSync(realPath).isDirectory() ? path.join(realPath, filename) : realPath, identity); return getPath(realPath); }
javascript
function resolveOutputTarget(customPath, filename) { const realPath = path.resolve('.', customPath); const getPath = tryCatch( realPath => fs.lstatSync(realPath).isDirectory() ? path.join(realPath, filename) : realPath, identity); return getPath(realPath); }
[ "function", "resolveOutputTarget", "(", "customPath", ",", "filename", ")", "{", "const", "realPath", "=", "path", ".", "resolve", "(", "'.'", ",", "customPath", ")", ";", "const", "getPath", "=", "tryCatch", "(", "realPath", "=>", "fs", ".", "lstatSync", ...
Taking account the -o parameter can be used to specify the output directory, let's deal with it @param {String} customPath @param {String} filename @return {String}
[ "Taking", "account", "the", "-", "o", "parameter", "can", "be", "used", "to", "specify", "the", "output", "directory", "let", "s", "deal", "with", "it" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/build.js#L238-L248
train
iuap-design/tinper-neoui-grid
dist/tinper-neoui-grid.js
objCompare
function objCompare(rootObj, objAry) { var aryLen = objAry.length; // var rootStr = JSON.stringify(rootObj); var matchNum = 0; for (var i = 0; i < aryLen; i++) { // var compareStr = JSON.stringify(objAry[i]); var compareObj = objAry[i]; matchNum += rootObj == compareObj ? 1 : 0; ...
javascript
function objCompare(rootObj, objAry) { var aryLen = objAry.length; // var rootStr = JSON.stringify(rootObj); var matchNum = 0; for (var i = 0; i < aryLen; i++) { // var compareStr = JSON.stringify(objAry[i]); var compareObj = objAry[i]; matchNum += rootObj == compareObj ? 1 : 0; ...
[ "function", "objCompare", "(", "rootObj", ",", "objAry", ")", "{", "var", "aryLen", "=", "objAry", ".", "length", ";", "// var rootStr = JSON.stringify(rootObj);", "var", "matchNum", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aryLen",...
Object Compare with Array Object
[ "Object", "Compare", "with", "Array", "Object" ]
24d392eb460beede997187593982952a1af2cfcc
https://github.com/iuap-design/tinper-neoui-grid/blob/24d392eb460beede997187593982952a1af2cfcc/dist/tinper-neoui-grid.js#L1989-L1999
train
rung-tools/rung-cli
src/db.js
serialize
function serialize(input) { const value = JSON.stringify(input); return value === undefined ? reject(new Error(`Unsupported type ${type(input)}`)) : resolve(value); }
javascript
function serialize(input) { const value = JSON.stringify(input); return value === undefined ? reject(new Error(`Unsupported type ${type(input)}`)) : resolve(value); }
[ "function", "serialize", "(", "input", ")", "{", "const", "value", "=", "JSON", ".", "stringify", "(", "input", ")", ";", "return", "value", "===", "undefined", "?", "reject", "(", "new", "Error", "(", "`", "${", "type", "(", "input", ")", "}", "`", ...
Marshalls the JS input @param {Mixed} input @return {Promise}
[ "Marshalls", "the", "JS", "input" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/db.js#L26-L31
train
rung-tools/rung-cli
src/db.js
resolveRungFolder
function resolveRungFolder() { const folder = path.join(os.homedir(), '.rung'); const createIfNotExists = tryCatch( ~(fs.lstatSync(folder).isDirectory() ? resolve() : reject(new Error('~/.rung is not a directory'))), ~createFolder(folder) ); return createIfNotExi...
javascript
function resolveRungFolder() { const folder = path.join(os.homedir(), '.rung'); const createIfNotExists = tryCatch( ~(fs.lstatSync(folder).isDirectory() ? resolve() : reject(new Error('~/.rung is not a directory'))), ~createFolder(folder) ); return createIfNotExi...
[ "function", "resolveRungFolder", "(", ")", "{", "const", "folder", "=", "path", ".", "join", "(", "os", ".", "homedir", "(", ")", ",", "'.rung'", ")", ";", "const", "createIfNotExists", "=", "tryCatch", "(", "~", "(", "fs", ".", "lstatSync", "(", "fold...
Creates the .rung folder when it doesn't exist @return {Promise}
[ "Creates", "the", ".", "rung", "folder", "when", "it", "doesn", "t", "exist" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/db.js#L87-L97
train
rung-tools/rung-cli
src/live.js
watchChanges
function watchChanges(io, params) { const folder = process.cwd(); return watch(folder, { recursive: true }, () => { emitInfo('changes detected. Recompiling...'); io.sockets.emit('load'); const start = new Date().getTime(); executeWithParams(params) .tap(alerts => { ...
javascript
function watchChanges(io, params) { const folder = process.cwd(); return watch(folder, { recursive: true }, () => { emitInfo('changes detected. Recompiling...'); io.sockets.emit('load'); const start = new Date().getTime(); executeWithParams(params) .tap(alerts => { ...
[ "function", "watchChanges", "(", "io", ",", "params", ")", "{", "const", "folder", "=", "process", ".", "cwd", "(", ")", ";", "return", "watch", "(", "folder", ",", "{", "recursive", ":", "true", "}", ",", "(", ")", "=>", "{", "emitInfo", "(", "'ch...
Watches folder for file changes, hot recompiling everything and notifying the clients @param {SocketIO} io @param {Object} params @return {Object}
[ "Watches", "folder", "for", "file", "changes", "hot", "recompiling", "everything", "and", "notifying", "the", "clients" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/live.js#L76-L93
train
rung-tools/rung-cli
src/live.js
startServer
function startServer(alerts, params, port, resources) { const compiledAlerts = compileMarkdown(alerts); const app = http.createServer((req, res) => res.end(resources[req.url] || resources['/index.html'])); const io = listen(app); io.on('connection', socket => { emitInfo(`new session for ...
javascript
function startServer(alerts, params, port, resources) { const compiledAlerts = compileMarkdown(alerts); const app = http.createServer((req, res) => res.end(resources[req.url] || resources['/index.html'])); const io = listen(app); io.on('connection', socket => { emitInfo(`new session for ...
[ "function", "startServer", "(", "alerts", ",", "params", ",", "port", ",", "resources", ")", "{", "const", "compiledAlerts", "=", "compileMarkdown", "(", "alerts", ")", ";", "const", "app", "=", "http", ".", "createServer", "(", "(", "req", ",", "res", "...
Starts the stream server using sockets @param {Object} alerts @param {Object} params @param {Number} port @param {Object} resources @return {Promise}
[ "Starts", "the", "stream", "server", "using", "sockets" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/live.js#L104-L119
train
rung-tools/rung-cli
src/cli.js
cli
function cli(args) { const { _: [command] } = args; return getModule(command).default(args) .catch(err => { getModule('input').emitError(err.message); process.exit(1); }); }
javascript
function cli(args) { const { _: [command] } = args; return getModule(command).default(args) .catch(err => { getModule('input').emitError(err.message); process.exit(1); }); }
[ "function", "cli", "(", "args", ")", "{", "const", "{", "_", ":", "[", "command", "]", "}", "=", "args", ";", "return", "getModule", "(", "command", ")", ".", "default", "(", "args", ")", ".", "catch", "(", "err", "=>", "{", "getModule", "(", "'i...
Entry point of Rung CLI @param {Object} args
[ "Entry", "point", "of", "Rung", "CLI" ]
c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5
https://github.com/rung-tools/rung-cli/blob/c8906bb6733bdd5bcea2e9b54ed48f26ae1526d5/src/cli.js#L18-L25
train
drkibitz/node-pixi
src/pixi/InteractionManager.js
InteractionManager
function InteractionManager(stage) { /** * a refference to the stage * * @property stage * @type Stage */ this.stage = stage; /** * the mouse data * * @property mouse * @type InteractionData */ this.mouse = new InteractionData(); /** * an obje...
javascript
function InteractionManager(stage) { /** * a refference to the stage * * @property stage * @type Stage */ this.stage = stage; /** * the mouse data * * @property mouse * @type InteractionData */ this.mouse = new InteractionData(); /** * an obje...
[ "function", "InteractionManager", "(", "stage", ")", "{", "/**\n * a refference to the stage\n *\n * @property stage\n * @type Stage\n */", "this", ".", "stage", "=", "stage", ";", "/**\n * the mouse data\n *\n * @property mouse\n * @type InteractionData...
The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive This manager also supports multitouch. @class InteractionManager @constructor @param stage {Stage} The stage to handle interactions
[ "The", "interaction", "manager", "deals", "with", "mouse", "and", "touch", "events", ".", "Any", "DisplayObject", "can", "be", "interactive", "This", "manager", "also", "supports", "multitouch", "." ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/InteractionManager.js#L76-L115
train
drkibitz/node-pixi
src/pixi/textures/RenderTexture.js
RenderTexture
function RenderTexture(width, height) { EventTarget.call( this ); this.width = width || 100; this.height = height || 100; this.identityMatrix = mat3.create(); this.frame = new Rectangle(0, 0, this.width, this.height); if(globals.gl) { this.initWebGL(); } else { ...
javascript
function RenderTexture(width, height) { EventTarget.call( this ); this.width = width || 100; this.height = height || 100; this.identityMatrix = mat3.create(); this.frame = new Rectangle(0, 0, this.width, this.height); if(globals.gl) { this.initWebGL(); } else { ...
[ "function", "RenderTexture", "(", "width", ",", "height", ")", "{", "EventTarget", ".", "call", "(", "this", ")", ";", "this", ".", "width", "=", "width", "||", "100", ";", "this", ".", "height", "=", "height", "||", "100", ";", "this", ".", "identit...
A RenderTexture is a special texture that allows any pixi displayObject to be rendered to it. __Hint__: All DisplayObjects (exmpl. Sprites) that renders on RenderTexture should be preloaded. Otherwise black rectangles will be drawn instead. RenderTexture takes snapshot of DisplayObject passed to render method. If Dis...
[ "A", "RenderTexture", "is", "a", "special", "texture", "that", "allows", "any", "pixi", "displayObject", "to", "be", "rendered", "to", "it", "." ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/textures/RenderTexture.js#L45-L64
train
drkibitz/node-pixi
src/pixi/display/MovieClip.js
MovieClip
function MovieClip(textures) { Sprite.call(this, textures[0]); /** * The array of textures that make up the animation * * @property textures * @type Array */ this.textures = textures; /** * The speed that the MovieClip will play at. Higher is faster, lower is slower ...
javascript
function MovieClip(textures) { Sprite.call(this, textures[0]); /** * The array of textures that make up the animation * * @property textures * @type Array */ this.textures = textures; /** * The speed that the MovieClip will play at. Higher is faster, lower is slower ...
[ "function", "MovieClip", "(", "textures", ")", "{", "Sprite", ".", "call", "(", "this", ",", "textures", "[", "0", "]", ")", ";", "/**\n * The array of textures that make up the animation\n *\n * @property textures\n * @type Array\n */", "this", ".", "te...
A MovieClip is a simple way to display an animation depicted by a list of textures. @class MovieClip @extends Sprite @constructor @param textures {Array<Texture>} an array of {Texture} objects that make up the animation
[ "A", "MovieClip", "is", "a", "simple", "way", "to", "display", "an", "animation", "depicted", "by", "a", "list", "of", "textures", "." ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/display/MovieClip.js#L16-L72
train
drkibitz/node-pixi
src/pixi/filters/AbstractFilter.js
AbstractFilter
function AbstractFilter(fragmentSrc, uniforms) { /** * An array of passes - some filters contain a few steps this array simply stores the steps in a liniear fashion. * For example the blur filter has two passes blurX and blurY. * @property passes * @type Array an array of filter objects * @priva...
javascript
function AbstractFilter(fragmentSrc, uniforms) { /** * An array of passes - some filters contain a few steps this array simply stores the steps in a liniear fashion. * For example the blur filter has two passes blurX and blurY. * @property passes * @type Array an array of filter objects * @priva...
[ "function", "AbstractFilter", "(", "fragmentSrc", ",", "uniforms", ")", "{", "/**\n * An array of passes - some filters contain a few steps this array simply stores the steps in a liniear fashion.\n * For example the blur filter has two passes blurX and blurY.\n * @property passes\n * @t...
This is the base class for creating a pixi.js filter. Currently only webGL supports filters. If you want to make a custom filter this should be your base class. @class AbstractFilter @constructor @param fragmentSrc @param uniforms
[ "This", "is", "the", "base", "class", "for", "creating", "a", "pixi", ".", "js", "filter", ".", "Currently", "only", "webGL", "supports", "filters", ".", "If", "you", "want", "to", "make", "a", "custom", "filter", "this", "should", "be", "your", "base", ...
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/filters/AbstractFilter.js#L14-L36
train
drkibitz/node-pixi
src/pixi/display/DisplayObject.js
DisplayObject
function DisplayObject() { this.last = this; this.first = this; /** * The coordinate of the object relative to the local coordinates of the parent. * * @property position * @type Point */ this.position = new Point(); /** * The scale factor of the object. * * ...
javascript
function DisplayObject() { this.last = this; this.first = this; /** * The coordinate of the object relative to the local coordinates of the parent. * * @property position * @type Point */ this.position = new Point(); /** * The scale factor of the object. * * ...
[ "function", "DisplayObject", "(", ")", "{", "this", ".", "last", "=", "this", ";", "this", ".", "first", "=", "this", ";", "/**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @property position\n * @type Point\n */", ...
The base class for all objects that are rendered on the screen. @class DisplayObject @constructor
[ "The", "base", "class", "for", "all", "objects", "that", "are", "rendered", "on", "the", "screen", "." ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/display/DisplayObject.js#L18-L251
train
stampit-org/stamp
packages/privatize/index.js
function (fn, name) { function proxiedFn() { 'use strict'; var fields = privates.get(this); // jshint ignore:line return fn.apply(fields, arguments); } Object.defineProperty(proxiedFn, 'name', { value: name, configurable: true }); return proxiedFn; }
javascript
function (fn, name) { function proxiedFn() { 'use strict'; var fields = privates.get(this); // jshint ignore:line return fn.apply(fields, arguments); } Object.defineProperty(proxiedFn, 'name', { value: name, configurable: true }); return proxiedFn; }
[ "function", "(", "fn", ",", "name", ")", "{", "function", "proxiedFn", "(", ")", "{", "'use strict'", ";", "var", "fields", "=", "privates", ".", "get", "(", "this", ")", ";", "// jshint ignore:line", "return", "fn", ".", "apply", "(", "fields", ",", "...
WeakMap works in IE11, node 0.12
[ "WeakMap", "works", "in", "IE11", "node", "0", ".", "12" ]
7eb5ec0576e90ca17e5777a4ab9677d3478aa583
https://github.com/stampit-org/stamp/blob/7eb5ec0576e90ca17e5777a4ab9677d3478aa583/packages/privatize/index.js#L4-L17
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
prepareView
function prepareView() { _(this).el = document.createElement('div'); _(this).el.setAttribute('class', 'VirtualScrollingTree'); let contentDiv = `<div class="VirtualScrollingTree-content"></div>`; _(this).el.innerHTML = ` ${_(this).smoothScrolling? '' : contentDiv} <div class="VirtualSc...
javascript
function prepareView() { _(this).el = document.createElement('div'); _(this).el.setAttribute('class', 'VirtualScrollingTree'); let contentDiv = `<div class="VirtualScrollingTree-content"></div>`; _(this).el.innerHTML = ` ${_(this).smoothScrolling? '' : contentDiv} <div class="VirtualSc...
[ "function", "prepareView", "(", ")", "{", "_", "(", "this", ")", ".", "el", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "_", "(", "this", ")", ".", "el", ".", "setAttribute", "(", "'class'", ",", "'VirtualScrollingTree'", ")", ";", ...
Creates a shortcut view object which we can use to access our DOM elements. Also sets up event handlers for the content. @method prepareView @private
[ "Creates", "a", "shortcut", "view", "object", "which", "we", "can", "use", "to", "access", "our", "DOM", "elements", ".", "Also", "sets", "up", "event", "handlers", "for", "the", "content", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L171-L220
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
updateViewDimensions
function updateViewDimensions(totalItems) { let visibleItems = Math.floor(_(this).parent.offsetHeight / _(this).itemHeight); _(this).view.scrollbar.style.height = visibleItems * _(this).itemHeight + 'px'; _(this).view.scrollbarContent.style.height = totalItems * _(this).itemHeight + 'px'; let scro...
javascript
function updateViewDimensions(totalItems) { let visibleItems = Math.floor(_(this).parent.offsetHeight / _(this).itemHeight); _(this).view.scrollbar.style.height = visibleItems * _(this).itemHeight + 'px'; _(this).view.scrollbarContent.style.height = totalItems * _(this).itemHeight + 'px'; let scro...
[ "function", "updateViewDimensions", "(", "totalItems", ")", "{", "let", "visibleItems", "=", "Math", ".", "floor", "(", "_", "(", "this", ")", ".", "parent", ".", "offsetHeight", "/", "_", "(", "this", ")", ".", "itemHeight", ")", ";", "_", "(", "this"...
Updates the width of the tree to match its containing element. @method updateViewDimensions @private
[ "Updates", "the", "width", "of", "the", "tree", "to", "match", "its", "containing", "element", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L228-L245
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
getNativeScrollbarWidth
function getNativeScrollbarWidth() { let outer = document.createElement('div'); outer.style.overflowY = 'scroll'; outer.setAttribute('class', _(this).scrollbarClass); outer.style.visibility = 'hidden'; outer.style.width = '100px'; document.body.appendChild(outer); let content = document.crea...
javascript
function getNativeScrollbarWidth() { let outer = document.createElement('div'); outer.style.overflowY = 'scroll'; outer.setAttribute('class', _(this).scrollbarClass); outer.style.visibility = 'hidden'; outer.style.width = '100px'; document.body.appendChild(outer); let content = document.crea...
[ "function", "getNativeScrollbarWidth", "(", ")", "{", "let", "outer", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "outer", ".", "style", ".", "overflowY", "=", "'scroll'", ";", "outer", ".", "setAttribute", "(", "'class'", ",", "_", "(",...
Creates a div which is used to calculate the width of the scrollbar for the current browser. @method getNativeScrollbarWidth @private @return {number}
[ "Creates", "a", "div", "which", "is", "used", "to", "calculate", "the", "width", "of", "the", "scrollbar", "for", "the", "current", "browser", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L255-L267
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
requestData
function requestData() { let visible = Math.ceil(_(this).parent.offsetHeight / _(this).itemHeight); let scrollIndex = Math.floor(_(this).view.scrollbar.scrollTop / _(this).itemHeight); let request = buildRequest.call(this, scrollIndex, visible); _(this).request = request; _(this).onDataFetch(request...
javascript
function requestData() { let visible = Math.ceil(_(this).parent.offsetHeight / _(this).itemHeight); let scrollIndex = Math.floor(_(this).view.scrollbar.scrollTop / _(this).itemHeight); let request = buildRequest.call(this, scrollIndex, visible); _(this).request = request; _(this).onDataFetch(request...
[ "function", "requestData", "(", ")", "{", "let", "visible", "=", "Math", ".", "ceil", "(", "_", "(", "this", ")", ".", "parent", ".", "offsetHeight", "/", "_", "(", "this", ")", ".", "itemHeight", ")", ";", "let", "scrollIndex", "=", "Math", ".", "...
Builds query, and triggers the onDataFetch call for the developer. When the developer calls success the data of the tree gets updated. @method requestData @private
[ "Builds", "query", "and", "triggers", "the", "onDataFetch", "call", "for", "the", "developer", ".", "When", "the", "developer", "calls", "success", "the", "data", "of", "the", "tree", "gets", "updated", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L276-L282
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
renderItem
function renderItem (element, data, updating) { _(this).onItemRender(element, { ...data.original, expanded: isExpanded.call(this, data.id), indent: calculateLevel.call(this, data), toggle: () => { // Check to see if this item is expanded or not let expanded = ...
javascript
function renderItem (element, data, updating) { _(this).onItemRender(element, { ...data.original, expanded: isExpanded.call(this, data.id), indent: calculateLevel.call(this, data), toggle: () => { // Check to see if this item is expanded or not let expanded = ...
[ "function", "renderItem", "(", "element", ",", "data", ",", "updating", ")", "{", "_", "(", "this", ")", ".", "onItemRender", "(", "element", ",", "{", "...", "data", ".", "original", ",", "expanded", ":", "isExpanded", ".", "call", "(", "this", ",", ...
Calls the onItemRender option. @method renderItem @private @param {HTMLElement} element @param {Object} data @param {Boolean} updating
[ "Calls", "the", "onItemRender", "option", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L428-L446
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
createItem
function createItem (data) { let itemEl = document.createElement('div'); itemEl.setAttribute('class', 'VirtualScrollingTree-item'); renderItem.call(this, itemEl, data); return { id: data.id, el: itemEl }; }
javascript
function createItem (data) { let itemEl = document.createElement('div'); itemEl.setAttribute('class', 'VirtualScrollingTree-item'); renderItem.call(this, itemEl, data); return { id: data.id, el: itemEl }; }
[ "function", "createItem", "(", "data", ")", "{", "let", "itemEl", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "itemEl", ".", "setAttribute", "(", "'class'", ",", "'VirtualScrollingTree-item'", ")", ";", "renderItem", ".", "call", "(", "thi...
Creates a HTMLElement to render an item into. @method createItem @private @param {Object} data @return {Object}
[ "Creates", "a", "HTMLElement", "to", "render", "an", "item", "into", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L456-L466
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
forEachExpansion
function forEachExpansion(expansions, fn) { let impl = function(expansions) { expansions.forEach((expansion) => { fn(expansion); impl(expansion.expansions); }); }; impl(expansions); }
javascript
function forEachExpansion(expansions, fn) { let impl = function(expansions) { expansions.forEach((expansion) => { fn(expansion); impl(expansion.expansions); }); }; impl(expansions); }
[ "function", "forEachExpansion", "(", "expansions", ",", "fn", ")", "{", "let", "impl", "=", "function", "(", "expansions", ")", "{", "expansions", ".", "forEach", "(", "(", "expansion", ")", "=>", "{", "fn", "(", "expansion", ")", ";", "impl", "(", "ex...
Recursively iterate over the expansions and execute the passed callback against it. @method forEachExpansion @private @param {Array<Object>} expansions @param {Functin} fn
[ "Recursively", "iterate", "over", "the", "expansions", "and", "execute", "the", "passed", "callback", "against", "it", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L477-L486
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
findExpansion
function findExpansion(id) { let result; forEachExpansion(_(this).expansions, (expansion) => { if (expansion.id === id) { result = expansion; } }); return result; }
javascript
function findExpansion(id) { let result; forEachExpansion(_(this).expansions, (expansion) => { if (expansion.id === id) { result = expansion; } }); return result; }
[ "function", "findExpansion", "(", "id", ")", "{", "let", "result", ";", "forEachExpansion", "(", "_", "(", "this", ")", ".", "expansions", ",", "(", "expansion", ")", "=>", "{", "if", "(", "expansion", ".", "id", "===", "id", ")", "{", "result", "=",...
Finds the expansion with the id specified. @method findExpansion @private @param {String} id @return {Object}
[ "Finds", "the", "expansion", "with", "the", "id", "specified", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L496-L506
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
collapseItem
function collapseItem(data) { let parentExpansions = findExpansion.call(this, data.parent).expansions; let index = parentExpansions.findIndex((expansion) => { return expansion.id === data.id; }); parentExpansions.splice(index, 1); }
javascript
function collapseItem(data) { let parentExpansions = findExpansion.call(this, data.parent).expansions; let index = parentExpansions.findIndex((expansion) => { return expansion.id === data.id; }); parentExpansions.splice(index, 1); }
[ "function", "collapseItem", "(", "data", ")", "{", "let", "parentExpansions", "=", "findExpansion", ".", "call", "(", "this", ",", "data", ".", "parent", ")", ".", "expansions", ";", "let", "index", "=", "parentExpansions", ".", "findIndex", "(", "(", "exp...
Removes item to list of expansions. @method collapseItem @private @params {Object} data
[ "Removes", "item", "to", "list", "of", "expansions", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L539-L547
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
expandItem
function expandItem(data) { // Cloning to avoid modification of the original data item. data = JSON.parse(JSON.stringify(data)); if (!data.expansions) { data.expansions = []; } // Expansions are stored in a tree structure. let obj = findExpansion.call(this, data.parent); obj.expans...
javascript
function expandItem(data) { // Cloning to avoid modification of the original data item. data = JSON.parse(JSON.stringify(data)); if (!data.expansions) { data.expansions = []; } // Expansions are stored in a tree structure. let obj = findExpansion.call(this, data.parent); obj.expans...
[ "function", "expandItem", "(", "data", ")", "{", "// Cloning to avoid modification of the original data item.", "data", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "data", ")", ")", ";", "if", "(", "!", "data", ".", "expansions", ")", "{", ...
Adds item to list of expansions. @method expandItem @private @params {Object} data
[ "Adds", "item", "to", "list", "of", "expansions", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L556-L567
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
sortExpansions
function sortExpansions() { let impl = function(expansions) { expansions.sort((a, b) => { return a.offset - b.offset; }); for (let i = 0; i < expansions.length; i++) { impl(expansions[i].expansions); } } impl(_(this).expansions); }
javascript
function sortExpansions() { let impl = function(expansions) { expansions.sort((a, b) => { return a.offset - b.offset; }); for (let i = 0; i < expansions.length; i++) { impl(expansions[i].expansions); } } impl(_(this).expansions); }
[ "function", "sortExpansions", "(", ")", "{", "let", "impl", "=", "function", "(", "expansions", ")", "{", "expansions", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "return", "a", ".", "offset", "-", "b", ".", "offset", ";", "}", ")", ";...
Sorting expansions makes the query more accurate. @method sortExpansions @private
[ "Sorting", "expansions", "makes", "the", "query", "more", "accurate", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L575-L587
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
calculateExpansions
function calculateExpansions() { let impl = function(expansions, parentStart, parentLevel) { expansions.forEach((expansion, index) => { expansion._level = parentLevel; // We need to calculate the start position of this expansion. The start // position isn't just the offs...
javascript
function calculateExpansions() { let impl = function(expansions, parentStart, parentLevel) { expansions.forEach((expansion, index) => { expansion._level = parentLevel; // We need to calculate the start position of this expansion. The start // position isn't just the offs...
[ "function", "calculateExpansions", "(", ")", "{", "let", "impl", "=", "function", "(", "expansions", ",", "parentStart", ",", "parentLevel", ")", "{", "expansions", ".", "forEach", "(", "(", "expansion", ",", "index", ")", "=>", "{", "expansion", ".", "_le...
Sorts and calculates the scroll indexes for the expansions. @method calculateExpansions @private
[ "Sorts", "and", "calculates", "the", "scroll", "indexes", "for", "the", "expansions", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L595-L653
train
PepsRyuu/virtual-scrolling-tree
src/virtual-scrolling-tree/VirtualScrollingTree.js
buildRequest
function buildRequest(scrollPos, viewport) { // Variables let queries = []; let requestedTotal = 0; let expanded = _(this).expansions; sortExpansions.call(this); calculateExpansions.call(this); // One-dimensional collision detection. // It checks to see if start/end are both either be...
javascript
function buildRequest(scrollPos, viewport) { // Variables let queries = []; let requestedTotal = 0; let expanded = _(this).expansions; sortExpansions.call(this); calculateExpansions.call(this); // One-dimensional collision detection. // It checks to see if start/end are both either be...
[ "function", "buildRequest", "(", "scrollPos", ",", "viewport", ")", "{", "// Variables", "let", "queries", "=", "[", "]", ";", "let", "requestedTotal", "=", "0", ";", "let", "expanded", "=", "_", "(", "this", ")", ".", "expansions", ";", "sortExpansions", ...
Calculates what's in the viewport and generates a series of queries for the developer to respond to. @method buildRequest @private
[ "Calculates", "what", "s", "in", "the", "viewport", "and", "generates", "a", "series", "of", "queries", "for", "the", "developer", "to", "respond", "to", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/src/virtual-scrolling-tree/VirtualScrollingTree.js#L662-L729
train
express-vue/vue-pronto
lib/utils/head.js
BuildHead
function BuildHead(metaObject = {}) { const metaCopy = Object.assign({}, metaObject); let finalString = ""; if (metaCopy.title) { finalString += `<title>${metaCopy.title}</title>`; } if (metaCopy.meta) { throw new Error("WARNING - DEPRECATED: It looks like you're using the old meta ...
javascript
function BuildHead(metaObject = {}) { const metaCopy = Object.assign({}, metaObject); let finalString = ""; if (metaCopy.title) { finalString += `<title>${metaCopy.title}</title>`; } if (metaCopy.meta) { throw new Error("WARNING - DEPRECATED: It looks like you're using the old meta ...
[ "function", "BuildHead", "(", "metaObject", "=", "{", "}", ")", "{", "const", "metaCopy", "=", "Object", ".", "assign", "(", "{", "}", ",", "metaObject", ")", ";", "let", "finalString", "=", "\"\"", ";", "if", "(", "metaCopy", ".", "title", ")", "{",...
BuildHead takes the array and splits it up for processing @param {object} metaObject @returns {String}
[ "BuildHead", "takes", "the", "array", "and", "splits", "it", "up", "for", "processing" ]
3fac4d204af4c7d569f68236885fd288904f8bbd
https://github.com/express-vue/vue-pronto/blob/3fac4d204af4c7d569f68236885fd288904f8bbd/lib/utils/head.js#L8-L54
train
PepsRyuu/virtual-scrolling-tree
examples/preact/index.js
findItemInDataForExpansion
function findItemInDataForExpansion (label) { for (let i = 0; i < data.length; i++) { if (data[i].label === label) { let item = data[i]; let offset = data.filter(d => d.parent === item.parent).findIndex(d => d.id === item.id); return { parent: item.parent...
javascript
function findItemInDataForExpansion (label) { for (let i = 0; i < data.length; i++) { if (data[i].label === label) { let item = data[i]; let offset = data.filter(d => d.parent === item.parent).findIndex(d => d.id === item.id); return { parent: item.parent...
[ "function", "findItemInDataForExpansion", "(", "label", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "if", "(", "data", "[", "i", "]", ".", "label", "===", "label", ")", "{", "let", ...
Helper function for demo to dynamically expand items
[ "Helper", "function", "for", "demo", "to", "dynamically", "expand", "items" ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/examples/preact/index.js#L33-L47
train
PepsRyuu/virtual-scrolling-tree
examples/preact/index.js
onDataFetch
function onDataFetch(query, resolve) { let output = []; query.forEach(function(query) { let filteredItems = data.filter(function(obj) { return obj.parent === query.parent; }); output.push({ parent: query.parent, items: filteredItems.splice(query.offs...
javascript
function onDataFetch(query, resolve) { let output = []; query.forEach(function(query) { let filteredItems = data.filter(function(obj) { return obj.parent === query.parent; }); output.push({ parent: query.parent, items: filteredItems.splice(query.offs...
[ "function", "onDataFetch", "(", "query", ",", "resolve", ")", "{", "let", "output", "=", "[", "]", ";", "query", ".", "forEach", "(", "function", "(", "query", ")", "{", "let", "filteredItems", "=", "data", ".", "filter", "(", "function", "(", "obj", ...
Called by the VST to get data. @method onDataFetch
[ "Called", "by", "the", "VST", "to", "get", "data", "." ]
bc3d5ff20eecae19b7fc13fc233d9ea33990c503
https://github.com/PepsRyuu/virtual-scrolling-tree/blob/bc3d5ff20eecae19b7fc13fc233d9ea33990c503/examples/preact/index.js#L54-L70
train
duizendnegen/ember-cli-lazy-load
ember-addon.js
EmberAddon
function EmberAddon() { var args = []; var options = {}; console.log("Addon init") for (var i = 0, l = arguments.length; i < l; i++) { args.push(arguments[i]); } if (args.length === 1) { options = args[0]; } else if (args.length > 1) { args.reverse(); option...
javascript
function EmberAddon() { var args = []; var options = {}; console.log("Addon init") for (var i = 0, l = arguments.length; i < l; i++) { args.push(arguments[i]); } if (args.length === 1) { options = args[0]; } else if (args.length > 1) { args.reverse(); option...
[ "function", "EmberAddon", "(", ")", "{", "var", "args", "=", "[", "]", ";", "var", "options", "=", "{", "}", ";", "console", ".", "log", "(", "\"Addon init\"", ")", "for", "(", "var", "i", "=", "0", ",", "l", "=", "arguments", ".", "length", ";",...
EmberAddon is used during addon development. @class EmberAddon @extends EmberApp @constructor @param options
[ "EmberAddon", "is", "used", "during", "addon", "development", "." ]
ae1adcc0a1d5e8e6b11d7ff79cf3844852adbf17
https://github.com/duizendnegen/ember-cli-lazy-load/blob/ae1adcc0a1d5e8e6b11d7ff79cf3844852adbf17/ember-addon.js#L21-L56
train
drkibitz/node-pixi
src/pixi/display/Sprite.js
Sprite
function Sprite(texture) { DisplayObjectContainer.call(this); /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the textures origin is the top left * Setting than anchor to 0.5,0.5 means the textures origin is centered * Setting the anchor to 1,1 would m...
javascript
function Sprite(texture) { DisplayObjectContainer.call(this); /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the textures origin is the top left * Setting than anchor to 0.5,0.5 means the textures origin is centered * Setting the anchor to 1,1 would m...
[ "function", "Sprite", "(", "texture", ")", "{", "DisplayObjectContainer", ".", "call", "(", "this", ")", ";", "/**\n * The anchor sets the origin point of the texture.\n * The default is 0,0 this means the textures origin is the top left\n * Setting than anchor to 0.5,0.5 means...
The SPrite object is the base for all textured objects that are rendered to the screen @class Sprite @extends DisplayObjectContainer @constructor @param texture {Texture} The texture for this sprite @type String
[ "The", "SPrite", "object", "is", "the", "base", "for", "all", "textured", "objects", "that", "are", "rendered", "to", "the", "screen" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/display/Sprite.js#L20-L83
train
drkibitz/node-pixi
src/pixi/textures/Texture.js
Texture
function Texture(baseTexture, frame) { EventTarget.call( this ); if(!frame) { this.noFrame = true; frame = new Rectangle(0,0,1,1); } if(baseTexture instanceof Texture) baseTexture = baseTexture.baseTexture; /** * The base texture of this texture * * @pro...
javascript
function Texture(baseTexture, frame) { EventTarget.call( this ); if(!frame) { this.noFrame = true; frame = new Rectangle(0,0,1,1); } if(baseTexture instanceof Texture) baseTexture = baseTexture.baseTexture; /** * The base texture of this texture * * @pro...
[ "function", "Texture", "(", "baseTexture", ",", "frame", ")", "{", "EventTarget", ".", "call", "(", "this", ")", ";", "if", "(", "!", "frame", ")", "{", "this", ".", "noFrame", "=", "true", ";", "frame", "=", "new", "Rectangle", "(", "0", ",", "0",...
A texture stores the information that represents an image or part of an image. It cannot be added to the display list directly. To do this use Sprite. If no frame is provided then the whole image is used @class Texture @uses EventTarget @constructor @param baseTexture {BaseTexture} The base texture source to create th...
[ "A", "texture", "stores", "the", "information", "that", "represents", "an", "image", "or", "part", "of", "an", "image", ".", "It", "cannot", "be", "added", "to", "the", "display", "list", "directly", ".", "To", "do", "this", "use", "Sprite", ".", "If", ...
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/textures/Texture.js#L21-L72
train
drkibitz/node-pixi
src/pixi/textures/BaseTexture.js
BaseTexture
function BaseTexture(source, scaleMode) { EventTarget.call(this); /** * [read-only] The width of the base texture set when the image has loaded * * @property width * @type Number * @readOnly */ this.width = 100; /** * [read-only] The height of the base texture set wh...
javascript
function BaseTexture(source, scaleMode) { EventTarget.call(this); /** * [read-only] The width of the base texture set when the image has loaded * * @property width * @type Number * @readOnly */ this.width = 100; /** * [read-only] The height of the base texture set wh...
[ "function", "BaseTexture", "(", "source", ",", "scaleMode", ")", "{", "EventTarget", ".", "call", "(", "this", ")", ";", "/**\n * [read-only] The width of the base texture set when the image has loaded\n *\n * @property width\n * @type Number\n * @readOnly\n */"...
A texture stores the information that represents an image. All textures have a base texture @class BaseTexture @uses EventTarget @constructor @param source {String} the source object (image or canvas)
[ "A", "texture", "stores", "the", "information", "that", "represents", "an", "image", ".", "All", "textures", "have", "a", "base", "texture" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/textures/BaseTexture.js#L19-L106
train
drkibitz/node-pixi
src/pixi/utils/Polyk.js
pointInTriangle
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy) { var v0x = cx-ax; var v0y = cy-ay; var v1x = bx-ax; var v1y = by-ay; var v2x = px-ax; var v2y = py-ay; var dot00 = v0x*v0x+v0y*v0y; var dot01 = v0x*v1x+v0y*v1y; var dot02 = v0x*v2x+v0y*v2y; var dot11 = v1x*v1x+v1y*v1y; ...
javascript
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy) { var v0x = cx-ax; var v0y = cy-ay; var v1x = bx-ax; var v1y = by-ay; var v2x = px-ax; var v2y = py-ay; var dot00 = v0x*v0x+v0y*v0y; var dot01 = v0x*v1x+v0y*v1y; var dot02 = v0x*v2x+v0y*v2y; var dot11 = v1x*v1x+v1y*v1y; ...
[ "function", "pointInTriangle", "(", "px", ",", "py", ",", "ax", ",", "ay", ",", "bx", ",", "by", ",", "cx", ",", "cy", ")", "{", "var", "v0x", "=", "cx", "-", "ax", ";", "var", "v0y", "=", "cy", "-", "ay", ";", "var", "v1x", "=", "bx", "-",...
Checks if a point is within a triangle @private
[ "Checks", "if", "a", "point", "is", "within", "a", "triangle" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/utils/Polyk.js#L42-L63
train
drkibitz/node-pixi
src/pixi/utils/Polyk.js
convex
function convex(ax, ay, bx, by, cx, cy, sign) { return ((ay-by)*(cx-bx) + (bx-ax)*(cy-by) >= 0) === sign; }
javascript
function convex(ax, ay, bx, by, cx, cy, sign) { return ((ay-by)*(cx-bx) + (bx-ax)*(cy-by) >= 0) === sign; }
[ "function", "convex", "(", "ax", ",", "ay", ",", "bx", ",", "by", ",", "cx", ",", "cy", ",", "sign", ")", "{", "return", "(", "(", "ay", "-", "by", ")", "*", "(", "cx", "-", "bx", ")", "+", "(", "bx", "-", "ax", ")", "*", "(", "cy", "-"...
Checks if a shape is convex @private
[ "Checks", "if", "a", "shape", "is", "convex" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/utils/Polyk.js#L70-L73
train
drkibitz/node-pixi
src/pixi/geom/Circle.js
Circle
function Circle(x, y, radius) { /** * @property x * @type Number * @default 0 */ this.x = x || 0; /** * @property y * @type Number * @default 0 */ this.y = y || 0; /** * @property radius * @type Number * @default 0 */ this.radius = ra...
javascript
function Circle(x, y, radius) { /** * @property x * @type Number * @default 0 */ this.x = x || 0; /** * @property y * @type Number * @default 0 */ this.y = y || 0; /** * @property radius * @type Number * @default 0 */ this.radius = ra...
[ "function", "Circle", "(", "x", ",", "y", ",", "radius", ")", "{", "/**\n * @property x\n * @type Number\n * @default 0\n */", "this", ".", "x", "=", "x", "||", "0", ";", "/**\n * @property y\n * @type Number\n * @default 0\n */", "this", "."...
The Circle object can be used to specify a hit area for displayobjects @class Circle @constructor @param x {Number} The X coord of the upper-left corner of the framing rectangle of this circle @param y {Number} The Y coord of the upper-left corner of the framing rectangle of this circle @param radius {Number} The radi...
[ "The", "Circle", "object", "can", "be", "used", "to", "specify", "a", "hit", "area", "for", "displayobjects" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/geom/Circle.js#L15-L37
train
drkibitz/node-pixi
src/bundle-node.js
ImageMock
function ImageMock() { var _complete = true; var _width = 0; var _height = 0; var _src = ''; var _onLoad = null; var _loadTimeoutId; Object.defineProperties(this, { complete: { get: function getComplete() { return _complete; }, enumerable: true }, onload: { get: function getOnload() { ...
javascript
function ImageMock() { var _complete = true; var _width = 0; var _height = 0; var _src = ''; var _onLoad = null; var _loadTimeoutId; Object.defineProperties(this, { complete: { get: function getComplete() { return _complete; }, enumerable: true }, onload: { get: function getOnload() { ...
[ "function", "ImageMock", "(", ")", "{", "var", "_complete", "=", "true", ";", "var", "_width", "=", "0", ";", "var", "_height", "=", "0", ";", "var", "_src", "=", "''", ";", "var", "_onLoad", "=", "null", ";", "var", "_loadTimeoutId", ";", "Object", ...
Minimal Image Element mock This does not implement anything further than what pixi uses.
[ "Minimal", "Image", "Element", "mock" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/bundle-node.js#L16-L77
train
geut/postcss-copy
src/index.js
ignore
function ignore(fileMeta, opts) { if (typeof opts.ignore === 'function') { return opts.ignore(fileMeta, opts); } if (typeof opts.ignore === 'string' || Array.isArray(opts.ignore)) { return micromatch.any(fileMeta.sourceValue, opts.ignore); } return false; }
javascript
function ignore(fileMeta, opts) { if (typeof opts.ignore === 'function') { return opts.ignore(fileMeta, opts); } if (typeof opts.ignore === 'string' || Array.isArray(opts.ignore)) { return micromatch.any(fileMeta.sourceValue, opts.ignore); } return false; }
[ "function", "ignore", "(", "fileMeta", ",", "opts", ")", "{", "if", "(", "typeof", "opts", ".", "ignore", "===", "'function'", ")", "{", "return", "opts", ".", "ignore", "(", "fileMeta", ",", "opts", ")", ";", "}", "if", "(", "typeof", "opts", ".", ...
Helper function to ignore files @param {string} filename @param {string} extra @param {Object} opts plugin options @return {boolean}
[ "Helper", "function", "to", "ignore", "files" ]
50f6f086336632c22f5db89143cc07b61f34093d
https://github.com/geut/postcss-copy/blob/50f6f086336632c22f5db89143cc07b61f34093d/src/index.js#L20-L30
train
geut/postcss-copy
src/index.js
getFileMeta
function getFileMeta(dirname, sourceInputFile, value, opts) { const parsedUrl = url.parse(value, true); const filename = decodeURI(parsedUrl.pathname); const pathname = path.resolve(dirname, filename); const params = parsedUrl.search || ''; const hash = parsedUrl.hash || ''; // path between the...
javascript
function getFileMeta(dirname, sourceInputFile, value, opts) { const parsedUrl = url.parse(value, true); const filename = decodeURI(parsedUrl.pathname); const pathname = path.resolve(dirname, filename); const params = parsedUrl.search || ''; const hash = parsedUrl.hash || ''; // path between the...
[ "function", "getFileMeta", "(", "dirname", ",", "sourceInputFile", ",", "value", ",", "opts", ")", "{", "const", "parsedUrl", "=", "url", ".", "parse", "(", "value", ",", "true", ")", ";", "const", "filename", "=", "decodeURI", "(", "parsedUrl", ".", "pa...
Helper function that reads the file ang get some helpful information to the copy process. @param {string} dirname path of the read file css @param {string} sourceInputFile path to the source input file css @param {string} value url @param {Object} opts plugin options @return {Promise} resolve => fileMeta | reject ...
[ "Helper", "function", "that", "reads", "the", "file", "ang", "get", "some", "helpful", "information", "to", "the", "copy", "process", "." ]
50f6f086336632c22f5db89143cc07b61f34093d
https://github.com/geut/postcss-copy/blob/50f6f086336632c22f5db89143cc07b61f34093d/src/index.js#L42-L75
train
geut/postcss-copy
src/index.js
processUrl
function processUrl(result, decl, node, opts) { // ignore from the css file by `!` if (node.value.indexOf('!') === 0) { node.value = node.value.slice(1); return Promise.resolve(); } if ( node.value.indexOf('/') === 0 || node.value.indexOf('data:') === 0 || node.v...
javascript
function processUrl(result, decl, node, opts) { // ignore from the css file by `!` if (node.value.indexOf('!') === 0) { node.value = node.value.slice(1); return Promise.resolve(); } if ( node.value.indexOf('/') === 0 || node.value.indexOf('data:') === 0 || node.v...
[ "function", "processUrl", "(", "result", ",", "decl", ",", "node", ",", "opts", ")", "{", "// ignore from the css file by `!`", "if", "(", "node", ".", "value", ".", "indexOf", "(", "'!'", ")", "===", "0", ")", "{", "node", ".", "value", "=", "node", "...
process to copy an asset based on the css file, destination and the url value @param {Object} result @param {Object} decl postcss declaration @param {Object} node postcss-value-parser @param {Object} opts plugin options @return {Promise}
[ "process", "to", "copy", "an", "asset", "based", "on", "the", "css", "file", "destination", "and", "the", "url", "value" ]
50f6f086336632c22f5db89143cc07b61f34093d
https://github.com/geut/postcss-copy/blob/50f6f086336632c22f5db89143cc07b61f34093d/src/index.js#L87-L173
train
geut/postcss-copy
src/index.js
processDecl
function processDecl(result, decl, opts) { const promises = []; decl.value = valueParser(decl.value).walk(node => { if ( node.type !== 'function' || node.value !== 'url' || node.nodes.length === 0 ) { return; } const promise = Pro...
javascript
function processDecl(result, decl, opts) { const promises = []; decl.value = valueParser(decl.value).walk(node => { if ( node.type !== 'function' || node.value !== 'url' || node.nodes.length === 0 ) { return; } const promise = Pro...
[ "function", "processDecl", "(", "result", ",", "decl", ",", "opts", ")", "{", "const", "promises", "=", "[", "]", ";", "decl", ".", "value", "=", "valueParser", "(", "decl", ".", "value", ")", ".", "walk", "(", "node", "=>", "{", "if", "(", "node",...
Processes each declaration using postcss-value-parser @param {Object} result @param {Object} decl postcss declaration @param {Object} opts plugin options @return {Promise}
[ "Processes", "each", "declaration", "using", "postcss", "-", "value", "-", "parser" ]
50f6f086336632c22f5db89143cc07b61f34093d
https://github.com/geut/postcss-copy/blob/50f6f086336632c22f5db89143cc07b61f34093d/src/index.js#L183-L205
train
geut/postcss-copy
src/index.js
init
function init(userOpts = {}) { const opts = Object.assign( { template: '[hash].[ext][query]', preservePath: false, hashFunction(contents) { return crypto .createHash('sha1') .update(contents) .dig...
javascript
function init(userOpts = {}) { const opts = Object.assign( { template: '[hash].[ext][query]', preservePath: false, hashFunction(contents) { return crypto .createHash('sha1') .update(contents) .dig...
[ "function", "init", "(", "userOpts", "=", "{", "}", ")", "{", "const", "opts", "=", "Object", ".", "assign", "(", "{", "template", ":", "'[hash].[ext][query]'", ",", "preservePath", ":", "false", ",", "hashFunction", "(", "contents", ")", "{", "return", ...
Initialize the postcss-copy plugin @param {Object} plugin options @return {plugin}
[ "Initialize", "the", "postcss", "-", "copy", "plugin" ]
50f6f086336632c22f5db89143cc07b61f34093d
https://github.com/geut/postcss-copy/blob/50f6f086336632c22f5db89143cc07b61f34093d/src/index.js#L212-L261
train
drkibitz/node-pixi
src/pixi/display/Stage.js
Stage
function Stage(backgroundColor) { DisplayObjectContainer.call(this); /** * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform * @type Mat3 * @readOnly * @private */ this.worldTransform = mat3.create(); /** * ...
javascript
function Stage(backgroundColor) { DisplayObjectContainer.call(this); /** * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform * @type Mat3 * @readOnly * @private */ this.worldTransform = mat3.create(); /** * ...
[ "function", "Stage", "(", "backgroundColor", ")", "{", "DisplayObjectContainer", ".", "call", "(", "this", ")", ";", "/**\n * [read-only] Current transform of the object based on world (parent) factors\n *\n * @property worldTransform\n * @type Mat3\n * @readOnly\n ...
A Stage represents the root of the display tree. Everything connected to the stage is rendered @class Stage @extends DisplayObjectContainer @constructor @param backgroundColor {Number} the background color of the stage, easiest way to pass this in is in hex format like: 0xFFFFFF for white
[ "A", "Stage", "represents", "the", "root", "of", "the", "display", "tree", ".", "Everything", "connected", "to", "the", "stage", "is", "rendered" ]
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/display/Stage.js#L23-L73
train
drkibitz/node-pixi
src/pixi/loaders/AtlasLoader.js
AtlasLoader
function AtlasLoader(url, crossorigin) { EventTarget.call(this); this.url = url; this.baseUrl = url.replace(/[^\/]*$/, ''); this.crossorigin = crossorigin; this.loaded = false; }
javascript
function AtlasLoader(url, crossorigin) { EventTarget.call(this); this.url = url; this.baseUrl = url.replace(/[^\/]*$/, ''); this.crossorigin = crossorigin; this.loaded = false; }
[ "function", "AtlasLoader", "(", "url", ",", "crossorigin", ")", "{", "EventTarget", ".", "call", "(", "this", ")", ";", "this", ".", "url", "=", "url", ";", "this", ".", "baseUrl", "=", "url", ".", "replace", "(", "/", "[^\\/]*$", "/", ",", "''", "...
The atlas file loader is used to load in Atlas data and parsing it When loaded this class will dispatch a 'loaded' event If load failed this class will dispatch a 'error' event @class AtlasLoader @extends EventTarget @constructor @param {String} url the url of the JSON file @param {Boolean} crossorigin
[ "The", "atlas", "file", "loader", "is", "used", "to", "load", "in", "Atlas", "data", "and", "parsing", "it", "When", "loaded", "this", "class", "will", "dispatch", "a", "loaded", "event", "If", "load", "failed", "this", "class", "will", "dispatch", "a", ...
2ddb5361c50293419a46a76bf4771cecd6d9aef4
https://github.com/drkibitz/node-pixi/blob/2ddb5361c50293419a46a76bf4771cecd6d9aef4/src/pixi/loaders/AtlasLoader.js#L21-L27
train
Flexberry/ember-flexberry-data
addon/stores/base-store/decorate-adapter.js
addIdToSnapshot
function addIdToSnapshot(snapshot) { var record = snapshot.record; record.get('store').updateId(record, { id: generateUniqueId() }); return record._createSnapshot(); }
javascript
function addIdToSnapshot(snapshot) { var record = snapshot.record; record.get('store').updateId(record, { id: generateUniqueId() }); return record._createSnapshot(); }
[ "function", "addIdToSnapshot", "(", "snapshot", ")", "{", "var", "record", "=", "snapshot", ".", "record", ";", "record", ".", "get", "(", "'store'", ")", ".", "updateId", "(", "record", ",", "{", "id", ":", "generateUniqueId", "(", ")", "}", ")", ";",...
Add an id to record before create in local
[ "Add", "an", "id", "to", "record", "before", "create", "in", "local" ]
fd8fa5ad8488f759b5d872435d8044bfbb96b5a4
https://github.com/Flexberry/ember-flexberry-data/blob/fd8fa5ad8488f759b5d872435d8044bfbb96b5a4/addon/stores/base-store/decorate-adapter.js#L91-L95
train
here-be/snapdragon-node
index.js
assign
function assign(node, token, clone) { copy(node, token, clone); ensureNodes(node, clone); if (token.constructor && token.constructor.name === 'Token') { copy(node, token.constructor.prototype, clone); } }
javascript
function assign(node, token, clone) { copy(node, token, clone); ensureNodes(node, clone); if (token.constructor && token.constructor.name === 'Token') { copy(node, token.constructor.prototype, clone); } }
[ "function", "assign", "(", "node", ",", "token", ",", "clone", ")", "{", "copy", "(", "node", ",", "token", ",", "clone", ")", ";", "ensureNodes", "(", "node", ",", "clone", ")", ";", "if", "(", "token", ".", "constructor", "&&", "token", ".", "con...
assign `token` properties to `node`
[ "assign", "token", "properties", "to", "node" ]
bd9c41060c9a31f550847b3095148085546db349
https://github.com/here-be/snapdragon-node/blob/bd9c41060c9a31f550847b3095148085546db349/index.js#L629-L636
train
Flexberry/ember-flexberry-data
addon/query/indexeddb-adapter.js
function(a, b) { let aVal = a[sortField]; let bVal = b[sortField]; return (!aVal && bVal) || (aVal < bVal) ? -1 : (aVal && !bVal) || (aVal > bVal) ? 1 : 0; }
javascript
function(a, b) { let aVal = a[sortField]; let bVal = b[sortField]; return (!aVal && bVal) || (aVal < bVal) ? -1 : (aVal && !bVal) || (aVal > bVal) ? 1 : 0; }
[ "function", "(", "a", ",", "b", ")", "{", "let", "aVal", "=", "a", "[", "sortField", "]", ";", "let", "bVal", "=", "b", "[", "sortField", "]", ";", "return", "(", "!", "aVal", "&&", "bVal", ")", "||", "(", "aVal", "<", "bVal", ")", "?", "-", ...
Sorting array by `sortField` and asc.
[ "Sorting", "array", "by", "sortField", "and", "asc", "." ]
fd8fa5ad8488f759b5d872435d8044bfbb96b5a4
https://github.com/Flexberry/ember-flexberry-data/blob/fd8fa5ad8488f759b5d872435d8044bfbb96b5a4/addon/query/indexeddb-adapter.js#L67-L71
train
Flexberry/ember-flexberry-data
addon/query/indexeddb-adapter.js
containsRelationships
function containsRelationships(query) { let contains = false; if (query.predicate instanceof SimplePredicate || query.predicate instanceof StringPredicate || query.predicate instanceof DatePredicate) { contains = Information.parseAttributePath(query.predicate.attributePath).length > 1; } if (query.predicat...
javascript
function containsRelationships(query) { let contains = false; if (query.predicate instanceof SimplePredicate || query.predicate instanceof StringPredicate || query.predicate instanceof DatePredicate) { contains = Information.parseAttributePath(query.predicate.attributePath).length > 1; } if (query.predicat...
[ "function", "containsRelationships", "(", "query", ")", "{", "let", "contains", "=", "false", ";", "if", "(", "query", ".", "predicate", "instanceof", "SimplePredicate", "||", "query", ".", "predicate", "instanceof", "StringPredicate", "||", "query", ".", "predi...
Checks query on contains restrictions by relationships. @method containsRelationships @param {QueryObject} query @return {Boolean}
[ "Checks", "query", "on", "contains", "restrictions", "by", "relationships", "." ]
fd8fa5ad8488f759b5d872435d8044bfbb96b5a4
https://github.com/Flexberry/ember-flexberry-data/blob/fd8fa5ad8488f759b5d872435d8044bfbb96b5a4/addon/query/indexeddb-adapter.js#L695-L723
train
Khan/fuzzy-match-utils
dist/fuzzy-match-utils.js
filterOptions
function filterOptions(options, filter, substitutions) { // If the filter is blank, return the full list of Options. if (!filter) { return options; } var cleanFilter = cleanUpText(filter, substitutions); return options // Filter out undefined or null Options. .filter(function (_ref)...
javascript
function filterOptions(options, filter, substitutions) { // If the filter is blank, return the full list of Options. if (!filter) { return options; } var cleanFilter = cleanUpText(filter, substitutions); return options // Filter out undefined or null Options. .filter(function (_ref)...
[ "function", "filterOptions", "(", "options", ",", "filter", ",", "substitutions", ")", "{", "// If the filter is blank, return the full list of Options.", "if", "(", "!", "filter", ")", "{", "return", "options", ";", "}", "var", "cleanFilter", "=", "cleanUpText", "(...
A collection of string matching algorithms built with React Select in mind. Option type from React Select and similar libraries.
[ "A", "collection", "of", "string", "matching", "algorithms", "built", "with", "React", "Select", "in", "mind", ".", "Option", "type", "from", "React", "Select", "and", "similar", "libraries", "." ]
6d22f93324271a301e5840bcc542e945074abcfe
https://github.com/Khan/fuzzy-match-utils/blob/6d22f93324271a301e5840bcc542e945074abcfe/dist/fuzzy-match-utils.js#L31-L66
train
Khan/fuzzy-match-utils
dist/fuzzy-match-utils.js
typeaheadSimilarity
function typeaheadSimilarity(a, b) { var aLength = a.length; var bLength = b.length; var table = []; if (!aLength || !bLength) { return 0; } // Ensure `a` isn't shorter than `b`. if (aLength < bLength) { var _ref2 = [b, a]; a = _ref2[0]; b = _ref2[1]; } ...
javascript
function typeaheadSimilarity(a, b) { var aLength = a.length; var bLength = b.length; var table = []; if (!aLength || !bLength) { return 0; } // Ensure `a` isn't shorter than `b`. if (aLength < bLength) { var _ref2 = [b, a]; a = _ref2[0]; b = _ref2[1]; } ...
[ "function", "typeaheadSimilarity", "(", "a", ",", "b", ")", "{", "var", "aLength", "=", "a", ".", "length", ";", "var", "bLength", "=", "b", ".", "length", ";", "var", "table", "=", "[", "]", ";", "if", "(", "!", "aLength", "||", "!", "bLength", ...
Scores the similarity between two strings by returning the length of the longest common subsequence. Intended for comparing strings of different lengths; eg. when matching a typeahead search input with a school name. Meant for use in an instant search box where results are being fetched as a user is typing. @param a...
[ "Scores", "the", "similarity", "between", "two", "strings", "by", "returning", "the", "length", "of", "the", "longest", "common", "subsequence", ".", "Intended", "for", "comparing", "strings", "of", "different", "lengths", ";", "eg", ".", "when", "matching", "...
6d22f93324271a301e5840bcc542e945074abcfe
https://github.com/Khan/fuzzy-match-utils/blob/6d22f93324271a301e5840bcc542e945074abcfe/dist/fuzzy-match-utils.js#L82-L130
train
Khan/fuzzy-match-utils
dist/fuzzy-match-utils.js
fullStringDistance
function fullStringDistance(a, b) { var aLength = a.length; var bLength = b.length; var table = []; if (!aLength) { return bLength; } if (!bLength) { return aLength; } // Initialize the table axes: // // 0 1 2 3 4 ... bLength // 1 // 2 // ...
javascript
function fullStringDistance(a, b) { var aLength = a.length; var bLength = b.length; var table = []; if (!aLength) { return bLength; } if (!bLength) { return aLength; } // Initialize the table axes: // // 0 1 2 3 4 ... bLength // 1 // 2 // ...
[ "function", "fullStringDistance", "(", "a", ",", "b", ")", "{", "var", "aLength", "=", "a", ".", "length", ";", "var", "bLength", "=", "b", ".", "length", ";", "var", "table", "=", "[", "]", ";", "if", "(", "!", "aLength", ")", "{", "return", "bL...
Returns the Levenshtein distance between two strings. NOTE: The Jaro-Winkler distance also worked well and is slightly more performant. Levenshtein seems to match more reliably, which is more important here. @param a The first string for comparison. @param b The second string for comparison. @return The Levensht...
[ "Returns", "the", "Levenshtein", "distance", "between", "two", "strings", "." ]
6d22f93324271a301e5840bcc542e945074abcfe
https://github.com/Khan/fuzzy-match-utils/blob/6d22f93324271a301e5840bcc542e945074abcfe/dist/fuzzy-match-utils.js#L145-L184
train
Khan/fuzzy-match-utils
dist/fuzzy-match-utils.js
cleanUpText
function cleanUpText(input, substitutions) { if (!input) { return ''; } // Uppercase and remove all non-alphanumeric, non-accented characters. // Also remove underscores. input = input.toUpperCase().replace(/((?=[^\u00E0-\u00FC])\W)|_/g, ''); if (!substitutions) { return input;...
javascript
function cleanUpText(input, substitutions) { if (!input) { return ''; } // Uppercase and remove all non-alphanumeric, non-accented characters. // Also remove underscores. input = input.toUpperCase().replace(/((?=[^\u00E0-\u00FC])\W)|_/g, ''); if (!substitutions) { return input;...
[ "function", "cleanUpText", "(", "input", ",", "substitutions", ")", "{", "if", "(", "!", "input", ")", "{", "return", "''", ";", "}", "// Uppercase and remove all non-alphanumeric, non-accented characters.", "// Also remove underscores.", "input", "=", "input", ".", "...
Apply string substitutions, remove non-alphanumeric characters, and convert all letters to uppercase. eg. 'Scoil Bhríde Primary School' may become 'SCOILBHRIDEPRIMARYSCHOOL'. @param input An unsanitized input string. @param substitutions Strings with multiple spellings or variations that we expect to match, for e...
[ "Apply", "string", "substitutions", "remove", "non", "-", "alphanumeric", "characters", "and", "convert", "all", "letters", "to", "uppercase", "." ]
6d22f93324271a301e5840bcc542e945074abcfe
https://github.com/Khan/fuzzy-match-utils/blob/6d22f93324271a301e5840bcc542e945074abcfe/dist/fuzzy-match-utils.js#L199-L219
train
Q42Philips/hue-color-converter
index.js
function(red, green, blue, model) { red = red / 255; green = green / 255; blue = blue / 255; var r = red > 0.04045 ? Math.pow(((red + 0.055) / 1.055), 2.4000000953674316) : red / 12.92; var g = green > 0.04045 ? Math.pow(((green + 0.055) / 1.055), 2.4000000953674316) : green / 12.92; var b = blu...
javascript
function(red, green, blue, model) { red = red / 255; green = green / 255; blue = blue / 255; var r = red > 0.04045 ? Math.pow(((red + 0.055) / 1.055), 2.4000000953674316) : red / 12.92; var g = green > 0.04045 ? Math.pow(((green + 0.055) / 1.055), 2.4000000953674316) : green / 12.92; var b = blu...
[ "function", "(", "red", ",", "green", ",", "blue", ",", "model", ")", "{", "red", "=", "red", "/", "255", ";", "green", "=", "green", "/", "255", ";", "blue", "=", "blue", "/", "255", ";", "var", "r", "=", "red", ">", "0.04045", "?", "Math", ...
Calculate XY color points for a given RGB value. @param {number} red RGB red value (0-255) @param {number} green RGB green value (0-255) @param {number} blue RGB blue value (0-255) @param {string} model Hue bulb model @returns {number[]}
[ "Calculate", "XY", "color", "points", "for", "a", "given", "RGB", "value", "." ]
98d0faa08b776573deedb2f531b31c795a928a93
https://github.com/Q42Philips/hue-color-converter/blob/98d0faa08b776573deedb2f531b31c795a928a93/index.js#L20-L66
train
thinkjs/think-helper
index.js
isInt
function isInt(value) { if (isNaN(value) || exports.isString(value)) { return false; } var x = parseFloat(value); return (x | 0) === x; }
javascript
function isInt(value) { if (isNaN(value) || exports.isString(value)) { return false; } var x = parseFloat(value); return (x | 0) === x; }
[ "function", "isInt", "(", "value", ")", "{", "if", "(", "isNaN", "(", "value", ")", "||", "exports", ".", "isString", "(", "value", ")", ")", "{", "return", "false", ";", "}", "var", "x", "=", "parseFloat", "(", "value", ")", ";", "return", "(", ...
check value is integer
[ "check", "value", "is", "integer" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L64-L70
train
thinkjs/think-helper
index.js
isEmpty
function isEmpty(obj) { if (isTrueEmpty(obj)) return true; if (exports.isRegExp(obj)) { return false; } else if (exports.isDate(obj)) { return false; } else if (exports.isError(obj)) { return false; } else if (exports.isArray(obj)) { return obj.length === 0; } else if (exports.isString(obj))...
javascript
function isEmpty(obj) { if (isTrueEmpty(obj)) return true; if (exports.isRegExp(obj)) { return false; } else if (exports.isDate(obj)) { return false; } else if (exports.isError(obj)) { return false; } else if (exports.isArray(obj)) { return obj.length === 0; } else if (exports.isString(obj))...
[ "function", "isEmpty", "(", "obj", ")", "{", "if", "(", "isTrueEmpty", "(", "obj", ")", ")", "return", "true", ";", "if", "(", "exports", ".", "isRegExp", "(", "obj", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "exports", ".", ...
check object is mepty @param {[Mixed]} obj [] @return {Boolean} []
[ "check", "object", "is", "mepty" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L186-L209
train
thinkjs/think-helper
index.js
isExist
function isExist(dir) { dir = path.normalize(dir); try { fs.accessSync(dir, fs.R_OK); return true; } catch (e) { return false; } }
javascript
function isExist(dir) { dir = path.normalize(dir); try { fs.accessSync(dir, fs.R_OK); return true; } catch (e) { return false; } }
[ "function", "isExist", "(", "dir", ")", "{", "dir", "=", "path", ".", "normalize", "(", "dir", ")", ";", "try", "{", "fs", ".", "accessSync", "(", "dir", ",", "fs", ".", "R_OK", ")", ";", "return", "true", ";", "}", "catch", "(", "e", ")", "{",...
check path is exist
[ "check", "path", "is", "exist" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L386-L394
train
thinkjs/think-helper
index.js
isFile
function isFile(filePath) { if (!isExist(filePath)) return false; try { const stat = fs.statSync(filePath); return stat.isFile(); } catch (e) { return false; } }
javascript
function isFile(filePath) { if (!isExist(filePath)) return false; try { const stat = fs.statSync(filePath); return stat.isFile(); } catch (e) { return false; } }
[ "function", "isFile", "(", "filePath", ")", "{", "if", "(", "!", "isExist", "(", "filePath", ")", ")", "return", "false", ";", "try", "{", "const", "stat", "=", "fs", ".", "statSync", "(", "filePath", ")", ";", "return", "stat", ".", "isFile", "(", ...
check filepath is file
[ "check", "filepath", "is", "file" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L401-L409
train
thinkjs/think-helper
index.js
isDirectory
function isDirectory(filePath) { if (!isExist(filePath)) return false; try { const stat = fs.statSync(filePath); return stat.isDirectory(); } catch (e) { return false; } }
javascript
function isDirectory(filePath) { if (!isExist(filePath)) return false; try { const stat = fs.statSync(filePath); return stat.isDirectory(); } catch (e) { return false; } }
[ "function", "isDirectory", "(", "filePath", ")", "{", "if", "(", "!", "isExist", "(", "filePath", ")", ")", "return", "false", ";", "try", "{", "const", "stat", "=", "fs", ".", "statSync", "(", "filePath", ")", ";", "return", "stat", ".", "isDirectory"...
check path is directory
[ "check", "path", "is", "directory" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L415-L423
train
thinkjs/think-helper
index.js
chmod
function chmod(p, mode) { try { fs.chmodSync(p, mode); return true; } catch (e) { return false; } }
javascript
function chmod(p, mode) { try { fs.chmodSync(p, mode); return true; } catch (e) { return false; } }
[ "function", "chmod", "(", "p", ",", "mode", ")", "{", "try", "{", "fs", ".", "chmodSync", "(", "p", ",", "mode", ")", ";", "return", "true", ";", "}", "catch", "(", "e", ")", "{", "return", "false", ";", "}", "}" ]
change path mode @param {String} p [path] @param {String} mode [path mode] @return {Boolean} []
[ "change", "path", "mode" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L432-L439
train
thinkjs/think-helper
index.js
getdirFiles
function getdirFiles(dir, prefix = '') { dir = path.normalize(dir); if (!fs.existsSync(dir)) return []; const files = fs.readdirSync(dir); let result = []; files.forEach(item => { const currentDir = path.join(dir, item); const stat = fs.statSync(currentDir); if (stat.isFile()) { result.push(...
javascript
function getdirFiles(dir, prefix = '') { dir = path.normalize(dir); if (!fs.existsSync(dir)) return []; const files = fs.readdirSync(dir); let result = []; files.forEach(item => { const currentDir = path.join(dir, item); const stat = fs.statSync(currentDir); if (stat.isFile()) { result.push(...
[ "function", "getdirFiles", "(", "dir", ",", "prefix", "=", "''", ")", "{", "dir", "=", "path", ".", "normalize", "(", "dir", ")", ";", "if", "(", "!", "fs", ".", "existsSync", "(", "dir", ")", ")", "return", "[", "]", ";", "const", "files", "=", ...
get files in path @param {} dir [] @param {} prefix [] @return {} []
[ "get", "files", "in", "path" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L470-L486
train
thinkjs/think-helper
index.js
rmdir
function rmdir(p, reserve) { if (!isDirectory(p)) return Promise.resolve(); return fsReaddir(p).then(files => { const promises = files.map(item => { const filepath = path.join(p, item); if (isDirectory(filepath)) return rmdir(filepath, false); return fsUnlink(filepath); }); return Prom...
javascript
function rmdir(p, reserve) { if (!isDirectory(p)) return Promise.resolve(); return fsReaddir(p).then(files => { const promises = files.map(item => { const filepath = path.join(p, item); if (isDirectory(filepath)) return rmdir(filepath, false); return fsUnlink(filepath); }); return Prom...
[ "function", "rmdir", "(", "p", ",", "reserve", ")", "{", "if", "(", "!", "isDirectory", "(", "p", ")", ")", "return", "Promise", ".", "resolve", "(", ")", ";", "return", "fsReaddir", "(", "p", ")", ".", "then", "(", "files", "=>", "{", "const", "...
remove dir aync @param {String} p [path] @param {Boolean} reserve [] @return {Promise} []
[ "remove", "dir", "aync" ]
43d7b132a47248ebb403a01901936c480906e8a0
https://github.com/thinkjs/think-helper/blob/43d7b132a47248ebb403a01901936c480906e8a0/index.js#L496-L508
train
ember-cli/node-modules-path
index.js
nodeModulePaths
function nodeModulePaths(from) { // guarantee that 'from' is absolute. from = path.resolve(from); // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. var splitRe = process.plat...
javascript
function nodeModulePaths(from) { // guarantee that 'from' is absolute. from = path.resolve(from); // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. var splitRe = process.plat...
[ "function", "nodeModulePaths", "(", "from", ")", "{", "// guarantee that 'from' is absolute.", "from", "=", "path", ".", "resolve", "(", "from", ")", ";", "// note: this approach *only* works when the path is guaranteed", "// to be absolute. Doing a fully-edge-case-correct path.sp...
Due to the fact that the node community doesn't feel that the node_modules resolution algorithm should be public method we have copy pasta'd it here.
[ "Due", "to", "the", "fact", "that", "the", "node", "community", "doesn", "t", "feel", "that", "the", "node_modules", "resolution", "algorithm", "should", "be", "public", "method", "we", "have", "copy", "pasta", "d", "it", "here", "." ]
adbcc4a5ebeeae3dfa0adffc1821170ce9b47dad
https://github.com/ember-cli/node-modules-path/blob/adbcc4a5ebeeae3dfa0adffc1821170ce9b47dad/index.js#L9-L31
train
c9/vfs-local
localfs.js
createStatEntry
function createStatEntry(file, fullpath, callback) { fs.lstat(fullpath, function (err, stat) { var entry = { name: file }; if (err) { entry.err = err; return callback(entry); } else { entry.size = st...
javascript
function createStatEntry(file, fullpath, callback) { fs.lstat(fullpath, function (err, stat) { var entry = { name: file }; if (err) { entry.err = err; return callback(entry); } else { entry.size = st...
[ "function", "createStatEntry", "(", "file", ",", "fullpath", ",", "callback", ")", "{", "fs", ".", "lstat", "(", "fullpath", ",", "function", "(", "err", ",", "stat", ")", "{", "var", "entry", "=", "{", "name", ":", "file", "}", ";", "if", "(", "er...
This helper function doesn't follow node conventions in the callback, there is no err, only entry.
[ "This", "helper", "function", "doesn", "t", "follow", "node", "conventions", "in", "the", "callback", "there", "is", "no", "err", "only", "entry", "." ]
9569c00e2fca4a4e2c2c9c0227e440322cd74882
https://github.com/c9/vfs-local/blob/9569c00e2fca4a4e2c2c9c0227e440322cd74882/localfs.js#L166-L218
train
c9/vfs-local
localfs.js
remove
function remove(path, fn, callback) { var meta = {}; resolvePath(path, function (err, realpath) { if (err) return callback(err); fn(realpath, function (err) { if (err) return callback(err); // Remove metadata resolv...
javascript
function remove(path, fn, callback) { var meta = {}; resolvePath(path, function (err, realpath) { if (err) return callback(err); fn(realpath, function (err) { if (err) return callback(err); // Remove metadata resolv...
[ "function", "remove", "(", "path", ",", "fn", ",", "callback", ")", "{", "var", "meta", "=", "{", "}", ";", "resolvePath", "(", "path", ",", "function", "(", "err", ",", "realpath", ")", "{", "if", "(", "err", ")", "return", "callback", "(", "err",...
Common logic used by rmdir and rmfile
[ "Common", "logic", "used", "by", "rmdir", "and", "rmfile" ]
9569c00e2fca4a4e2c2c9c0227e440322cd74882
https://github.com/c9/vfs-local/blob/9569c00e2fca4a4e2c2c9c0227e440322cd74882/localfs.js#L221-L238
train
c9/vfs-local
localfs.js
resolve
function resolve() { resolvePath(path, function (err, _resolvedPath) { if (err) { if (err.code !== "ENOENT") { return error(err); } // If checkSymlinks is on we'll get an ENOENT when creating a new file. ...
javascript
function resolve() { resolvePath(path, function (err, _resolvedPath) { if (err) { if (err.code !== "ENOENT") { return error(err); } // If checkSymlinks is on we'll get an ENOENT when creating a new file. ...
[ "function", "resolve", "(", ")", "{", "resolvePath", "(", "path", ",", "function", "(", "err", ",", "_resolvedPath", ")", "{", "if", "(", "err", ")", "{", "if", "(", "err", ".", "code", "!==", "\"ENOENT\"", ")", "{", "return", "error", "(", "err", ...
Make sure the user has access to the directory and get the real path.
[ "Make", "sure", "the", "user", "has", "access", "to", "the", "directory", "and", "get", "the", "real", "path", "." ]
9569c00e2fca4a4e2c2c9c0227e440322cd74882
https://github.com/c9/vfs-local/blob/9569c00e2fca4a4e2c2c9c0227e440322cd74882/localfs.js#L500-L519
train
c9/vfs-local
localfs.js
consumeStream
function consumeStream(stream, callback) { var chunks = []; stream.on("data", onData); stream.on("end", onEnd); stream.on("error", onError); function onData(chunk) { chunks.push(chunk); } function onEnd() { cleanup(); callback(null, chunks.join("")); } functio...
javascript
function consumeStream(stream, callback) { var chunks = []; stream.on("data", onData); stream.on("end", onEnd); stream.on("error", onError); function onData(chunk) { chunks.push(chunk); } function onEnd() { cleanup(); callback(null, chunks.join("")); } functio...
[ "function", "consumeStream", "(", "stream", ",", "callback", ")", "{", "var", "chunks", "=", "[", "]", ";", "stream", ".", "on", "(", "\"data\"", ",", "onData", ")", ";", "stream", ".", "on", "(", "\"end\"", ",", "onEnd", ")", ";", "stream", ".", "...
Consume all data in a readable stream and call callback with full buffer.
[ "Consume", "all", "data", "in", "a", "readable", "stream", "and", "call", "callback", "with", "full", "buffer", "." ]
9569c00e2fca4a4e2c2c9c0227e440322cd74882
https://github.com/c9/vfs-local/blob/9569c00e2fca4a4e2c2c9c0227e440322cd74882/localfs.js#L1114-L1135
train
c9/vfs-local
localfs.js
evaluate
function evaluate(code) { var exports = {}; var module = { exports: exports }; vm.runInNewContext(code, { require: require, exports: exports, module: module, console: console, global: global, process: process, Buffer: Buffer, setTimeout: setTim...
javascript
function evaluate(code) { var exports = {}; var module = { exports: exports }; vm.runInNewContext(code, { require: require, exports: exports, module: module, console: console, global: global, process: process, Buffer: Buffer, setTimeout: setTim...
[ "function", "evaluate", "(", "code", ")", "{", "var", "exports", "=", "{", "}", ";", "var", "module", "=", "{", "exports", ":", "exports", "}", ";", "vm", ".", "runInNewContext", "(", "code", ",", "{", "require", ":", "require", ",", "exports", ":", ...
node-style eval
[ "node", "-", "style", "eval" ]
9569c00e2fca4a4e2c2c9c0227e440322cd74882
https://github.com/c9/vfs-local/blob/9569c00e2fca4a4e2c2c9c0227e440322cd74882/localfs.js#L1138-L1155
train
c9/vfs-local
localfs.js
calcEtag
function calcEtag(stat) { return (stat.isFile() ? '': 'W/') + '"' + (stat.ino || 0).toString(36) + "-" + stat.size.toString(36) + "-" + stat.mtime.valueOf().toString(36) + '"'; }
javascript
function calcEtag(stat) { return (stat.isFile() ? '': 'W/') + '"' + (stat.ino || 0).toString(36) + "-" + stat.size.toString(36) + "-" + stat.mtime.valueOf().toString(36) + '"'; }
[ "function", "calcEtag", "(", "stat", ")", "{", "return", "(", "stat", ".", "isFile", "(", ")", "?", "''", ":", "'W/'", ")", "+", "'\"'", "+", "(", "stat", ".", "ino", "||", "0", ")", ".", "toString", "(", "36", ")", "+", "\"-\"", "+", "stat", ...
Calculate a proper etag from a nodefs stat object
[ "Calculate", "a", "proper", "etag", "from", "a", "nodefs", "stat", "object" ]
9569c00e2fca4a4e2c2c9c0227e440322cd74882
https://github.com/c9/vfs-local/blob/9569c00e2fca4a4e2c2c9c0227e440322cd74882/localfs.js#L1158-L1160
train
catamphetamine/react-styling
source/index.js
parse_style_json_object
function parse_style_json_object(text, options) { // remove multiline comments text = text.replace(/\/\*([\s\S]*?)\*\//g, '') // ignore curly braces for now. // maybe support curly braces along with tabulation in future text = text.replace(/[\{\}]/g, '') const lines = text.split('\n') // helper class for deal...
javascript
function parse_style_json_object(text, options) { // remove multiline comments text = text.replace(/\/\*([\s\S]*?)\*\//g, '') // ignore curly braces for now. // maybe support curly braces along with tabulation in future text = text.replace(/[\{\}]/g, '') const lines = text.split('\n') // helper class for deal...
[ "function", "parse_style_json_object", "(", "text", ",", "options", ")", "{", "// remove multiline comments", "text", "=", "text", ".", "replace", "(", "/", "\\/\\*([\\s\\S]*?)\\*\\/", "/", "g", ",", "''", ")", "// ignore curly braces for now.", "// maybe support curly ...
converts text to JSON object
[ "converts", "text", "to", "JSON", "object" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L34-L61
train
catamphetamine/react-styling
source/index.js
split_into_style_lines_and_children_lines
function split_into_style_lines_and_children_lines(lines) { // get this node style lines const style_lines = lines.filter(function(line) { // styles always have indentation of 1 if (line.tabs !== 1) { return false } // detect generic css style line (skip modifier classes and media queries) const colo...
javascript
function split_into_style_lines_and_children_lines(lines) { // get this node style lines const style_lines = lines.filter(function(line) { // styles always have indentation of 1 if (line.tabs !== 1) { return false } // detect generic css style line (skip modifier classes and media queries) const colo...
[ "function", "split_into_style_lines_and_children_lines", "(", "lines", ")", "{", "// get this node style lines", "const", "style_lines", "=", "lines", ".", "filter", "(", "function", "(", "line", ")", "{", "// styles always have indentation of 1", "if", "(", "line", "."...
separates style lines from children lines
[ "separates", "style", "lines", "from", "children", "lines" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L105-L140
train
catamphetamine/react-styling
source/index.js
parse_node_name
function parse_node_name(name) { // is it a "modifier" style class let is_a_modifier = false // detect modifier style classes if (starts_with(name, '&')) { name = name.substring('&'.length) is_a_modifier = true } // support old-school CSS syntax if (starts_with(name, '.')) { name = name.substring('.'.l...
javascript
function parse_node_name(name) { // is it a "modifier" style class let is_a_modifier = false // detect modifier style classes if (starts_with(name, '&')) { name = name.substring('&'.length) is_a_modifier = true } // support old-school CSS syntax if (starts_with(name, '.')) { name = name.substring('.'.l...
[ "function", "parse_node_name", "(", "name", ")", "{", "// is it a \"modifier\" style class", "let", "is_a_modifier", "=", "false", "// detect modifier style classes", "if", "(", "starts_with", "(", "name", ",", "'&'", ")", ")", "{", "name", "=", "name", ".", "subs...
parses a style class node name
[ "parses", "a", "style", "class", "node", "name" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L143-L170
train
catamphetamine/react-styling
source/index.js
parse_children
function parse_children(lines, parent_node_names) { // preprocess the lines (filter out comments, blank lines, etc) lines = filter_lines_for_parsing(lines) // return empty object if there are no lines to parse if (lines.length === 0) { return {} } // parse each child node's lines return split_lines_by_child...
javascript
function parse_children(lines, parent_node_names) { // preprocess the lines (filter out comments, blank lines, etc) lines = filter_lines_for_parsing(lines) // return empty object if there are no lines to parse if (lines.length === 0) { return {} } // parse each child node's lines return split_lines_by_child...
[ "function", "parse_children", "(", "lines", ",", "parent_node_names", ")", "{", "// preprocess the lines (filter out comments, blank lines, etc)", "lines", "=", "filter_lines_for_parsing", "(", "lines", ")", "// return empty object if there are no lines to parse", "if", "(", "lin...
parses child nodes' lines of text into the corresponding child node JSON objects
[ "parses", "child", "nodes", "lines", "of", "text", "into", "the", "corresponding", "child", "node", "JSON", "objects" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L173-L249
train
catamphetamine/react-styling
source/index.js
filter_lines_for_parsing
function filter_lines_for_parsing(lines) { // filter out blank lines lines = lines.filter(line => !is_blank(line.line)) lines.forEach(function(line) { // remove single line comments line.line = line.line.replace(/^\s*\/\/.*/, '') // remove any trailing whitespace line.line = line.line.trim() }) return l...
javascript
function filter_lines_for_parsing(lines) { // filter out blank lines lines = lines.filter(line => !is_blank(line.line)) lines.forEach(function(line) { // remove single line comments line.line = line.line.replace(/^\s*\/\/.*/, '') // remove any trailing whitespace line.line = line.line.trim() }) return l...
[ "function", "filter_lines_for_parsing", "(", "lines", ")", "{", "// filter out blank lines", "lines", "=", "lines", ".", "filter", "(", "line", "=>", "!", "is_blank", "(", "line", ".", "line", ")", ")", "lines", ".", "forEach", "(", "function", "(", "line", ...
filters out comments, blank lines, etc
[ "filters", "out", "comments", "blank", "lines", "etc" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L252-L266
train
catamphetamine/react-styling
source/index.js
split_lines_by_child_nodes
function split_lines_by_child_nodes(lines) { // determine lines with indentation = 0 (child node entry lines) const node_entry_lines = lines.map((line, index) => { return { tabs: line.tabs, index } }) .filter(line => line.tabs === 0) .map(line => line.index) // deduce corresponding child node ending lines c...
javascript
function split_lines_by_child_nodes(lines) { // determine lines with indentation = 0 (child node entry lines) const node_entry_lines = lines.map((line, index) => { return { tabs: line.tabs, index } }) .filter(line => line.tabs === 0) .map(line => line.index) // deduce corresponding child node ending lines c...
[ "function", "split_lines_by_child_nodes", "(", "lines", ")", "{", "// determine lines with indentation = 0 (child node entry lines)", "const", "node_entry_lines", "=", "lines", ".", "map", "(", "(", "line", ",", "index", ")", "=>", "{", "return", "{", "tabs", ":", "...
takes the whole lines array and splits it by its top-tier child nodes
[ "takes", "the", "whole", "lines", "array", "and", "splits", "it", "by", "its", "top", "-", "tier", "child", "nodes" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L269-L289
train
catamphetamine/react-styling
source/index.js
expand_modifier_style_classes
function expand_modifier_style_classes(node) { const style = get_node_style(node) const pseudo_classes_and_media_queries_and_keyframes = get_node_pseudo_classes_and_media_queries_and_keyframes(node) const modifiers = Object.keys(node) // get all modifier style class nodes .filter(name => typeof(node[name]) === ...
javascript
function expand_modifier_style_classes(node) { const style = get_node_style(node) const pseudo_classes_and_media_queries_and_keyframes = get_node_pseudo_classes_and_media_queries_and_keyframes(node) const modifiers = Object.keys(node) // get all modifier style class nodes .filter(name => typeof(node[name]) === ...
[ "function", "expand_modifier_style_classes", "(", "node", ")", "{", "const", "style", "=", "get_node_style", "(", "node", ")", "const", "pseudo_classes_and_media_queries_and_keyframes", "=", "get_node_pseudo_classes_and_media_queries_and_keyframes", "(", "node", ")", "const",...
expand modifier style classes
[ "expand", "modifier", "style", "classes" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L292-L333
train
catamphetamine/react-styling
source/index.js
get_node_style
function get_node_style(node) { return Object.keys(node) // get all CSS styles of this style class node .filter(property => typeof(node[property]) !== 'object') // for each CSS style of this style class node .reduce(function(style, style_property) { style[style_property] = node[style_property] return style }...
javascript
function get_node_style(node) { return Object.keys(node) // get all CSS styles of this style class node .filter(property => typeof(node[property]) !== 'object') // for each CSS style of this style class node .reduce(function(style, style_property) { style[style_property] = node[style_property] return style }...
[ "function", "get_node_style", "(", "node", ")", "{", "return", "Object", ".", "keys", "(", "node", ")", "// get all CSS styles of this style class node", ".", "filter", "(", "property", "=>", "typeof", "(", "node", "[", "property", "]", ")", "!==", "'object'", ...
extracts root css styles of this style class node
[ "extracts", "root", "css", "styles", "of", "this", "style", "class", "node" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L336-L348
train
catamphetamine/react-styling
source/index.js
get_node_pseudo_classes_and_media_queries_and_keyframes
function get_node_pseudo_classes_and_media_queries_and_keyframes(node) { return Object.keys(node) // get all child style classes this style class node, // which aren't modifiers and are a pseudoclass or a media query or keyframes .filter(property => typeof(node[property]) === 'object' && (is_pseudo_class(proper...
javascript
function get_node_pseudo_classes_and_media_queries_and_keyframes(node) { return Object.keys(node) // get all child style classes this style class node, // which aren't modifiers and are a pseudoclass or a media query or keyframes .filter(property => typeof(node[property]) === 'object' && (is_pseudo_class(proper...
[ "function", "get_node_pseudo_classes_and_media_queries_and_keyframes", "(", "node", ")", "{", "return", "Object", ".", "keys", "(", "node", ")", "// get all child style classes this style class node, ", "// which aren't modifiers and are a pseudoclass or a media query or keyframes", "....
extracts root pseudo-classes and media queries of this style class node
[ "extracts", "root", "pseudo", "-", "classes", "and", "media", "queries", "of", "this", "style", "class", "node" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L351-L366
train
catamphetamine/react-styling
source/index.js
validate_child_style_class_types
function validate_child_style_class_types(parent_node_names, names) { for (let parent of parent_node_names) { // if it's a pseudoclass, it can't contain any style classes if (is_pseudo_class(parent) && not_empty(names)) { throw new Error(`A style class declaration "${names[0]}" found inside a pseudoclass "${...
javascript
function validate_child_style_class_types(parent_node_names, names) { for (let parent of parent_node_names) { // if it's a pseudoclass, it can't contain any style classes if (is_pseudo_class(parent) && not_empty(names)) { throw new Error(`A style class declaration "${names[0]}" found inside a pseudoclass "${...
[ "function", "validate_child_style_class_types", "(", "parent_node_names", ",", "names", ")", "{", "for", "(", "let", "parent", "of", "parent_node_names", ")", "{", "// if it's a pseudoclass, it can't contain any style classes", "if", "(", "is_pseudo_class", "(", "parent", ...
style class nesting validation
[ "style", "class", "nesting", "validation" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L428-L459
train
catamphetamine/react-styling
source/index.js
parse_style_class
function parse_style_class(lines, node_names) { // separate style lines from children lines const { style_lines, children_lines } = split_into_style_lines_and_children_lines(lines) // convert style lines info to just text lines const styles = style_lines.map(line => line.line) // using this child node's (or thes...
javascript
function parse_style_class(lines, node_names) { // separate style lines from children lines const { style_lines, children_lines } = split_into_style_lines_and_children_lines(lines) // convert style lines info to just text lines const styles = style_lines.map(line => line.line) // using this child node's (or thes...
[ "function", "parse_style_class", "(", "lines", ",", "node_names", ")", "{", "// separate style lines from children lines", "const", "{", "style_lines", ",", "children_lines", "}", "=", "split_into_style_lines_and_children_lines", "(", "lines", ")", "// convert style lines inf...
parse CSS style class
[ "parse", "CSS", "style", "class" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/index.js#L462-L475
train
catamphetamine/react-styling
source/flat.js
move_up
function move_up(object, upside, new_name) { let prefix if (upside) { upside[new_name] = object prefix = `${new_name}_` } else { upside = object prefix = '' } for (let key of Object.keys(object)) { const child_object = object[key] if (is_object(child_object) && !is_pseudo_class(key) && !is_media...
javascript
function move_up(object, upside, new_name) { let prefix if (upside) { upside[new_name] = object prefix = `${new_name}_` } else { upside = object prefix = '' } for (let key of Object.keys(object)) { const child_object = object[key] if (is_object(child_object) && !is_pseudo_class(key) && !is_media...
[ "function", "move_up", "(", "object", ",", "upside", ",", "new_name", ")", "{", "let", "prefix", "if", "(", "upside", ")", "{", "upside", "[", "new_name", "]", "=", "object", "prefix", "=", "`", "${", "new_name", "}", "`", "}", "else", "{", "upside",...
moves child style classes to the surface of the style class tree prefixing them accordingly
[ "moves", "child", "style", "classes", "to", "the", "surface", "of", "the", "style", "class", "tree", "prefixing", "them", "accordingly" ]
24d6fc0de74de67ae6c08450d0542a992d388ff3
https://github.com/catamphetamine/react-styling/blob/24d6fc0de74de67ae6c08450d0542a992d388ff3/source/flat.js#L19-L44
train
joyent/node-sdc-clients
lib/imgapi.js
SigningError
function SigningError(cause) { this.code = 'SigningError'; assert.optionalObject(cause); var msg = 'error signing request'; var args = (cause ? [cause, msg] : [msg]); WError.apply(this, args); }
javascript
function SigningError(cause) { this.code = 'SigningError'; assert.optionalObject(cause); var msg = 'error signing request'; var args = (cause ? [cause, msg] : [msg]); WError.apply(this, args); }
[ "function", "SigningError", "(", "cause", ")", "{", "this", ".", "code", "=", "'SigningError'", ";", "assert", ".", "optionalObject", "(", "cause", ")", ";", "var", "msg", "=", "'error signing request'", ";", "var", "args", "=", "(", "cause", "?", "[", "...
An error signing a request.
[ "An", "error", "signing", "a", "request", "." ]
5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb
https://github.com/joyent/node-sdc-clients/blob/5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb/lib/imgapi.js#L108-L114
train
joyent/node-sdc-clients
lib/vmapi.js
listAllVms
function listAllVms(cb) { var limit = undefined; var offset = params.offset; var vms = []; var stop = false; async.whilst( function testAllVmsFetched() { return !stop; }, listVms, function doneFetching(fetchErr) { ...
javascript
function listAllVms(cb) { var limit = undefined; var offset = params.offset; var vms = []; var stop = false; async.whilst( function testAllVmsFetched() { return !stop; }, listVms, function doneFetching(fetchErr) { ...
[ "function", "listAllVms", "(", "cb", ")", "{", "var", "limit", "=", "undefined", ";", "var", "offset", "=", "params", ".", "offset", ";", "var", "vms", "=", "[", "]", ";", "var", "stop", "=", "false", ";", "async", ".", "whilst", "(", "function", "...
This function will execute at least 2 queries when it is not known how the remote VMAPI is returning the collection. If no limit is set, then listVms would receive all VMs on the first call and then perform a second one to discover that all items have been returned. When limit is undefined, listVms will get someVms.len...
[ "This", "function", "will", "execute", "at", "least", "2", "queries", "when", "it", "is", "not", "known", "how", "the", "remote", "VMAPI", "is", "returning", "the", "collection", ".", "If", "no", "limit", "is", "set", "then", "listVms", "would", "receive",...
5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb
https://github.com/joyent/node-sdc-clients/blob/5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb/lib/vmapi.js#L193-L248
train
joyent/node-sdc-clients
lib/sapi.js
updateApplication
function updateApplication(uuid, opts, callback) { assert.string(uuid, 'uuid'); assert.object(opts, 'opts'); return (this.put(sprintf('/applications/%s', uuid), opts, callback)); }
javascript
function updateApplication(uuid, opts, callback) { assert.string(uuid, 'uuid'); assert.object(opts, 'opts'); return (this.put(sprintf('/applications/%s', uuid), opts, callback)); }
[ "function", "updateApplication", "(", "uuid", ",", "opts", ",", "callback", ")", "{", "assert", ".", "string", "(", "uuid", ",", "'uuid'", ")", ";", "assert", ".", "object", "(", "opts", ",", "'opts'", ")", ";", "return", "(", "this", ".", "put", "("...
Updates an application @param {String} uuid: the UUID of the applications. @param {String} opts: new attributes @param {Function} callback: of the form f(err, app).
[ "Updates", "an", "application" ]
5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb
https://github.com/joyent/node-sdc-clients/blob/5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb/lib/sapi.js#L127-L132
train
joyent/node-sdc-clients
lib/sapi.js
createInstanceAsync
function createInstanceAsync(service_uuid, opts, callback) { assert.string(service_uuid, 'service_uuid'); if (typeof (opts) === 'function') { callback = opts; opts = {}; } assert.object(opts, 'opts'); assert.func(callback, 'callback'); opts.service_uuid = service_uuid; retu...
javascript
function createInstanceAsync(service_uuid, opts, callback) { assert.string(service_uuid, 'service_uuid'); if (typeof (opts) === 'function') { callback = opts; opts = {}; } assert.object(opts, 'opts'); assert.func(callback, 'callback'); opts.service_uuid = service_uuid; retu...
[ "function", "createInstanceAsync", "(", "service_uuid", ",", "opts", ",", "callback", ")", "{", "assert", ".", "string", "(", "service_uuid", ",", "'service_uuid'", ")", ";", "if", "(", "typeof", "(", "opts", ")", "===", "'function'", ")", "{", "callback", ...
Create an instance asynchronously @param {String} service_uuid: The UUID of the service for which to create an instance. @param {String} opts: Optional attributes per <https://mo.joyent.com/docs/sapi/master/#CreateInstance> @param {Function} callback: of the form f(err, instance).
[ "Create", "an", "instance", "asynchronously" ]
5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb
https://github.com/joyent/node-sdc-clients/blob/5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb/lib/sapi.js#L277-L289
train
joyent/node-sdc-clients
lib/sapi.js
listInstances
function listInstances(search_opts, callback) { if (arguments.length === 1) { callback = search_opts; search_opts = {}; } var uri = '/instances?' + qs.stringify(search_opts); return (this.get(uri, callback)); }
javascript
function listInstances(search_opts, callback) { if (arguments.length === 1) { callback = search_opts; search_opts = {}; } var uri = '/instances?' + qs.stringify(search_opts); return (this.get(uri, callback)); }
[ "function", "listInstances", "(", "search_opts", ",", "callback", ")", "{", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "callback", "=", "search_opts", ";", "search_opts", "=", "{", "}", ";", "}", "var", "uri", "=", "'/instances?'", "+",...
Lists all instances @param {Function} callback: of the form f(err, instances).
[ "Lists", "all", "instances" ]
5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb
https://github.com/joyent/node-sdc-clients/blob/5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb/lib/sapi.js#L299-L307
train
joyent/node-sdc-clients
lib/sapi.js
reprovisionInstance
function reprovisionInstance(uuid, image_uuid, callback) { assert.string(uuid, 'uuid'); assert.string(image_uuid, 'image_uuid'); var opts = {}; opts.image_uuid = image_uuid; return (this.put(sprintf('/instances/%s/upgrade', uuid), opts, callback)); }
javascript
function reprovisionInstance(uuid, image_uuid, callback) { assert.string(uuid, 'uuid'); assert.string(image_uuid, 'image_uuid'); var opts = {}; opts.image_uuid = image_uuid; return (this.put(sprintf('/instances/%s/upgrade', uuid), opts, callback)); }
[ "function", "reprovisionInstance", "(", "uuid", ",", "image_uuid", ",", "callback", ")", "{", "assert", ".", "string", "(", "uuid", ",", "'uuid'", ")", ";", "assert", ".", "string", "(", "image_uuid", ",", "'image_uuid'", ")", ";", "var", "opts", "=", "{...
Reprovision an instance @param {String} uuid: the UUID of the instances. @param {String} image_uuid: new attributes @param {Function} callback: of the form f(err, app).
[ "Reprovision", "an", "instance" ]
5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb
https://github.com/joyent/node-sdc-clients/blob/5dd2d17e8ab8e2eccb49b3fa3384cbf2f25562eb/lib/sapi.js#L331-L339
train
AgronKabashi/jspicl
lib/jspicl.js
prettify
function prettify (luaCode) { const lines = luaCode .split("\n") .map(line => line.trim()); const { code } = lines.reduce((result, line) => { const { code, indentation } = result; let currentIndentation = indentation; let nextLineIndentation = indentation; if (indentIncrease.some(entry => ...
javascript
function prettify (luaCode) { const lines = luaCode .split("\n") .map(line => line.trim()); const { code } = lines.reduce((result, line) => { const { code, indentation } = result; let currentIndentation = indentation; let nextLineIndentation = indentation; if (indentIncrease.some(entry => ...
[ "function", "prettify", "(", "luaCode", ")", "{", "const", "lines", "=", "luaCode", ".", "split", "(", "\"\\n\"", ")", ".", "map", "(", "line", "=>", "line", ".", "trim", "(", ")", ")", ";", "const", "{", "code", "}", "=", "lines", ".", "reduce", ...
Fixes code indentation @param {string} luaCode Original lua code @returns {string} Formatted code
[ "Fixes", "code", "indentation" ]
13380add182b0189597d2ec318403f81129b676b
https://github.com/AgronKabashi/jspicl/blob/13380add182b0189597d2ec318403f81129b676b/lib/jspicl.js#L308-L339
train
lmgonzalves/jelly
js/jellyfish.js
buildOptions
function buildOptions(i) { var index = (i + 1); var isCurrent = i === current; // Options for each text, arrow and image, using the base options and the index var text = extend({}, optionsText, {paths: '#jelly-text-' + index + ' path'}); var arrow = extend({}, optionsArrow, {pat...
javascript
function buildOptions(i) { var index = (i + 1); var isCurrent = i === current; // Options for each text, arrow and image, using the base options and the index var text = extend({}, optionsText, {paths: '#jelly-text-' + index + ' path'}); var arrow = extend({}, optionsArrow, {pat...
[ "function", "buildOptions", "(", "i", ")", "{", "var", "index", "=", "(", "i", "+", "1", ")", ";", "var", "isCurrent", "=", "i", "===", "current", ";", "// Options for each text, arrow and image, using the base options and the index", "var", "text", "=", "extend",...
Function to build the options for an specific item
[ "Function", "to", "build", "the", "options", "for", "an", "specific", "item" ]
cca6a02ed8365f30c8d1be82e7e8fbef6e257c35
https://github.com/lmgonzalves/jelly/blob/cca6a02ed8365f30c8d1be82e7e8fbef6e257c35/js/jellyfish.js#L78-L98
train
IndigoUnited/js-dejavu
dist/node/loose/Class.js
applyBinds
function applyBinds(fns, instance) { var i, current; for (i = fns.length - 1; i >= 0; i -= 1) { current = instance[fns[i]]; instance[fns[i]] = bind(current, instance); } }
javascript
function applyBinds(fns, instance) { var i, current; for (i = fns.length - 1; i >= 0; i -= 1) { current = instance[fns[i]]; instance[fns[i]] = bind(current, instance); } }
[ "function", "applyBinds", "(", "fns", ",", "instance", ")", "{", "var", "i", ",", "current", ";", "for", "(", "i", "=", "fns", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "-=", "1", ")", "{", "current", "=", "instance", "[", "fns", ...
Applies the context of given methods in the target. @param {Array} fns The array of functions to be bound @param {Object} instance The target instance
[ "Applies", "the", "context", "of", "given", "methods", "in", "the", "target", "." ]
b251d5e8508bb05854081968528e6a3b2ec68d33
https://github.com/IndigoUnited/js-dejavu/blob/b251d5e8508bb05854081968528e6a3b2ec68d33/dist/node/loose/Class.js#L357-L365
train
IndigoUnited/js-dejavu
dist/node/loose/Class.js
doBind
function doBind(func) { /*jshint validthis:true*/ var args = toArray(arguments), bound; if (this && !func[$wrapped] && this.$static && this.$static[$class]) { func = wrapMethod(null, func, this.$self || this.$static); } args.splice(1, 0, this); b...
javascript
function doBind(func) { /*jshint validthis:true*/ var args = toArray(arguments), bound; if (this && !func[$wrapped] && this.$static && this.$static[$class]) { func = wrapMethod(null, func, this.$self || this.$static); } args.splice(1, 0, this); b...
[ "function", "doBind", "(", "func", ")", "{", "/*jshint validthis:true*/", "var", "args", "=", "toArray", "(", "arguments", ")", ",", "bound", ";", "if", "(", "this", "&&", "!", "func", "[", "$wrapped", "]", "&&", "this", ".", "$static", "&&", "this", "...
Bind. Works for anonymous functions also. @param {Function} func The function to be bound @param {...mixed} [args] The arguments to also be bound @return {Function} The bound function
[ "Bind", ".", "Works", "for", "anonymous", "functions", "also", "." ]
b251d5e8508bb05854081968528e6a3b2ec68d33
https://github.com/IndigoUnited/js-dejavu/blob/b251d5e8508bb05854081968528e6a3b2ec68d33/dist/node/loose/Class.js#L430-L443
train
IndigoUnited/js-dejavu
dist/node/loose/Class.js
optimizeConstructor
function optimizeConstructor(constructor) { var tmp = constructor[$class], canOptimizeConst, newConstructor, parentInitialize; // Check if we can optimize the constructor if (tmp.efficient) { canOptimizeConst = constructor.$canOptimizeConst; ...
javascript
function optimizeConstructor(constructor) { var tmp = constructor[$class], canOptimizeConst, newConstructor, parentInitialize; // Check if we can optimize the constructor if (tmp.efficient) { canOptimizeConst = constructor.$canOptimizeConst; ...
[ "function", "optimizeConstructor", "(", "constructor", ")", "{", "var", "tmp", "=", "constructor", "[", "$class", "]", ",", "canOptimizeConst", ",", "newConstructor", ",", "parentInitialize", ";", "// Check if we can optimize the constructor", "if", "(", "tmp", ".", ...
Attempts to optimize the constructor function. @param {Function} constructor The constructor @param {Function} The old or the new constructor
[ "Attempts", "to", "optimize", "the", "constructor", "function", "." ]
b251d5e8508bb05854081968528e6a3b2ec68d33
https://github.com/IndigoUnited/js-dejavu/blob/b251d5e8508bb05854081968528e6a3b2ec68d33/dist/node/loose/Class.js#L522-L576
train
GoogleCloudPlatform/cloud-errors-nodejs
lib/request-extractors/hapi.js
attemptToExtractStatusCode
function attemptToExtractStatusCode(req) { if (has(req, 'response') && isObject(req.response) && has(req.response, 'statusCode')) { return req.response.statusCode; } else if (has(req, 'response') && isObject(req.response) && isObject(req.response.output)) { return req.response.output.s...
javascript
function attemptToExtractStatusCode(req) { if (has(req, 'response') && isObject(req.response) && has(req.response, 'statusCode')) { return req.response.statusCode; } else if (has(req, 'response') && isObject(req.response) && isObject(req.response.output)) { return req.response.output.s...
[ "function", "attemptToExtractStatusCode", "(", "req", ")", "{", "if", "(", "has", "(", "req", ",", "'response'", ")", "&&", "isObject", "(", "req", ".", "response", ")", "&&", "has", "(", "req", ".", "response", ",", "'statusCode'", ")", ")", "{", "ret...
This function is used to check for a pending status code on the response or a set status code on the response.output object property. If neither of these properties can be found then -1 will be returned as the output. @function attemptToExtractStatusCode @param {Object} req - the request information object to extract f...
[ "This", "function", "is", "used", "to", "check", "for", "a", "pending", "status", "code", "on", "the", "response", "or", "a", "set", "status", "code", "on", "the", "response", ".", "output", "object", "property", ".", "If", "neither", "of", "these", "pro...
fda2218759cd8754a096dbe437e8a668321f5ba6
https://github.com/GoogleCloudPlatform/cloud-errors-nodejs/blob/fda2218759cd8754a096dbe437e8a668321f5ba6/lib/request-extractors/hapi.js#L34-L47
train
GoogleCloudPlatform/cloud-errors-nodejs
lib/request-extractors/hapi.js
extractRemoteAddressFromRequest
function extractRemoteAddressFromRequest(req) { if (has(req.headers, 'x-forwarded-for')) { return req.headers['x-forwarded-for']; } else if (isObject(req.info)) { return req.info.remoteAddress; } return ''; }
javascript
function extractRemoteAddressFromRequest(req) { if (has(req.headers, 'x-forwarded-for')) { return req.headers['x-forwarded-for']; } else if (isObject(req.info)) { return req.info.remoteAddress; } return ''; }
[ "function", "extractRemoteAddressFromRequest", "(", "req", ")", "{", "if", "(", "has", "(", "req", ".", "headers", ",", "'x-forwarded-for'", ")", ")", "{", "return", "req", ".", "headers", "[", "'x-forwarded-for'", "]", ";", "}", "else", "if", "(", "isObje...
This function is used to check for the x-forwarded-for header first to identify source IP connnections. If this header is not present, then the function will attempt to extract the remoteAddress from the request.info object property. If neither of these properties can be found then an empty string will be returned. @fu...
[ "This", "function", "is", "used", "to", "check", "for", "the", "x", "-", "forwarded", "-", "for", "header", "first", "to", "identify", "source", "IP", "connnections", ".", "If", "this", "header", "is", "not", "present", "then", "the", "function", "will", ...
fda2218759cd8754a096dbe437e8a668321f5ba6
https://github.com/GoogleCloudPlatform/cloud-errors-nodejs/blob/fda2218759cd8754a096dbe437e8a668321f5ba6/lib/request-extractors/hapi.js#L60-L71
train
GoogleCloudPlatform/cloud-errors-nodejs
lib/request-extractors/hapi.js
hapiRequestInformationExtractor
function hapiRequestInformationExtractor(req) { var returnObject = new RequestInformationContainer(); if (!isObject(req) || !isObject(req.headers) || isFunction(req) || isArray(req)) { return returnObject; } returnObject.setMethod(req.method) .setUrl(req.url) .setUserAgent(req.headers[...
javascript
function hapiRequestInformationExtractor(req) { var returnObject = new RequestInformationContainer(); if (!isObject(req) || !isObject(req.headers) || isFunction(req) || isArray(req)) { return returnObject; } returnObject.setMethod(req.method) .setUrl(req.url) .setUserAgent(req.headers[...
[ "function", "hapiRequestInformationExtractor", "(", "req", ")", "{", "var", "returnObject", "=", "new", "RequestInformationContainer", "(", ")", ";", "if", "(", "!", "isObject", "(", "req", ")", "||", "!", "isObject", "(", "req", ".", "headers", ")", "||", ...
This function is used to extract request information from a hapi request object. This function will not check for the presence of properties on the request object. @function hapiRequestInformationExtractor @param {Object} req - the hapi request object to extract from @returns {RequestInformationContainer} - an object c...
[ "This", "function", "is", "used", "to", "extract", "request", "information", "from", "a", "hapi", "request", "object", ".", "This", "function", "will", "not", "check", "for", "the", "presence", "of", "properties", "on", "the", "request", "object", "." ]
fda2218759cd8754a096dbe437e8a668321f5ba6
https://github.com/GoogleCloudPlatform/cloud-errors-nodejs/blob/fda2218759cd8754a096dbe437e8a668321f5ba6/lib/request-extractors/hapi.js#L82-L100
train
anvilresearch/connect-nodejs
index.js
addScope
function addScope (scope) { if (!scope) { return } var oldScope = new Set(this.scope.split(' ')) var newScope // Convert the incoming new scopes to a Set if (typeof scope === 'string') { newScope = new Set(scope.split(' ')) } else if (Array.isArray(scope)) { newScope = new Set(scope) } else ...
javascript
function addScope (scope) { if (!scope) { return } var oldScope = new Set(this.scope.split(' ')) var newScope // Convert the incoming new scopes to a Set if (typeof scope === 'string') { newScope = new Set(scope.split(' ')) } else if (Array.isArray(scope)) { newScope = new Set(scope) } else ...
[ "function", "addScope", "(", "scope", ")", "{", "if", "(", "!", "scope", ")", "{", "return", "}", "var", "oldScope", "=", "new", "Set", "(", "this", ".", "scope", ".", "split", "(", "' '", ")", ")", "var", "newScope", "// Convert the incoming new scopes ...
Adds the passed in list of scopes to the current one via a Set union operation. @param scope {Array|String} Either an array or a space-separated string list of scopes. @method addScope
[ "Adds", "the", "passed", "in", "list", "of", "scopes", "to", "the", "current", "one", "via", "a", "Set", "union", "operation", "." ]
fa630d5bd447bac630c33f9259d65a1483c0ff11
https://github.com/anvilresearch/connect-nodejs/blob/fa630d5bd447bac630c33f9259d65a1483c0ff11/index.js#L77-L96
train
anvilresearch/connect-nodejs
index.js
discover
function discover () { var self = this // construct the uri var uri = url.parse(this.issuer) uri.pathname = '.well-known/openid-configuration' uri = url.format(uri) var requestOptions = { url: uri, method: 'GET', json: true, agentOptions: self.agentOptions } if (self.proxy) { reque...
javascript
function discover () { var self = this // construct the uri var uri = url.parse(this.issuer) uri.pathname = '.well-known/openid-configuration' uri = url.format(uri) var requestOptions = { url: uri, method: 'GET', json: true, agentOptions: self.agentOptions } if (self.proxy) { reque...
[ "function", "discover", "(", ")", "{", "var", "self", "=", "this", "// construct the uri", "var", "uri", "=", "url", ".", "parse", "(", "this", ".", "issuer", ")", "uri", ".", "pathname", "=", "'.well-known/openid-configuration'", "uri", "=", "url", ".", "...
Requests OIDC configuration from the AnvilConnect instance's provider. Requires issuer to be set. @method discover @return {Promise}
[ "Requests", "OIDC", "configuration", "from", "the", "AnvilConnect", "instance", "s", "provider", ".", "Requires", "issuer", "to", "be", "set", "." ]
fa630d5bd447bac630c33f9259d65a1483c0ff11
https://github.com/anvilresearch/connect-nodejs/blob/fa630d5bd447bac630c33f9259d65a1483c0ff11/index.js#L110-L145
train
anvilresearch/connect-nodejs
index.js
initAdminAPI
function initAdminAPI () { this.clients = { list: clients.list.bind(this), get: clients.get.bind(this), create: clients.create.bind(this), update: clients.update.bind(this), delete: clients.delete.bind(this), roles: { list: clientRoles.listRoles.bind(this), add: clientRoles.addRole...
javascript
function initAdminAPI () { this.clients = { list: clients.list.bind(this), get: clients.get.bind(this), create: clients.create.bind(this), update: clients.update.bind(this), delete: clients.delete.bind(this), roles: { list: clientRoles.listRoles.bind(this), add: clientRoles.addRole...
[ "function", "initAdminAPI", "(", ")", "{", "this", ".", "clients", "=", "{", "list", ":", "clients", ".", "list", ".", "bind", "(", "this", ")", ",", "get", ":", "clients", ".", "get", ".", "bind", "(", "this", ")", ",", "create", ":", "clients", ...
Initializes the Anvil Connect admin API functions. Called by constructor. @private @method initAdminAPI
[ "Initializes", "the", "Anvil", "Connect", "admin", "API", "functions", ".", "Called", "by", "constructor", "." ]
fa630d5bd447bac630c33f9259d65a1483c0ff11
https://github.com/anvilresearch/connect-nodejs/blob/fa630d5bd447bac630c33f9259d65a1483c0ff11/index.js#L242-L289
train
anvilresearch/connect-nodejs
index.js
authorizationUri
function authorizationUri (options) { var u = url.parse(this.configuration.authorization_endpoint) // assign endpoint and ensure options var endpoint = 'authorize' if (typeof options === 'string') { endpoint = options options = {} } else if (typeof options === 'object') { endpoint = options.endpo...
javascript
function authorizationUri (options) { var u = url.parse(this.configuration.authorization_endpoint) // assign endpoint and ensure options var endpoint = 'authorize' if (typeof options === 'string') { endpoint = options options = {} } else if (typeof options === 'object') { endpoint = options.endpo...
[ "function", "authorizationUri", "(", "options", ")", "{", "var", "u", "=", "url", ".", "parse", "(", "this", ".", "configuration", ".", "authorization_endpoint", ")", "// assign endpoint and ensure options", "var", "endpoint", "=", "'authorize'", "if", "(", "typeo...
Returns the url for an OIDC authorization call, for a given set of options. @method authorizationUri @param [options={}] {String|Object} Either a string representing an endpoint (such as 'authorize'), or an options hashmap. For a full list of options, see the docstring of `authorizationParams()`. @param [options.endpoi...
[ "Returns", "the", "url", "for", "an", "OIDC", "authorization", "call", "for", "a", "given", "set", "of", "options", "." ]
fa630d5bd447bac630c33f9259d65a1483c0ff11
https://github.com/anvilresearch/connect-nodejs/blob/fa630d5bd447bac630c33f9259d65a1483c0ff11/index.js#L414-L435
train
anvilresearch/connect-nodejs
index.js
verify
function verify (token, options) { options = options || {} options.issuer = options.issuer || this.issuer options.client_id = options.client_id || this.client_id options.client_secret = options.client_secret || this.client_secret options.scope = options.scope || this.scope options.key = options.key || this....
javascript
function verify (token, options) { options = options || {} options.issuer = options.issuer || this.issuer options.client_id = options.client_id || this.client_id options.client_secret = options.client_secret || this.client_secret options.scope = options.scope || this.scope options.key = options.key || this....
[ "function", "verify", "(", "token", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", "options", ".", "issuer", "=", "options", ".", "issuer", "||", "this", ".", "issuer", "options", ".", "client_id", "=", "options", ".", "client_id", ...
Verifies a given OIDC token @method verify @param token {String} JWT AccessToken for OpenID Connect (base64 encoded) @param [options={}] {Object} Options hashmap @param [options.issuer] {String} OIDC Provider/Issuer URL @param [options.key] {Object} Issuer's public key for signatures (jwks.sig) @param [options.client_i...
[ "Verifies", "a", "given", "OIDC", "token" ]
fa630d5bd447bac630c33f9259d65a1483c0ff11
https://github.com/anvilresearch/connect-nodejs/blob/fa630d5bd447bac630c33f9259d65a1483c0ff11/index.js#L794-L808
train
GoogleCloudPlatform/cloud-errors-nodejs
lib/error-extractors/object.js
extractFromObject
function extractFromObject(err, errorMessage) { if (has(err, 'message')) { errorMessage.setMessage(err.message); } if (has(err, 'user')) { errorMessage.setUser(err.user); } if (has(err, 'filePath')) { errorMessage.setFilePath(err.filePath); } if (has(err, 'lineNumber')) { errorMess...
javascript
function extractFromObject(err, errorMessage) { if (has(err, 'message')) { errorMessage.setMessage(err.message); } if (has(err, 'user')) { errorMessage.setUser(err.user); } if (has(err, 'filePath')) { errorMessage.setFilePath(err.filePath); } if (has(err, 'lineNumber')) { errorMess...
[ "function", "extractFromObject", "(", "err", ",", "errorMessage", ")", "{", "if", "(", "has", "(", "err", ",", "'message'", ")", ")", "{", "errorMessage", ".", "setMessage", "(", "err", ".", "message", ")", ";", "}", "if", "(", "has", "(", "err", ","...
Attempts to extract error information given an object as the input for the error. This function will check presence of each property before attempting to access the given property on the object but will not check for type compliance as that is allocated to the instance of the error message itself. @function extractFrom...
[ "Attempts", "to", "extract", "error", "information", "given", "an", "object", "as", "the", "input", "for", "the", "error", ".", "This", "function", "will", "check", "presence", "of", "each", "property", "before", "attempting", "to", "access", "the", "given", ...
fda2218759cd8754a096dbe437e8a668321f5ba6
https://github.com/GoogleCloudPlatform/cloud-errors-nodejs/blob/fda2218759cd8754a096dbe437e8a668321f5ba6/lib/error-extractors/object.js#L46-L78
train