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
tus/tus-js-client
bin/phantom-jasmine.js
injectReporter
function injectReporter() { page.evaluate(function (script) { function print(msg) { console.log(msg); } function onComplete(passed) { window.callPhantom(passed); } eval(script); var reporter = new ConsoleReporter(); reporter.setOptions({ print: print, printDeprec...
javascript
function injectReporter() { page.evaluate(function (script) { function print(msg) { console.log(msg); } function onComplete(passed) { window.callPhantom(passed); } eval(script); var reporter = new ConsoleReporter(); reporter.setOptions({ print: print, printDeprec...
[ "function", "injectReporter", "(", ")", "{", "page", ".", "evaluate", "(", "function", "(", "script", ")", "{", "function", "print", "(", "msg", ")", "{", "console", ".", "log", "(", "msg", ")", ";", "}", "function", "onComplete", "(", "passed", ")", ...
Inject the ConsoleReporter's source into the browser context and register an instance as a reporter.
[ "Inject", "the", "ConsoleReporter", "s", "source", "into", "the", "browser", "context", "and", "register", "an", "instance", "as", "a", "reporter", "." ]
13cdc861391a343f303c15e9eb0d24f6df87978f
https://github.com/tus/tus-js-client/blob/13cdc861391a343f303c15e9eb0d24f6df87978f/bin/phantom-jasmine.js#L61-L83
train
fians/Waves
dist/waves.js
removeRipple
function removeRipple(e, el, ripple) { // Check if the ripple still exist if (!ripple) { return; } ripple.classList.remove('waves-rippling'); var relativeX = ripple.getAttribute('data-x'); var relativeY = ripple.getAttribute('data-y'); var scale ...
javascript
function removeRipple(e, el, ripple) { // Check if the ripple still exist if (!ripple) { return; } ripple.classList.remove('waves-rippling'); var relativeX = ripple.getAttribute('data-x'); var relativeY = ripple.getAttribute('data-y'); var scale ...
[ "function", "removeRipple", "(", "e", ",", "el", ",", "ripple", ")", "{", "// Check if the ripple still exist", "if", "(", "!", "ripple", ")", "{", "return", ";", "}", "ripple", ".", "classList", ".", "remove", "(", "'waves-rippling'", ")", ";", "var", "re...
Hide the effect and remove the ripple. Must be a separate function to pass the JSLint...
[ "Hide", "the", "effect", "and", "remove", "the", "ripple", ".", "Must", "be", "a", "separate", "function", "to", "pass", "the", "JSLint", "..." ]
1985b7e18327f86f1bb640efe3a2ab4b4fea4078
https://github.com/fians/Waves/blob/1985b7e18327f86f1bb640efe3a2ab4b4fea4078/dist/waves.js#L259-L318
train
zarocknz/javascript-winwheel
Winwheel.js
winwheelStopAnimation
function winwheelStopAnimation(canCallback) { // When the animation is stopped if canCallback is not false then try to call the callback. // false can be passed in to stop the after happening if the animation has been stopped before it ended normally. if (canCallback != false) { let callback = winwh...
javascript
function winwheelStopAnimation(canCallback) { // When the animation is stopped if canCallback is not false then try to call the callback. // false can be passed in to stop the after happening if the animation has been stopped before it ended normally. if (canCallback != false) { let callback = winwh...
[ "function", "winwheelStopAnimation", "(", "canCallback", ")", "{", "// When the animation is stopped if canCallback is not false then try to call the callback.", "// false can be passed in to stop the after happening if the animation has been stopped before it ended normally.", "if", "(", "canCa...
This global is set by the winwheel class to the wheel object to be re-drawn.
[ "This", "global", "is", "set", "by", "the", "winwheel", "class", "to", "the", "wheel", "object", "to", "be", "re", "-", "drawn", "." ]
229a47acc3d7fd941d72a3ba9e1649751fd10ed5
https://github.com/zarocknz/javascript-winwheel/blob/229a47acc3d7fd941d72a3ba9e1649751fd10ed5/Winwheel.js#L2237-L2254
train
inikulin/parse5
packages/parse5/lib/parser/index.js
aaObtainFurthestBlock
function aaObtainFurthestBlock(p, formattingElementEntry) { let furthestBlock = null; for (let i = p.openElements.stackTop; i >= 0; i--) { const element = p.openElements.items[i]; if (element === formattingElementEntry.element) { break; } if (p._isSpecialElement(el...
javascript
function aaObtainFurthestBlock(p, formattingElementEntry) { let furthestBlock = null; for (let i = p.openElements.stackTop; i >= 0; i--) { const element = p.openElements.items[i]; if (element === formattingElementEntry.element) { break; } if (p._isSpecialElement(el...
[ "function", "aaObtainFurthestBlock", "(", "p", ",", "formattingElementEntry", ")", "{", "let", "furthestBlock", "=", "null", ";", "for", "(", "let", "i", "=", "p", ".", "openElements", ".", "stackTop", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "co...
Steps 9 and 10 of the algorithm
[ "Steps", "9", "and", "10", "of", "the", "algorithm" ]
fff571f3277eadff45c3d60a4c2953ad4dbb16af
https://github.com/inikulin/parse5/blob/fff571f3277eadff45c3d60a4c2953ad4dbb16af/packages/parse5/lib/parser/index.js#L910-L931
train
inikulin/parse5
packages/parse5/lib/parser/index.js
aaInnerLoop
function aaInnerLoop(p, furthestBlock, formattingElement) { let lastElement = furthestBlock; let nextElement = p.openElements.getCommonAncestor(furthestBlock); for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) { //NOTE: store next element for the next...
javascript
function aaInnerLoop(p, furthestBlock, formattingElement) { let lastElement = furthestBlock; let nextElement = p.openElements.getCommonAncestor(furthestBlock); for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) { //NOTE: store next element for the next...
[ "function", "aaInnerLoop", "(", "p", ",", "furthestBlock", ",", "formattingElement", ")", "{", "let", "lastElement", "=", "furthestBlock", ";", "let", "nextElement", "=", "p", ".", "openElements", ".", "getCommonAncestor", "(", "furthestBlock", ")", ";", "for", ...
Step 13 of the algorithm
[ "Step", "13", "of", "the", "algorithm" ]
fff571f3277eadff45c3d60a4c2953ad4dbb16af
https://github.com/inikulin/parse5/blob/fff571f3277eadff45c3d60a4c2953ad4dbb16af/packages/parse5/lib/parser/index.js#L934-L966
train
inikulin/parse5
packages/parse5/lib/parser/index.js
aaRecreateElementFromEntry
function aaRecreateElementFromEntry(p, elementEntry) { const ns = p.treeAdapter.getNamespaceURI(elementEntry.element); const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs); p.openElements.replace(elementEntry.element, newElement); elementEntry.element...
javascript
function aaRecreateElementFromEntry(p, elementEntry) { const ns = p.treeAdapter.getNamespaceURI(elementEntry.element); const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs); p.openElements.replace(elementEntry.element, newElement); elementEntry.element...
[ "function", "aaRecreateElementFromEntry", "(", "p", ",", "elementEntry", ")", "{", "const", "ns", "=", "p", ".", "treeAdapter", ".", "getNamespaceURI", "(", "elementEntry", ".", "element", ")", ";", "const", "newElement", "=", "p", ".", "treeAdapter", ".", "...
Step 13.7 of the algorithm
[ "Step", "13", ".", "7", "of", "the", "algorithm" ]
fff571f3277eadff45c3d60a4c2953ad4dbb16af
https://github.com/inikulin/parse5/blob/fff571f3277eadff45c3d60a4c2953ad4dbb16af/packages/parse5/lib/parser/index.js#L969-L977
train
inikulin/parse5
packages/parse5/lib/parser/index.js
aaInsertLastNodeInCommonAncestor
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) { if (p._isElementCausesFosterParenting(commonAncestor)) { p._fosterParentElement(lastElement); } else { const tn = p.treeAdapter.getTagName(commonAncestor); const ns = p.treeAdapter.getNamespaceURI(commonAncestor)...
javascript
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) { if (p._isElementCausesFosterParenting(commonAncestor)) { p._fosterParentElement(lastElement); } else { const tn = p.treeAdapter.getTagName(commonAncestor); const ns = p.treeAdapter.getNamespaceURI(commonAncestor)...
[ "function", "aaInsertLastNodeInCommonAncestor", "(", "p", ",", "commonAncestor", ",", "lastElement", ")", "{", "if", "(", "p", ".", "_isElementCausesFosterParenting", "(", "commonAncestor", ")", ")", "{", "p", ".", "_fosterParentElement", "(", "lastElement", ")", ...
Step 14 of the algorithm
[ "Step", "14", "of", "the", "algorithm" ]
fff571f3277eadff45c3d60a4c2953ad4dbb16af
https://github.com/inikulin/parse5/blob/fff571f3277eadff45c3d60a4c2953ad4dbb16af/packages/parse5/lib/parser/index.js#L980-L993
train
inikulin/parse5
packages/parse5/lib/parser/index.js
aaReplaceFormattingElement
function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) { const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element); const token = formattingElementEntry.token; const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs); p._adoptNodes(furthestBlo...
javascript
function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) { const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element); const token = formattingElementEntry.token; const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs); p._adoptNodes(furthestBlo...
[ "function", "aaReplaceFormattingElement", "(", "p", ",", "furthestBlock", ",", "formattingElementEntry", ")", "{", "const", "ns", "=", "p", ".", "treeAdapter", ".", "getNamespaceURI", "(", "formattingElementEntry", ".", "element", ")", ";", "const", "token", "=", ...
Steps 15-19 of the algorithm
[ "Steps", "15", "-", "19", "of", "the", "algorithm" ]
fff571f3277eadff45c3d60a4c2953ad4dbb16af
https://github.com/inikulin/parse5/blob/fff571f3277eadff45c3d60a4c2953ad4dbb16af/packages/parse5/lib/parser/index.js#L996-L1009
train
ansman/validate.js
validate.js
function(errors, options) { errors = v.pruneEmptyErrors(errors, options); errors = v.expandMultipleErrors(errors, options); errors = v.convertErrorMessages(errors, options); var format = options.format || "grouped"; if (typeof v.formatters[format] === 'function') { errors = v.for...
javascript
function(errors, options) { errors = v.pruneEmptyErrors(errors, options); errors = v.expandMultipleErrors(errors, options); errors = v.convertErrorMessages(errors, options); var format = options.format || "grouped"; if (typeof v.formatters[format] === 'function') { errors = v.for...
[ "function", "(", "errors", ",", "options", ")", "{", "errors", "=", "v", ".", "pruneEmptyErrors", "(", "errors", ",", "options", ")", ";", "errors", "=", "v", ".", "expandMultipleErrors", "(", "errors", ",", "options", ")", ";", "errors", "=", "v", "."...
Takes the output from runValidations and converts it to the correct output format.
[ "Takes", "the", "output", "from", "runValidations", "and", "converts", "it", "to", "the", "correct", "output", "format", "." ]
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L144-L158
train
ansman/validate.js
validate.js
function(attributes, constraints, options) { options = v.extend({}, v.async.options, options); var WrapErrors = options.wrapErrors || function(errors) { return errors; }; // Removes unknown attributes if (options.cleanAttributes !== false) { attributes = v.cleanAttributes...
javascript
function(attributes, constraints, options) { options = v.extend({}, v.async.options, options); var WrapErrors = options.wrapErrors || function(errors) { return errors; }; // Removes unknown attributes if (options.cleanAttributes !== false) { attributes = v.cleanAttributes...
[ "function", "(", "attributes", ",", "constraints", ",", "options", ")", "{", "options", "=", "v", ".", "extend", "(", "{", "}", ",", "v", ".", "async", ".", "options", ",", "options", ")", ";", "var", "WrapErrors", "=", "options", ".", "wrapErrors", ...
Runs the validations with support for promises. This function will return a promise that is settled when all the validation promises have been completed. It can be called even if no validations returned a promise.
[ "Runs", "the", "validations", "with", "support", "for", "promises", ".", "This", "function", "will", "return", "a", "promise", "that", "is", "settled", "when", "all", "the", "validation", "promises", "have", "been", "completed", ".", "It", "can", "be", "call...
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L164-L190
train
ansman/validate.js
validate.js
function(results) { // Create a sequence of all the results starting with a resolved promise. return results.reduce(function(memo, result) { // If this result isn't a promise skip it in the sequence. if (!v.isPromise(result.error)) { return memo; } return memo.then...
javascript
function(results) { // Create a sequence of all the results starting with a resolved promise. return results.reduce(function(memo, result) { // If this result isn't a promise skip it in the sequence. if (!v.isPromise(result.error)) { return memo; } return memo.then...
[ "function", "(", "results", ")", "{", "// Create a sequence of all the results starting with a resolved promise.", "return", "results", ".", "reduce", "(", "function", "(", "memo", ",", "result", ")", "{", "// If this result isn't a promise skip it in the sequence.", "if", "(...
Returns a promise that is resolved when all promises in the results array are settled. The promise returned from this function is always resolved, never rejected. This function modifies the input argument, it replaces the promises with the value returned from the promise.
[ "Returns", "a", "promise", "that", "is", "resolved", "when", "all", "promises", "in", "the", "results", "array", "are", "settled", ".", "The", "promise", "returned", "from", "this", "function", "is", "always", "resolved", "never", "rejected", ".", "This", "f...
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L205-L219
train
ansman/validate.js
validate.js
function(value) { return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); }
javascript
function(value) { return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); }
[ "function", "(", "value", ")", "{", "return", "v", ".", "isObject", "(", "value", ")", "&&", "!", "v", ".", "isArray", "(", "value", ")", "&&", "!", "v", ".", "isFunction", "(", "value", ")", ";", "}" ]
Checks if the object is a hash, which is equivalent to an object that is neither an array nor a function.
[ "Checks", "if", "the", "object", "is", "a", "hash", "which", "is", "equivalent", "to", "an", "object", "that", "is", "neither", "an", "array", "nor", "a", "function", "." ]
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L425-L427
train
ansman/validate.js
validate.js
function(errors, options) { options = options || {}; var ret = [] , prettify = options.prettify || v.prettify; errors.forEach(function(errorInfo) { var error = v.result(errorInfo.error, errorInfo.value, errorInfo.attribute, errorInfo.options, ...
javascript
function(errors, options) { options = options || {}; var ret = [] , prettify = options.prettify || v.prettify; errors.forEach(function(errorInfo) { var error = v.result(errorInfo.error, errorInfo.value, errorInfo.attribute, errorInfo.options, ...
[ "function", "(", "errors", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "ret", "=", "[", "]", ",", "prettify", "=", "options", ".", "prettify", "||", "v", ".", "prettify", ";", "errors", ".", "forEach", "(", "fun...
Converts the error mesages by prepending the attribute name unless the message is prefixed by ^
[ "Converts", "the", "error", "mesages", "by", "prepending", "the", "attribute", "name", "unless", "the", "message", "is", "prefixed", "by", "^" ]
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L627-L657
train
ansman/validate.js
validate.js
function(value, options) { options = v.extend({}, this.options, options); if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { return options.message || this.message || "can't be blank"; } }
javascript
function(value, options) { options = v.extend({}, this.options, options); if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { return options.message || this.message || "can't be blank"; } }
[ "function", "(", "value", ",", "options", ")", "{", "options", "=", "v", ".", "extend", "(", "{", "}", ",", "this", ".", "options", ",", "options", ")", ";", "if", "(", "options", ".", "allowEmpty", "!==", "false", "?", "!", "v", ".", "isDefined", ...
Presence validates that the value isn't empty
[ "Presence", "validates", "that", "the", "value", "isn", "t", "empty" ]
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L767-L772
train
ansman/validate.js
validate.js
function(value, options) { if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var message = options.message || this.message || "is not a valid url" , schemes = options.schemes || this.schemes || ['http', 'https'] , allowLocal = options.a...
javascript
function(value, options) { if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var message = options.message || this.message || "is not a valid url" , schemes = options.schemes || this.schemes || ['http', 'https'] , allowLocal = options.a...
[ "function", "(", "value", ",", "options", ")", "{", "if", "(", "!", "v", ".", "isDefined", "(", "value", ")", ")", "{", "return", ";", "}", "options", "=", "v", ".", "extend", "(", "{", "}", ",", "this", ".", "options", ",", "options", ")", ";"...
A URL validator that is used to validate URLs with the ability to restrict schemes and some domains.
[ "A", "URL", "validator", "that", "is", "used", "to", "validate", "URLs", "with", "the", "ability", "to", "restrict", "schemes", "and", "some", "domains", "." ]
c7553ffe9df4a3474e604a3f354cbc9d17190259
https://github.com/ansman/validate.js/blob/c7553ffe9df4a3474e604a3f354cbc9d17190259/validate.js#L1093-L1164
train
YvesCoding/vuescroll
src/mode/shared/bar.js
getRgbAColor
function getRgbAColor(color, opacity) { const id = color + '&' + opacity; if (colorCache[id]) { return colorCache[id]; } const div = document.createElement('div'); div.style.background = color; document.body.appendChild(div); const computedColor = window.getComputedStyle(div).backgroundColor; docum...
javascript
function getRgbAColor(color, opacity) { const id = color + '&' + opacity; if (colorCache[id]) { return colorCache[id]; } const div = document.createElement('div'); div.style.background = color; document.body.appendChild(div); const computedColor = window.getComputedStyle(div).backgroundColor; docum...
[ "function", "getRgbAColor", "(", "color", ",", "opacity", ")", "{", "const", "id", "=", "color", "+", "'&'", "+", "opacity", ";", "if", "(", "colorCache", "[", "id", "]", ")", "{", "return", "colorCache", "[", "id", "]", ";", "}", "const", "div", "...
Transform a common color int oa `rgbA` color
[ "Transform", "a", "common", "color", "int", "oa", "rgbA", "color" ]
8e91550833db7e94b334dfddba20b876c9b1e59c
https://github.com/YvesCoding/vuescroll/blob/8e91550833db7e94b334dfddba20b876c9b1e59c/src/mode/shared/bar.js#L167-L187
train
YvesCoding/vuescroll
src/mode/slide/slide-panel.js
createTipDom
function createTipDom(h, context, type, tip) { const stage = context.vuescroll.state[`${type}Stage`]; let dom = null; // Return user specified animation dom /* istanbul ignore if */ if ((dom = context.$slots[`${type}-${stage}`])) { return dom; } switch (stage) { // The dom will show at deactive sta...
javascript
function createTipDom(h, context, type, tip) { const stage = context.vuescroll.state[`${type}Stage`]; let dom = null; // Return user specified animation dom /* istanbul ignore if */ if ((dom = context.$slots[`${type}-${stage}`])) { return dom; } switch (stage) { // The dom will show at deactive sta...
[ "function", "createTipDom", "(", "h", ",", "context", ",", "type", ",", "tip", ")", "{", "const", "stage", "=", "context", ".", "vuescroll", ".", "state", "[", "`", "${", "type", "}", "`", "]", ";", "let", "dom", "=", "null", ";", "// Return user spe...
Create load or refresh tip dom of each stages
[ "Create", "load", "or", "refresh", "tip", "dom", "of", "each", "stages" ]
8e91550833db7e94b334dfddba20b876c9b1e59c
https://github.com/YvesCoding/vuescroll/blob/8e91550833db7e94b334dfddba20b876c9b1e59c/src/mode/slide/slide-panel.js#L104-L171
train
YvesCoding/vuescroll
src/mode/mix/config.js
configValidator
function configValidator(ops) { let renderError = false; const { vuescroll } = ops; // validate modes if (!~modes.indexOf(vuescroll.mode)) { error( `Unknown mode: ${ vuescroll.mode },the vuescroll's option "mode" should be one of the ${modes}` ); renderError = true; } retur...
javascript
function configValidator(ops) { let renderError = false; const { vuescroll } = ops; // validate modes if (!~modes.indexOf(vuescroll.mode)) { error( `Unknown mode: ${ vuescroll.mode },the vuescroll's option "mode" should be one of the ${modes}` ); renderError = true; } retur...
[ "function", "configValidator", "(", "ops", ")", "{", "let", "renderError", "=", "false", ";", "const", "{", "vuescroll", "}", "=", "ops", ";", "// validate modes", "if", "(", "!", "~", "modes", ".", "indexOf", "(", "vuescroll", ".", "mode", ")", ")", "...
validate the options @export @param {any} ops
[ "validate", "the", "options" ]
8e91550833db7e94b334dfddba20b876c9b1e59c
https://github.com/YvesCoding/vuescroll/blob/8e91550833db7e94b334dfddba20b876c9b1e59c/src/mode/mix/config.js#L21-L36
train
Azure/azure-storage-node
lib/common/streams/batchoperation.js
BatchOperation
function BatchOperation(name, options) { if (!options) { options = {}; } this.name = name; this.logger = options.logger || new Logger(Logger.LogLevels.INFO); this.operationMemoryUsage = options.operationMemoryUsage || DEFAULT_OPERATION_MEMORY_USAGE; this.callbackInOrder = options.callbackInOrder === tr...
javascript
function BatchOperation(name, options) { if (!options) { options = {}; } this.name = name; this.logger = options.logger || new Logger(Logger.LogLevels.INFO); this.operationMemoryUsage = options.operationMemoryUsage || DEFAULT_OPERATION_MEMORY_USAGE; this.callbackInOrder = options.callbackInOrder === tr...
[ "function", "BatchOperation", "(", "name", ",", "options", ")", "{", "if", "(", "!", "options", ")", "{", "options", "=", "{", "}", ";", "}", "this", ".", "name", "=", "name", ";", "this", ".", "logger", "=", "options", ".", "logger", "||", "new", ...
Concurrently execute batch operations and call operation callback randomly or in sequence. Random mode is for uploading. 1. Fire user callback when the operation is done. Sequence mode is for downloading. 1. Fire user callback when the operation is done and all previous operations and callback has finished. 2. BatchOpe...
[ "Concurrently", "execute", "batch", "operations", "and", "call", "operation", "callback", "randomly", "or", "in", "sequence", ".", "Random", "mode", "is", "for", "uploading", ".", "1", ".", "Fire", "user", "callback", "when", "the", "operation", "is", "done", ...
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/streams/batchoperation.js#L48-L79
train
Azure/azure-storage-node
lib/common/streams/batchoperation.js
RestOperation
function RestOperation(serviceClient, operation) { this.status = OperationState.Inited; this.operationId = -1; this._callbackArguments = null; // setup callback and args this._userCallback = arguments[arguments.length - 1]; var sliceEnd = arguments.length; if(azureutil.objectIsFunction(this._userCallback...
javascript
function RestOperation(serviceClient, operation) { this.status = OperationState.Inited; this.operationId = -1; this._callbackArguments = null; // setup callback and args this._userCallback = arguments[arguments.length - 1]; var sliceEnd = arguments.length; if(azureutil.objectIsFunction(this._userCallback...
[ "function", "RestOperation", "(", "serviceClient", ",", "operation", ")", "{", "this", ".", "status", "=", "OperationState", ".", "Inited", ";", "this", ".", "operationId", "=", "-", "1", ";", "this", ".", "_callbackArguments", "=", "null", ";", "// setup ca...
Rest operation in sdk
[ "Rest", "operation", "in", "sdk" ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/streams/batchoperation.js#L355-L388
train
Azure/azure-storage-node
lib/common/streams/batchoperation.js
CommonOperation
function CommonOperation(operationFunc, callback) { this.status = OperationState.Inited; this.operationId = -1; this._callbackArguments = null; var sliceStart = 2; if (azureutil.objectIsFunction(callback)) { this._userCallback = callback; } else { this._userCallback = null; sliceStart = 1; } ...
javascript
function CommonOperation(operationFunc, callback) { this.status = OperationState.Inited; this.operationId = -1; this._callbackArguments = null; var sliceStart = 2; if (azureutil.objectIsFunction(callback)) { this._userCallback = callback; } else { this._userCallback = null; sliceStart = 1; } ...
[ "function", "CommonOperation", "(", "operationFunc", ",", "callback", ")", "{", "this", ".", "status", "=", "OperationState", ".", "Inited", ";", "this", ".", "operationId", "=", "-", "1", ";", "this", ".", "_callbackArguments", "=", "null", ";", "var", "s...
Common operation wrapper
[ "Common", "operation", "wrapper" ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/streams/batchoperation.js#L395-L421
train
Azure/azure-storage-node
lib/services/file/internal/filerangestream.js
FileRangeStream
function FileRangeStream(fileServiceClient, share, directory, file, options) { FileRangeStream['super_'].call(this, fileServiceClient, null, null, options); this._lengthHeader = Constants.HeaderConstants.FILE_CONTENT_LENGTH; if (options.minRangeSize) { this._minRangeSize = options.minRangeSize; } else ...
javascript
function FileRangeStream(fileServiceClient, share, directory, file, options) { FileRangeStream['super_'].call(this, fileServiceClient, null, null, options); this._lengthHeader = Constants.HeaderConstants.FILE_CONTENT_LENGTH; if (options.minRangeSize) { this._minRangeSize = options.minRangeSize; } else ...
[ "function", "FileRangeStream", "(", "fileServiceClient", ",", "share", ",", "directory", ",", "file", ",", "options", ")", "{", "FileRangeStream", "[", "'super_'", "]", ".", "call", "(", "this", ",", "fileServiceClient", ",", "null", ",", "null", ",", "optio...
File range stream
[ "File", "range", "stream" ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/services/file/internal/filerangestream.js#L24-L42
train
Azure/azure-storage-node
examples/samples/sassample.js
function () { var options = { publicAccessLevel: BlobUtilities.BlobContainerPublicAccessType.CONTAINER }; blobService.setContainerAcl(container, signedIdentifiers, options, function(error) { if (error) { console.log(error); } else { console.log('Uploaded the permissions for the conta...
javascript
function () { var options = { publicAccessLevel: BlobUtilities.BlobContainerPublicAccessType.CONTAINER }; blobService.setContainerAcl(container, signedIdentifiers, options, function(error) { if (error) { console.log(error); } else { console.log('Uploaded the permissions for the conta...
[ "function", "(", ")", "{", "var", "options", "=", "{", "publicAccessLevel", ":", "BlobUtilities", ".", "BlobContainerPublicAccessType", ".", "CONTAINER", "}", ";", "blobService", ".", "setContainerAcl", "(", "container", ",", "signedIdentifiers", ",", "options", "...
Wait 30 seconds for the container acl to be processed
[ "Wait", "30", "seconds", "for", "the", "container", "acl", "to", "be", "processed" ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/examples/samples/sassample.js#L161-L171
train
Azure/azure-storage-node
examples/samples/retrypolicysample.js
setRetries
function setRetries() { console.log('Starting Sample 1 - setRetries.'); // By default, no retry will be performed with all kinds of services created // by Azure storage client library for Node.js. var blobServiceWithoutRetry = azure.createBlobService(); console.log('BlobService instance created, no retry wil...
javascript
function setRetries() { console.log('Starting Sample 1 - setRetries.'); // By default, no retry will be performed with all kinds of services created // by Azure storage client library for Node.js. var blobServiceWithoutRetry = azure.createBlobService(); console.log('BlobService instance created, no retry wil...
[ "function", "setRetries", "(", ")", "{", "console", ".", "log", "(", "'Starting Sample 1 - setRetries.'", ")", ";", "// By default, no retry will be performed with all kinds of services created", "// by Azure storage client library for Node.js.", "var", "blobServiceWithoutRetry", "="...
Demonstrate how to use pre-written retry policies. By default, no retry will be performed with service instances newly created. Several pre-written retry policies are available with modifiable settings, and can be used through associating filter.
[ "Demonstrate", "how", "to", "use", "pre", "-", "written", "retry", "policies", ".", "By", "default", "no", "retry", "will", "be", "performed", "with", "service", "instances", "newly", "created", ".", "Several", "pre", "-", "written", "retry", "policies", "ar...
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/examples/samples/retrypolicysample.js#L54-L82
train
Azure/azure-storage-node
examples/samples/retrypolicysample.js
setCustomRetryPolicy
function setCustomRetryPolicy() { console.log('Starting Sample 2 - setCustomRetryPolicy.'); // Step 1 : Set the retry policy to customized retry policy which will // not retry on any failing status code other than the excepted one. var retryOnContainerBeingDeleted = new RetryPolicyFilter(); retryOnContainerB...
javascript
function setCustomRetryPolicy() { console.log('Starting Sample 2 - setCustomRetryPolicy.'); // Step 1 : Set the retry policy to customized retry policy which will // not retry on any failing status code other than the excepted one. var retryOnContainerBeingDeleted = new RetryPolicyFilter(); retryOnContainerB...
[ "function", "setCustomRetryPolicy", "(", ")", "{", "console", ".", "log", "(", "'Starting Sample 2 - setCustomRetryPolicy.'", ")", ";", "// Step 1 : Set the retry policy to customized retry policy which will", "// not retry on any failing status code other than the excepted one.", "var",...
Demonstrate how to use custom retry policy. Any custom retry logic may be used by simply creating and setting RetryPolicyFilter instance.
[ "Demonstrate", "how", "to", "use", "custom", "retry", "policy", ".", "Any", "custom", "retry", "logic", "may", "be", "used", "by", "simply", "creating", "and", "setting", "RetryPolicyFilter", "instance", "." ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/examples/samples/retrypolicysample.js#L88-L149
train
Azure/azure-storage-node
lib/common/streams/filereadstream.js
FileReadStream
function FileReadStream(path, options) { stream.Stream.call(this); this.readable = true; if(!options) { options = {}; } this._destroyed = false; this._streamEnded = false; this._fd = null; this._fileName = undefined; this._highWaterMark = options.highWaterMark || bufferSize; this._offset = 0; ...
javascript
function FileReadStream(path, options) { stream.Stream.call(this); this.readable = true; if(!options) { options = {}; } this._destroyed = false; this._streamEnded = false; this._fd = null; this._fileName = undefined; this._highWaterMark = options.highWaterMark || bufferSize; this._offset = 0; ...
[ "function", "FileReadStream", "(", "path", ",", "options", ")", "{", "stream", ".", "Stream", ".", "call", "(", "this", ")", ";", "this", ".", "readable", "=", "true", ";", "if", "(", "!", "options", ")", "{", "options", "=", "{", "}", ";", "}", ...
File read stream 1. Calculate md5 2. Track reading offset 3. Work with customize memory allocator 4. Buffer data from stream. @param {object} options stream.Readable options
[ "File", "read", "stream", "1", ".", "Calculate", "md5", "2", ".", "Track", "reading", "offset", "3", ".", "Work", "with", "customize", "memory", "allocator", "4", ".", "Buffer", "data", "from", "stream", "." ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/streams/filereadstream.js#L36-L62
train
Azure/azure-storage-node
lib/common/streams/speedsummary.js
toHumanReadableSize
function toHumanReadableSize(size, len) { if(!size) return '0B'; if (!len || len <= 0) { len = 2; } var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; var i = Math.floor( Math.log(size) / Math.log(1024)); return (size/Math.pow(1024, i)).toFixed(len) + units[i]; }
javascript
function toHumanReadableSize(size, len) { if(!size) return '0B'; if (!len || len <= 0) { len = 2; } var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; var i = Math.floor( Math.log(size) / Math.log(1024)); return (size/Math.pow(1024, i)).toFixed(len) + units[i]; }
[ "function", "toHumanReadableSize", "(", "size", ",", "len", ")", "{", "if", "(", "!", "size", ")", "return", "'0B'", ";", "if", "(", "!", "len", "||", "len", "<=", "0", ")", "{", "len", "=", "2", ";", "}", "var", "units", "=", "[", "'B'", ",", ...
Convert the size to human readable size
[ "Convert", "the", "size", "to", "human", "readable", "size" ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/streams/speedsummary.js#L42-L50
train
Azure/azure-storage-node
lib/common/services/storageservicesettings.js
StorageServiceSettings
function StorageServiceSettings(name, key, sasToken, blobEndpoint, queueEndpoint, tableEndpoint, fileEndpoint, usePathStyleUri, token) { this._name = name; this._key = key; if (sasToken && sasToken[0] === '?') { this._sasToken = sasToken.slice(1); } else { this._sasToken = sasToken; } this._blobEn...
javascript
function StorageServiceSettings(name, key, sasToken, blobEndpoint, queueEndpoint, tableEndpoint, fileEndpoint, usePathStyleUri, token) { this._name = name; this._key = key; if (sasToken && sasToken[0] === '?') { this._sasToken = sasToken.slice(1); } else { this._sasToken = sasToken; } this._blobEn...
[ "function", "StorageServiceSettings", "(", "name", ",", "key", ",", "sasToken", ",", "blobEndpoint", ",", "queueEndpoint", ",", "tableEndpoint", ",", "fileEndpoint", ",", "usePathStyleUri", ",", "token", ")", "{", "this", ".", "_name", "=", "name", ";", "this"...
Creates new storage service settings instance. @param {string} name The storage service name. @param {string} key The storage service key. @param {string} sasToken The storage service shared access signature token. @param {string} blobEndpoint Th...
[ "Creates", "new", "storage", "service", "settings", "instance", "." ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/services/storageservicesettings.js#L91-L113
train
Azure/azure-storage-node
lib/services/table/models/batchresult.js
BatchResult
function BatchResult(tableService, table, operations) { this.tableService = tableService; this.table = table; this.operations = operations; this.batchBoundary = 'batch_' + BatchResult._getBoundary(); this.changesetBoundary = 'changeset_' + BatchResult._getBoundary(); }
javascript
function BatchResult(tableService, table, operations) { this.tableService = tableService; this.table = table; this.operations = operations; this.batchBoundary = 'batch_' + BatchResult._getBoundary(); this.changesetBoundary = 'changeset_' + BatchResult._getBoundary(); }
[ "function", "BatchResult", "(", "tableService", ",", "table", ",", "operations", ")", "{", "this", ".", "tableService", "=", "tableService", ";", "this", ".", "table", "=", "table", ";", "this", ".", "operations", "=", "operations", ";", "this", ".", "batc...
Creates a new BatchResult. @param {TableService} tableService The table service. @param {string} table The table name. @param {array} operations The array of batch operations. @constructor @ignore
[ "Creates", "a", "new", "BatchResult", "." ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/services/table/models/batchresult.js#L39-L45
train
Azure/azure-storage-node
lib/common/services/storageserviceclient.js
StorageServiceClient
function StorageServiceClient(storageAccount, storageAccessKey, host, usePathStyleUri, sas, token) { StorageServiceClient['super_'].call(this); if(storageAccount && storageAccessKey) { // account and key this.storageAccount = storageAccount; this.storageAccessKey = storageAccessKey; this.storageCre...
javascript
function StorageServiceClient(storageAccount, storageAccessKey, host, usePathStyleUri, sas, token) { StorageServiceClient['super_'].call(this); if(storageAccount && storageAccessKey) { // account and key this.storageAccount = storageAccount; this.storageAccessKey = storageAccessKey; this.storageCre...
[ "function", "StorageServiceClient", "(", "storageAccount", ",", "storageAccessKey", ",", "host", ",", "usePathStyleUri", ",", "sas", ",", "token", ")", "{", "StorageServiceClient", "[", "'super_'", "]", ".", "call", "(", "this", ")", ";", "if", "(", "storageAc...
Creates a new StorageServiceClient object. @class The StorageServiceClient class is the base class of all the service classes. @constructor @param {string} storageAccount The storage account. @param {string} storageAccessKey The storage access key. @param {object} host The host fo...
[ "Creates", "a", "new", "StorageServiceClient", "object", "." ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/services/storageserviceclient.js#L75-L122
train
Azure/azure-storage-node
lib/common/services/storageserviceclient.js
function (postPostRequestOptions, parentFilterCallback) { // The parentFilterNext is the filter next to the merged filter. // For 2 filters, that'd be the actual operation. parentFilterNext(postPostRequestOptions, function (responseObject, responseCallback, finalCallback) { ...
javascript
function (postPostRequestOptions, parentFilterCallback) { // The parentFilterNext is the filter next to the merged filter. // For 2 filters, that'd be the actual operation. parentFilterNext(postPostRequestOptions, function (responseObject, responseCallback, finalCallback) { ...
[ "function", "(", "postPostRequestOptions", ",", "parentFilterCallback", ")", "{", "// The parentFilterNext is the filter next to the merged filter.", "// For 2 filters, that'd be the actual operation.", "parentFilterNext", "(", "postPostRequestOptions", ",", "function", "(", "responseO...
handle parent filter pre and get Parent filter post
[ "handle", "parent", "filter", "pre", "and", "get", "Parent", "filter", "post" ]
1e315487b8801b8357b8974c7d925313cb143483
https://github.com/Azure/azure-storage-node/blob/1e315487b8801b8357b8974c7d925313cb143483/lib/common/services/storageserviceclient.js#L796-L804
train
astefanutti/decktape
decktape.js
parseXObject
function parseXObject(xObject) { const objectId = xObject.getObjectID(); const pdfStreamInput = cpyCxtParser.parseNewObject(objectId); const xObjectDictionary = pdfStreamInput.getDictionary().toJSObject(); if (xObjectDictionary.Subtype.value === 'Image') { // Create a hash of the compressed stream...
javascript
function parseXObject(xObject) { const objectId = xObject.getObjectID(); const pdfStreamInput = cpyCxtParser.parseNewObject(objectId); const xObjectDictionary = pdfStreamInput.getDictionary().toJSObject(); if (xObjectDictionary.Subtype.value === 'Image') { // Create a hash of the compressed stream...
[ "function", "parseXObject", "(", "xObject", ")", "{", "const", "objectId", "=", "xObject", ".", "getObjectID", "(", ")", ";", "const", "pdfStreamInput", "=", "cpyCxtParser", ".", "parseNewObject", "(", "objectId", ")", ";", "const", "xObjectDictionary", "=", "...
Consolidate duplicate images
[ "Consolidate", "duplicate", "images" ]
e7e666f6276e9d818e8738531a8cfb4a5c680fa2
https://github.com/astefanutti/decktape/blob/e7e666f6276e9d818e8738531a8cfb4a5c680fa2/decktape.js#L382-L404
train
astefanutti/decktape
decktape.js
parseFont
function parseFont(fontObject) { const pdfStreamInput = cpyCxtParser.parseNewObject(fontObject.getObjectID()); const fontDictionary = pdfStreamInput.toJSObject(); // See "Introduction to Font Data Structures" from PDF specification if (fontDictionary.Subtype.value === 'Type0') { // TODO: properly ...
javascript
function parseFont(fontObject) { const pdfStreamInput = cpyCxtParser.parseNewObject(fontObject.getObjectID()); const fontDictionary = pdfStreamInput.toJSObject(); // See "Introduction to Font Data Structures" from PDF specification if (fontDictionary.Subtype.value === 'Type0') { // TODO: properly ...
[ "function", "parseFont", "(", "fontObject", ")", "{", "const", "pdfStreamInput", "=", "cpyCxtParser", ".", "parseNewObject", "(", "fontObject", ".", "getObjectID", "(", ")", ")", ";", "const", "fontDictionary", "=", "pdfStreamInput", ".", "toJSObject", "(", ")",...
Consolidate duplicate fonts
[ "Consolidate", "duplicate", "fonts" ]
e7e666f6276e9d818e8738531a8cfb4a5c680fa2
https://github.com/astefanutti/decktape/blob/e7e666f6276e9d818e8738531a8cfb4a5c680fa2/decktape.js#L407-L452
train
depcheck/depcheck
src/special/gulp-load-plugins.js
getReferences
function getReferences(path, variableName) { const bindings = path.scope.getBinding(variableName); const references = bindings.referencePaths; return references; }
javascript
function getReferences(path, variableName) { const bindings = path.scope.getBinding(variableName); const references = bindings.referencePaths; return references; }
[ "function", "getReferences", "(", "path", ",", "variableName", ")", "{", "const", "bindings", "=", "path", ".", "scope", ".", "getBinding", "(", "variableName", ")", ";", "const", "references", "=", "bindings", ".", "referencePaths", ";", "return", "references...
Get the references to the variable in the path scope. @example Within the path scope, returns references to `loadPlugins` variable.
[ "Get", "the", "references", "to", "the", "variable", "in", "the", "path", "scope", "." ]
2a877930e3f7033d4f8ac99d412182a7edca4b9b
https://github.com/depcheck/depcheck/blob/2a877930e3f7033d4f8ac99d412182a7edca4b9b/src/special/gulp-load-plugins.js#L34-L38
train
depcheck/depcheck
src/special/gulp-load-plugins.js
getIdentifierVariableName
function getIdentifierVariableName(path) { if ( path.isIdentifier() && path.parentPath.isCallExpression() && path.parentPath.parentPath.isVariableDeclarator() ) { const variableName = path.parentPath.parentPath.node.id.name; return variableName; } return ''; }
javascript
function getIdentifierVariableName(path) { if ( path.isIdentifier() && path.parentPath.isCallExpression() && path.parentPath.parentPath.isVariableDeclarator() ) { const variableName = path.parentPath.parentPath.node.id.name; return variableName; } return ''; }
[ "function", "getIdentifierVariableName", "(", "path", ")", "{", "if", "(", "path", ".", "isIdentifier", "(", ")", "&&", "path", ".", "parentPath", ".", "isCallExpression", "(", ")", "&&", "path", ".", "parentPath", ".", "parentPath", ".", "isVariableDeclarator...
Get the variable name from the variable assigned declaration. @example With code `$ = loadPlugins()` and `loadPlugins` as path, returns the string `$`.
[ "Get", "the", "variable", "name", "from", "the", "variable", "assigned", "declaration", "." ]
2a877930e3f7033d4f8ac99d412182a7edca4b9b
https://github.com/depcheck/depcheck/blob/2a877930e3f7033d4f8ac99d412182a7edca4b9b/src/special/gulp-load-plugins.js#L44-L55
train
depcheck/depcheck
src/special/gulp-load-plugins.js
getPackageName
function getPackageName(content, pluginLookup, identifierPath) { let memberPath = identifierPath.parentPath; while (memberPath.isMemberExpression()) { const code = content.slice(identifierPath.node.end, memberPath.node.end); const pluginName = pluginLookup[code]; if (pluginName) { return pluginNam...
javascript
function getPackageName(content, pluginLookup, identifierPath) { let memberPath = identifierPath.parentPath; while (memberPath.isMemberExpression()) { const code = content.slice(identifierPath.node.end, memberPath.node.end); const pluginName = pluginLookup[code]; if (pluginName) { return pluginNam...
[ "function", "getPackageName", "(", "content", ",", "pluginLookup", ",", "identifierPath", ")", "{", "let", "memberPath", "=", "identifierPath", ".", "parentPath", ";", "while", "(", "memberPath", ".", "isMemberExpression", "(", ")", ")", "{", "const", "code", ...
Get the package name from the identifier call path. @example With code `$.jshint()` and `$` as path, returns `gulp-jshint` string.
[ "Get", "the", "package", "name", "from", "the", "identifier", "call", "path", "." ]
2a877930e3f7033d4f8ac99d412182a7edca4b9b
https://github.com/depcheck/depcheck/blob/2a877930e3f7033d4f8ac99d412182a7edca4b9b/src/special/gulp-load-plugins.js#L78-L91
train
depcheck/depcheck
src/special/gulp-load-plugins.js
check
function check(content, deps, path) { if ( // Pattern: import plugins from 'gulp-load-plugins', $ = plugins(), $.jshint() importDetector(path.node)[0] === 'gulp-load-plugins' && path.isImportDeclaration() && path.get('specifiers')[0] && path.get('specifiers')[0].isImportDefaultSpecifier() && p...
javascript
function check(content, deps, path) { if ( // Pattern: import plugins from 'gulp-load-plugins', $ = plugins(), $.jshint() importDetector(path.node)[0] === 'gulp-load-plugins' && path.isImportDeclaration() && path.get('specifiers')[0] && path.get('specifiers')[0].isImportDefaultSpecifier() && p...
[ "function", "check", "(", "content", ",", "deps", ",", "path", ")", "{", "if", "(", "// Pattern: import plugins from 'gulp-load-plugins', $ = plugins(), $.jshint()", "importDetector", "(", "path", ".", "node", ")", "[", "0", "]", "===", "'gulp-load-plugins'", "&&", ...
Get the gulp packages found from the path. This is the entry for traverse.
[ "Get", "the", "gulp", "packages", "found", "from", "the", "path", ".", "This", "is", "the", "entry", "for", "traverse", "." ]
2a877930e3f7033d4f8ac99d412182a7edca4b9b
https://github.com/depcheck/depcheck/blob/2a877930e3f7033d4f8ac99d412182a7edca4b9b/src/special/gulp-load-plugins.js#L96-L150
train
shakiba/planck.js
lib/Manifold.js
Manifold
function Manifold() { this.type; this.localNormal = Vec2.zero(); this.localPoint = Vec2.zero(); this.points = [ new ManifoldPoint(), new ManifoldPoint() ]; this.pointCount = 0; }
javascript
function Manifold() { this.type; this.localNormal = Vec2.zero(); this.localPoint = Vec2.zero(); this.points = [ new ManifoldPoint(), new ManifoldPoint() ]; this.pointCount = 0; }
[ "function", "Manifold", "(", ")", "{", "this", ".", "type", ";", "this", ".", "localNormal", "=", "Vec2", ".", "zero", "(", ")", ";", "this", ".", "localPoint", "=", "Vec2", ".", "zero", "(", ")", ";", "this", ".", "points", "=", "[", "new", "Man...
A manifold for two touching convex shapes. Manifolds are created in `evaluate` method of Contact subclasses. Supported manifold types are e_faceA or e_faceB for clip point versus plane with radius and e_circles point versus point with radius. We store contacts in this way so that position correction can account for m...
[ "A", "manifold", "for", "two", "touching", "convex", "shapes", ".", "Manifolds", "are", "created", "in", "evaluate", "method", "of", "Contact", "subclasses", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/Manifold.js#L69-L75
train
shakiba/planck.js
lib/Manifold.js
getPointStates
function getPointStates(state1, state2, manifold1, manifold2) { // for (var i = 0; i < Settings.maxManifoldPoints; ++i) { // state1[i] = PointState.nullState; // state2[i] = PointState.nullState; // } // Detect persists and removes. for (var i = 0; i < manifold1.pointCount; ++i) { var id = manifold1.po...
javascript
function getPointStates(state1, state2, manifold1, manifold2) { // for (var i = 0; i < Settings.maxManifoldPoints; ++i) { // state1[i] = PointState.nullState; // state2[i] = PointState.nullState; // } // Detect persists and removes. for (var i = 0; i < manifold1.pointCount; ++i) { var id = manifold1.po...
[ "function", "getPointStates", "(", "state1", ",", "state2", ",", "manifold1", ",", "manifold2", ")", "{", "// for (var i = 0; i < Settings.maxManifoldPoints; ++i) {", "// state1[i] = PointState.nullState;", "// state2[i] = PointState.nullState;", "// }", "// Detect persists and remov...
Compute the point states given two manifolds. The states pertain to the transition from manifold1 to manifold2. So state1 is either persist or remove while state2 is either add or persist. @param {PointState[Settings.maxManifoldPoints]} state1 @param {PointState[Settings.maxManifoldPoints]} state2
[ "Compute", "the", "point", "states", "given", "two", "manifolds", ".", "The", "states", "pertain", "to", "the", "transition", "from", "manifold1", "to", "manifold2", ".", "So", "state1", "is", "either", "persist", "or", "remove", "while", "state2", "is", "ei...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/Manifold.js#L259-L292
train
shakiba/planck.js
lib/Manifold.js
clipSegmentToLine
function clipSegmentToLine(vOut, vIn, normal, offset, vertexIndexA) { // Start with no output points var numOut = 0; // Calculate the distance of end points to the line var distance0 = Vec2.dot(normal, vIn[0].v) - offset; var distance1 = Vec2.dot(normal, vIn[1].v) - offset; // If the points are behind the...
javascript
function clipSegmentToLine(vOut, vIn, normal, offset, vertexIndexA) { // Start with no output points var numOut = 0; // Calculate the distance of end points to the line var distance0 = Vec2.dot(normal, vIn[0].v) - offset; var distance1 = Vec2.dot(normal, vIn[1].v) - offset; // If the points are behind the...
[ "function", "clipSegmentToLine", "(", "vOut", ",", "vIn", ",", "normal", ",", "offset", ",", "vertexIndexA", ")", "{", "// Start with no output points", "var", "numOut", "=", "0", ";", "// Calculate the distance of end points to the line", "var", "distance0", "=", "Ve...
Clipping for contact manifolds. Sutherland-Hodgman clipping. @param {ClipVertex[2]} vOut @param {ClipVertex[2]} vIn
[ "Clipping", "for", "contact", "manifolds", ".", "Sutherland", "-", "Hodgman", "clipping", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/Manifold.js#L316-L345
train
shakiba/planck.js
lib/joint/MotorJoint.js
MotorJoint
function MotorJoint(def, bodyA, bodyB) { if (!(this instanceof MotorJoint)) { return new MotorJoint(def, bodyA, bodyB); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = MotorJoint.TYPE; this.m_linearOffset = def.linearO...
javascript
function MotorJoint(def, bodyA, bodyB) { if (!(this instanceof MotorJoint)) { return new MotorJoint(def, bodyA, bodyB); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = MotorJoint.TYPE; this.m_linearOffset = def.linearO...
[ "function", "MotorJoint", "(", "def", ",", "bodyA", ",", "bodyB", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MotorJoint", ")", ")", "{", "return", "new", "MotorJoint", "(", "def", ",", "bodyA", ",", "bodyB", ")", ";", "}", "def", "=", "o...
A motor joint is used to control the relative motion between two bodies. A typical usage is to control the movement of a dynamic body with respect to the ground. @param {MotorJointDef} def @param {Body} bodyA @param {Body} bodyB
[ "A", "motor", "joint", "is", "used", "to", "control", "the", "relative", "motion", "between", "two", "bodies", ".", "A", "typical", "usage", "is", "to", "control", "the", "movement", "of", "a", "dynamic", "body", "with", "respect", "to", "the", "ground", ...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/MotorJoint.js#L76-L126
train
shakiba/planck.js
lib/joint/WeldJoint.js
WeldJoint
function WeldJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof WeldJoint)) { return new WeldJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = WeldJoint.TYPE; this.m_localAnchorA =...
javascript
function WeldJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof WeldJoint)) { return new WeldJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = WeldJoint.TYPE; this.m_localAnchorA =...
[ "function", "WeldJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchor", ")", "{", "if", "(", "!", "(", "this", "instanceof", "WeldJoint", ")", ")", "{", "return", "new", "WeldJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchor", ")",...
A weld joint essentially glues two bodies together. A weld joint may distort somewhat because the island constraint solver is approximate. @param {WeldJointDef} def @param {Body} bodyA @param {Body} bodyB
[ "A", "weld", "joint", "essentially", "glues", "two", "bodies", "together", ".", "A", "weld", "joint", "may", "distort", "somewhat", "because", "the", "island", "constraint", "solver", "is", "approximate", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/WeldJoint.js#L77-L125
train
shakiba/planck.js
lib/common/Mat33.js
Mat33
function Mat33(a, b, c) { if (typeof a === 'object' && a !== null) { this.ex = Vec3.clone(a); this.ey = Vec3.clone(b); this.ez = Vec3.clone(c); } else { this.ex = Vec3(); this.ey = Vec3(); this.ez = Vec3(); } }
javascript
function Mat33(a, b, c) { if (typeof a === 'object' && a !== null) { this.ex = Vec3.clone(a); this.ey = Vec3.clone(b); this.ez = Vec3.clone(c); } else { this.ex = Vec3(); this.ey = Vec3(); this.ez = Vec3(); } }
[ "function", "Mat33", "(", "a", ",", "b", ",", "c", ")", "{", "if", "(", "typeof", "a", "===", "'object'", "&&", "a", "!==", "null", ")", "{", "this", ".", "ex", "=", "Vec3", ".", "clone", "(", "a", ")", ";", "this", ".", "ey", "=", "Vec3", ...
A 3-by-3 matrix. Stored in column-major order.
[ "A", "3", "-", "by", "-", "3", "matrix", ".", "Stored", "in", "column", "-", "major", "order", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/common/Mat33.js#L33-L43
train
shakiba/planck.js
lib/common/Mat22.js
Mat22
function Mat22(a, b, c, d) { if (typeof a === 'object' && a !== null) { this.ex = Vec2.clone(a); this.ey = Vec2.clone(b); } else if (typeof a === 'number') { this.ex = Vec2.neo(a, c); this.ey = Vec2.neo(b, d) } else { this.ex = Vec2.zero(); this.ey = Vec2.zero() } }
javascript
function Mat22(a, b, c, d) { if (typeof a === 'object' && a !== null) { this.ex = Vec2.clone(a); this.ey = Vec2.clone(b); } else if (typeof a === 'number') { this.ex = Vec2.neo(a, c); this.ey = Vec2.neo(b, d) } else { this.ex = Vec2.zero(); this.ey = Vec2.zero() } }
[ "function", "Mat22", "(", "a", ",", "b", ",", "c", ",", "d", ")", "{", "if", "(", "typeof", "a", "===", "'object'", "&&", "a", "!==", "null", ")", "{", "this", ".", "ex", "=", "Vec2", ".", "clone", "(", "a", ")", ";", "this", ".", "ey", "="...
A 2-by-2 matrix. Stored in column-major order.
[ "A", "2", "-", "by", "-", "2", "matrix", ".", "Stored", "in", "column", "-", "major", "order", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/common/Mat22.js#L32-L43
train
shakiba/planck.js
lib/joint/RopeJoint.js
RopeJoint
function RopeJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof RopeJoint)) { return new RopeJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = RopeJoint.TYPE; this.m_localAnchorA = ...
javascript
function RopeJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof RopeJoint)) { return new RopeJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = RopeJoint.TYPE; this.m_localAnchorA = ...
[ "function", "RopeJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchor", ")", "{", "if", "(", "!", "(", "this", "instanceof", "RopeJoint", ")", ")", "{", "return", "new", "RopeJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchor", ")",...
A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. Warning: if you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so I chose no...
[ "A", "rope", "joint", "enforces", "a", "maximum", "distance", "between", "two", "points", "on", "two", "bodies", ".", "It", "has", "no", "other", "effect", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/RopeJoint.js#L85-L125
train
shakiba/planck.js
lib/shape/CollidePolygon.js
FindMaxSeparation
function FindMaxSeparation(poly1, xf1, poly2, xf2) { var count1 = poly1.m_count; var count2 = poly2.m_count; var n1s = poly1.m_normals; var v1s = poly1.m_vertices; var v2s = poly2.m_vertices; var xf = Transform.mulTXf(xf2, xf1); var bestIndex = 0; var maxSeparation = -Infinity; for (var i = 0; i < co...
javascript
function FindMaxSeparation(poly1, xf1, poly2, xf2) { var count1 = poly1.m_count; var count2 = poly2.m_count; var n1s = poly1.m_normals; var v1s = poly1.m_vertices; var v2s = poly2.m_vertices; var xf = Transform.mulTXf(xf2, xf1); var bestIndex = 0; var maxSeparation = -Infinity; for (var i = 0; i < co...
[ "function", "FindMaxSeparation", "(", "poly1", ",", "xf1", ",", "poly2", ",", "xf2", ")", "{", "var", "count1", "=", "poly1", ".", "m_count", ";", "var", "count2", "=", "poly2", ".", "m_count", ";", "var", "n1s", "=", "poly1", ".", "m_normals", ";", ...
Find the max separation between poly1 and poly2 using edge normals from poly1.
[ "Find", "the", "max", "separation", "between", "poly1", "and", "poly2", "using", "edge", "normals", "from", "poly1", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/shape/CollidePolygon.js#L49-L82
train
shakiba/planck.js
lib/shape/PolygonShape.js
PolygonShape
function PolygonShape(vertices) { if (!(this instanceof PolygonShape)) { return new PolygonShape(vertices); } PolygonShape._super.call(this); this.m_type = PolygonShape.TYPE; this.m_radius = Settings.polygonRadius; this.m_centroid = Vec2.zero(); this.m_vertices = []; // Vec2[Settings.maxPolygonVerti...
javascript
function PolygonShape(vertices) { if (!(this instanceof PolygonShape)) { return new PolygonShape(vertices); } PolygonShape._super.call(this); this.m_type = PolygonShape.TYPE; this.m_radius = Settings.polygonRadius; this.m_centroid = Vec2.zero(); this.m_vertices = []; // Vec2[Settings.maxPolygonVerti...
[ "function", "PolygonShape", "(", "vertices", ")", "{", "if", "(", "!", "(", "this", "instanceof", "PolygonShape", ")", ")", "{", "return", "new", "PolygonShape", "(", "vertices", ")", ";", "}", "PolygonShape", ".", "_super", ".", "call", "(", "this", ")"...
A convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to Settings.maxPolygonVertices. In most cases you should not need many vertices for a convex polygon. extends Shape
[ "A", "convex", "polygon", ".", "It", "is", "assumed", "that", "the", "interior", "of", "the", "polygon", "is", "to", "the", "left", "of", "each", "edge", ".", "Polygons", "have", "a", "maximum", "number", "of", "vertices", "equal", "to", "Settings", ".",...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/shape/PolygonShape.js#L48-L65
train
shakiba/planck.js
lib/joint/RevoluteJoint.js
RevoluteJoint
function RevoluteJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof RevoluteJoint)) { return new RevoluteJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = RevoluteJoint.TYPE; this....
javascript
function RevoluteJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof RevoluteJoint)) { return new RevoluteJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = RevoluteJoint.TYPE; this....
[ "function", "RevoluteJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchor", ")", "{", "if", "(", "!", "(", "this", "instanceof", "RevoluteJoint", ")", ")", "{", "return", "new", "RevoluteJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anc...
A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation...
[ "A", "revolute", "joint", "constrains", "two", "bodies", "to", "share", "a", "common", "point", "while", "they", "are", "free", "to", "rotate", "about", "the", "point", ".", "The", "relative", "rotation", "about", "the", "shared", "point", "is", "the", "jo...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/RevoluteJoint.js#L103-L156
train
shakiba/planck.js
lib/collision/Distance.js
DistanceInput
function DistanceInput() { this.proxyA = new DistanceProxy(); this.proxyB = new DistanceProxy(); this.transformA = null; this.transformB = null; this.useRadii = false; }
javascript
function DistanceInput() { this.proxyA = new DistanceProxy(); this.proxyB = new DistanceProxy(); this.transformA = null; this.transformB = null; this.useRadii = false; }
[ "function", "DistanceInput", "(", ")", "{", "this", ".", "proxyA", "=", "new", "DistanceProxy", "(", ")", ";", "this", ".", "proxyB", "=", "new", "DistanceProxy", "(", ")", ";", "this", ".", "transformA", "=", "null", ";", "this", ".", "transformB", "=...
Input for Distance. You have to option to use the shape radii in the computation. Even
[ "Input", "for", "Distance", ".", "You", "have", "to", "option", "to", "use", "the", "shape", "radii", "in", "the", "computation", ".", "Even" ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/collision/Distance.js#L58-L64
train
shakiba/planck.js
lib/Joint.js
Joint
function Joint(def, bodyA, bodyB) { bodyA = def.bodyA || bodyA; bodyB = def.bodyB || bodyB; _ASSERT && common.assert(bodyA); _ASSERT && common.assert(bodyB); _ASSERT && common.assert(bodyA != bodyB); this.m_type = 'unknown-joint'; this.m_bodyA = bodyA; this.m_bodyB = bodyB; this.m_index = 0; thi...
javascript
function Joint(def, bodyA, bodyB) { bodyA = def.bodyA || bodyA; bodyB = def.bodyB || bodyB; _ASSERT && common.assert(bodyA); _ASSERT && common.assert(bodyB); _ASSERT && common.assert(bodyA != bodyB); this.m_type = 'unknown-joint'; this.m_bodyA = bodyA; this.m_bodyB = bodyB; this.m_index = 0; thi...
[ "function", "Joint", "(", "def", ",", "bodyA", ",", "bodyB", ")", "{", "bodyA", "=", "def", ".", "bodyA", "||", "bodyA", ";", "bodyB", "=", "def", ".", "bodyB", "||", "bodyB", ";", "_ASSERT", "&&", "common", ".", "assert", "(", "bodyA", ")", ";", ...
The base joint class. Joints are used to constraint two bodies together in various fashions. Some joints also feature limits and motors. @param {JointDef} def
[ "The", "base", "joint", "class", ".", "Joints", "are", "used", "to", "constraint", "two", "bodies", "together", "in", "various", "fashions", ".", "Some", "joints", "also", "feature", "limits", "and", "motors", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/Joint.js#L70-L94
train
shakiba/planck.js
lib/shape/ChainShape.js
ChainShape
function ChainShape(vertices, loop) { if (!(this instanceof ChainShape)) { return new ChainShape(vertices, loop); } ChainShape._super.call(this); this.m_type = ChainShape.TYPE; this.m_radius = Settings.polygonRadius; this.m_vertices = []; this.m_count = 0; this.m_prevVertex = null; this.m_nextVe...
javascript
function ChainShape(vertices, loop) { if (!(this instanceof ChainShape)) { return new ChainShape(vertices, loop); } ChainShape._super.call(this); this.m_type = ChainShape.TYPE; this.m_radius = Settings.polygonRadius; this.m_vertices = []; this.m_count = 0; this.m_prevVertex = null; this.m_nextVe...
[ "function", "ChainShape", "(", "vertices", ",", "loop", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ChainShape", ")", ")", "{", "return", "new", "ChainShape", "(", "vertices", ",", "loop", ")", ";", "}", "ChainShape", ".", "_super", ".", "cal...
A chain shape is a free form sequence of line segments. The chain has two-sided collision, so you can use inside and outside collision. Therefore, you may use any winding order. Connectivity information is used to create smooth collisions. WARNING: The chain will not collide properly if there are self-intersections.
[ "A", "chain", "shape", "is", "a", "free", "form", "sequence", "of", "line", "segments", ".", "The", "chain", "has", "two", "-", "sided", "collision", "so", "you", "can", "use", "inside", "and", "outside", "collision", ".", "Therefore", "you", "may", "use...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/shape/ChainShape.js#L51-L76
train
shakiba/planck.js
lib/collision/TimeOfImpact.js
TOIInput
function TOIInput() { this.proxyA = new DistanceProxy(); this.proxyB = new DistanceProxy(); this.sweepA = new Sweep(); this.sweepB = new Sweep(); this.tMax; }
javascript
function TOIInput() { this.proxyA = new DistanceProxy(); this.proxyB = new DistanceProxy(); this.sweepA = new Sweep(); this.sweepB = new Sweep(); this.tMax; }
[ "function", "TOIInput", "(", ")", "{", "this", ".", "proxyA", "=", "new", "DistanceProxy", "(", ")", ";", "this", ".", "proxyB", "=", "new", "DistanceProxy", "(", ")", ";", "this", ".", "sweepA", "=", "new", "Sweep", "(", ")", ";", "this", ".", "sw...
Input parameters for TimeOfImpact. @prop {DistanceProxy} proxyA @prop {DistanceProxy} proxyB @prop {Sweep} sweepA @prop {Sweep} sweepB @prop tMax defines sweep interval [0, tMax]
[ "Input", "parameters", "for", "TimeOfImpact", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/collision/TimeOfImpact.js#L60-L66
train
shakiba/planck.js
lib/shape/BoxShape.js
BoxShape
function BoxShape(hx, hy, center, angle) { if (!(this instanceof BoxShape)) { return new BoxShape(hx, hy, center, angle); } BoxShape._super.call(this); this._setAsBox(hx, hy, center, angle); }
javascript
function BoxShape(hx, hy, center, angle) { if (!(this instanceof BoxShape)) { return new BoxShape(hx, hy, center, angle); } BoxShape._super.call(this); this._setAsBox(hx, hy, center, angle); }
[ "function", "BoxShape", "(", "hx", ",", "hy", ",", "center", ",", "angle", ")", "{", "if", "(", "!", "(", "this", "instanceof", "BoxShape", ")", ")", "{", "return", "new", "BoxShape", "(", "hx", ",", "hy", ",", "center", ",", "angle", ")", ";", "...
A rectangle polygon which extend PolygonShape.
[ "A", "rectangle", "polygon", "which", "extend", "PolygonShape", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/shape/BoxShape.js#L37-L45
train
shakiba/planck.js
example/Asteroid.js
addAsteroids
function addAsteroids() { while (asteroidBodies.length) { var asteroidBody = asteroidBodies.shift(); world.destroyBody(asteroidBody); // asteroidBody.uiRemove(); } for (var i = 0; i < level; i++) { var shipPosition = shipBody.getPosition(); var x = shipPosition.x; var y ...
javascript
function addAsteroids() { while (asteroidBodies.length) { var asteroidBody = asteroidBodies.shift(); world.destroyBody(asteroidBody); // asteroidBody.uiRemove(); } for (var i = 0; i < level; i++) { var shipPosition = shipBody.getPosition(); var x = shipPosition.x; var y ...
[ "function", "addAsteroids", "(", ")", "{", "while", "(", "asteroidBodies", ".", "length", ")", "{", "var", "asteroidBody", "=", "asteroidBodies", ".", "shift", "(", ")", ";", "world", ".", "destroyBody", "(", "asteroidBody", ")", ";", "// asteroidBody.uiRemove...
Adds some asteroids to the scene.
[ "Adds", "some", "asteroids", "to", "the", "scene", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/example/Asteroid.js#L202-L229
train
shakiba/planck.js
example/Asteroid.js
wrap
function wrap(body) { var p = body.getPosition(); p.x = wrapNumber(p.x, -SPACE_WIDTH / 2, SPACE_WIDTH / 2); p.y = wrapNumber(p.y, -SPACE_HEIGHT / 2, SPACE_HEIGHT / 2); body.setPosition(p); }
javascript
function wrap(body) { var p = body.getPosition(); p.x = wrapNumber(p.x, -SPACE_WIDTH / 2, SPACE_WIDTH / 2); p.y = wrapNumber(p.y, -SPACE_HEIGHT / 2, SPACE_HEIGHT / 2); body.setPosition(p); }
[ "function", "wrap", "(", "body", ")", "{", "var", "p", "=", "body", ".", "getPosition", "(", ")", ";", "p", ".", "x", "=", "wrapNumber", "(", "p", ".", "x", ",", "-", "SPACE_WIDTH", "/", "2", ",", "SPACE_WIDTH", "/", "2", ")", ";", "p", ".", ...
If the body is out of space bounds, wrap it to the other side
[ "If", "the", "body", "is", "out", "of", "space", "bounds", "wrap", "it", "to", "the", "other", "side" ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/example/Asteroid.js#L329-L334
train
shakiba/planck.js
lib/joint/DistanceJoint.js
DistanceJoint
function DistanceJoint(def, bodyA, bodyB, anchorA, anchorB) { if (!(this instanceof DistanceJoint)) { return new DistanceJoint(def, bodyA, bodyB, anchorA, anchorB); } // order of constructor arguments is changed in v0.2 if (bodyB && anchorA && ('m_type' in anchorA) && ('x' in bodyB) && ('y' in bodyB)) { ...
javascript
function DistanceJoint(def, bodyA, bodyB, anchorA, anchorB) { if (!(this instanceof DistanceJoint)) { return new DistanceJoint(def, bodyA, bodyB, anchorA, anchorB); } // order of constructor arguments is changed in v0.2 if (bodyB && anchorA && ('m_type' in anchorA) && ('x' in bodyB) && ('y' in bodyB)) { ...
[ "function", "DistanceJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchorA", ",", "anchorB", ")", "{", "if", "(", "!", "(", "this", "instanceof", "DistanceJoint", ")", ")", "{", "return", "new", "DistanceJoint", "(", "def", ",", "bodyA", ",", "...
A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod. @param {DistanceJointDef} def @param {Body} bodyA @param {Body} bodyB @param {Vec2} anchorA Anchor A in global coordination. @param {Vec2} anchorB Anchor B in global coordinat...
[ "A", "distance", "joint", "constrains", "two", "points", "on", "two", "bodies", "to", "remain", "at", "a", "fixed", "distance", "from", "each", "other", ".", "You", "can", "view", "this", "as", "a", "massless", "rigid", "rod", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/DistanceJoint.js#L81-L137
train
shakiba/planck.js
lib/joint/FrictionJoint.js
FrictionJoint
function FrictionJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof FrictionJoint)) { return new FrictionJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = FrictionJoint.TYPE; this....
javascript
function FrictionJoint(def, bodyA, bodyB, anchor) { if (!(this instanceof FrictionJoint)) { return new FrictionJoint(def, bodyA, bodyB, anchor); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = FrictionJoint.TYPE; this....
[ "function", "FrictionJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anchor", ")", "{", "if", "(", "!", "(", "this", "instanceof", "FrictionJoint", ")", ")", "{", "return", "new", "FrictionJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "anc...
Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction. @param {FrictionJointDef} def @param {Body} bodyA @param {Body} bodyB @param {Vec2} anchor Anchor in global coordination.
[ "Friction", "joint", ".", "This", "is", "used", "for", "top", "-", "down", "friction", ".", "It", "provides", "2D", "translational", "friction", "and", "angular", "friction", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/FrictionJoint.js#L74-L118
train
shakiba/planck.js
lib/joint/MouseJoint.js
MouseJoint
function MouseJoint(def, bodyA, bodyB, target) { if (!(this instanceof MouseJoint)) { return new MouseJoint(def, bodyA, bodyB, target); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = MouseJoint.TYPE; _ASSERT && common...
javascript
function MouseJoint(def, bodyA, bodyB, target) { if (!(this instanceof MouseJoint)) { return new MouseJoint(def, bodyA, bodyB, target); } def = options(def, DEFAULTS); Joint.call(this, def, bodyA, bodyB); bodyA = this.m_bodyA; bodyB = this.m_bodyB; this.m_type = MouseJoint.TYPE; _ASSERT && common...
[ "function", "MouseJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "target", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MouseJoint", ")", ")", "{", "return", "new", "MouseJoint", "(", "def", ",", "bodyA", ",", "bodyB", ",", "target", "...
A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces. NOTE: this joint is not documented in the manual because it was developed to be used in the testbed. If you want to learn h...
[ "A", "mouse", "joint", "is", "used", "to", "make", "a", "point", "on", "a", "body", "track", "a", "specified", "world", "point", ".", "This", "a", "soft", "constraint", "with", "a", "maximum", "force", ".", "This", "allows", "the", "constraint", "to", ...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/joint/MouseJoint.js#L83-L126
train
shakiba/planck.js
lib/Fixture.js
FixtureProxy
function FixtureProxy(fixture, childIndex) { this.aabb = new AABB(); this.fixture = fixture; this.childIndex = childIndex; this.proxyId; }
javascript
function FixtureProxy(fixture, childIndex) { this.aabb = new AABB(); this.fixture = fixture; this.childIndex = childIndex; this.proxyId; }
[ "function", "FixtureProxy", "(", "fixture", ",", "childIndex", ")", "{", "this", ".", "aabb", "=", "new", "AABB", "(", ")", ";", "this", ".", "fixture", "=", "fixture", ";", "this", ".", "childIndex", "=", "childIndex", ";", "this", ".", "proxyId", ";"...
This proxy is used internally to connect shape children to the broad-phase.
[ "This", "proxy", "is", "used", "internally", "to", "connect", "shape", "children", "to", "the", "broad", "-", "phase", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/Fixture.js#L70-L75
train
shakiba/planck.js
lib/Fixture.js
Fixture
function Fixture(body, shape, def) { if (shape.shape) { def = shape; shape = shape.shape; } else if (typeof def === 'number') { def = {density : def}; } def = options(def, FixtureDef); this.m_body = body; this.m_friction = def.friction; this.m_restitution = def.restitution; this.m_densit...
javascript
function Fixture(body, shape, def) { if (shape.shape) { def = shape; shape = shape.shape; } else if (typeof def === 'number') { def = {density : def}; } def = options(def, FixtureDef); this.m_body = body; this.m_friction = def.friction; this.m_restitution = def.restitution; this.m_densit...
[ "function", "Fixture", "(", "body", ",", "shape", ",", "def", ")", "{", "if", "(", "shape", ".", "shape", ")", "{", "def", "=", "shape", ";", "shape", "=", "shape", ".", "shape", ";", "}", "else", "if", "(", "typeof", "def", "===", "'number'", ")...
A fixture is used to attach a shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as friction, collision filters, etc. Fixtures are created via Body.createFixture. @param {Body} body @param {Shape|FixtureDef} shape Shape of fixture...
[ "A", "fixture", "is", "used", "to", "attach", "a", "shape", "to", "a", "body", "for", "collision", "detection", ".", "A", "fixture", "inherits", "its", "transform", "from", "its", "parent", ".", "Fixtures", "hold", "additional", "non", "-", "geometric", "d...
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/Fixture.js#L87-L123
train
shakiba/planck.js
lib/shape/CollideEdgePolygon.js
ReferenceFace
function ReferenceFace() { this.i1, this.i2; // int this.v1, this.v2; // v this.normal = Vec2.zero(); this.sideNormal1 = Vec2.zero(); this.sideOffset1; // float this.sideNormal2 = Vec2.zero(); this.sideOffset2; // float }
javascript
function ReferenceFace() { this.i1, this.i2; // int this.v1, this.v2; // v this.normal = Vec2.zero(); this.sideNormal1 = Vec2.zero(); this.sideOffset1; // float this.sideNormal2 = Vec2.zero(); this.sideOffset2; // float }
[ "function", "ReferenceFace", "(", ")", "{", "this", ".", "i1", ",", "this", ".", "i2", ";", "// int", "this", ".", "v1", ",", "this", ".", "v2", ";", "// v", "this", ".", "normal", "=", "Vec2", ".", "zero", "(", ")", ";", "this", ".", "sideNormal...
Reference face used for clipping
[ "Reference", "face", "used", "for", "clipping" ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/shape/CollideEdgePolygon.js#L83-L91
train
shakiba/planck.js
lib/collision/DynamicTree.js
TreeNode
function TreeNode(id) { this.id = id; this.aabb = new AABB(); this.userData = null; this.parent = null; this.child1 = null; this.child2 = null; this.height = -1; this.toString = function() { return this.id + ": " + this.userData; } }
javascript
function TreeNode(id) { this.id = id; this.aabb = new AABB(); this.userData = null; this.parent = null; this.child1 = null; this.child2 = null; this.height = -1; this.toString = function() { return this.id + ": " + this.userData; } }
[ "function", "TreeNode", "(", "id", ")", "{", "this", ".", "id", "=", "id", ";", "this", ".", "aabb", "=", "new", "AABB", "(", ")", ";", "this", ".", "userData", "=", "null", ";", "this", ".", "parent", "=", "null", ";", "this", ".", "child1", "...
A node in the dynamic tree. The client does not interact with this directly. @prop {AABB} aabb Enlarged AABB @prop {integer} height 0: leaf, -1: free node
[ "A", "node", "in", "the", "dynamic", "tree", ".", "The", "client", "does", "not", "interact", "with", "this", "directly", "." ]
59c32eb8821a63b867b0bef4ccd066a0a4146a9b
https://github.com/shakiba/planck.js/blob/59c32eb8821a63b867b0bef4ccd066a0a4146a9b/lib/collision/DynamicTree.js#L38-L50
train
emmetio/emmet
lib/resolver/tagName.js
function(name) { name = (name || '').toLowerCase(); if (name in elementMap) return this.getMapping(name); if (this.isInlineLevel(name)) return 'span'; return 'div'; }
javascript
function(name) { name = (name || '').toLowerCase(); if (name in elementMap) return this.getMapping(name); if (this.isInlineLevel(name)) return 'span'; return 'div'; }
[ "function", "(", "name", ")", "{", "name", "=", "(", "name", "||", "''", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "name", "in", "elementMap", ")", "return", "this", ".", "getMapping", "(", "name", ")", ";", "if", "(", "this", ".", "isIn...
Returns best matched child element name for passed parent's tag name @param {String} name @returns {String} @memberOf tagName
[ "Returns", "best", "matched", "child", "element", "name", "for", "passed", "parent", "s", "tag", "name" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/tagName.js#L48-L58
train
emmetio/emmet
lib/resolver/tagName.js
function(name, collection) { if (!elementTypes[collection]) elementTypes[collection] = []; var col = this.getCollection(collection); if (!~col.indexOf(name)) { col.push(name); } }
javascript
function(name, collection) { if (!elementTypes[collection]) elementTypes[collection] = []; var col = this.getCollection(collection); if (!~col.indexOf(name)) { col.push(name); } }
[ "function", "(", "name", ",", "collection", ")", "{", "if", "(", "!", "elementTypes", "[", "collection", "]", ")", "elementTypes", "[", "collection", "]", "=", "[", "]", ";", "var", "col", "=", "this", ".", "getCollection", "(", "collection", ")", ";",...
Adds new element into collection @param {String} name Element name @param {String} collection Collection name
[ "Adds", "new", "element", "into", "collection" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/tagName.js#L129-L137
train
emmetio/emmet
lib/resolver/tagName.js
function(name, collection) { if (collection in elementTypes) { elementTypes[collection] = utils.without(this.getCollection(collection), name); } }
javascript
function(name, collection) { if (collection in elementTypes) { elementTypes[collection] = utils.without(this.getCollection(collection), name); } }
[ "function", "(", "name", ",", "collection", ")", "{", "if", "(", "collection", "in", "elementTypes", ")", "{", "elementTypes", "[", "collection", "]", "=", "utils", ".", "without", "(", "this", ".", "getCollection", "(", "collection", ")", ",", "name", "...
Removes element name from specified collection @param {String} name Element name @param {String} collection Collection name @returns
[ "Removes", "element", "name", "from", "specified", "collection" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/tagName.js#L145-L149
train
emmetio/emmet
lib/filter/comment.js
addComments
function addComments(node, templateBefore, templateAfter) { // check if comments should be added var trigger = prefs.get('filter.commentTrigger'); if (trigger != '*') { var shouldAdd = utils.find(trigger.split(','), function(name) { return !!node.attribute(utils.trim(name)); }); if (!shouldAdd) { ...
javascript
function addComments(node, templateBefore, templateAfter) { // check if comments should be added var trigger = prefs.get('filter.commentTrigger'); if (trigger != '*') { var shouldAdd = utils.find(trigger.split(','), function(name) { return !!node.attribute(utils.trim(name)); }); if (!shouldAdd) { ...
[ "function", "addComments", "(", "node", ",", "templateBefore", ",", "templateAfter", ")", "{", "// check if comments should be added", "var", "trigger", "=", "prefs", ".", "get", "(", "'filter.commentTrigger'", ")", ";", "if", "(", "trigger", "!=", "'*'", ")", "...
Add comments to tag @param {AbbreviationNode} node
[ "Add", "comments", "to", "tag" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/filter/comment.js#L56-L88
train
emmetio/emmet
lib/parser/processor/tagName.js
resolveNodeNames
function resolveNodeNames(tree) { tree.children.forEach(function(node) { if (node.hasImplicitName() || node.data('forceNameResolving')) { node._name = tagName.resolve(node.parent.name()); node.data('nameResolved', true); } resolveNodeNames(node); }); return tree; }
javascript
function resolveNodeNames(tree) { tree.children.forEach(function(node) { if (node.hasImplicitName() || node.data('forceNameResolving')) { node._name = tagName.resolve(node.parent.name()); node.data('nameResolved', true); } resolveNodeNames(node); }); return tree; }
[ "function", "resolveNodeNames", "(", "tree", ")", "{", "tree", ".", "children", ".", "forEach", "(", "function", "(", "node", ")", "{", "if", "(", "node", ".", "hasImplicitName", "(", ")", "||", "node", ".", "data", "(", "'forceNameResolving'", ")", ")",...
Resolves implicit node names in parsed tree @param {AbbreviationNode} tree
[ "Resolves", "implicit", "node", "names", "in", "parsed", "tree" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/parser/processor/tagName.js#L17-L27
train
emmetio/emmet
lib/resolver/css.js
isSingleProperty
function isSingleProperty(snippet) { snippet = utils.trim(snippet); // check if it doesn't contain a comment and a newline if (/\/\*|\n|\r/.test(snippet)) { return false; } // check if it's a valid snippet definition if (!/^[a-z0-9\-]+\s*\:/i.test(snippet)) { return false; } return snippe...
javascript
function isSingleProperty(snippet) { snippet = utils.trim(snippet); // check if it doesn't contain a comment and a newline if (/\/\*|\n|\r/.test(snippet)) { return false; } // check if it's a valid snippet definition if (!/^[a-z0-9\-]+\s*\:/i.test(snippet)) { return false; } return snippe...
[ "function", "isSingleProperty", "(", "snippet", ")", "{", "snippet", "=", "utils", ".", "trim", "(", "snippet", ")", ";", "// check if it doesn't contain a comment and a newline", "if", "(", "/", "\\/\\*|\\n|\\r", "/", ".", "test", "(", "snippet", ")", ")", "{",...
Check if provided snippet contains only one CSS property and value. @param {String} snippet @returns {Boolean}
[ "Check", "if", "provided", "snippet", "contains", "only", "one", "CSS", "property", "and", "value", "." ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L222-L236
train
emmetio/emmet
lib/resolver/css.js
normalizeValue
function normalizeValue(value) { if (value.charAt(0) == '-' && !/^\-[\.\d]/.test(value)) { value = value.replace(/^\-+/, ''); } var ch = value.charAt(0); if (ch == '#') { return normalizeHexColor(value); } if (ch == '$') { return utils.escapeText(value); } return getKeyword(value); }
javascript
function normalizeValue(value) { if (value.charAt(0) == '-' && !/^\-[\.\d]/.test(value)) { value = value.replace(/^\-+/, ''); } var ch = value.charAt(0); if (ch == '#') { return normalizeHexColor(value); } if (ch == '$') { return utils.escapeText(value); } return getKeyword(value); }
[ "function", "normalizeValue", "(", "value", ")", "{", "if", "(", "value", ".", "charAt", "(", "0", ")", "==", "'-'", "&&", "!", "/", "^\\-[\\.\\d]", "/", ".", "test", "(", "value", ")", ")", "{", "value", "=", "value", ".", "replace", "(", "/", "...
Normalizes abbreviated value to final CSS one @param {String} value @returns {String}
[ "Normalizes", "abbreviated", "value", "to", "final", "CSS", "one" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L243-L258
train
emmetio/emmet
lib/resolver/css.js
toRgba
function toRgba(color, opacity) { var r = parseInt(color.substr(0, 2), 16); var g = parseInt(color.substr(2, 2), 16); var b = parseInt(color.substr(4, 2), 16); return 'rgba(' + [r, g, b, opacity].join(', ') + ')'; }
javascript
function toRgba(color, opacity) { var r = parseInt(color.substr(0, 2), 16); var g = parseInt(color.substr(2, 2), 16); var b = parseInt(color.substr(4, 2), 16); return 'rgba(' + [r, g, b, opacity].join(', ') + ')'; }
[ "function", "toRgba", "(", "color", ",", "opacity", ")", "{", "var", "r", "=", "parseInt", "(", "color", ".", "substr", "(", "0", ",", "2", ")", ",", "16", ")", ";", "var", "g", "=", "parseInt", "(", "color", ".", "substr", "(", "2", ",", "2", ...
Transforms HEX color definition into RGBA one @param {String} color HEX color, 6 characters @param {String} opacity Opacity value @return {String}
[ "Transforms", "HEX", "color", "definition", "into", "RGBA", "one" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L325-L331
train
emmetio/emmet
lib/resolver/css.js
hasPrefix
function hasPrefix(property, prefix) { var info = vendorPrefixes[prefix]; if (!info) info = utils.find(vendorPrefixes, function(data) { return data.prefix == prefix; }); return info && info.supports(property); }
javascript
function hasPrefix(property, prefix) { var info = vendorPrefixes[prefix]; if (!info) info = utils.find(vendorPrefixes, function(data) { return data.prefix == prefix; }); return info && info.supports(property); }
[ "function", "hasPrefix", "(", "property", ",", "prefix", ")", "{", "var", "info", "=", "vendorPrefixes", "[", "prefix", "]", ";", "if", "(", "!", "info", ")", "info", "=", "utils", ".", "find", "(", "vendorPrefixes", ",", "function", "(", "data", ")", ...
Check if passed CSS property support specified vendor prefix @param {String} property @param {String} prefix
[ "Check", "if", "passed", "CSS", "property", "support", "specified", "vendor", "prefix" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L352-L361
train
emmetio/emmet
lib/resolver/css.js
findVendorPrefixes
function findVendorPrefixes(property) { var prefixes = ciu.resolvePrefixes(property); if (!prefixes) { // Can I Use database is disabled or prefixes are not // available for this property prefixes = []; Object.keys(vendorPrefixes).forEach(function(key) { if (hasPrefix(property, key)) { prefixes...
javascript
function findVendorPrefixes(property) { var prefixes = ciu.resolvePrefixes(property); if (!prefixes) { // Can I Use database is disabled or prefixes are not // available for this property prefixes = []; Object.keys(vendorPrefixes).forEach(function(key) { if (hasPrefix(property, key)) { prefixes...
[ "function", "findVendorPrefixes", "(", "property", ")", "{", "var", "prefixes", "=", "ciu", ".", "resolvePrefixes", "(", "property", ")", ";", "if", "(", "!", "prefixes", ")", "{", "// Can I Use database is disabled or prefixes are not", "// available for this property"...
Finds available vendor prefixes for given CSS property. Search is performed within Can I Use database and internal property list @param {String} property CSS property name @return {Array} Array of resolved prefixes or null if prefixes are not available for this property at all. Empty array means prefixes are not avail...
[ "Finds", "available", "vendor", "prefixes", "for", "given", "CSS", "property", ".", "Search", "is", "performed", "within", "Can", "I", "Use", "database", "and", "internal", "property", "list" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L373-L391
train
emmetio/emmet
lib/resolver/css.js
findInternalPrefixes
function findInternalPrefixes(property, noAutofill) { var result = []; var prefixes = findVendorPrefixes(property); if (prefixes) { var prefixMap = {}; Object.keys(vendorPrefixes).forEach(function(key) { prefixMap[vendorPrefixes[key].prefix] = key; }); result = prefixes.map(function(prefix) { ...
javascript
function findInternalPrefixes(property, noAutofill) { var result = []; var prefixes = findVendorPrefixes(property); if (prefixes) { var prefixMap = {}; Object.keys(vendorPrefixes).forEach(function(key) { prefixMap[vendorPrefixes[key].prefix] = key; }); result = prefixes.map(function(prefix) { ...
[ "function", "findInternalPrefixes", "(", "property", ",", "noAutofill", ")", "{", "var", "result", "=", "[", "]", ";", "var", "prefixes", "=", "findVendorPrefixes", "(", "property", ")", ";", "if", "(", "prefixes", ")", "{", "var", "prefixMap", "=", "{", ...
Search for a list of supported prefixes for CSS property. This list is used to generate all-prefixed snippet @param {String} property CSS property name @returns {Array}
[ "Search", "for", "a", "list", "of", "supported", "prefixes", "for", "CSS", "property", ".", "This", "list", "is", "used", "to", "generate", "all", "-", "prefixed", "snippet" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L399-L424
train
emmetio/emmet
lib/resolver/css.js
formatProperty
function formatProperty(property, syntax) { var ix = property.indexOf(':'); property = property.substring(0, ix).replace(/\s+$/, '') + getSyntaxPreference('valueSeparator', syntax) + utils.trim(property.substring(ix + 1)); return property.replace(/\s*;\s*$/, getSyntaxPreference('propertyEnd', syntax)); ...
javascript
function formatProperty(property, syntax) { var ix = property.indexOf(':'); property = property.substring(0, ix).replace(/\s+$/, '') + getSyntaxPreference('valueSeparator', syntax) + utils.trim(property.substring(ix + 1)); return property.replace(/\s*;\s*$/, getSyntaxPreference('propertyEnd', syntax)); ...
[ "function", "formatProperty", "(", "property", ",", "syntax", ")", "{", "var", "ix", "=", "property", ".", "indexOf", "(", "':'", ")", ";", "property", "=", "property", ".", "substring", "(", "0", ",", "ix", ")", ".", "replace", "(", "/", "\\s+$", "/...
Format CSS property according to current syntax dialect @param {String} property @param {String} syntax @returns {String}
[ "Format", "CSS", "property", "according", "to", "current", "syntax", "dialect" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L456-L463
train
emmetio/emmet
lib/resolver/css.js
resolvePrefixedValues
function resolvePrefixedValues(snippetObj, isImportant, syntax) { var prefixes = []; var lookup = {}; var parts = cssEditTree.findParts(snippetObj.value); parts.reverse(); parts.forEach(function(p) { var partValue = p.substring(snippetObj.value); (findVendorPrefixes(partValue) || []).forEach(function(p...
javascript
function resolvePrefixedValues(snippetObj, isImportant, syntax) { var prefixes = []; var lookup = {}; var parts = cssEditTree.findParts(snippetObj.value); parts.reverse(); parts.forEach(function(p) { var partValue = p.substring(snippetObj.value); (findVendorPrefixes(partValue) || []).forEach(function(p...
[ "function", "resolvePrefixedValues", "(", "snippetObj", ",", "isImportant", ",", "syntax", ")", "{", "var", "prefixes", "=", "[", "]", ";", "var", "lookup", "=", "{", "}", ";", "var", "parts", "=", "cssEditTree", ".", "findParts", "(", "snippetObj", ".", ...
Tries to produce properties with vendor-prefixed value @param {Object} snippetObj Parsed snippet object @return {Array} Array of properties with prefixed values
[ "Tries", "to", "produce", "properties", "with", "vendor", "-", "prefixed", "value" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L516-L537
train
emmetio/emmet
lib/resolver/css.js
function(abbr) { if (abbr.charAt(0) != '-') { return { property: abbr, prefixes: null }; } // abbreviation may either contain sequence of one-character prefixes // or just dash, meaning that user wants to produce all possible // prefixed properties var i = 1, il = abbr.length, ch...
javascript
function(abbr) { if (abbr.charAt(0) != '-') { return { property: abbr, prefixes: null }; } // abbreviation may either contain sequence of one-character prefixes // or just dash, meaning that user wants to produce all possible // prefixed properties var i = 1, il = abbr.length, ch...
[ "function", "(", "abbr", ")", "{", "if", "(", "abbr", ".", "charAt", "(", "0", ")", "!=", "'-'", ")", "{", "return", "{", "property", ":", "abbr", ",", "prefixes", ":", "null", "}", ";", "}", "// abbreviation may either contain sequence of one-character pref...
Extract vendor prefixes from abbreviation @param {String} abbr @returns {Object} Object containing array of prefixes and clean abbreviation name
[ "Extract", "vendor", "prefixes", "from", "abbreviation" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L628-L673
train
emmetio/emmet
lib/resolver/css.js
function(abbr, syntax) { syntax = syntax || 'css'; var i = 0, il = abbr.length, value = '', ch; while (i < il) { ch = abbr.charAt(i); if (isNumeric(ch) || ch == '#' || ch == '$' || (ch == '-' && isNumeric(abbr.charAt(i + 1)))) { value = abbr.substring(i); break; } i++; } ...
javascript
function(abbr, syntax) { syntax = syntax || 'css'; var i = 0, il = abbr.length, value = '', ch; while (i < il) { ch = abbr.charAt(i); if (isNumeric(ch) || ch == '#' || ch == '$' || (ch == '-' && isNumeric(abbr.charAt(i + 1)))) { value = abbr.substring(i); break; } i++; } ...
[ "function", "(", "abbr", ",", "syntax", ")", "{", "syntax", "=", "syntax", "||", "'css'", ";", "var", "i", "=", "0", ",", "il", "=", "abbr", ".", "length", ",", "value", "=", "''", ",", "ch", ";", "while", "(", "i", "<", "il", ")", "{", "ch",...
Search for value substring in abbreviation @param {String} abbr @returns {String} Value substring
[ "Search", "for", "value", "substring", "in", "abbreviation" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L680-L710
train
emmetio/emmet
lib/resolver/css.js
function(abbr) { // search for value start var abbrValues = this.findValuesInAbbreviation(abbr); if (!abbrValues) { return { property: abbr, values: null }; } return { property: abbr.substring(0, abbr.length - abbrValues.length).replace(/-$/, ''), values: this.parseValues(ab...
javascript
function(abbr) { // search for value start var abbrValues = this.findValuesInAbbreviation(abbr); if (!abbrValues) { return { property: abbr, values: null }; } return { property: abbr.substring(0, abbr.length - abbrValues.length).replace(/-$/, ''), values: this.parseValues(ab...
[ "function", "(", "abbr", ")", "{", "// search for value start", "var", "abbrValues", "=", "this", ".", "findValuesInAbbreviation", "(", "abbr", ")", ";", "if", "(", "!", "abbrValues", ")", "{", "return", "{", "property", ":", "abbr", ",", "values", ":", "n...
Extracts values from abbreviation @param {String} abbr @returns {Object} Object containing array of values and clean abbreviation name
[ "Extracts", "values", "from", "abbreviation" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L755-L769
train
emmetio/emmet
lib/resolver/css.js
function(value, property) { property = (property || '').toLowerCase(); var unitlessProps = prefs.getArray('css.unitlessProperties'); return value.replace(/^(\-?[0-9\.]+)([a-z]*)$/, function(str, val, unit) { if (!unit && (val == '0' || ~unitlessProps.indexOf(property))) return val; if (!unit)...
javascript
function(value, property) { property = (property || '').toLowerCase(); var unitlessProps = prefs.getArray('css.unitlessProperties'); return value.replace(/^(\-?[0-9\.]+)([a-z]*)$/, function(str, val, unit) { if (!unit && (val == '0' || ~unitlessProps.indexOf(property))) return val; if (!unit)...
[ "function", "(", "value", ",", "property", ")", "{", "property", "=", "(", "property", "||", "''", ")", ".", "toLowerCase", "(", ")", ";", "var", "unitlessProps", "=", "prefs", ".", "getArray", "(", "'css.unitlessProperties'", ")", ";", "return", "value", ...
Normalizes value, defined in abbreviation. @param {String} value @param {String} property @returns {String}
[ "Normalizes", "value", "defined", "in", "abbreviation", "." ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/resolver/css.js#L777-L789
train
emmetio/emmet
lib/utils/cssSections.js
function() { if (this._name === null) { var range = this.nameRange(); if (range) { this._name = range.substring(this.source()); } } return this._name; }
javascript
function() { if (this._name === null) { var range = this.nameRange(); if (range) { this._name = range.substring(this.source()); } } return this._name; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_name", "===", "null", ")", "{", "var", "range", "=", "this", ".", "nameRange", "(", ")", ";", "if", "(", "range", ")", "{", "this", ".", "_name", "=", "range", ".", "substring", "(", "this", ...
Returns section name @return {String}
[ "Returns", "section", "name" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L108-L117
train
emmetio/emmet
lib/utils/cssSections.js
function() { var out = []; if (this.parent) { // add current range if it is not root node out.push(this.range); } this.children.forEach(function(child) { out = out.concat(child.allRanges()); }); return out; }
javascript
function() { var out = []; if (this.parent) { // add current range if it is not root node out.push(this.range); } this.children.forEach(function(child) { out = out.concat(child.allRanges()); }); return out; }
[ "function", "(", ")", "{", "var", "out", "=", "[", "]", ";", "if", "(", "this", ".", "parent", ")", "{", "// add current range if it is not root node", "out", ".", "push", "(", "this", ".", "range", ")", ";", "}", "this", ".", "children", ".", "forEach...
Returns current and all nested sections ranges @return {Array}
[ "Returns", "current", "and", "all", "nested", "sections", "ranges" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L154-L166
train
emmetio/emmet
lib/utils/cssSections.js
function(content, pos, sanitize) { if (sanitize) { content = this.sanitize(content); } var stream = stringStream(content); stream.start = stream.pos = pos; var stack = [], ranges = []; var ch; while (ch = stream.next()) { if (ch == '{') { stack.push(stream.pos - 1); } else if (ch ...
javascript
function(content, pos, sanitize) { if (sanitize) { content = this.sanitize(content); } var stream = stringStream(content); stream.start = stream.pos = pos; var stack = [], ranges = []; var ch; while (ch = stream.next()) { if (ch == '{') { stack.push(stream.pos - 1); } else if (ch ...
[ "function", "(", "content", ",", "pos", ",", "sanitize", ")", "{", "if", "(", "sanitize", ")", "{", "content", "=", "this", ".", "sanitize", "(", "content", ")", ";", "}", "var", "stream", "=", "stringStream", "(", "content", ")", ";", "stream", ".",...
Matches curly braces content right after given position @param {String} content CSS content. Must not contain comments! @param {Number} pos Search start position @return {Range}
[ "Matches", "curly", "braces", "content", "right", "after", "given", "position" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L268-L294
train
emmetio/emmet
lib/utils/cssSections.js
function(content, pos, sanitize) { if (sanitize) { content = this.sanitize(content); } var skipString = function() { var quote = content.charAt(pos); if (quote == '"' || quote == "'") { while (--pos >= 0) { if (content.charAt(pos) == quote && content.charAt(pos - 1) != '\\') { br...
javascript
function(content, pos, sanitize) { if (sanitize) { content = this.sanitize(content); } var skipString = function() { var quote = content.charAt(pos); if (quote == '"' || quote == "'") { while (--pos >= 0) { if (content.charAt(pos) == quote && content.charAt(pos - 1) != '\\') { br...
[ "function", "(", "content", ",", "pos", ",", "sanitize", ")", "{", "if", "(", "sanitize", ")", "{", "content", "=", "this", ".", "sanitize", "(", "content", ")", ";", "}", "var", "skipString", "=", "function", "(", ")", "{", "var", "quote", "=", "c...
Extracts CSS selector from CSS document from given position. The selector is located by moving backward from given position which means that passed position must point to the end of selector @param {String} content CSS source @param {Number} pos Search position @param {Boolean} sanitize Sanitize CSS source bef...
[ "Extracts", "CSS", "selector", "from", "CSS", "document", "from", "given", "position", ".", "The", "selector", "is", "located", "by", "moving", "backward", "from", "given", "position", "which", "means", "that", "passed", "position", "must", "point", "to", "the...
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L308-L368
train
emmetio/emmet
lib/utils/cssSections.js
function(content, pos, isBackward) { // possible case: editor reported that current syntax is // CSS, but it’s actually a HTML document (either `style` tag or attribute) var offset = 0; var subrange = this.styleTagRange(content, pos); if (subrange) { offset = subrange.start; pos -= subrange.start...
javascript
function(content, pos, isBackward) { // possible case: editor reported that current syntax is // CSS, but it’s actually a HTML document (either `style` tag or attribute) var offset = 0; var subrange = this.styleTagRange(content, pos); if (subrange) { offset = subrange.start; pos -= subrange.start...
[ "function", "(", "content", ",", "pos", ",", "isBackward", ")", "{", "// possible case: editor reported that current syntax is", "// CSS, but it’s actually a HTML document (either `style` tag or attribute)", "var", "offset", "=", "0", ";", "var", "subrange", "=", "this", ".",...
Locates CSS rule next or before given position @param {String} content CSS content @param {Number} pos Search start position @param {Boolean} isBackward Search backward (find previous rule insteaf of next one) @return {Range}
[ "Locates", "CSS", "rule", "next", "or", "before", "given", "position" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L396-L419
train
emmetio/emmet
lib/utils/cssSections.js
function(range, ctx) { while (ctx && ctx.range) { if (ctx.range.contains(range)) { return ctx.addChild(range); } ctx = ctx.parent; } // if we are here then given range is a top-level section return root.addChild(range); }
javascript
function(range, ctx) { while (ctx && ctx.range) { if (ctx.range.contains(range)) { return ctx.addChild(range); } ctx = ctx.parent; } // if we are here then given range is a top-level section return root.addChild(range); }
[ "function", "(", "range", ",", "ctx", ")", "{", "while", "(", "ctx", "&&", "ctx", ".", "range", ")", "{", "if", "(", "ctx", ".", "range", ".", "contains", "(", "range", ")", ")", "{", "return", "ctx", ".", "addChild", "(", "range", ")", ";", "}...
rules are sorted in order they appear in CSS source so we can optimize their nesting routine
[ "rules", "are", "sorted", "in", "order", "they", "appear", "in", "CSS", "source", "so", "we", "can", "optimize", "their", "nesting", "routine" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L474-L485
train
emmetio/emmet
lib/utils/cssSections.js
function(rule) { var offset = rule.valueRange(true).start; var nestedSections = this.findAllRules(rule.valueRange().substring(rule.source)); nestedSections.forEach(function(section) { section.start += offset; section.end += offset; section._selectorEnd += offset; section._contentStart += offset...
javascript
function(rule) { var offset = rule.valueRange(true).start; var nestedSections = this.findAllRules(rule.valueRange().substring(rule.source)); nestedSections.forEach(function(section) { section.start += offset; section.end += offset; section._selectorEnd += offset; section._contentStart += offset...
[ "function", "(", "rule", ")", "{", "var", "offset", "=", "rule", ".", "valueRange", "(", "true", ")", ".", "start", ";", "var", "nestedSections", "=", "this", ".", "findAllRules", "(", "rule", ".", "valueRange", "(", ")", ".", "substring", "(", "rule",...
Returns ranges for all nested sections, available in given CSS rule @param {CSSEditContainer} rule @return {Array}
[ "Returns", "ranges", "for", "all", "nested", "sections", "available", "in", "given", "CSS", "rule" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/utils/cssSections.js#L501-L511
train
emmetio/emmet
lib/assets/elements.js
function(name, factory) { var that = this; factories[name] = function() { var elem = factory.apply(that, arguments); if (elem) elem.type = name; return elem; }; }
javascript
function(name, factory) { var that = this; factories[name] = function() { var elem = factory.apply(that, arguments); if (elem) elem.type = name; return elem; }; }
[ "function", "(", "name", ",", "factory", ")", "{", "var", "that", "=", "this", ";", "factories", "[", "name", "]", "=", "function", "(", ")", "{", "var", "elem", "=", "factory", ".", "apply", "(", "that", ",", "arguments", ")", ";", "if", "(", "e...
Create new element factory @param {String} name Element identifier @param {Function} factory Function that produces element of specified type. The object generated by this factory is automatically augmented with <code>type</code> property pointing to element <code>name</code> @memberOf elements
[ "Create", "new", "element", "factory" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/elements.js#L30-L39
train
emmetio/emmet
lib/assets/elements.js
function(name) { var args = [].slice.call(arguments, 1); var factory = this.get(name); return factory ? factory.apply(this, args) : null; }
javascript
function(name) { var args = [].slice.call(arguments, 1); var factory = this.get(name); return factory ? factory.apply(this, args) : null; }
[ "function", "(", "name", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "var", "factory", "=", "this", ".", "get", "(", "name", ")", ";", "return", "factory", "?", "factory", ".", "apply",...
Creates new element with specified type @param {String} name @returns {Object}
[ "Creates", "new", "element", "with", "specified", "type" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/elements.js#L55-L59
train
emmetio/emmet
lib/assets/preferences.js
function(name, value, description) { var prefs = name; if (typeof name === 'string') { prefs = {}; prefs[name] = { value: value, description: description }; } Object.keys(prefs).forEach(function(k) { var v = prefs[k]; defaults[k] = isValueObj(v) ? v : {value: v}; }); }
javascript
function(name, value, description) { var prefs = name; if (typeof name === 'string') { prefs = {}; prefs[name] = { value: value, description: description }; } Object.keys(prefs).forEach(function(k) { var v = prefs[k]; defaults[k] = isValueObj(v) ? v : {value: v}; }); }
[ "function", "(", "name", ",", "value", ",", "description", ")", "{", "var", "prefs", "=", "name", ";", "if", "(", "typeof", "name", "===", "'string'", ")", "{", "prefs", "=", "{", "}", ";", "prefs", "[", "name", "]", "=", "{", "value", ":", "valu...
Creates new preference item with default value @param {String} name Preference name. You can also pass object with many options @param {Object} value Preference default value @param {String} description Item textual description @memberOf preferences
[ "Creates", "new", "preference", "item", "with", "default", "value" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/preferences.js#L48-L62
train
emmetio/emmet
lib/assets/preferences.js
function(name) { var val = this.get(name); if (typeof val === 'undefined' || val === null || val === '') { return null; } val = val.split(',').map(utils.trim); if (!val.length) { return null; } return val; }
javascript
function(name) { var val = this.get(name); if (typeof val === 'undefined' || val === null || val === '') { return null; } val = val.split(',').map(utils.trim); if (!val.length) { return null; } return val; }
[ "function", "(", "name", ")", "{", "var", "val", "=", "this", ".", "get", "(", "name", ")", ";", "if", "(", "typeof", "val", "===", "'undefined'", "||", "val", "===", "null", "||", "val", "===", "''", ")", "{", "return", "null", ";", "}", "val", ...
Returns comma-separated preference value as array of values @param {String} name @returns {Array} Returns <code>undefined</code> if preference is not defined, <code>null</code> if string cannot be converted to array
[ "Returns", "comma", "-", "separated", "preference", "value", "as", "array", "of", "values" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/preferences.js#L132-L144
train
emmetio/emmet
lib/assets/preferences.js
function(name) { var result = {}; this.getArray(name).forEach(function(val) { var parts = val.split(':'); result[parts[0]] = parts[1]; }); return result; }
javascript
function(name) { var result = {}; this.getArray(name).forEach(function(val) { var parts = val.split(':'); result[parts[0]] = parts[1]; }); return result; }
[ "function", "(", "name", ")", "{", "var", "result", "=", "{", "}", ";", "this", ".", "getArray", "(", "name", ")", ".", "forEach", "(", "function", "(", "val", ")", "{", "var", "parts", "=", "val", ".", "split", "(", "':'", ")", ";", "result", ...
Returns comma and colon-separated preference value as dictionary @param {String} name @returns {Object}
[ "Returns", "comma", "and", "colon", "-", "separated", "preference", "value", "as", "dictionary" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/preferences.js#L151-L159
train
emmetio/emmet
lib/assets/preferences.js
function() { return Object.keys(defaults).sort().map(function(key) { return { name: key, value: this.get(key), type: typeof defaults[key].value, description: defaults[key].description }; }, this); }
javascript
function() { return Object.keys(defaults).sort().map(function(key) { return { name: key, value: this.get(key), type: typeof defaults[key].value, description: defaults[key].description }; }, this); }
[ "function", "(", ")", "{", "return", "Object", ".", "keys", "(", "defaults", ")", ".", "sort", "(", ")", ".", "map", "(", "function", "(", "key", ")", "{", "return", "{", "name", ":", "key", ",", "value", ":", "this", ".", "get", "(", "key", ")...
Returns sorted list of all available properties @returns {Array}
[ "Returns", "sorted", "list", "of", "all", "available", "properties" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/preferences.js#L194-L203
train
emmetio/emmet
lib/assets/preferences.js
function(json) { Object.keys(json).forEach(function(key) { this.set(key, json[key]); }, this); }
javascript
function(json) { Object.keys(json).forEach(function(key) { this.set(key, json[key]); }, this); }
[ "function", "(", "json", ")", "{", "Object", ".", "keys", "(", "json", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "this", ".", "set", "(", "key", ",", "json", "[", "key", "]", ")", ";", "}", ",", "this", ")", ";", "}" ]
Loads user-defined preferences from JSON @param {Object} json @returns
[ "Loads", "user", "-", "defined", "preferences", "from", "JSON" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/assets/preferences.js#L210-L214
train
emmetio/emmet
lib/parser/processor/pastedContent.js
insertPastedContent
function insertPastedContent(node, content, overwrite) { var nodesWithPlaceholders = node.findAll(function(item) { return hasOutputPlaceholder(item); }); if (hasOutputPlaceholder(node)) nodesWithPlaceholders.unshift(node); if (nodesWithPlaceholders.length) { nodesWithPlaceholders.forEach(function...
javascript
function insertPastedContent(node, content, overwrite) { var nodesWithPlaceholders = node.findAll(function(item) { return hasOutputPlaceholder(item); }); if (hasOutputPlaceholder(node)) nodesWithPlaceholders.unshift(node); if (nodesWithPlaceholders.length) { nodesWithPlaceholders.forEach(function...
[ "function", "insertPastedContent", "(", "node", ",", "content", ",", "overwrite", ")", "{", "var", "nodesWithPlaceholders", "=", "node", ".", "findAll", "(", "function", "(", "item", ")", "{", "return", "hasOutputPlaceholder", "(", "item", ")", ";", "}", ")"...
Insert pasted content into correct positions of parsed node @param {AbbreviationNode} node @param {String} content @param {Boolean} overwrite Overwrite node content if no value placeholders found instead of appending to existing content
[ "Insert", "pasted", "content", "into", "correct", "positions", "of", "parsed", "node" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/parser/processor/pastedContent.js#L86-L111
train
emmetio/emmet
lib/filter/format.js
shouldAddLineBreak
function shouldAddLineBreak(node, profile) { if (profile.tag_nl === true || abbrUtils.isBlock(node)) return true; if (!node.parent || !profile.inline_break) return false; // check if there are required amount of adjacent inline element return shouldFormatInline(node.parent, profile); }
javascript
function shouldAddLineBreak(node, profile) { if (profile.tag_nl === true || abbrUtils.isBlock(node)) return true; if (!node.parent || !profile.inline_break) return false; // check if there are required amount of adjacent inline element return shouldFormatInline(node.parent, profile); }
[ "function", "shouldAddLineBreak", "(", "node", ",", "profile", ")", "{", "if", "(", "profile", ".", "tag_nl", "===", "true", "||", "abbrUtils", ".", "isBlock", "(", "node", ")", ")", "return", "true", ";", "if", "(", "!", "node", ".", "parent", "||", ...
Check if a newline should be added before element @param {AbbreviationNode} node @param {OutputProfile} profile @return {Boolean}
[ "Check", "if", "a", "newline", "should", "be", "added", "before", "element" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/filter/format.js#L65-L74
train
emmetio/emmet
lib/filter/format.js
shouldBreakInsideInline
function shouldBreakInsideInline(node, profile) { var hasBlockElems = node.children.some(function(child) { if (abbrUtils.isSnippet(child)) return false; return !abbrUtils.isInline(child); }); if (!hasBlockElems) { return shouldFormatInline(node, profile); } return true; }
javascript
function shouldBreakInsideInline(node, profile) { var hasBlockElems = node.children.some(function(child) { if (abbrUtils.isSnippet(child)) return false; return !abbrUtils.isInline(child); }); if (!hasBlockElems) { return shouldFormatInline(node, profile); } return true; }
[ "function", "shouldBreakInsideInline", "(", "node", ",", "profile", ")", "{", "var", "hasBlockElems", "=", "node", ".", "children", ".", "some", "(", "function", "(", "child", ")", "{", "if", "(", "abbrUtils", ".", "isSnippet", "(", "child", ")", ")", "r...
Check if we should add line breaks inside inline element @param {AbbreviationNode} node @param {OutputProfile} profile @return {Boolean}
[ "Check", "if", "we", "should", "add", "line", "breaks", "inside", "inline", "element" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/filter/format.js#L127-L140
train
emmetio/emmet
lib/action/incrementDecrement.js
intLength
function intLength(num) { num = num.replace(/^\-/, ''); if (~num.indexOf('.')) { return num.split('.')[0].length; } return num.length; }
javascript
function intLength(num) { num = num.replace(/^\-/, ''); if (~num.indexOf('.')) { return num.split('.')[0].length; } return num.length; }
[ "function", "intLength", "(", "num", ")", "{", "num", "=", "num", ".", "replace", "(", "/", "^\\-", "/", ",", "''", ")", ";", "if", "(", "~", "num", ".", "indexOf", "(", "'.'", ")", ")", "{", "return", "num", ".", "split", "(", "'.'", ")", "[...
Returns length of integer part of number @param {String} num
[ "Returns", "length", "of", "integer", "part", "of", "number" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/action/incrementDecrement.js#L18-L25
train
emmetio/emmet
lib/editTree/css.js
consumeSingleProperty
function consumeSingleProperty(it, text) { var name, value, end; var token = it.current(); if (!token) { return null; } // skip whitespace var ws = {'white': 1, 'line': 1, 'comment': 1}; while ((token = it.current())) { if (!(token.type in ws)) { break; } it.next(); } if (!it.hasNex...
javascript
function consumeSingleProperty(it, text) { var name, value, end; var token = it.current(); if (!token) { return null; } // skip whitespace var ws = {'white': 1, 'line': 1, 'comment': 1}; while ((token = it.current())) { if (!(token.type in ws)) { break; } it.next(); } if (!it.hasNex...
[ "function", "consumeSingleProperty", "(", "it", ",", "text", ")", "{", "var", "name", ",", "value", ",", "end", ";", "var", "token", "=", "it", ".", "current", "(", ")", ";", "if", "(", "!", "token", ")", "{", "return", "null", ";", "}", "// skip w...
Consumes CSS property and value from current token iterator state. Offsets iterator pointer into token that can be used for next value consmption @param {TokenIterator} it @param {String} text @return {Object} Object with `name` and `value` properties ar ranges. Value range can be zero-length.
[ "Consumes", "CSS", "property", "and", "value", "from", "current", "token", "iterator", "state", ".", "Offsets", "iterator", "pointer", "into", "token", "that", "can", "be", "used", "for", "next", "value", "consmption" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/editTree/css.js#L70-L158
train
emmetio/emmet
lib/editTree/css.js
findParts
function findParts(str) { /** @type StringStream */ var stream = stringStream.create(str); var ch; var result = []; var sep = /[\s\u00a0,;]/; var add = function() { stream.next(); result.push(range(stream.start, stream.current())); stream.start = stream.pos; }; // skip whitespace stream...
javascript
function findParts(str) { /** @type StringStream */ var stream = stringStream.create(str); var ch; var result = []; var sep = /[\s\u00a0,;]/; var add = function() { stream.next(); result.push(range(stream.start, stream.current())); stream.start = stream.pos; }; // skip whitespace stream...
[ "function", "findParts", "(", "str", ")", "{", "/** @type StringStream */", "var", "stream", "=", "stringStream", ".", "create", "(", "str", ")", ";", "var", "ch", ";", "var", "result", "=", "[", "]", ";", "var", "sep", "=", "/", "[\\s\\u00a0,;]", "/", ...
Finds parts of complex CSS value @param {String} str @returns {Array} Returns list of <code>Range</code>'s
[ "Finds", "parts", "of", "complex", "CSS", "value" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/editTree/css.js#L165-L207
train
emmetio/emmet
lib/editTree/css.js
consumeProperties
function consumeProperties(node, source, offset) { var list = extractPropertiesFromSource(source, offset); list.forEach(function(property) { node._children.push(new CSSEditElement(node, editTree.createToken(property.name.start, property.nameText), editTree.createToken(property.value.start, property.valu...
javascript
function consumeProperties(node, source, offset) { var list = extractPropertiesFromSource(source, offset); list.forEach(function(property) { node._children.push(new CSSEditElement(node, editTree.createToken(property.name.start, property.nameText), editTree.createToken(property.value.start, property.valu...
[ "function", "consumeProperties", "(", "node", ",", "source", ",", "offset", ")", "{", "var", "list", "=", "extractPropertiesFromSource", "(", "source", ",", "offset", ")", ";", "list", ".", "forEach", "(", "function", "(", "property", ")", "{", "node", "."...
Parses CSS properties from given CSS source and adds them to CSSEditContainer node @param {CSSEditContainer} node @param {String} source CSS source @param {Number} offset Offset of properties subset from original source
[ "Parses", "CSS", "properties", "from", "given", "CSS", "source", "and", "adds", "them", "to", "CSSEditContainer", "node" ]
7c9a4623cea414c2f2cc9caebc13355d2bbd898d
https://github.com/emmetio/emmet/blob/7c9a4623cea414c2f2cc9caebc13355d2bbd898d/lib/editTree/css.js#L216-L226
train