id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,500 | bitovi/syn | src/drag.js | function(dataFlavor){
for (var i = 0; i < this.data.length; i++){
var tempdata = this.data[i];
if (tempdata.dataFlavor === dataFlavor){
return tempdata.val;
}
}
} | javascript | function(dataFlavor){
for (var i = 0; i < this.data.length; i++){
var tempdata = this.data[i];
if (tempdata.dataFlavor === dataFlavor){
return tempdata.val;
}
}
} | [
"function",
"(",
"dataFlavor",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"tempdata",
"=",
"this",
".",
"data",
"[",
"i",
"]",
";",
"if",
"(",
"tempdata",
".... | getData fetches the dragValue based on the input dataFlavor provided. | [
"getData",
"fetches",
"the",
"dragValue",
"based",
"on",
"the",
"input",
"dataFlavor",
"provided",
"."
] | f04e87b18bee9b4308838db04682d3ce2b98afaa | https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/drag.js#L184-L191 | |
16,501 | bitovi/syn | src/synthetic.js | function (el, type) {
while (el && el.nodeName.toLowerCase() !== type.toLowerCase()) {
el = el.parentNode;
}
return el;
} | javascript | function (el, type) {
while (el && el.nodeName.toLowerCase() !== type.toLowerCase()) {
el = el.parentNode;
}
return el;
} | [
"function",
"(",
"el",
",",
"type",
")",
"{",
"while",
"(",
"el",
"&&",
"el",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"!==",
"type",
".",
"toLowerCase",
"(",
")",
")",
"{",
"el",
"=",
"el",
".",
"parentNode",
";",
"}",
"return",
"el",
";",... | Returns the closest element of a particular type.
@hide
@param {Object} el
@param {Object} type | [
"Returns",
"the",
"closest",
"element",
"of",
"a",
"particular",
"type",
"."
] | f04e87b18bee9b4308838db04682d3ce2b98afaa | https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L302-L307 | |
16,502 | bitovi/syn | src/synthetic.js | function (el, func) {
var res;
while (el && res !== false) {
res = func(el);
el = el.parentNode;
}
return el;
} | javascript | function (el, func) {
var res;
while (el && res !== false) {
res = func(el);
el = el.parentNode;
}
return el;
} | [
"function",
"(",
"el",
",",
"func",
")",
"{",
"var",
"res",
";",
"while",
"(",
"el",
"&&",
"res",
"!==",
"false",
")",
"{",
"res",
"=",
"func",
"(",
"el",
")",
";",
"el",
"=",
"el",
".",
"parentNode",
";",
"}",
"return",
"el",
";",
"}"
] | Calls a function on the element and all parents of the element until the function returns
false.
@hide
@param {Object} el
@param {Object} func | [
"Calls",
"a",
"function",
"on",
"the",
"element",
"and",
"all",
"parents",
"of",
"the",
"element",
"until",
"the",
"function",
"returns",
"false",
"."
] | f04e87b18bee9b4308838db04682d3ce2b98afaa | https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L337-L344 | |
16,503 | bitovi/syn | src/synthetic.js | function (elem) {
var attributeNode;
// IE8 Standards doesn't like this on some elements
if (elem.getAttributeNode) {
attributeNode = elem.getAttributeNode("tabIndex");
}
return this.focusable.test(elem.nodeName) ||
(attributeNode && attributeNode.specified) &&
syn.isVisible(elem);
} | javascript | function (elem) {
var attributeNode;
// IE8 Standards doesn't like this on some elements
if (elem.getAttributeNode) {
attributeNode = elem.getAttributeNode("tabIndex");
}
return this.focusable.test(elem.nodeName) ||
(attributeNode && attributeNode.specified) &&
syn.isVisible(elem);
} | [
"function",
"(",
"elem",
")",
"{",
"var",
"attributeNode",
";",
"// IE8 Standards doesn't like this on some elements",
"if",
"(",
"elem",
".",
"getAttributeNode",
")",
"{",
"attributeNode",
"=",
"elem",
".",
"getAttributeNode",
"(",
"\"tabIndex\"",
")",
";",
"}",
... | Returns if an element is focusable
@hide
@param {Object} elem | [
"Returns",
"if",
"an",
"element",
"is",
"focusable"
] | f04e87b18bee9b4308838db04682d3ce2b98afaa | https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L352-L363 | |
16,504 | bitovi/syn | src/synthetic.js | function (elem) {
var attributeNode = elem.getAttributeNode("tabIndex");
return attributeNode && attributeNode.specified && (parseInt(elem.getAttribute('tabIndex')) || 0);
} | javascript | function (elem) {
var attributeNode = elem.getAttributeNode("tabIndex");
return attributeNode && attributeNode.specified && (parseInt(elem.getAttribute('tabIndex')) || 0);
} | [
"function",
"(",
"elem",
")",
"{",
"var",
"attributeNode",
"=",
"elem",
".",
"getAttributeNode",
"(",
"\"tabIndex\"",
")",
";",
"return",
"attributeNode",
"&&",
"attributeNode",
".",
"specified",
"&&",
"(",
"parseInt",
"(",
"elem",
".",
"getAttribute",
"(",
... | Gets the tabIndex as a number or null
@hide
@param {Object} elem | [
"Gets",
"the",
"tabIndex",
"as",
"a",
"number",
"or",
"null"
] | f04e87b18bee9b4308838db04682d3ce2b98afaa | https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L377-L380 | |
16,505 | marlove/react-native-geocoding | Geocoder.js | toQueryParams | function toQueryParams(object){
return Object.keys(object)
.filter(key => !!object[key])
.map(key => key + "=" + encodeURIComponent(object[key]))
.join("&")
} | javascript | function toQueryParams(object){
return Object.keys(object)
.filter(key => !!object[key])
.map(key => key + "=" + encodeURIComponent(object[key]))
.join("&")
} | [
"function",
"toQueryParams",
"(",
"object",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"object",
")",
".",
"filter",
"(",
"key",
"=>",
"!",
"!",
"object",
"[",
"key",
"]",
")",
".",
"map",
"(",
"key",
"=>",
"key",
"+",
"\"=\"",
"+",
"encodeURI... | Convert an object into query parameters.
@param {Object} object Object to convert.
@returns {string} Encoded query parameters. | [
"Convert",
"an",
"object",
"into",
"query",
"parameters",
"."
] | 90433d23ffd4a11d50bf8cc2f6852f8c4521a3b2 | https://github.com/marlove/react-native-geocoding/blob/90433d23ffd4a11d50bf8cc2f6852f8c4521a3b2/Geocoder.js#L192-L197 |
16,506 | benbaran/adal-angular4 | gulpfile.js | copy | function copy(cb) {
gulp.src(['adal-angular.d.ts']).pipe(gulp.dest('./dist/'));
console.log('adal-angular.d.ts Copied to Dist Directory');
gulp.src(['README.md']).pipe(gulp.dest('./dist/'));
console.log('README.md Copied to Dist Directory');
cb();
} | javascript | function copy(cb) {
gulp.src(['adal-angular.d.ts']).pipe(gulp.dest('./dist/'));
console.log('adal-angular.d.ts Copied to Dist Directory');
gulp.src(['README.md']).pipe(gulp.dest('./dist/'));
console.log('README.md Copied to Dist Directory');
cb();
} | [
"function",
"copy",
"(",
"cb",
")",
"{",
"gulp",
".",
"src",
"(",
"[",
"'adal-angular.d.ts'",
"]",
")",
".",
"pipe",
"(",
"gulp",
".",
"dest",
"(",
"'./dist/'",
")",
")",
";",
"console",
".",
"log",
"(",
"'adal-angular.d.ts Copied to Dist Directory'",
")",... | 4. include type definition file for adal-angular | [
"4",
".",
"include",
"type",
"definition",
"file",
"for",
"adal",
"-",
"angular"
] | 72794492c6ff3f2be0b96d9394126e53c8e45b5a | https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L44-L52 |
16,507 | benbaran/adal-angular4 | gulpfile.js | replace_d | function replace_d(cb) {
gulp.src('./dist/adal.service.d.ts')
.pipe(replace('../adal-angular.d.ts', './adal-angular.d.ts'))
.pipe(gulp.dest('./dist/'));
console.log('adal.service.d.ts Path Updated');
cb();
} | javascript | function replace_d(cb) {
gulp.src('./dist/adal.service.d.ts')
.pipe(replace('../adal-angular.d.ts', './adal-angular.d.ts'))
.pipe(gulp.dest('./dist/'));
console.log('adal.service.d.ts Path Updated');
cb();
} | [
"function",
"replace_d",
"(",
"cb",
")",
"{",
"gulp",
".",
"src",
"(",
"'./dist/adal.service.d.ts'",
")",
".",
"pipe",
"(",
"replace",
"(",
"'../adal-angular.d.ts'",
",",
"'./adal-angular.d.ts'",
")",
")",
".",
"pipe",
"(",
"gulp",
".",
"dest",
"(",
"'./dist... | 5. rewrite type definition file path for adal-angular in adal.service.d.ts | [
"5",
".",
"rewrite",
"type",
"definition",
"file",
"path",
"for",
"adal",
"-",
"angular",
"in",
"adal",
".",
"service",
".",
"d",
".",
"ts"
] | 72794492c6ff3f2be0b96d9394126e53c8e45b5a | https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L55-L61 |
16,508 | benbaran/adal-angular4 | gulpfile.js | bump_version | function bump_version(cb) {
gulp.src('./package.json')
.pipe(bump({
type: 'patch'
}))
.pipe(gulp.dest('./'));
console.log('Version Bumped');
cb();
} | javascript | function bump_version(cb) {
gulp.src('./package.json')
.pipe(bump({
type: 'patch'
}))
.pipe(gulp.dest('./'));
console.log('Version Bumped');
cb();
} | [
"function",
"bump_version",
"(",
"cb",
")",
"{",
"gulp",
".",
"src",
"(",
"'./package.json'",
")",
".",
"pipe",
"(",
"bump",
"(",
"{",
"type",
":",
"'patch'",
"}",
")",
")",
".",
"pipe",
"(",
"gulp",
".",
"dest",
"(",
"'./'",
")",
")",
";",
"cons... | 6. increase the version in package.json | [
"6",
".",
"increase",
"the",
"version",
"in",
"package",
".",
"json"
] | 72794492c6ff3f2be0b96d9394126e53c8e45b5a | https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L64-L72 |
16,509 | benbaran/adal-angular4 | gulpfile.js | git_commit | function git_commit(cb) {
var package = require('./package.json');
exec('git commit -m "Version ' + package.version + ' release."', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
} | javascript | function git_commit(cb) {
var package = require('./package.json');
exec('git commit -m "Version ' + package.version + ' release."', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
} | [
"function",
"git_commit",
"(",
"cb",
")",
"{",
"var",
"package",
"=",
"require",
"(",
"'./package.json'",
")",
";",
"exec",
"(",
"'git commit -m \"Version '",
"+",
"package",
".",
"version",
"+",
"' release.\"'",
",",
"function",
"(",
"err",
",",
"stdout",
"... | 8. git commit | [
"8",
".",
"git",
"commit"
] | 72794492c6ff3f2be0b96d9394126e53c8e45b5a | https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L84-L91 |
16,510 | RxNT/react-jsonschema-form-conditionals | src/actions/uiOverride.js | doOverride | function doOverride(uiSchema, params) {
Object.keys(params).forEach(field => {
let appendVal = params[field];
let fieldUiSchema = uiSchema[field];
if (!fieldUiSchema) {
uiSchema[field] = appendVal;
} else if (typeof appendVal === "object" && !Array.isArray(appendVal)) {
doOverride(fieldUiS... | javascript | function doOverride(uiSchema, params) {
Object.keys(params).forEach(field => {
let appendVal = params[field];
let fieldUiSchema = uiSchema[field];
if (!fieldUiSchema) {
uiSchema[field] = appendVal;
} else if (typeof appendVal === "object" && !Array.isArray(appendVal)) {
doOverride(fieldUiS... | [
"function",
"doOverride",
"(",
"uiSchema",
",",
"params",
")",
"{",
"Object",
".",
"keys",
"(",
"params",
")",
".",
"forEach",
"(",
"field",
"=>",
"{",
"let",
"appendVal",
"=",
"params",
"[",
"field",
"]",
";",
"let",
"fieldUiSchema",
"=",
"uiSchema",
... | Override original field in uiSchema with defined configuration
@param field
@param schema
@param uiSchema
@param conf
@returns {{schema: *, uiSchema: *}} | [
"Override",
"original",
"field",
"in",
"uiSchema",
"with",
"defined",
"configuration"
] | c834a961d45a09ccbe23bfc30d87fee2a2c22aa9 | https://github.com/RxNT/react-jsonschema-form-conditionals/blob/c834a961d45a09ccbe23bfc30d87fee2a2c22aa9/src/actions/uiOverride.js#L13-L25 |
16,511 | RxNT/react-jsonschema-form-conditionals | src/actions/uiAppend.js | doAppend | function doAppend(uiSchema, params) {
Object.keys(params).forEach(field => {
let appendVal = params[field];
let fieldUiSchema = uiSchema[field];
if (!fieldUiSchema) {
uiSchema[field] = appendVal;
} else if (Array.isArray(fieldUiSchema)) {
toArray(appendVal)
.filter(v => !fieldUiSch... | javascript | function doAppend(uiSchema, params) {
Object.keys(params).forEach(field => {
let appendVal = params[field];
let fieldUiSchema = uiSchema[field];
if (!fieldUiSchema) {
uiSchema[field] = appendVal;
} else if (Array.isArray(fieldUiSchema)) {
toArray(appendVal)
.filter(v => !fieldUiSch... | [
"function",
"doAppend",
"(",
"uiSchema",
",",
"params",
")",
"{",
"Object",
".",
"keys",
"(",
"params",
")",
".",
"forEach",
"(",
"field",
"=>",
"{",
"let",
"appendVal",
"=",
"params",
"[",
"field",
"]",
";",
"let",
"fieldUiSchema",
"=",
"uiSchema",
"[... | Append original field in uiSchema with external configuration
@param field
@param schema
@param uiSchema
@param conf
@returns {{schema: *, uiSchema: *}} | [
"Append",
"original",
"field",
"in",
"uiSchema",
"with",
"external",
"configuration"
] | c834a961d45a09ccbe23bfc30d87fee2a2c22aa9 | https://github.com/RxNT/react-jsonschema-form-conditionals/blob/c834a961d45a09ccbe23bfc30d87fee2a2c22aa9/src/actions/uiAppend.js#L14-L34 |
16,512 | Availity/availity-reactstrap-validation | src/AvValidator/pattern.js | asRegExp | function asRegExp(pattern) {
// if regex then return it
if (isRegExp(pattern)) {
return pattern;
}
// if string then test for valid regex then convert to regex and return
const match = pattern.match(REGEX);
if (match) {
return new RegExp(match[1], match[2]);
}
return new RegExp(pattern);
} | javascript | function asRegExp(pattern) {
// if regex then return it
if (isRegExp(pattern)) {
return pattern;
}
// if string then test for valid regex then convert to regex and return
const match = pattern.match(REGEX);
if (match) {
return new RegExp(match[1], match[2]);
}
return new RegExp(pattern);
} | [
"function",
"asRegExp",
"(",
"pattern",
")",
"{",
"// if regex then return it",
"if",
"(",
"isRegExp",
"(",
"pattern",
")",
")",
"{",
"return",
"pattern",
";",
"}",
"// if string then test for valid regex then convert to regex and return",
"const",
"match",
"=",
"patter... | regular expression to test a regular expression | [
"regular",
"expression",
"to",
"test",
"a",
"regular",
"expression"
] | cae0221a60b3a02053e13a3946299555d02517e0 | https://github.com/Availity/availity-reactstrap-validation/blob/cae0221a60b3a02053e13a3946299555d02517e0/src/AvValidator/pattern.js#L6-L19 |
16,513 | heroku/heroku-cli-util | lib/styled.js | styledJSON | function styledJSON (obj) {
let json = JSON.stringify(obj, null, 2)
if (cli.color.enabled) {
let cardinal = require('cardinal')
let theme = require('cardinal/themes/jq')
cli.log(cardinal.highlight(json, {json: true, theme: theme}))
} else {
cli.log(json)
}
} | javascript | function styledJSON (obj) {
let json = JSON.stringify(obj, null, 2)
if (cli.color.enabled) {
let cardinal = require('cardinal')
let theme = require('cardinal/themes/jq')
cli.log(cardinal.highlight(json, {json: true, theme: theme}))
} else {
cli.log(json)
}
} | [
"function",
"styledJSON",
"(",
"obj",
")",
"{",
"let",
"json",
"=",
"JSON",
".",
"stringify",
"(",
"obj",
",",
"null",
",",
"2",
")",
"if",
"(",
"cli",
".",
"color",
".",
"enabled",
")",
"{",
"let",
"cardinal",
"=",
"require",
"(",
"'cardinal'",
")... | styledJSON prints out colored, indented JSON
@example
styledHeader({foo: 'bar'}) # Outputs === {
"foo": "bar"
}
@param {obj} object data to display
@returns {null} | [
"styledJSON",
"prints",
"out",
"colored",
"indented",
"JSON"
] | d214cd4279da2cabc39cec6df391696eed735dfd | https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/styled.js#L17-L26 |
16,514 | heroku/heroku-cli-util | lib/styled.js | styledHeader | function styledHeader (header) {
cli.log(cli.color.dim('=== ') + cli.color.bold(header))
} | javascript | function styledHeader (header) {
cli.log(cli.color.dim('=== ') + cli.color.bold(header))
} | [
"function",
"styledHeader",
"(",
"header",
")",
"{",
"cli",
".",
"log",
"(",
"cli",
".",
"color",
".",
"dim",
"(",
"'=== '",
")",
"+",
"cli",
".",
"color",
".",
"bold",
"(",
"header",
")",
")",
"}"
] | styledHeader logs in a consistent header style
@example
styledHeader('MyApp') # Outputs === MyApp
@param {header} header text
@returns {null} | [
"styledHeader",
"logs",
"in",
"a",
"consistent",
"header",
"style"
] | d214cd4279da2cabc39cec6df391696eed735dfd | https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/styled.js#L37-L39 |
16,515 | heroku/heroku-cli-util | lib/styled.js | styledObject | function styledObject (obj, keys) {
let keyLengths = Object.keys(obj).map(key => key.toString().length)
let maxKeyLength = Math.max.apply(Math, keyLengths) + 2
function pp (obj) {
if (typeof obj === 'string' || typeof obj === 'number') {
return obj
} else if (typeof obj === 'object') {
return ... | javascript | function styledObject (obj, keys) {
let keyLengths = Object.keys(obj).map(key => key.toString().length)
let maxKeyLength = Math.max.apply(Math, keyLengths) + 2
function pp (obj) {
if (typeof obj === 'string' || typeof obj === 'number') {
return obj
} else if (typeof obj === 'object') {
return ... | [
"function",
"styledObject",
"(",
"obj",
",",
"keys",
")",
"{",
"let",
"keyLengths",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"key",
"=>",
"key",
".",
"toString",
"(",
")",
".",
"length",
")",
"let",
"maxKeyLength",
"=",
"Math",
... | styledObject logs an object in a consistent columnar style
@example
styledObject({name: "myapp", collaborators: ["[email protected]", "[email protected]"]})
Collaborators: [email protected]
[email protected]
Name: myapp
@param {obj} object data to print
@param {keys} optional array of keys to sort/filter out... | [
"styledObject",
"logs",
"an",
"object",
"in",
"a",
"consistent",
"columnar",
"style"
] | d214cd4279da2cabc39cec6df391696eed735dfd | https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/styled.js#L54-L82 |
16,516 | heroku/heroku-cli-util | lib/preauth.js | preauth | function preauth (app, heroku, secondFactor) {
return heroku.request({
method: 'PUT',
path: `/apps/${app}/pre-authorizations`,
headers: { 'Heroku-Two-Factor-Code': secondFactor }
})
} | javascript | function preauth (app, heroku, secondFactor) {
return heroku.request({
method: 'PUT',
path: `/apps/${app}/pre-authorizations`,
headers: { 'Heroku-Two-Factor-Code': secondFactor }
})
} | [
"function",
"preauth",
"(",
"app",
",",
"heroku",
",",
"secondFactor",
")",
"{",
"return",
"heroku",
".",
"request",
"(",
"{",
"method",
":",
"'PUT'",
",",
"path",
":",
"`",
"${",
"app",
"}",
"`",
",",
"headers",
":",
"{",
"'Heroku-Two-Factor-Code'",
"... | preauth will make an API call to preauth a user for an app
this makes it so the user will not have to enter a 2fa code
for the next few minutes on the specified app.
You need this if your command is going to make multiple API calls
since otherwise the secondFactor key would only work one time for
yubikeys.
@param {St... | [
"preauth",
"will",
"make",
"an",
"API",
"call",
"to",
"preauth",
"a",
"user",
"for",
"an",
"app",
"this",
"makes",
"it",
"so",
"the",
"user",
"will",
"not",
"have",
"to",
"enter",
"a",
"2fa",
"code",
"for",
"the",
"next",
"few",
"minutes",
"on",
"the... | d214cd4279da2cabc39cec6df391696eed735dfd | https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/preauth.js#L18-L24 |
16,517 | heroku/heroku-cli-util | lib/util.js | promiseOrCallback | function promiseOrCallback (fn) {
return function () {
if (typeof arguments[arguments.length - 1] === 'function') {
let args = Array.prototype.slice.call(arguments)
let callback = args.pop()
fn.apply(null, args).then(function () {
let args = Array.prototype.slice.call(arguments)
... | javascript | function promiseOrCallback (fn) {
return function () {
if (typeof arguments[arguments.length - 1] === 'function') {
let args = Array.prototype.slice.call(arguments)
let callback = args.pop()
fn.apply(null, args).then(function () {
let args = Array.prototype.slice.call(arguments)
... | [
"function",
"promiseOrCallback",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"typeof",
"arguments",
"[",
"arguments",
".",
"length",
"-",
"1",
"]",
"===",
"'function'",
")",
"{",
"let",
"args",
"=",
"Array",
".",
"prototype",
"... | promiseOrCallback will convert a function that returns a promise
into one that will either make a node-style callback or return a promise
based on whether or not a callback is passed in.
@example
prompt('input? ').then(function (input) {
// deal with input
})
var prompt2 = promiseOrCallback(prompt)
prompt('input? ', f... | [
"promiseOrCallback",
"will",
"convert",
"a",
"function",
"that",
"returns",
"a",
"promise",
"into",
"one",
"that",
"will",
"either",
"make",
"a",
"node",
"-",
"style",
"callback",
"or",
"return",
"a",
"promise",
"based",
"on",
"whether",
"or",
"not",
"a",
... | d214cd4279da2cabc39cec6df391696eed735dfd | https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/util.js#L20-L36 |
16,518 | assetgraph/assetgraph | lib/transforms/subsetFonts.js | groupTextsByFontFamilyProps | function groupTextsByFontFamilyProps(
textByPropsArray,
availableFontFaceDeclarations
) {
const snappedTexts = _.flatMapDeep(textByPropsArray, textAndProps => {
const family = textAndProps.props['font-family'];
if (family === undefined) {
return [];
}
// Find all the families in the traced ... | javascript | function groupTextsByFontFamilyProps(
textByPropsArray,
availableFontFaceDeclarations
) {
const snappedTexts = _.flatMapDeep(textByPropsArray, textAndProps => {
const family = textAndProps.props['font-family'];
if (family === undefined) {
return [];
}
// Find all the families in the traced ... | [
"function",
"groupTextsByFontFamilyProps",
"(",
"textByPropsArray",
",",
"availableFontFaceDeclarations",
")",
"{",
"const",
"snappedTexts",
"=",
"_",
".",
"flatMapDeep",
"(",
"textByPropsArray",
",",
"textAndProps",
"=>",
"{",
"const",
"family",
"=",
"textAndProps",
... | Takes the output of fontTracer | [
"Takes",
"the",
"output",
"of",
"fontTracer"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/subsetFonts.js#L79-L158 |
16,519 | assetgraph/assetgraph | lib/transforms/bundleSystemJs.js | getSharedProperties | function getSharedProperties(configA, configB) {
const bKeys = Object.keys(configB);
return Object.keys(configA).filter(p => bKeys.includes(p));
} | javascript | function getSharedProperties(configA, configB) {
const bKeys = Object.keys(configB);
return Object.keys(configA).filter(p => bKeys.includes(p));
} | [
"function",
"getSharedProperties",
"(",
"configA",
",",
"configB",
")",
"{",
"const",
"bKeys",
"=",
"Object",
".",
"keys",
"(",
"configB",
")",
";",
"return",
"Object",
".",
"keys",
"(",
"configA",
")",
".",
"filter",
"(",
"p",
"=>",
"bKeys",
".",
"inc... | meta, packages deep | [
"meta",
"packages",
"deep"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L66-L69 |
16,520 | assetgraph/assetgraph | lib/transforms/bundleSystemJs.js | generateBundleName | function generateBundleName(name, modules, conditionValueOrVariationObject) {
// first check if the given modules already matches an existing bundle
let existingBundleName;
for (const bundleName of Object.keys(bundles)) {
const bundleModules = bundles[bundleName].modules;
if (
containsM... | javascript | function generateBundleName(name, modules, conditionValueOrVariationObject) {
// first check if the given modules already matches an existing bundle
let existingBundleName;
for (const bundleName of Object.keys(bundles)) {
const bundleModules = bundles[bundleName].modules;
if (
containsM... | [
"function",
"generateBundleName",
"(",
"name",
",",
"modules",
",",
"conditionValueOrVariationObject",
")",
"{",
"// first check if the given modules already matches an existing bundle",
"let",
"existingBundleName",
";",
"for",
"(",
"const",
"bundleName",
"of",
"Object",
".",... | simple random bundle name generation with duplication avoidance | [
"simple",
"random",
"bundle",
"name",
"generation",
"with",
"duplication",
"avoidance"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L240-L282 |
16,521 | assetgraph/assetgraph | lib/transforms/bundleSystemJs.js | intersectModules | function intersectModules(modulesA, modulesB) {
const intersection = [];
for (const module of modulesA) {
if (modulesB.includes(module)) {
intersection.push(module);
}
}
return intersection;
} | javascript | function intersectModules(modulesA, modulesB) {
const intersection = [];
for (const module of modulesA) {
if (modulesB.includes(module)) {
intersection.push(module);
}
}
return intersection;
} | [
"function",
"intersectModules",
"(",
"modulesA",
",",
"modulesB",
")",
"{",
"const",
"intersection",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"module",
"of",
"modulesA",
")",
"{",
"if",
"(",
"modulesB",
".",
"includes",
"(",
"module",
")",
")",
"{",
"i... | intersect two arrays | [
"intersect",
"two",
"arrays"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L285-L293 |
16,522 | assetgraph/assetgraph | lib/transforms/bundleSystemJs.js | subtractModules | function subtractModules(modulesA, modulesB) {
const subtracted = [];
for (const module of modulesA) {
if (!modulesB.includes(module)) {
subtracted.push(module);
}
}
return subtracted;
} | javascript | function subtractModules(modulesA, modulesB) {
const subtracted = [];
for (const module of modulesA) {
if (!modulesB.includes(module)) {
subtracted.push(module);
}
}
return subtracted;
} | [
"function",
"subtractModules",
"(",
"modulesA",
",",
"modulesB",
")",
"{",
"const",
"subtracted",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"module",
"of",
"modulesA",
")",
"{",
"if",
"(",
"!",
"modulesB",
".",
"includes",
"(",
"module",
")",
")",
"{",
... | remove elements of arrayB from arrayA | [
"remove",
"elements",
"of",
"arrayB",
"from",
"arrayA"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L296-L304 |
16,523 | assetgraph/assetgraph | lib/util/fonts/downloadGoogleFonts.js | downloadGoogleFonts | async function downloadGoogleFonts(
fontProps,
{ formats = ['woff2', 'woff'], fontDisplay = 'swap', text } = {}
) {
const sortedFormats = [];
for (const format of formatOrder) {
if (formats.includes(format)) {
sortedFormats.push(format);
}
}
const result = {};
const googleFontId = getGoogl... | javascript | async function downloadGoogleFonts(
fontProps,
{ formats = ['woff2', 'woff'], fontDisplay = 'swap', text } = {}
) {
const sortedFormats = [];
for (const format of formatOrder) {
if (formats.includes(format)) {
sortedFormats.push(format);
}
}
const result = {};
const googleFontId = getGoogl... | [
"async",
"function",
"downloadGoogleFonts",
"(",
"fontProps",
",",
"{",
"formats",
"=",
"[",
"'woff2'",
",",
"'woff'",
"]",
",",
"fontDisplay",
"=",
"'swap'",
",",
"text",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"sortedFormats",
"=",
"[",
"]",
";",
"for... | Download google fonts for self-hosting
@async
@param {FontProps} fontProps CSS font properties to get font for
@param {Object} options
@param {String[]} [options.formats=['woff2', 'woff']] List of formats that should be inclued in the output
@param {String} [options.fontDisplay='swap'] CSS font-display value in re... | [
"Download",
"google",
"fonts",
"for",
"self",
"-",
"hosting"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/util/fonts/downloadGoogleFonts.js#L43-L112 |
16,524 | assetgraph/assetgraph | lib/util/fonts/findCustomPropertyDefinitions.js | findCustomPropertyDefinitions | function findCustomPropertyDefinitions(cssAssets) {
const definitionsByProp = {};
const incomingReferencesByProp = {};
for (const cssAsset of cssAssets) {
cssAsset.eachRuleInParseTree(cssRule => {
if (
cssRule.parent.type === 'rule' &&
cssRule.type === 'decl' &&
/^--/.test(cssRul... | javascript | function findCustomPropertyDefinitions(cssAssets) {
const definitionsByProp = {};
const incomingReferencesByProp = {};
for (const cssAsset of cssAssets) {
cssAsset.eachRuleInParseTree(cssRule => {
if (
cssRule.parent.type === 'rule' &&
cssRule.type === 'decl' &&
/^--/.test(cssRul... | [
"function",
"findCustomPropertyDefinitions",
"(",
"cssAssets",
")",
"{",
"const",
"definitionsByProp",
"=",
"{",
"}",
";",
"const",
"incomingReferencesByProp",
"=",
"{",
"}",
";",
"for",
"(",
"const",
"cssAsset",
"of",
"cssAssets",
")",
"{",
"cssAsset",
".",
"... | Find all custom property definitions grouped by the custom properties they contribute to | [
"Find",
"all",
"custom",
"property",
"definitions",
"grouped",
"by",
"the",
"custom",
"properties",
"they",
"contribute",
"to"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/util/fonts/findCustomPropertyDefinitions.js#L4-L52 |
16,525 | assetgraph/assetgraph | lib/transforms/inlineAssetsPerQueryString.js | getMinimumIeVersionUsage | function getMinimumIeVersionUsage(asset, stack = []) {
if (asset.type === 'Html') {
return 1;
}
if (minimumIeVersionByAsset.has(asset)) {
return minimumIeVersionByAsset.get(asset);
}
stack.push(asset);
const minimumIeVersion = Math.min(
...asset.incomingRelati... | javascript | function getMinimumIeVersionUsage(asset, stack = []) {
if (asset.type === 'Html') {
return 1;
}
if (minimumIeVersionByAsset.has(asset)) {
return minimumIeVersionByAsset.get(asset);
}
stack.push(asset);
const minimumIeVersion = Math.min(
...asset.incomingRelati... | [
"function",
"getMinimumIeVersionUsage",
"(",
"asset",
",",
"stack",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"asset",
".",
"type",
"===",
"'Html'",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"minimumIeVersionByAsset",
".",
"has",
"(",
"asset",
")",
")",
... | Asset => minimumIeVersion | [
"Asset",
"=",
">",
"minimumIeVersion"
] | 43e00db43619d8fa74eca22d41c87e6f14f03639 | https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/inlineAssetsPerQueryString.js#L20-L61 |
16,526 | mixmaxhq/mongo-cursor-pagination | src/utils/resolveFields.js | fieldsFromMongo | function fieldsFromMongo(projection = {}, includeIdDefault = false) {
const fields = _.reduce(projection, (memo, value, key) => {
if (key !== '_id' && value !== undefined && !value) {
throw new TypeError('projection includes exclusion, but we do not support that');
}
if (value || (key === '_id' && v... | javascript | function fieldsFromMongo(projection = {}, includeIdDefault = false) {
const fields = _.reduce(projection, (memo, value, key) => {
if (key !== '_id' && value !== undefined && !value) {
throw new TypeError('projection includes exclusion, but we do not support that');
}
if (value || (key === '_id' && v... | [
"function",
"fieldsFromMongo",
"(",
"projection",
"=",
"{",
"}",
",",
"includeIdDefault",
"=",
"false",
")",
"{",
"const",
"fields",
"=",
"_",
".",
"reduce",
"(",
"projection",
",",
"(",
"memo",
",",
"value",
",",
"key",
")",
"=>",
"{",
"if",
"(",
"k... | Produce a ProjectionFieldSet from the given mongo projection, after validating it to ensure it
doesn't have exclusion rules.
@param {Object<String, *>} projection The projected fields.
@param {Boolean=} includeIdDefault Whether to include _id by default (mongo's default behavior).
@returns {ProjectionFieldSet} The syn... | [
"Produce",
"a",
"ProjectionFieldSet",
"from",
"the",
"given",
"mongo",
"projection",
"after",
"validating",
"it",
"to",
"ensure",
"it",
"doesn",
"t",
"have",
"exclusion",
"rules",
"."
] | fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42 | https://github.com/mixmaxhq/mongo-cursor-pagination/blob/fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42/src/utils/resolveFields.js#L12-L25 |
16,527 | mixmaxhq/mongo-cursor-pagination | src/utils/resolveFields.js | resolveFields | function resolveFields(desiredFields, allowedFields, overrideFields) {
if (desiredFields != null && !Array.isArray(desiredFields)) {
throw new TypeError('expected nullable array for desiredFields');
}
if (allowedFields != null && !_.isObject(allowedFields)) {
throw new TypeError('expected nullable plain ... | javascript | function resolveFields(desiredFields, allowedFields, overrideFields) {
if (desiredFields != null && !Array.isArray(desiredFields)) {
throw new TypeError('expected nullable array for desiredFields');
}
if (allowedFields != null && !_.isObject(allowedFields)) {
throw new TypeError('expected nullable plain ... | [
"function",
"resolveFields",
"(",
"desiredFields",
",",
"allowedFields",
",",
"overrideFields",
")",
"{",
"if",
"(",
"desiredFields",
"!=",
"null",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"desiredFields",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'e... | Resolve the fields object, given potentially untrusted fields the user has provided, permitted
fields defined by the application, and override fields that should always be provided.
@param {String[]} desiredFields The fields in the request.
@param {?Object<String, *>=} allowedFields A shallow fields object defining th... | [
"Resolve",
"the",
"fields",
"object",
"given",
"potentially",
"untrusted",
"fields",
"the",
"user",
"has",
"provided",
"permitted",
"fields",
"defined",
"by",
"the",
"application",
"and",
"override",
"fields",
"that",
"should",
"always",
"be",
"provided",
"."
] | fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42 | https://github.com/mixmaxhq/mongo-cursor-pagination/blob/fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42/src/utils/resolveFields.js#L38-L85 |
16,528 | MitocGroup/deep-framework | src/deep-validation/lib/Helpers/vogelsPolyfill.js | _joiVector | function _joiVector(proto) {
let arr = Joi.array();
if (arr.includes) {
return arr.includes(proto);
}
return arr.items(proto);
} | javascript | function _joiVector(proto) {
let arr = Joi.array();
if (arr.includes) {
return arr.includes(proto);
}
return arr.items(proto);
} | [
"function",
"_joiVector",
"(",
"proto",
")",
"{",
"let",
"arr",
"=",
"Joi",
".",
"array",
"(",
")",
";",
"if",
"(",
"arr",
".",
"includes",
")",
"{",
"return",
"arr",
".",
"includes",
"(",
"proto",
")",
";",
"}",
"return",
"arr",
".",
"items",
"(... | Fixes weird joi exception!
@param {Object} proto
@returns {Object}
@private | [
"Fixes",
"weird",
"joi",
"exception!"
] | f13b01efefedb3701d10d33138224574dc3189b9 | https://github.com/MitocGroup/deep-framework/blob/f13b01efefedb3701d10d33138224574dc3189b9/src/deep-validation/lib/Helpers/vogelsPolyfill.js#L18-L26 |
16,529 | MitocGroup/deep-framework | src/deep-core/lib/Generic/require1k.js | deepLoad | function deepLoad(module, callback, parentLocation, id) {
// If this module is already loading then don't proceed.
// This is a bug.
// If a module is requested but not loaded then the module isn't ready,
// but we callback as if it is. Oh well, 1k!
if (module.g) {
return callback(module.e, mo... | javascript | function deepLoad(module, callback, parentLocation, id) {
// If this module is already loading then don't proceed.
// This is a bug.
// If a module is requested but not loaded then the module isn't ready,
// but we callback as if it is. Oh well, 1k!
if (module.g) {
return callback(module.e, mo... | [
"function",
"deepLoad",
"(",
"module",
",",
"callback",
",",
"parentLocation",
",",
"id",
")",
"{",
"// If this module is already loading then don't proceed.",
"// This is a bug.",
"// If a module is requested but not loaded then the module isn't ready,",
"// but we callback as if it i... | Loads the given module and all of it dependencies, recursively - module The module object - callback Called when everything has been loaded - parentLocation Location of the parent directory to look in. Only given for non-relative dependencies - id The name of the dependency. Only used for non-... | [
"Loads",
"the",
"given",
"module",
"and",
"all",
"of",
"it",
"dependencies",
"recursively",
"-",
"module",
"The",
"module",
"object",
"-",
"callback",
"Called",
"when",
"everything",
"has",
"been",
"loaded",
"-",
"parentLocation",
"Location",
"of",
"the",
"par... | f13b01efefedb3701d10d33138224574dc3189b9 | https://github.com/MitocGroup/deep-framework/blob/f13b01efefedb3701d10d33138224574dc3189b9/src/deep-core/lib/Generic/require1k.js#L44-L112 |
16,530 | MitocGroup/deep-framework | src/deep-core/lib/Generic/require1k.js | resolveModuleOrGetExports | function resolveModuleOrGetExports(baseOrModule, relative, resolved) {
// This should really be after the relative check, but because we are
// `throw`ing, it messes up the optimizations. If we are being called
// as resolveModule then the string `base` won't have the `e` property,
// so we're fine.
... | javascript | function resolveModuleOrGetExports(baseOrModule, relative, resolved) {
// This should really be after the relative check, but because we are
// `throw`ing, it messes up the optimizations. If we are being called
// as resolveModule then the string `base` won't have the `e` property,
// so we're fine.
... | [
"function",
"resolveModuleOrGetExports",
"(",
"baseOrModule",
",",
"relative",
",",
"resolved",
")",
"{",
"// This should really be after the relative check, but because we are",
"// `throw`ing, it messes up the optimizations. If we are being called",
"// as resolveModule then the string `ba... | Save bytes by combining two functions - resolveModule which resolves a given relative path against the given base, and returns an existing or new module object - getExports which returns the existing exports or runs the factory to create the exports for a module | [
"Save",
"bytes",
"by",
"combining",
"two",
"functions",
"-",
"resolveModule",
"which",
"resolves",
"a",
"given",
"relative",
"path",
"against",
"the",
"given",
"base",
"and",
"returns",
"an",
"existing",
"or",
"new",
"module",
"object",
"-",
"getExports",
"whi... | f13b01efefedb3701d10d33138224574dc3189b9 | https://github.com/MitocGroup/deep-framework/blob/f13b01efefedb3701d10d33138224574dc3189b9/src/deep-core/lib/Generic/require1k.js#L119-L161 |
16,531 | generate/generate | index.js | Generate | function Generate(options) {
if (!(this instanceof Generate)) {
return new Generate(options);
}
Assemble.call(this, options);
this.is('generate');
this.initGenerate(this.options);
if (!setArgs) {
setArgs = true;
this.base.option(utils.argv);
}
} | javascript | function Generate(options) {
if (!(this instanceof Generate)) {
return new Generate(options);
}
Assemble.call(this, options);
this.is('generate');
this.initGenerate(this.options);
if (!setArgs) {
setArgs = true;
this.base.option(utils.argv);
}
} | [
"function",
"Generate",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Generate",
")",
")",
"{",
"return",
"new",
"Generate",
"(",
"options",
")",
";",
"}",
"Assemble",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this"... | Create an instance of `Generate` with the given `options`
```js
var Generate = require('generate');
var generate = new Generate();
```
@param {Object} `options` Settings to initialize with.
@api public | [
"Create",
"an",
"instance",
"of",
"Generate",
"with",
"the",
"given",
"options"
] | 63ab3cf87a61d83806d81541c27308da294c15e8 | https://github.com/generate/generate/blob/63ab3cf87a61d83806d81541c27308da294c15e8/index.js#L29-L42 |
16,532 | nylas/nylas-nodejs | example/webhooks/index.js | verify_nylas_request | function verify_nylas_request(req) {
const digest = crypto
.createHmac('sha256', config.nylasClientSecret)
.update(req.rawBody)
.digest('hex');
return digest === req.get('x-nylas-signature');
} | javascript | function verify_nylas_request(req) {
const digest = crypto
.createHmac('sha256', config.nylasClientSecret)
.update(req.rawBody)
.digest('hex');
return digest === req.get('x-nylas-signature');
} | [
"function",
"verify_nylas_request",
"(",
"req",
")",
"{",
"const",
"digest",
"=",
"crypto",
".",
"createHmac",
"(",
"'sha256'",
",",
"config",
".",
"nylasClientSecret",
")",
".",
"update",
"(",
"req",
".",
"rawBody",
")",
".",
"digest",
"(",
"'hex'",
")",
... | Each request made by Nylas includes an X-Nylas-Signature header. The header contains the HMAC-SHA256 signature of the request body, using your client secret as the signing key. This allows your app to verify that the notification really came from Nylas. | [
"Each",
"request",
"made",
"by",
"Nylas",
"includes",
"an",
"X",
"-",
"Nylas",
"-",
"Signature",
"header",
".",
"The",
"header",
"contains",
"the",
"HMAC",
"-",
"SHA256",
"signature",
"of",
"the",
"request",
"body",
"using",
"your",
"client",
"secret",
"as... | a562be663d135562b44b1d6faf61d518859d16d0 | https://github.com/nylas/nylas-nodejs/blob/a562be663d135562b44b1d6faf61d518859d16d0/example/webhooks/index.js#L64-L70 |
16,533 | AllenWooooo/rc-datetime-picker | build/build.js | buildUmdDev | function buildUmdDev() {
return rollup.rollup({
entry: 'src/index.js',
plugins: [
babel(babelOptions)
]
}).then(function (bundle) {
bundle.generate({
format: 'umd',
banner: banner,
name: 'rc-datetime-picker'
}).then(({ code }) => {
return write('dist/rc-datetime-pic... | javascript | function buildUmdDev() {
return rollup.rollup({
entry: 'src/index.js',
plugins: [
babel(babelOptions)
]
}).then(function (bundle) {
bundle.generate({
format: 'umd',
banner: banner,
name: 'rc-datetime-picker'
}).then(({ code }) => {
return write('dist/rc-datetime-pic... | [
"function",
"buildUmdDev",
"(",
")",
"{",
"return",
"rollup",
".",
"rollup",
"(",
"{",
"entry",
":",
"'src/index.js'",
",",
"plugins",
":",
"[",
"babel",
"(",
"babelOptions",
")",
"]",
"}",
")",
".",
"then",
"(",
"function",
"(",
"bundle",
")",
"{",
... | Standalone development build | [
"Standalone",
"development",
"build"
] | 3cb7b3e4a595047ddac5332ecc055a25187a055a | https://github.com/AllenWooooo/rc-datetime-picker/blob/3cb7b3e4a595047ddac5332ecc055a25187a055a/build/build.js#L55-L70 |
16,534 | nieldlr/hanzi | lib/dictionary.js | determineFreqCategories | function determineFreqCategories() {
if (mean - sd < 0) {
var lowrange = 0 + mean / 3;
} else {
var lowrange = mean - sd;
}
var midrange = [mean + sd, lowrange];
var highrange = mean + sd;
var i = 0;
for (; i < potentialexamples.length; i++) {
var word = potentialexamples[... | javascript | function determineFreqCategories() {
if (mean - sd < 0) {
var lowrange = 0 + mean / 3;
} else {
var lowrange = mean - sd;
}
var midrange = [mean + sd, lowrange];
var highrange = mean + sd;
var i = 0;
for (; i < potentialexamples.length; i++) {
var word = potentialexamples[... | [
"function",
"determineFreqCategories",
"(",
")",
"{",
"if",
"(",
"mean",
"-",
"sd",
"<",
"0",
")",
"{",
"var",
"lowrange",
"=",
"0",
"+",
"mean",
"/",
"3",
";",
"}",
"else",
"{",
"var",
"lowrange",
"=",
"mean",
"-",
"sd",
";",
"}",
"var",
"midran... | Create frequency categories | [
"Create",
"frequency",
"categories"
] | 8b80e6d85130c9412117dbc41802cf6add3a74a3 | https://github.com/nieldlr/hanzi/blob/8b80e6d85130c9412117dbc41802cf6add3a74a3/lib/dictionary.js#L202-L234 |
16,535 | Kitware/paraviewweb | src/IO/Core/DataManager/request.js | makeRequest | function makeRequest(url, handler) {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = handler.type;
xhr.onload = function onLoad(e) {
if (this.status === 200 || this.status === 0) {
handler.fn(null, xhr);
return;
}
handler.fn(e, xhr);
};
xhr.onerror ... | javascript | function makeRequest(url, handler) {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = handler.type;
xhr.onload = function onLoad(e) {
if (this.status === 200 || this.status === 0) {
handler.fn(null, xhr);
return;
}
handler.fn(e, xhr);
};
xhr.onerror ... | [
"function",
"makeRequest",
"(",
"url",
",",
"handler",
")",
"{",
"const",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"xhr",
".",
"open",
"(",
"'GET'",
",",
"url",
",",
"true",
")",
";",
"xhr",
".",
"responseType",
"=",
"handler",
".",
"type"... | Generic request handler | [
"Generic",
"request",
"handler"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/IO/Core/DataManager/request.js#L2-L19 |
16,536 | Kitware/paraviewweb | src/IO/Core/DataManager/request.js | arraybufferHandler | function arraybufferHandler(callback) {
return {
type: 'arraybuffer',
fn: (error, xhrObject) => {
if (error) {
callback(error);
return;
}
callback(null, xhrObject.response);
},
};
} | javascript | function arraybufferHandler(callback) {
return {
type: 'arraybuffer',
fn: (error, xhrObject) => {
if (error) {
callback(error);
return;
}
callback(null, xhrObject.response);
},
};
} | [
"function",
"arraybufferHandler",
"(",
"callback",
")",
"{",
"return",
"{",
"type",
":",
"'arraybuffer'",
",",
"fn",
":",
"(",
"error",
",",
"xhrObject",
")",
"=>",
"{",
"if",
"(",
"error",
")",
"{",
"callback",
"(",
"error",
")",
";",
"return",
";",
... | Array buffer handler | [
"Array",
"buffer",
"handler"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/IO/Core/DataManager/request.js#L22-L33 |
16,537 | Kitware/paraviewweb | src/Common/Misc/WebGl/index.js | showGlInfo | function showGlInfo(gl) {
const vertexUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
const fragmentUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
const combinedUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
console.log('vertex texture image units:', vertexUnits);
console.log(... | javascript | function showGlInfo(gl) {
const vertexUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
const fragmentUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
const combinedUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
console.log('vertex texture image units:', vertexUnits);
console.log(... | [
"function",
"showGlInfo",
"(",
"gl",
")",
"{",
"const",
"vertexUnits",
"=",
"gl",
".",
"getParameter",
"(",
"gl",
".",
"MAX_VERTEX_TEXTURE_IMAGE_UNITS",
")",
";",
"const",
"fragmentUnits",
"=",
"gl",
".",
"getParameter",
"(",
"gl",
".",
"MAX_TEXTURE_IMAGE_UNITS"... | Show GL informations | [
"Show",
"GL",
"informations"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L2-L9 |
16,538 | Kitware/paraviewweb | src/Common/Misc/WebGl/index.js | compileShader | function compileShader(gl, src, type) {
const shader = gl.createShader(type);
gl.shaderSource(shader, src);
// Compile and check status
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
// Something went wrong during compilation; get the error
const lastError = gl.ge... | javascript | function compileShader(gl, src, type) {
const shader = gl.createShader(type);
gl.shaderSource(shader, src);
// Compile and check status
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
// Something went wrong during compilation; get the error
const lastError = gl.ge... | [
"function",
"compileShader",
"(",
"gl",
",",
"src",
",",
"type",
")",
"{",
"const",
"shader",
"=",
"gl",
".",
"createShader",
"(",
"type",
")",
";",
"gl",
".",
"shaderSource",
"(",
"shader",
",",
"src",
")",
";",
"// Compile and check status",
"gl",
".",... | Compile a shader | [
"Compile",
"a",
"shader"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L12-L29 |
16,539 | Kitware/paraviewweb | src/Common/Misc/WebGl/index.js | applyProgramDataMapping | function applyProgramDataMapping(
gl,
programName,
mappingName,
glConfig,
glResources
) {
const program = glResources.programs[programName];
const mapping = glConfig.mappings[mappingName];
mapping.forEach((bufferMapping) => {
const glBuffer = glResources.buffers[bufferMapping.id];
gl.bindBuffe... | javascript | function applyProgramDataMapping(
gl,
programName,
mappingName,
glConfig,
glResources
) {
const program = glResources.programs[programName];
const mapping = glConfig.mappings[mappingName];
mapping.forEach((bufferMapping) => {
const glBuffer = glResources.buffers[bufferMapping.id];
gl.bindBuffe... | [
"function",
"applyProgramDataMapping",
"(",
"gl",
",",
"programName",
",",
"mappingName",
",",
"glConfig",
",",
"glResources",
")",
"{",
"const",
"program",
"=",
"glResources",
".",
"programs",
"[",
"programName",
"]",
";",
"const",
"mapping",
"=",
"glConfig",
... | Apply new mapping to a program | [
"Apply",
"new",
"mapping",
"to",
"a",
"program"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L59-L89 |
16,540 | Kitware/paraviewweb | src/Common/Misc/WebGl/index.js | bindTextureToFramebuffer | function bindTextureToFramebuffer(gl, fbo, texture) {
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(
gl.TEXTURE_2D,
0,
gl.RGBA,
fbo.width,
fbo.height,
0,
gl.RGBA,
gl.UNSIGNED_BYTE,
null
);
gl.framebufferTexture2D(
gl.FR... | javascript | function bindTextureToFramebuffer(gl, fbo, texture) {
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(
gl.TEXTURE_2D,
0,
gl.RGBA,
fbo.width,
fbo.height,
0,
gl.RGBA,
gl.UNSIGNED_BYTE,
null
);
gl.framebufferTexture2D(
gl.FR... | [
"function",
"bindTextureToFramebuffer",
"(",
"gl",
",",
"fbo",
",",
"texture",
")",
"{",
"gl",
".",
"bindFramebuffer",
"(",
"gl",
".",
"FRAMEBUFFER",
",",
"fbo",
")",
";",
"gl",
".",
"bindTexture",
"(",
"gl",
".",
"TEXTURE_2D",
",",
"texture",
")",
";",
... | Bind texture to Framebuffer | [
"Bind",
"texture",
"to",
"Framebuffer"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L122-L155 |
16,541 | Kitware/paraviewweb | src/Common/Misc/WebGl/index.js | freeGLResources | function freeGLResources(glResources) {
const gl = glResources.gl;
// Delete each program
Object.keys(glResources.programs).forEach((programName) => {
const program = glResources.programs[programName];
const shaders = program.shaders;
let count = shaders.length;
// Delete shaders
while (cou... | javascript | function freeGLResources(glResources) {
const gl = glResources.gl;
// Delete each program
Object.keys(glResources.programs).forEach((programName) => {
const program = glResources.programs[programName];
const shaders = program.shaders;
let count = shaders.length;
// Delete shaders
while (cou... | [
"function",
"freeGLResources",
"(",
"glResources",
")",
"{",
"const",
"gl",
"=",
"glResources",
".",
"gl",
";",
"// Delete each program",
"Object",
".",
"keys",
"(",
"glResources",
".",
"programs",
")",
".",
"forEach",
"(",
"(",
"programName",
")",
"=>",
"{"... | Free GL resources | [
"Free",
"GL",
"resources"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L158-L192 |
16,542 | Kitware/paraviewweb | src/Common/Misc/WebGl/index.js | createGLResources | function createGLResources(gl, glConfig) {
const resources = {
gl,
buffers: {},
textures: {},
framebuffers: {},
programs: {},
};
const buffers = glConfig.resources.buffers || [];
const textures = glConfig.resources.textures || [];
const framebuffers = glConfig.resources.framebuffers || [];... | javascript | function createGLResources(gl, glConfig) {
const resources = {
gl,
buffers: {},
textures: {},
framebuffers: {},
programs: {},
};
const buffers = glConfig.resources.buffers || [];
const textures = glConfig.resources.textures || [];
const framebuffers = glConfig.resources.framebuffers || [];... | [
"function",
"createGLResources",
"(",
"gl",
",",
"glConfig",
")",
"{",
"const",
"resources",
"=",
"{",
"gl",
",",
"buffers",
":",
"{",
"}",
",",
"textures",
":",
"{",
"}",
",",
"framebuffers",
":",
"{",
"}",
",",
"programs",
":",
"{",
"}",
",",
"}"... | Create GL resources | [
"Create",
"GL",
"resources"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L195-L254 |
16,543 | Kitware/paraviewweb | src/InfoViz/Native/HistogramSelector/index.js | styleRows | function styleRows(selection, self) {
selection
.classed(style.row, true)
.style('height', `${self.rowHeight}px`)
.style(
transformCSSProp,
(d, i) => `translate3d(0,${d.key * self.rowHeight}px,0)`
);
} | javascript | function styleRows(selection, self) {
selection
.classed(style.row, true)
.style('height', `${self.rowHeight}px`)
.style(
transformCSSProp,
(d, i) => `translate3d(0,${d.key * self.rowHeight}px,0)`
);
} | [
"function",
"styleRows",
"(",
"selection",
",",
"self",
")",
"{",
"selection",
".",
"classed",
"(",
"style",
".",
"row",
",",
"true",
")",
".",
"style",
"(",
"'height'",
",",
"`",
"${",
"self",
".",
"rowHeight",
"}",
"`",
")",
".",
"style",
"(",
"t... | Apply our desired attributes to the grid rows | [
"Apply",
"our",
"desired",
"attributes",
"to",
"the",
"grid",
"rows"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/HistogramSelector/index.js#L81-L89 |
16,544 | Kitware/paraviewweb | src/InfoViz/Native/HistogramSelector/index.js | styleBoxes | function styleBoxes(selection, self) {
selection
.style('width', `${self.boxWidth}px`)
.style('height', `${self.boxHeight}px`);
// .style('margin', `${self.boxMargin / 2}px`)
} | javascript | function styleBoxes(selection, self) {
selection
.style('width', `${self.boxWidth}px`)
.style('height', `${self.boxHeight}px`);
// .style('margin', `${self.boxMargin / 2}px`)
} | [
"function",
"styleBoxes",
"(",
"selection",
",",
"self",
")",
"{",
"selection",
".",
"style",
"(",
"'width'",
",",
"`",
"${",
"self",
".",
"boxWidth",
"}",
"`",
")",
".",
"style",
"(",
"'height'",
",",
"`",
"${",
"self",
".",
"boxHeight",
"}",
"`",
... | apply our desired attributes to the boxes of a row | [
"apply",
"our",
"desired",
"attributes",
"to",
"the",
"boxes",
"of",
"a",
"row"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/HistogramSelector/index.js#L92-L97 |
16,545 | Kitware/paraviewweb | src/InfoViz/Native/HistogramSelector/index.js | getFieldRow | function getFieldRow(name) {
if (model.nest === null) return 0;
const foundRow = model.nest.reduce((prev, item, i) => {
const val = item.value.filter((def) => def.name === name);
if (val.length > 0) {
return item.key;
}
return prev;
}, 0);
return foundRow;
} | javascript | function getFieldRow(name) {
if (model.nest === null) return 0;
const foundRow = model.nest.reduce((prev, item, i) => {
const val = item.value.filter((def) => def.name === name);
if (val.length > 0) {
return item.key;
}
return prev;
}, 0);
return foundRow;
} | [
"function",
"getFieldRow",
"(",
"name",
")",
"{",
"if",
"(",
"model",
".",
"nest",
"===",
"null",
")",
"return",
"0",
";",
"const",
"foundRow",
"=",
"model",
".",
"nest",
".",
"reduce",
"(",
"(",
"prev",
",",
"item",
",",
"i",
")",
"=>",
"{",
"co... | which row of model.nest does this field name reside in? | [
"which",
"row",
"of",
"model",
".",
"nest",
"does",
"this",
"field",
"name",
"reside",
"in?"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/HistogramSelector/index.js#L161-L171 |
16,546 | Kitware/paraviewweb | src/InfoViz/Native/MutualInformationDiagram/index.js | updateStatusBarVisibility | function updateStatusBarVisibility() {
const cntnr = d3.select(model.container);
if (model.statusBarVisible) {
cntnr
.select('.status-bar-container')
.style('width', function updateWidth() {
return this.dataset.width;
});
cntnr.select('.show-button').classed(style.h... | javascript | function updateStatusBarVisibility() {
const cntnr = d3.select(model.container);
if (model.statusBarVisible) {
cntnr
.select('.status-bar-container')
.style('width', function updateWidth() {
return this.dataset.width;
});
cntnr.select('.show-button').classed(style.h... | [
"function",
"updateStatusBarVisibility",
"(",
")",
"{",
"const",
"cntnr",
"=",
"d3",
".",
"select",
"(",
"model",
".",
"container",
")",
";",
"if",
"(",
"model",
".",
"statusBarVisible",
")",
"{",
"cntnr",
".",
"select",
"(",
"'.status-bar-container'",
")",
... | Handle style for status bar | [
"Handle",
"style",
"for",
"status",
"bar"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/MutualInformationDiagram/index.js#L58-L75 |
16,547 | Kitware/paraviewweb | src/InfoViz/Native/MutualInformationDiagram/index.js | singleClick | function singleClick(d, i) {
// single click handler
const overCoords = d3.mouse(model.container);
const info = findGroupAndBin(overCoords);
if (info.radius > veryOutermostRadius) {
showAllChords();
} else if (
info.radius > outerRadius ||
... | javascript | function singleClick(d, i) {
// single click handler
const overCoords = d3.mouse(model.container);
const info = findGroupAndBin(overCoords);
if (info.radius > veryOutermostRadius) {
showAllChords();
} else if (
info.radius > outerRadius ||
... | [
"function",
"singleClick",
"(",
"d",
",",
"i",
")",
"{",
"// single click handler",
"const",
"overCoords",
"=",
"d3",
".",
"mouse",
"(",
"model",
".",
"container",
")",
";",
"const",
"info",
"=",
"findGroupAndBin",
"(",
"overCoords",
")",
";",
"if",
"(",
... | multiClicker([ | [
"multiClicker",
"(",
"["
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/MutualInformationDiagram/index.js#L748-L773 |
16,548 | Kitware/paraviewweb | src/Common/Core/CompositeClosureHelper/index.js | flushDataToListener | function flushDataToListener(dataListener, dataChanged) {
try {
if (dataListener) {
const dataToForward = dataHandler.get(
model[dataContainerName],
dataListener.request,
dataChanged
);
if (
dataToForward &&
(JSON.stringify(dataToForwar... | javascript | function flushDataToListener(dataListener, dataChanged) {
try {
if (dataListener) {
const dataToForward = dataHandler.get(
model[dataContainerName],
dataListener.request,
dataChanged
);
if (
dataToForward &&
(JSON.stringify(dataToForwar... | [
"function",
"flushDataToListener",
"(",
"dataListener",
",",
"dataChanged",
")",
"{",
"try",
"{",
"if",
"(",
"dataListener",
")",
"{",
"const",
"dataToForward",
"=",
"dataHandler",
".",
"get",
"(",
"model",
"[",
"dataContainerName",
"]",
",",
"dataListener",
"... | Internal function that will notify any subscriber with its data in a synchronous manner | [
"Internal",
"function",
"that",
"will",
"notify",
"any",
"subscriber",
"with",
"its",
"data",
"in",
"a",
"synchronous",
"manner"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Core/CompositeClosureHelper/index.js#L269-L289 |
16,549 | Kitware/paraviewweb | src/React/Containers/OverlayWindow/index.js | getMouseEventInfo | function getMouseEventInfo(event, divElt) {
const clientRect = divElt.getBoundingClientRect();
return {
relX: event.clientX - clientRect.left,
relY: event.clientY - clientRect.top,
eltBounds: clientRect,
};
} | javascript | function getMouseEventInfo(event, divElt) {
const clientRect = divElt.getBoundingClientRect();
return {
relX: event.clientX - clientRect.left,
relY: event.clientY - clientRect.top,
eltBounds: clientRect,
};
} | [
"function",
"getMouseEventInfo",
"(",
"event",
",",
"divElt",
")",
"{",
"const",
"clientRect",
"=",
"divElt",
".",
"getBoundingClientRect",
"(",
")",
";",
"return",
"{",
"relX",
":",
"event",
".",
"clientX",
"-",
"clientRect",
".",
"left",
",",
"relY",
":"... | Return extra information about the target element bounds | [
"Return",
"extra",
"information",
"about",
"the",
"target",
"element",
"bounds"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/React/Containers/OverlayWindow/index.js#L19-L26 |
16,550 | Kitware/paraviewweb | src/React/Widgets/SelectionEditorWidget/rule/index.js | ensureRuleNumbers | function ensureRuleNumbers(rule) {
if (!rule || rule.length === 0) {
return;
}
const ruleSelector = rule.type;
if (ruleSelector === 'rule') {
ensureRuleNumbers(rule.rule);
}
if (ruleSelector === 'logical') {
rule.terms.filter((r, idx) => idx > 0).forEach((r) => ensureRuleNumbers(r));
}
if ... | javascript | function ensureRuleNumbers(rule) {
if (!rule || rule.length === 0) {
return;
}
const ruleSelector = rule.type;
if (ruleSelector === 'rule') {
ensureRuleNumbers(rule.rule);
}
if (ruleSelector === 'logical') {
rule.terms.filter((r, idx) => idx > 0).forEach((r) => ensureRuleNumbers(r));
}
if ... | [
"function",
"ensureRuleNumbers",
"(",
"rule",
")",
"{",
"if",
"(",
"!",
"rule",
"||",
"rule",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
"}",
"const",
"ruleSelector",
"=",
"rule",
".",
"type",
";",
"if",
"(",
"ruleSelector",
"===",
"'rule'",
... | Edit in place | [
"Edit",
"in",
"place"
] | ebff9dbeefee70225c349077e25280c56d39920e | https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/React/Widgets/SelectionEditorWidget/rule/index.js#L27-L45 |
16,551 | CartoDB/odyssey.js | lib/odyssey/template.js | md2json | function md2json(tree) {
var slide = null;
var slides = [];
var globalProperties = {}
var elements = tree.slice(1);
for (var i = 0; i < elements.length; ++i) {
var el = elements[i];
var add = true;
if (el[0] === 'header' && el[1].level === 1) {
if (slide) slides.push(Slide(slide.md_tree, sli... | javascript | function md2json(tree) {
var slide = null;
var slides = [];
var globalProperties = {}
var elements = tree.slice(1);
for (var i = 0; i < elements.length; ++i) {
var el = elements[i];
var add = true;
if (el[0] === 'header' && el[1].level === 1) {
if (slide) slides.push(Slide(slide.md_tree, sli... | [
"function",
"md2json",
"(",
"tree",
")",
"{",
"var",
"slide",
"=",
"null",
";",
"var",
"slides",
"=",
"[",
"]",
";",
"var",
"globalProperties",
"=",
"{",
"}",
"var",
"elements",
"=",
"tree",
".",
"slice",
"(",
"1",
")",
";",
"for",
"(",
"var",
"i... | given a markdown parsed tree return a list of slides with
html and actions | [
"given",
"a",
"markdown",
"parsed",
"tree",
"return",
"a",
"list",
"of",
"slides",
"with",
"html",
"and",
"actions"
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/template.js#L239-L302 |
16,552 | CartoDB/odyssey.js | sandbox/dialog.js | addAction | function addAction(codemirror, slideNumer, action) {
// parse properties from the new actions to next compare with
// the current ones in the slide
var currentActions = O.Template.parseProperties(action);
var currentLine;
var c = 0;
var blockStart;
// search for a actions block
for (var... | javascript | function addAction(codemirror, slideNumer, action) {
// parse properties from the new actions to next compare with
// the current ones in the slide
var currentActions = O.Template.parseProperties(action);
var currentLine;
var c = 0;
var blockStart;
// search for a actions block
for (var... | [
"function",
"addAction",
"(",
"codemirror",
",",
"slideNumer",
",",
"action",
")",
"{",
"// parse properties from the new actions to next compare with",
"// the current ones in the slide",
"var",
"currentActions",
"=",
"O",
".",
"Template",
".",
"parseProperties",
"(",
"act... | adds action to slideNumber. creates it if the slide does not have any action | [
"adds",
"action",
"to",
"slideNumber",
".",
"creates",
"it",
"if",
"the",
"slide",
"does",
"not",
"have",
"any",
"action"
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/sandbox/dialog.js#L330-L381 |
16,553 | CartoDB/odyssey.js | sandbox/dialog.js | placeActionButtons | function placeActionButtons(el, codemirror) {
// search for h1's
var positions = [];
var lineNumber = 0;
codemirror.eachLine(function(a) {
if (SLIDE_REGEXP.exec(a.text)) {
positions.push({
pos: codemirror.heightAtLine(lineNumber)-66, // header height
line: lineNumbe... | javascript | function placeActionButtons(el, codemirror) {
// search for h1's
var positions = [];
var lineNumber = 0;
codemirror.eachLine(function(a) {
if (SLIDE_REGEXP.exec(a.text)) {
positions.push({
pos: codemirror.heightAtLine(lineNumber)-66, // header height
line: lineNumbe... | [
"function",
"placeActionButtons",
"(",
"el",
",",
"codemirror",
")",
"{",
"// search for h1's",
"var",
"positions",
"=",
"[",
"]",
";",
"var",
"lineNumber",
"=",
"0",
";",
"codemirror",
".",
"eachLine",
"(",
"function",
"(",
"a",
")",
"{",
"if",
"(",
"SL... | place actions buttons on the left of the beggining of each slide | [
"place",
"actions",
"buttons",
"on",
"the",
"left",
"of",
"the",
"beggining",
"of",
"each",
"slide"
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/sandbox/dialog.js#L385-L436 |
16,554 | CartoDB/odyssey.js | lib/odyssey/actions/debug.js | Debug | function Debug() {
function _debug() {};
_debug.log = function(_) {
return Action({
enter: function() {
console.log("STATE =>", _, arguments);
},
update: function() {
console.log("STATE (.)", _, arguments);
},
exit: function() {
console.log("STATE <=", ... | javascript | function Debug() {
function _debug() {};
_debug.log = function(_) {
return Action({
enter: function() {
console.log("STATE =>", _, arguments);
},
update: function() {
console.log("STATE (.)", _, arguments);
},
exit: function() {
console.log("STATE <=", ... | [
"function",
"Debug",
"(",
")",
"{",
"function",
"_debug",
"(",
")",
"{",
"}",
";",
"_debug",
".",
"log",
"=",
"function",
"(",
"_",
")",
"{",
"return",
"Action",
"(",
"{",
"enter",
":",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"\"ST... | debug action prints information about current state | [
"debug",
"action",
"prints",
"information",
"about",
"current",
"state"
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/actions/debug.js#L7-L31 |
16,555 | CartoDB/odyssey.js | lib/odyssey/actions/leaflet/map.js | leaflet_method | function leaflet_method(name) {
_map[name] = function() {
var args = arguments;
return Action(function() {
map[name].apply(map, args);
});
};
} | javascript | function leaflet_method(name) {
_map[name] = function() {
var args = arguments;
return Action(function() {
map[name].apply(map, args);
});
};
} | [
"function",
"leaflet_method",
"(",
"name",
")",
"{",
"_map",
"[",
"name",
"]",
"=",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"arguments",
";",
"return",
"Action",
"(",
"function",
"(",
")",
"{",
"map",
"[",
"name",
"]",
".",
"apply",
"(",
"ma... | helper method to translate leaflet methods to actions | [
"helper",
"method",
"to",
"translate",
"leaflet",
"methods",
"to",
"actions"
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/actions/leaflet/map.js#L9-L16 |
16,556 | CartoDB/odyssey.js | vendor/jquery.spriteanim.js | function(elem) {
// is this already initialized?
if ($(elem).data('spriteanim')) return $(elem).data('spriteanim');
var spriteanim = new SpriteAnim(elem);
$(elem).data('spriteanim', spriteanim);
return spriteanim;
} | javascript | function(elem) {
// is this already initialized?
if ($(elem).data('spriteanim')) return $(elem).data('spriteanim');
var spriteanim = new SpriteAnim(elem);
$(elem).data('spriteanim', spriteanim);
return spriteanim;
} | [
"function",
"(",
"elem",
")",
"{",
"// is this already initialized?",
"if",
"(",
"$",
"(",
"elem",
")",
".",
"data",
"(",
"'spriteanim'",
")",
")",
"return",
"$",
"(",
"elem",
")",
".",
"data",
"(",
"'spriteanim'",
")",
";",
"var",
"spriteanim",
"=",
"... | Initialize the animation for the element. | [
"Initialize",
"the",
"animation",
"for",
"the",
"element",
"."
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/vendor/jquery.spriteanim.js#L426-L433 | |
16,557 | CartoDB/odyssey.js | lib/odyssey/story.js | Edge | function Edge(a, b) {
var s = 0;
function t() {}
a._story(null, function() {
if(s !== 0) {
t.trigger();
}
s = 0;
});
b._story(null, function() {
if(s !== 1) {
t.trigger();
}
s = 1;
});
return Trigger(t);
} | javascript | function Edge(a, b) {
var s = 0;
function t() {}
a._story(null, function() {
if(s !== 0) {
t.trigger();
}
s = 0;
});
b._story(null, function() {
if(s !== 1) {
t.trigger();
}
s = 1;
});
return Trigger(t);
} | [
"function",
"Edge",
"(",
"a",
",",
"b",
")",
"{",
"var",
"s",
"=",
"0",
";",
"function",
"t",
"(",
")",
"{",
"}",
"a",
".",
"_story",
"(",
"null",
",",
"function",
"(",
")",
"{",
"if",
"(",
"s",
"!==",
"0",
")",
"{",
"t",
".",
"trigger",
... | check change between two states and triggers | [
"check",
"change",
"between",
"two",
"states",
"and",
"triggers"
] | 59e194e8cf18154d095f004e01f955b6af9348f9 | https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/story.js#L305-L321 |
16,558 | platanus/angular-restmod | src/module/support/default-packer.js | processFeature | function processFeature(_raw, _name, _feature, _other, _do) {
if(_feature === '.' || _feature === true) {
var skip = [_name];
if(_other) skip.push.apply(skip, angular.isArray(_other) ? _other : [_other]);
exclude(_raw, skip, _do);
} else if(typeof _feature === 'string') {
exclude(_raw[_f... | javascript | function processFeature(_raw, _name, _feature, _other, _do) {
if(_feature === '.' || _feature === true) {
var skip = [_name];
if(_other) skip.push.apply(skip, angular.isArray(_other) ? _other : [_other]);
exclude(_raw, skip, _do);
} else if(typeof _feature === 'string') {
exclude(_raw[_f... | [
"function",
"processFeature",
"(",
"_raw",
",",
"_name",
",",
"_feature",
",",
"_other",
",",
"_do",
")",
"{",
"if",
"(",
"_feature",
"===",
"'.'",
"||",
"_feature",
"===",
"true",
")",
"{",
"var",
"skip",
"=",
"[",
"_name",
"]",
";",
"if",
"(",
"_... | process links and stores them in the packer cache | [
"process",
"links",
"and",
"stores",
"them",
"in",
"the",
"packer",
"cache"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/support/default-packer.js#L20-L30 |
16,559 | platanus/angular-restmod | src/module/extended/builder-relations.js | applyHooks | function applyHooks(_target, _hooks, _owner) {
for(var key in _hooks) {
if(_hooks.hasOwnProperty(key)) {
_target.$on(key, wrapHook(_hooks[key], _owner));
}
}
} | javascript | function applyHooks(_target, _hooks, _owner) {
for(var key in _hooks) {
if(_hooks.hasOwnProperty(key)) {
_target.$on(key, wrapHook(_hooks[key], _owner));
}
}
} | [
"function",
"applyHooks",
"(",
"_target",
",",
"_hooks",
",",
"_owner",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"_hooks",
")",
"{",
"if",
"(",
"_hooks",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"_target",
".",
"$on",
"(",
"key",
",",
"wr... | wraps a bunch of hooks | [
"wraps",
"a",
"bunch",
"of",
"hooks"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/extended/builder-relations.js#L19-L25 |
16,560 | platanus/angular-restmod | dist/plugins/preload.js | processGroup | function processGroup(_records, _target, _params) {
// extract targets
var targets = [], record;
for(var i = 0, l = _records.length; i < l; i++) {
record = _records[i][_target];
if(angular.isArray(record)) {
targets.push.apply(targets, record);
} else if(record) {
targets.... | javascript | function processGroup(_records, _target, _params) {
// extract targets
var targets = [], record;
for(var i = 0, l = _records.length; i < l; i++) {
record = _records[i][_target];
if(angular.isArray(record)) {
targets.push.apply(targets, record);
} else if(record) {
targets.... | [
"function",
"processGroup",
"(",
"_records",
",",
"_target",
",",
"_params",
")",
"{",
"// extract targets",
"var",
"targets",
"=",
"[",
"]",
",",
"record",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"_records",
".",
"length",
";",
"i",
"<... | processes a group records of the same type | [
"processes",
"a",
"group",
"records",
"of",
"the",
"same",
"type"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/plugins/preload.js#L29-L56 |
16,561 | platanus/angular-restmod | src/module/serializer.js | function() {
return {
/**
* @memberof BuilderApi#
*
* @description Sets an attribute mapping.
*
* Allows a explicit server to model property mapping to be defined.
*
* For example, to map the response property `stats.create... | javascript | function() {
return {
/**
* @memberof BuilderApi#
*
* @description Sets an attribute mapping.
*
* Allows a explicit server to model property mapping to be defined.
*
* For example, to map the response property `stats.create... | [
"function",
"(",
")",
"{",
"return",
"{",
"/**\n * @memberof BuilderApi#\n *\n * @description Sets an attribute mapping.\n *\n * Allows a explicit server to model property mapping to be defined.\n *\n * For example, to map the respons... | builds a serializerd DSL, is a standalone object that can be extended. | [
"builds",
"a",
"serializerd",
"DSL",
"is",
"a",
"standalone",
"object",
"that",
"can",
"be",
"extended",
"."
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/serializer.js#L195-L326 | |
16,562 | platanus/angular-restmod | src/module/builder.js | function(_chain) {
for(var i = 0, l = _chain.length; i < l; i++) {
this.mixin(_chain[i]);
}
} | javascript | function(_chain) {
for(var i = 0, l = _chain.length; i < l; i++) {
this.mixin(_chain[i]);
}
} | [
"function",
"(",
"_chain",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"_chain",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"this",
".",
"mixin",
"(",
"_chain",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | use the builder to process a mixin chain | [
"use",
"the",
"builder",
"to",
"process",
"a",
"mixin",
"chain"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/builder.js#L313-L317 | |
16,563 | platanus/angular-restmod | src/module/builder.js | function(_mix) {
if(_mix.$$chain) {
this.chain(_mix.$$chain);
} else if(typeof _mix === 'string') {
this.mixin($injector.get(_mix));
} else if(isArray(_mix)) {
this.chain(_mix);
} else if(isFunction(_mix)) {
_mix.call(this.dsl, $injector);
} else {
t... | javascript | function(_mix) {
if(_mix.$$chain) {
this.chain(_mix.$$chain);
} else if(typeof _mix === 'string') {
this.mixin($injector.get(_mix));
} else if(isArray(_mix)) {
this.chain(_mix);
} else if(isFunction(_mix)) {
_mix.call(this.dsl, $injector);
} else {
t... | [
"function",
"(",
"_mix",
")",
"{",
"if",
"(",
"_mix",
".",
"$$chain",
")",
"{",
"this",
".",
"chain",
"(",
"_mix",
".",
"$$chain",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"_mix",
"===",
"'string'",
")",
"{",
"this",
".",
"mixin",
"(",
"$injec... | use the builder to process a single mixin | [
"use",
"the",
"builder",
"to",
"process",
"a",
"single",
"mixin"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/builder.js#L320-L332 | |
16,564 | platanus/angular-restmod | src/plugins/debounced.js | buildAsyncSaveFun | function buildAsyncSaveFun(_this, _oldSave, _promise, _oldPromise) {
return function() {
// swap promises so save behaves like it has been called during the original call.
var currentPromise = _this.$promise;
_this.$promise = _oldPromise;
// when save resolves, the timeout promise is resol... | javascript | function buildAsyncSaveFun(_this, _oldSave, _promise, _oldPromise) {
return function() {
// swap promises so save behaves like it has been called during the original call.
var currentPromise = _this.$promise;
_this.$promise = _oldPromise;
// when save resolves, the timeout promise is resol... | [
"function",
"buildAsyncSaveFun",
"(",
"_this",
",",
"_oldSave",
",",
"_promise",
",",
"_oldPromise",
")",
"{",
"return",
"function",
"(",
")",
"{",
"// swap promises so save behaves like it has been called during the original call.",
"var",
"currentPromise",
"=",
"_this",
... | builds a new async save function bound to a given context and promise. | [
"builds",
"a",
"new",
"async",
"save",
"function",
"bound",
"to",
"a",
"given",
"context",
"and",
"promise",
"."
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/plugins/debounced.js#L46-L67 |
16,565 | platanus/angular-restmod | dist/angular-restmod-bundle.js | applyRules | function applyRules(_string, _ruleSet, _skip) {
if(_skip.indexOf(_string.toLowerCase()) === -1) {
var i = 0, rule;
while(rule = _ruleSet[i++]) {
if(_string.match(rule[0])) {
return _string.replace(rule[0], rule[1]);
}
}
}
return _string;
} | javascript | function applyRules(_string, _ruleSet, _skip) {
if(_skip.indexOf(_string.toLowerCase()) === -1) {
var i = 0, rule;
while(rule = _ruleSet[i++]) {
if(_string.match(rule[0])) {
return _string.replace(rule[0], rule[1]);
}
}
}
return _string;
} | [
"function",
"applyRules",
"(",
"_string",
",",
"_ruleSet",
",",
"_skip",
")",
"{",
"if",
"(",
"_skip",
".",
"indexOf",
"(",
"_string",
".",
"toLowerCase",
"(",
")",
")",
"===",
"-",
"1",
")",
"{",
"var",
"i",
"=",
"0",
",",
"rule",
";",
"while",
... | helper function used by singularize and pluralize | [
"helper",
"function",
"used",
"by",
"singularize",
"and",
"pluralize"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L99-L111 |
16,566 | platanus/angular-restmod | dist/angular-restmod-bundle.js | function(_hook, _args, _ctx) {
var cbs = hooks[_hook], i, cb;
if(cbs) {
for(i = 0; !!(cb = cbs[i]); i++) {
cb.apply(_ctx || this, _args || []);
}
}
return this;
} | javascript | function(_hook, _args, _ctx) {
var cbs = hooks[_hook], i, cb;
if(cbs) {
for(i = 0; !!(cb = cbs[i]); i++) {
cb.apply(_ctx || this, _args || []);
}
}
return this;
} | [
"function",
"(",
"_hook",
",",
"_args",
",",
"_ctx",
")",
"{",
"var",
"cbs",
"=",
"hooks",
"[",
"_hook",
"]",
",",
"i",
",",
"cb",
";",
"if",
"(",
"cbs",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"!",
"!",
"(",
"cb",
"=",
"cbs",
"[",
"i",... | bubbles events comming from related resources | [
"bubbles",
"events",
"comming",
"from",
"related",
"resources"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L2819-L2827 | |
16,567 | platanus/angular-restmod | dist/angular-restmod-bundle.js | function(_items) {
var list = new List();
if(_items) list.push.apply(list, _items);
return list;
} | javascript | function(_items) {
var list = new List();
if(_items) list.push.apply(list, _items);
return list;
} | [
"function",
"(",
"_items",
")",
"{",
"var",
"list",
"=",
"new",
"List",
"(",
")",
";",
"if",
"(",
"_items",
")",
"list",
".",
"push",
".",
"apply",
"(",
"list",
",",
"_items",
")",
";",
"return",
"list",
";",
"}"
] | Creates a new record list.
A list is a ordered set of records not bound to a particular scope.
Contained records can belong to any scope.
@return {List} the new list | [
"Creates",
"a",
"new",
"record",
"list",
"."
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L2928-L2932 | |
16,568 | platanus/angular-restmod | dist/angular-restmod-bundle.js | function(_params, _scope) {
_params = this.$params ? angular.extend({}, this.$params, _params) : _params;
return newCollection(_params, _scope || this.$scope);
} | javascript | function(_params, _scope) {
_params = this.$params ? angular.extend({}, this.$params, _params) : _params;
return newCollection(_params, _scope || this.$scope);
} | [
"function",
"(",
"_params",
",",
"_scope",
")",
"{",
"_params",
"=",
"this",
".",
"$params",
"?",
"angular",
".",
"extend",
"(",
"{",
"}",
",",
"this",
".",
"$params",
",",
"_params",
")",
":",
"_params",
";",
"return",
"newCollection",
"(",
"_params",... | provide collection constructor | [
"provide",
"collection",
"constructor"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L3116-L3119 | |
16,569 | platanus/angular-restmod | dist/angular-restmod-bundle.js | helpDefine | function helpDefine(_api, _name, _fun) {
var api = APIS[_api];
Utils.assert(!!api, 'Invalid api name $1', _api);
if(_name) {
api[_name] = Utils.override(api[_name], _fun);
} else {
Utils.extendOverriden(api, _fun);
}
} | javascript | function helpDefine(_api, _name, _fun) {
var api = APIS[_api];
Utils.assert(!!api, 'Invalid api name $1', _api);
if(_name) {
api[_name] = Utils.override(api[_name], _fun);
} else {
Utils.extendOverriden(api, _fun);
}
} | [
"function",
"helpDefine",
"(",
"_api",
",",
"_name",
",",
"_fun",
")",
"{",
"var",
"api",
"=",
"APIS",
"[",
"_api",
"]",
";",
"Utils",
".",
"assert",
"(",
"!",
"!",
"api",
",",
"'Invalid api name $1'",
",",
"_api",
")",
";",
"if",
"(",
"_name",
")"... | helper used to extend api's | [
"helper",
"used",
"to",
"extend",
"api",
"s"
] | ed18b4da48fca7582edb8bcbcca91ef3177adf0b | https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L3154-L3164 |
16,570 | adonisjs/adonis-bodyparser | src/Bindings/Validations.js | validateFile | async function validateFile (file, options) {
if (file instanceof File === false) {
return null
}
await file.setOptions(Object.assign(file.validationOptions, options)).runValidations()
return _.size(file.error()) ? file.error().message : null
} | javascript | async function validateFile (file, options) {
if (file instanceof File === false) {
return null
}
await file.setOptions(Object.assign(file.validationOptions, options)).runValidations()
return _.size(file.error()) ? file.error().message : null
} | [
"async",
"function",
"validateFile",
"(",
"file",
",",
"options",
")",
"{",
"if",
"(",
"file",
"instanceof",
"File",
"===",
"false",
")",
"{",
"return",
"null",
"}",
"await",
"file",
".",
"setOptions",
"(",
"Object",
".",
"assign",
"(",
"file",
".",
"v... | Validates a single file instance. If validation has error, then error
message will be returned as string, else null is returned.
@method validateFile
@param {File} file
@param {Object} options
@return {String|Null} | [
"Validates",
"a",
"single",
"file",
"instance",
".",
"If",
"validation",
"has",
"error",
"then",
"error",
"message",
"will",
"be",
"returned",
"as",
"string",
"else",
"null",
"is",
"returned",
"."
] | 11efb935e382c68da531da28d32d9b3d821338da | https://github.com/adonisjs/adonis-bodyparser/blob/11efb935e382c68da531da28d32d9b3d821338da/src/Bindings/Validations.js#L24-L31 |
16,571 | adonisjs/adonis-bodyparser | src/Multipart/File.js | function (type, data) {
if (type === 'size') {
return `File size should be less than ${bytes(data.size)}`
}
if (type === 'type') {
const verb = data.types.length === 1 ? 'is' : 'are'
return `Invalid file type ${data.subtype} or ${data.type}. Only ${data.types.join(', ')} ${verb} allowed`
}
if (t... | javascript | function (type, data) {
if (type === 'size') {
return `File size should be less than ${bytes(data.size)}`
}
if (type === 'type') {
const verb = data.types.length === 1 ? 'is' : 'are'
return `Invalid file type ${data.subtype} or ${data.type}. Only ${data.types.join(', ')} ${verb} allowed`
}
if (t... | [
"function",
"(",
"type",
",",
"data",
")",
"{",
"if",
"(",
"type",
"===",
"'size'",
")",
"{",
"return",
"`",
"${",
"bytes",
"(",
"data",
".",
"size",
")",
"}",
"`",
"}",
"if",
"(",
"type",
"===",
"'type'",
")",
"{",
"const",
"verb",
"=",
"data"... | Returns the error string for given error
type
@method getError
@param {String} type
@param {Object} data
@return {String} | [
"Returns",
"the",
"error",
"string",
"for",
"given",
"error",
"type"
] | 11efb935e382c68da531da28d32d9b3d821338da | https://github.com/adonisjs/adonis-bodyparser/blob/11efb935e382c68da531da28d32d9b3d821338da/src/Multipart/File.js#L40-L54 | |
16,572 | tikonen/blog | mine/js/game.js | _empty | function _empty( x, y, force ) {
if ( x < 0 || x >= that.width || y < 0 || y >= that.height ) return;
var pos = that.pos(x, y);
var d = that.grid[pos];
if (d && (d & SLAB_MASK) && (force || !(d & APPLE_MASK))) {
that.grid[pos] &= ~SLAB_MASK; // clear ou... | javascript | function _empty( x, y, force ) {
if ( x < 0 || x >= that.width || y < 0 || y >= that.height ) return;
var pos = that.pos(x, y);
var d = that.grid[pos];
if (d && (d & SLAB_MASK) && (force || !(d & APPLE_MASK))) {
that.grid[pos] &= ~SLAB_MASK; // clear ou... | [
"function",
"_empty",
"(",
"x",
",",
"y",
",",
"force",
")",
"{",
"if",
"(",
"x",
"<",
"0",
"||",
"x",
">=",
"that",
".",
"width",
"||",
"y",
"<",
"0",
"||",
"y",
">=",
"that",
".",
"height",
")",
"return",
";",
"var",
"pos",
"=",
"that",
"... | Check where click hit Recursive function to clear empty areas | [
"Check",
"where",
"click",
"hit",
"Recursive",
"function",
"to",
"clear",
"empty",
"areas"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/mine/js/game.js#L182-L204 |
16,573 | tikonen/blog | simplehttpserver/simplehttpserver.js | directoryHTML | function directoryHTML( res, urldir, pathname, list ) {
var ulist = [];
function sendHTML( list ) {
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.send('<!DOCTYPE html>' +
'<html>\n' +
'<title>Directory listing for '+htmlsafe(urldir)+'</title>\n' +
'<body>... | javascript | function directoryHTML( res, urldir, pathname, list ) {
var ulist = [];
function sendHTML( list ) {
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.send('<!DOCTYPE html>' +
'<html>\n' +
'<title>Directory listing for '+htmlsafe(urldir)+'</title>\n' +
'<body>... | [
"function",
"directoryHTML",
"(",
"res",
",",
"urldir",
",",
"pathname",
",",
"list",
")",
"{",
"var",
"ulist",
"=",
"[",
"]",
";",
"function",
"sendHTML",
"(",
"list",
")",
"{",
"res",
".",
"setHeader",
"(",
"'Content-Type'",
",",
"'text/html; charset=utf... | Reads directory content and builds HTML response | [
"Reads",
"directory",
"content",
"and",
"builds",
"HTML",
"response"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/simplehttpserver/simplehttpserver.js#L142-L184 |
16,574 | tikonen/blog | slot5/js/slot.js | _check | function _check(err, id) {
updateProgress(1);
if (err) {
alert('Failed to load ' + id + ': ' + err);
}
loadc++;
if (itemc == loadc) callback();
} | javascript | function _check(err, id) {
updateProgress(1);
if (err) {
alert('Failed to load ' + id + ': ' + err);
}
loadc++;
if (itemc == loadc) callback();
} | [
"function",
"_check",
"(",
"err",
",",
"id",
")",
"{",
"updateProgress",
"(",
"1",
")",
";",
"if",
"(",
"err",
")",
"{",
"alert",
"(",
"'Failed to load '",
"+",
"id",
"+",
"': '",
"+",
"err",
")",
";",
"}",
"loadc",
"++",
";",
"if",
"(",
"itemc",... | called by preloadFunction to notify result | [
"called",
"by",
"preloadFunction",
"to",
"notify",
"result"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L31-L38 |
16,575 | tikonen/blog | slot5/js/slot.js | _fill_canvas | function _fill_canvas(canvas, items) {
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#ddd';
for (var i = 0; i < ITEM_COUNT; i++) {
var asset = items[i];
ctx.save();
ctx.shadowColor = "rgba(0,0,0,0.5)";
ctx.shadowO... | javascript | function _fill_canvas(canvas, items) {
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#ddd';
for (var i = 0; i < ITEM_COUNT; i++) {
var asset = items[i];
ctx.save();
ctx.shadowColor = "rgba(0,0,0,0.5)";
ctx.shadowO... | [
"function",
"_fill_canvas",
"(",
"canvas",
",",
"items",
")",
"{",
"var",
"ctx",
"=",
"canvas",
".",
"getContext",
"(",
"'2d'",
")",
";",
"ctx",
".",
"fillStyle",
"=",
"'#ddd'",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ITEM_COUNT",
";... | all loaded draws canvas strip | [
"all",
"loaded",
"draws",
"canvas",
"strip"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L289-L306 |
16,576 | tikonen/blog | slot5/js/slot.js | _find | function _find( items, id ) {
for ( var i=0; i < items.length; i++ ) {
if (items[i].id == id) return i;
}
} | javascript | function _find( items, id ) {
for ( var i=0; i < items.length; i++ ) {
if (items[i].id == id) return i;
}
} | [
"function",
"_find",
"(",
"items",
",",
"id",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"items",
"[",
"i",
"]",
".",
"id",
"==",
"id",
")",
"return",
"i",
";",
... | function locates id from items | [
"function",
"locates",
"id",
"from",
"items"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L400-L404 |
16,577 | tikonen/blog | slot5/js/slot.js | _check_slot | function _check_slot(offset, result) {
if (now - that.lastUpdate > SPINTIME) {
var c = parseInt(Math.abs(offset / SLOT_HEIGHT)) % ITEM_COUNT;
if (c == result) {
if (result == 0) {
if (Math.abs(offset + (ITEM_COUNT * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) ... | javascript | function _check_slot(offset, result) {
if (now - that.lastUpdate > SPINTIME) {
var c = parseInt(Math.abs(offset / SLOT_HEIGHT)) % ITEM_COUNT;
if (c == result) {
if (result == 0) {
if (Math.abs(offset + (ITEM_COUNT * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) ... | [
"function",
"_check_slot",
"(",
"offset",
",",
"result",
")",
"{",
"if",
"(",
"now",
"-",
"that",
".",
"lastUpdate",
">",
"SPINTIME",
")",
"{",
"var",
"c",
"=",
"parseInt",
"(",
"Math",
".",
"abs",
"(",
"offset",
"/",
"SLOT_HEIGHT",
")",
")",
"%",
... | Check slot status and if spun long enough stop it on result | [
"Check",
"slot",
"status",
"and",
"if",
"spun",
"long",
"enough",
"stop",
"it",
"on",
"result"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L478-L492 |
16,578 | tikonen/blog | slot2/js/slot.js | initAudio | function initAudio( audios, callback ) {
var format = 'mp3';
var elem = document.createElement('audio');
if ( elem ) {
// Check if we can play mp3, if not then fall back to ogg
if( !elem.canPlayType( 'audio/mpeg;' ) && elem.canPlayType('audio/ogg;')) format = 'ogg';
}
var AudioCont... | javascript | function initAudio( audios, callback ) {
var format = 'mp3';
var elem = document.createElement('audio');
if ( elem ) {
// Check if we can play mp3, if not then fall back to ogg
if( !elem.canPlayType( 'audio/mpeg;' ) && elem.canPlayType('audio/ogg;')) format = 'ogg';
}
var AudioCont... | [
"function",
"initAudio",
"(",
"audios",
",",
"callback",
")",
"{",
"var",
"format",
"=",
"'mp3'",
";",
"var",
"elem",
"=",
"document",
".",
"createElement",
"(",
"'audio'",
")",
";",
"if",
"(",
"elem",
")",
"{",
"// Check if we can play mp3, if not then fall b... | Initializes audio and loads audio files | [
"Initializes",
"audio",
"and",
"loads",
"audio",
"files"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot2/js/slot.js#L156-L185 |
16,579 | tikonen/blog | drive/js/drive.js | _build_object | function _build_object( game, x, y, speed ) {
var car_asset = game.carAssets[parseInt(Math.random()*game.carAssets.length)]
var framex = car_asset.w * parseInt(Math.random() * car_asset.count);
return {
collided: 0,
width: car_asset.w,
height: car_asset.h,
img: car_asset.img,
framex: framex,
pos: {
... | javascript | function _build_object( game, x, y, speed ) {
var car_asset = game.carAssets[parseInt(Math.random()*game.carAssets.length)]
var framex = car_asset.w * parseInt(Math.random() * car_asset.count);
return {
collided: 0,
width: car_asset.w,
height: car_asset.h,
img: car_asset.img,
framex: framex,
pos: {
... | [
"function",
"_build_object",
"(",
"game",
",",
"x",
",",
"y",
",",
"speed",
")",
"{",
"var",
"car_asset",
"=",
"game",
".",
"carAssets",
"[",
"parseInt",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"game",
".",
"carAssets",
".",
"length",
")",
"]",
... | Add car in game | [
"Add",
"car",
"in",
"game"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/drive/js/drive.js#L161-L208 |
16,580 | tikonen/blog | biased/biased.js | select | function select(elems) {
var r = Math.random();
var ref = 0;
for(var i=0; i < elems.length; i++) {
var elem= elems[i];
ref += elem[1];
if (r < ref) return elem[0];
}
// This happens only if probabilities don't add up to 1
return null;
} | javascript | function select(elems) {
var r = Math.random();
var ref = 0;
for(var i=0; i < elems.length; i++) {
var elem= elems[i];
ref += elem[1];
if (r < ref) return elem[0];
}
// This happens only if probabilities don't add up to 1
return null;
} | [
"function",
"select",
"(",
"elems",
")",
"{",
"var",
"r",
"=",
"Math",
".",
"random",
"(",
")",
";",
"var",
"ref",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elems",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"ele... | Biased random entry selection | [
"Biased",
"random",
"entry",
"selection"
] | 4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae | https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/biased/biased.js#L4-L16 |
16,581 | bustle/shep | src/util/aws/lambda.js | configStripper | function configStripper (c) {
return {
DeadLetterConfig: c.DeadLetterConfig,
Description: c.Description,
Environment: c.Environment,
Handler: c.Handler,
MemorySize: c.MemorySize,
Role: c.Role,
Runtime: c.Runtime,
Timeout: c.Timeout,
TracingConfig: c.TracingConfig
}
} | javascript | function configStripper (c) {
return {
DeadLetterConfig: c.DeadLetterConfig,
Description: c.Description,
Environment: c.Environment,
Handler: c.Handler,
MemorySize: c.MemorySize,
Role: c.Role,
Runtime: c.Runtime,
Timeout: c.Timeout,
TracingConfig: c.TracingConfig
}
} | [
"function",
"configStripper",
"(",
"c",
")",
"{",
"return",
"{",
"DeadLetterConfig",
":",
"c",
".",
"DeadLetterConfig",
",",
"Description",
":",
"c",
".",
"Description",
",",
"Environment",
":",
"c",
".",
"Environment",
",",
"Handler",
":",
"c",
".",
"Hand... | should beef this up for VpcConfig can only pass SecurityGroupIds and SubnetIds | [
"should",
"beef",
"this",
"up",
"for",
"VpcConfig",
"can",
"only",
"pass",
"SecurityGroupIds",
"and",
"SubnetIds"
] | a5bbdd27209f5079c12eb98a456d2a2f91a4af8a | https://github.com/bustle/shep/blob/a5bbdd27209f5079c12eb98a456d2a2f91a4af8a/src/util/aws/lambda.js#L160-L172 |
16,582 | TencentWSRD/connect-cas2 | lib/validate.js | validateTicket | function validateTicket(req, options, callback) {
var query = {
service: utils.getPath('service', options),
ticket: req.query.ticket
};
var logger = utils.getLogger(req, options);
if (options.paths.proxyCallback) query.pgtUrl = utils.getPath('pgtUrl', options);
var casServerValidPath = utils.getPath... | javascript | function validateTicket(req, options, callback) {
var query = {
service: utils.getPath('service', options),
ticket: req.query.ticket
};
var logger = utils.getLogger(req, options);
if (options.paths.proxyCallback) query.pgtUrl = utils.getPath('pgtUrl', options);
var casServerValidPath = utils.getPath... | [
"function",
"validateTicket",
"(",
"req",
",",
"options",
",",
"callback",
")",
"{",
"var",
"query",
"=",
"{",
"service",
":",
"utils",
".",
"getPath",
"(",
"'service'",
",",
"options",
")",
",",
"ticket",
":",
"req",
".",
"query",
".",
"ticket",
"}",
... | Validate ticket from CAS server
@param req
@param options
@param callback | [
"Validate",
"ticket",
"from",
"CAS",
"server"
] | b01415629abc08bb4a462873c0d53577481bd52d | https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/validate.js#L151-L175 |
16,583 | TencentWSRD/connect-cas2 | lib/validate.js | retrievePGTFromPGTIOU | function retrievePGTFromPGTIOU(req, res, callback, pgtIou, options) {
var logger = utils.getLogger(req, options);
logger.info('Trying to retrieve pgtId from pgtIou...');
req.sessionStore.get(pgtIou, function(err, session) {
/* istanbul ignore if */
if (err) {
logger.error('Get pgtId from sessionSto... | javascript | function retrievePGTFromPGTIOU(req, res, callback, pgtIou, options) {
var logger = utils.getLogger(req, options);
logger.info('Trying to retrieve pgtId from pgtIou...');
req.sessionStore.get(pgtIou, function(err, session) {
/* istanbul ignore if */
if (err) {
logger.error('Get pgtId from sessionSto... | [
"function",
"retrievePGTFromPGTIOU",
"(",
"req",
",",
"res",
",",
"callback",
",",
"pgtIou",
",",
"options",
")",
"{",
"var",
"logger",
"=",
"utils",
".",
"getLogger",
"(",
"req",
",",
"options",
")",
";",
"logger",
".",
"info",
"(",
"'Trying to retrieve p... | Find PGT by PGTIOU
@param req
@param res
@param callback
@param pgtIou
@param options | [
"Find",
"PGT",
"by",
"PGTIOU"
] | b01415629abc08bb4a462873c0d53577481bd52d | https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/validate.js#L231-L292 |
16,584 | TencentWSRD/connect-cas2 | lib/getProxyTicket.js | requestPT | function requestPT(path, callback, retryHandler) {
logger.info('Trying to request proxy ticket from ', proxyPath);
var startTime = Date.now();
utils.getRequest(path, function(err, response) {
/* istanbul ignore if */
logger.access('|GET|' + path + '|' + (err ? 500 : response.status) + "|" + (Da... | javascript | function requestPT(path, callback, retryHandler) {
logger.info('Trying to request proxy ticket from ', proxyPath);
var startTime = Date.now();
utils.getRequest(path, function(err, response) {
/* istanbul ignore if */
logger.access('|GET|' + path + '|' + (err ? 500 : response.status) + "|" + (Da... | [
"function",
"requestPT",
"(",
"path",
",",
"callback",
",",
"retryHandler",
")",
"{",
"logger",
".",
"info",
"(",
"'Trying to request proxy ticket from '",
",",
"proxyPath",
")",
";",
"var",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"utils",
".",
... | Request a proxy ticket
@param req
@param path
@param callback
@param {Function} retryHandler If this callback is set, it will be called only if request failed due to authentication issue. | [
"Request",
"a",
"proxy",
"ticket"
] | b01415629abc08bb4a462873c0d53577481bd52d | https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/getProxyTicket.js#L159-L191 |
16,585 | TencentWSRD/connect-cas2 | lib/utils.js | isMatchRule | function isMatchRule(req, pathname, rule) {
if (typeof rule === 'string') {
return pathname.indexOf(rule) > -1;
} else if (rule instanceof RegExp) {
return rule.test(pathname);
} else if (typeof rule === 'function') {
return rule(pathname, req);
}
} | javascript | function isMatchRule(req, pathname, rule) {
if (typeof rule === 'string') {
return pathname.indexOf(rule) > -1;
} else if (rule instanceof RegExp) {
return rule.test(pathname);
} else if (typeof rule === 'function') {
return rule(pathname, req);
}
} | [
"function",
"isMatchRule",
"(",
"req",
",",
"pathname",
",",
"rule",
")",
"{",
"if",
"(",
"typeof",
"rule",
"===",
"'string'",
")",
"{",
"return",
"pathname",
".",
"indexOf",
"(",
"rule",
")",
">",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"rule",
"in... | Return `true` when pathname match the rule.
@param req
@param pathname
@param rule
@returns {*} | [
"Return",
"true",
"when",
"pathname",
"match",
"the",
"rule",
"."
] | b01415629abc08bb4a462873c0d53577481bd52d | https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/utils.js#L16-L24 |
16,586 | TencentWSRD/connect-cas2 | lib/utils.js | shouldIgnore | function shouldIgnore(req, options) {
var logger = getLogger(req, options);
if (options.match && options.match.splice && options.match.length) {
var matchedRule;
var hasMatch = options.match.some(function (rule) {
matchedRule = rule;
return isMatchRule(req, req.path, rule);
});
if (hasM... | javascript | function shouldIgnore(req, options) {
var logger = getLogger(req, options);
if (options.match && options.match.splice && options.match.length) {
var matchedRule;
var hasMatch = options.match.some(function (rule) {
matchedRule = rule;
return isMatchRule(req, req.path, rule);
});
if (hasM... | [
"function",
"shouldIgnore",
"(",
"req",
",",
"options",
")",
"{",
"var",
"logger",
"=",
"getLogger",
"(",
"req",
",",
"options",
")",
";",
"if",
"(",
"options",
".",
"match",
"&&",
"options",
".",
"match",
".",
"splice",
"&&",
"options",
".",
"match",
... | Check options.match first, if match, return `false`, then check the options.ignore, if match, return `true`.
If returned `true`, then this request will bypass CAS directly.
@param req
@param options
@param logger | [
"Check",
"options",
".",
"match",
"first",
"if",
"match",
"return",
"false",
"then",
"check",
"the",
"options",
".",
"ignore",
"if",
"match",
"return",
"true",
"."
] | b01415629abc08bb4a462873c0d53577481bd52d | https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/utils.js#L53-L86 |
16,587 | TencentWSRD/connect-cas2 | lib/utils.js | getRequest | function getRequest(path, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {
method: 'get'
};
} else {
options.method = 'get';
}
if (options.params) {
var uri = url.parse(path, true);
uri.query = _.merge({}, uri.query, options.params);
pa... | javascript | function getRequest(path, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {
method: 'get'
};
} else {
options.method = 'get';
}
if (options.params) {
var uri = url.parse(path, true);
uri.query = _.merge({}, uri.query, options.params);
pa... | [
"function",
"getRequest",
"(",
"path",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"method",
":",
"'get'",
"}",
";",
"}",
"else",
"{",
... | Send a GET request
@param path
@param {Object} options (Optional)
@param callback | [
"Send",
"a",
"GET",
"request"
] | b01415629abc08bb4a462873c0d53577481bd52d | https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/utils.js#L108-L126 |
16,588 | DScheglov/mongoose-schema-jsonschema | lib/schema.js | schema_jsonSchema | function schema_jsonSchema(name) {
let result;
name = name || this.options.name;
if (this.__buildingSchema) {
this.__jsonSchemaId =
this.__jsonSchemaId ||
'#schema-' + (++schema_jsonSchema.__jsonSchemaIdCounter);
return {'$ref': this.__jsonSchemaId}
}
if (!this.__jsonSchem... | javascript | function schema_jsonSchema(name) {
let result;
name = name || this.options.name;
if (this.__buildingSchema) {
this.__jsonSchemaId =
this.__jsonSchemaId ||
'#schema-' + (++schema_jsonSchema.__jsonSchemaIdCounter);
return {'$ref': this.__jsonSchemaId}
}
if (!this.__jsonSchem... | [
"function",
"schema_jsonSchema",
"(",
"name",
")",
"{",
"let",
"result",
";",
"name",
"=",
"name",
"||",
"this",
".",
"options",
".",
"name",
";",
"if",
"(",
"this",
".",
"__buildingSchema",
")",
"{",
"this",
".",
"__jsonSchemaId",
"=",
"this",
".",
"_... | schema_jsonSchema - builds the json schema based on the Mongooose schema.
if schema has been already built the method returns new deep copy
Method considers the `schema.options.toJSON.virtuals` to included
the virtual paths (without detailed description)
@memberof mongoose.Schema
@param {String} name Name of the ob... | [
"schema_jsonSchema",
"-",
"builds",
"the",
"json",
"schema",
"based",
"on",
"the",
"Mongooose",
"schema",
".",
"if",
"schema",
"has",
"been",
"already",
"built",
"the",
"method",
"returns",
"new",
"deep",
"copy"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/schema.js#L19-L51 |
16,589 | DScheglov/mongoose-schema-jsonschema | lib/types.js | simpleType_jsonSchema | function simpleType_jsonSchema(name) {
var result = {};
result.type = this.instance.toLowerCase();
__processOptions(result, this.options)
return result;
} | javascript | function simpleType_jsonSchema(name) {
var result = {};
result.type = this.instance.toLowerCase();
__processOptions(result, this.options)
return result;
} | [
"function",
"simpleType_jsonSchema",
"(",
"name",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"result",
".",
"type",
"=",
"this",
".",
"instance",
".",
"toLowerCase",
"(",
")",
";",
"__processOptions",
"(",
"result",
",",
"this",
".",
"options",
")",
... | simpleType_jsonSchema - returns jsonSchema for simple-type parameter
@memberof mongoose.Schema.Types.String
@param {String} name the name of parameter
@return {object} the jsonSchema for parameter | [
"simpleType_jsonSchema",
"-",
"returns",
"jsonSchema",
"for",
"simple",
"-",
"type",
"parameter"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L18-L25 |
16,590 | DScheglov/mongoose-schema-jsonschema | lib/types.js | objectId_jsonSchema | function objectId_jsonSchema(name) {
var result = simpleType_jsonSchema.call(this, name);
result.type = 'string';
result.pattern = '^[0-9a-fA-F]{24}$';
return result;
} | javascript | function objectId_jsonSchema(name) {
var result = simpleType_jsonSchema.call(this, name);
result.type = 'string';
result.pattern = '^[0-9a-fA-F]{24}$';
return result;
} | [
"function",
"objectId_jsonSchema",
"(",
"name",
")",
"{",
"var",
"result",
"=",
"simpleType_jsonSchema",
".",
"call",
"(",
"this",
",",
"name",
")",
";",
"result",
".",
"type",
"=",
"'string'",
";",
"result",
".",
"pattern",
"=",
"'^[0-9a-fA-F]{24}$'",
";",
... | objectId_jsonSchema - returns the jsonSchema for ObjectId parameters
@memberof mongoose.Schema.Types.ObjectId
@param {String} name the name of parameter
@return {object} the jsonSchema for parameter | [
"objectId_jsonSchema",
"-",
"returns",
"the",
"jsonSchema",
"for",
"ObjectId",
"parameters"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L36-L44 |
16,591 | DScheglov/mongoose-schema-jsonschema | lib/types.js | date_jsonSchema | function date_jsonSchema(name) {
var result = simpleType_jsonSchema.call(this, name);
result.type = 'string';
result.format = 'date-time';
return result;
} | javascript | function date_jsonSchema(name) {
var result = simpleType_jsonSchema.call(this, name);
result.type = 'string';
result.format = 'date-time';
return result;
} | [
"function",
"date_jsonSchema",
"(",
"name",
")",
"{",
"var",
"result",
"=",
"simpleType_jsonSchema",
".",
"call",
"(",
"this",
",",
"name",
")",
";",
"result",
".",
"type",
"=",
"'string'",
";",
"result",
".",
"format",
"=",
"'date-time'",
";",
"return",
... | date_jsonSchema - description
@param {type} name description
@return {type} description | [
"date_jsonSchema",
"-",
"description"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L53-L61 |
16,592 | DScheglov/mongoose-schema-jsonschema | lib/types.js | array_jsonSchema | function array_jsonSchema(name) {
var result = {};
var itemName;
itemName = 'itemOf_' + name;
result.type = 'array';
if (this.options.required) result.__required = true;
if (this.schema) {
result.items = this.schema.jsonSchema(itemName);
} else {
result.items = this.caster.jsonSchem... | javascript | function array_jsonSchema(name) {
var result = {};
var itemName;
itemName = 'itemOf_' + name;
result.type = 'array';
if (this.options.required) result.__required = true;
if (this.schema) {
result.items = this.schema.jsonSchema(itemName);
} else {
result.items = this.caster.jsonSchem... | [
"function",
"array_jsonSchema",
"(",
"name",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"var",
"itemName",
";",
"itemName",
"=",
"'itemOf_'",
"+",
"name",
";",
"result",
".",
"type",
"=",
"'array'",
";",
"if",
"(",
"this",
".",
"options",
".",
"r... | array_jsonSchema - returns jsonSchema for array parameters
@memberof mongoose.Schema.Types.SchemaArray
@memberof mongoose.Schema.Types.DocumentArray
@param {String} name parameter name
@return {object} json schema | [
"array_jsonSchema",
"-",
"returns",
"jsonSchema",
"for",
"array",
"parameters"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L73-L96 |
16,593 | DScheglov/mongoose-schema-jsonschema | lib/types.js | mixed_jsonSchema | function mixed_jsonSchema(name) {
var result = __describe(name, this.options.type);
__processOptions(result, this.options);
return result;
} | javascript | function mixed_jsonSchema(name) {
var result = __describe(name, this.options.type);
__processOptions(result, this.options);
return result;
} | [
"function",
"mixed_jsonSchema",
"(",
"name",
")",
"{",
"var",
"result",
"=",
"__describe",
"(",
"name",
",",
"this",
".",
"options",
".",
"type",
")",
";",
"__processOptions",
"(",
"result",
",",
"this",
".",
"options",
")",
";",
"return",
"result",
";",... | mixed_jsonSchema - returns jsonSchema for Mixed parameter
@memberof mongoose.Schema.Types.Mixed
@param {String} name parameter name
@return {object} json schema | [
"mixed_jsonSchema",
"-",
"returns",
"jsonSchema",
"for",
"Mixed",
"parameter"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L107-L111 |
16,594 | DScheglov/mongoose-schema-jsonschema | lib/model.js | model_jsonSchema | function model_jsonSchema(fields, populate, readonly) {
var jsonSchema = this.schema.jsonSchema(this.modelName);
if (populate != null) {
jsonSchema = __populate.call(this, jsonSchema, populate);
};
__excludedPaths(this.schema, fields).forEach(
__delPath.bind(null, jsonSchema)
);
if (re... | javascript | function model_jsonSchema(fields, populate, readonly) {
var jsonSchema = this.schema.jsonSchema(this.modelName);
if (populate != null) {
jsonSchema = __populate.call(this, jsonSchema, populate);
};
__excludedPaths(this.schema, fields).forEach(
__delPath.bind(null, jsonSchema)
);
if (re... | [
"function",
"model_jsonSchema",
"(",
"fields",
",",
"populate",
",",
"readonly",
")",
"{",
"var",
"jsonSchema",
"=",
"this",
".",
"schema",
".",
"jsonSchema",
"(",
"this",
".",
"modelName",
")",
";",
"if",
"(",
"populate",
"!=",
"null",
")",
"{",
"jsonSc... | model_jsonSchema - builds json schema for model considering
the selection and population
if `fields` specified the method removes `required` contraints
@memberof mongoose.Model
@param {String|Array|Object} fields mongoose selection object
@param {String|Object} populate mongoose population options
@return {objec... | [
"model_jsonSchema",
"-",
"builds",
"json",
"schema",
"for",
"model",
"considering",
"the",
"selection",
"and",
"population"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/model.js#L20-L38 |
16,595 | DScheglov/mongoose-schema-jsonschema | lib/query.js | query_jsonSchema | function query_jsonSchema() {
let populate = this._mongooseOptions.populate;
if (populate) {
populate = Object.keys(populate).map(k => populate[k]);
}
let jsonSchema = this.model.jsonSchema(
this._fields, populate
);
delete jsonSchema.required;
if (this.op.indexOf('findOne') === 0) re... | javascript | function query_jsonSchema() {
let populate = this._mongooseOptions.populate;
if (populate) {
populate = Object.keys(populate).map(k => populate[k]);
}
let jsonSchema = this.model.jsonSchema(
this._fields, populate
);
delete jsonSchema.required;
if (this.op.indexOf('findOne') === 0) re... | [
"function",
"query_jsonSchema",
"(",
")",
"{",
"let",
"populate",
"=",
"this",
".",
"_mongooseOptions",
".",
"populate",
";",
"if",
"(",
"populate",
")",
"{",
"populate",
"=",
"Object",
".",
"keys",
"(",
"populate",
")",
".",
"map",
"(",
"k",
"=>",
"po... | query_jsonSchema - returns json schema considering the query type and options
@return {Object} json schema | [
"query_jsonSchema",
"-",
"returns",
"json",
"schema",
"considering",
"the",
"query",
"type",
"and",
"options"
] | b1a844644553420d2dad341bd55cfce966922ca0 | https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/query.js#L14-L40 |
16,596 | browserify/node-util | util.js | callbackified | function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== 'function') {
throw new TypeError('The last argument must be of type Function');
}
var self = this;
var cb = fun... | javascript | function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== 'function') {
throw new TypeError('The last argument must be of type Function');
}
var self = this;
var cb = fun... | [
"function",
"callbackified",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"args",
".",
"push",
"(",
"arguments",
"[",
"i",
"]",
")",
"... | We DO NOT return the promise as it gives the user a false sense that the promise is actually somehow related to the callback's execution and that the callback throwing will reject the promise. | [
"We",
"DO",
"NOT",
"return",
"the",
"promise",
"as",
"it",
"gives",
"the",
"user",
"a",
"false",
"sense",
"that",
"the",
"promise",
"is",
"actually",
"somehow",
"related",
"to",
"the",
"callback",
"s",
"execution",
"and",
"that",
"the",
"callback",
"throwi... | 53026a2923edeaa0a113f479298f555b761f8042 | https://github.com/browserify/node-util/blob/53026a2923edeaa0a113f479298f555b761f8042/util.js#L682-L701 |
16,597 | waldophotos/kafka-avro | lib/schema-registry.js | typeFromSchemaResponse | function typeFromSchemaResponse(schema, parseOptions) {
var schemaType = avro.parse(schema);
//check if the schema has been previouisly parsed and added to the registry
if(typeof parseOptions.registry === 'object' && typeof parseOptions.registry[schemaType.name] !== 'undefined'){
return parseOptions.registry... | javascript | function typeFromSchemaResponse(schema, parseOptions) {
var schemaType = avro.parse(schema);
//check if the schema has been previouisly parsed and added to the registry
if(typeof parseOptions.registry === 'object' && typeof parseOptions.registry[schemaType.name] !== 'undefined'){
return parseOptions.registry... | [
"function",
"typeFromSchemaResponse",
"(",
"schema",
",",
"parseOptions",
")",
"{",
"var",
"schemaType",
"=",
"avro",
".",
"parse",
"(",
"schema",
")",
";",
"//check if the schema has been previouisly parsed and added to the registry",
"if",
"(",
"typeof",
"parseOptions",... | Get the avro RecordType from a schema response.
@return {RecordType} An avro RecordType representing the parsed avro schema. | [
"Get",
"the",
"avro",
"RecordType",
"from",
"a",
"schema",
"response",
"."
] | 116b516561348bdc95c13c378da86cb4e335dcd6 | https://github.com/waldophotos/kafka-avro/blob/116b516561348bdc95c13c378da86cb4e335dcd6/lib/schema-registry.js#L100-L109 |
16,598 | markusslima/bootstrap-filestyle | src/bootstrap-filestyle.js | function() {
var content = '', files = [];
if (this.$element[0].files === undefined) {
files[0] = {
'name' : this.$element[0] && this.$element[0].value
};
} else {
files = this.$element[0].files;
}
for (var i = 0; i < files.length; i++) {
content += files[i].name.split("\\").pop() +... | javascript | function() {
var content = '', files = [];
if (this.$element[0].files === undefined) {
files[0] = {
'name' : this.$element[0] && this.$element[0].value
};
} else {
files = this.$element[0].files;
}
for (var i = 0; i < files.length; i++) {
content += files[i].name.split("\\").pop() +... | [
"function",
"(",
")",
"{",
"var",
"content",
"=",
"''",
",",
"files",
"=",
"[",
"]",
";",
"if",
"(",
"this",
".",
"$element",
"[",
"0",
"]",
".",
"files",
"===",
"undefined",
")",
"{",
"files",
"[",
"0",
"]",
"=",
"{",
"'name'",
":",
"this",
... | puts the name of the input files return files | [
"puts",
"the",
"name",
"of",
"the",
"input",
"files",
"return",
"files"
] | 071ae6f3ff9a49a04346848b05d165e86c50f3b7 | https://github.com/markusslima/bootstrap-filestyle/blob/071ae6f3ff9a49a04346848b05d165e86c50f3b7/src/bootstrap-filestyle.js#L192-L213 | |
16,599 | w8r/polygon-offset | src/edge.js | Edge | function Edge(current, next) {
/**
* @type {Object}
*/
this.current = current;
/**
* @type {Object}
*/
this.next = next;
/**
* @type {Object}
*/
this._inNormal = this.inwardsNormal();
/**
* @type {Object}
*/
this._outNormal = this.outwardsNormal();
} | javascript | function Edge(current, next) {
/**
* @type {Object}
*/
this.current = current;
/**
* @type {Object}
*/
this.next = next;
/**
* @type {Object}
*/
this._inNormal = this.inwardsNormal();
/**
* @type {Object}
*/
this._outNormal = this.outwardsNormal();
} | [
"function",
"Edge",
"(",
"current",
",",
"next",
")",
"{",
"/**\n * @type {Object}\n */",
"this",
".",
"current",
"=",
"current",
";",
"/**\n * @type {Object}\n */",
"this",
".",
"next",
"=",
"next",
";",
"/**\n * @type {Object}\n */",
"this",
".",
"_inN... | Offset edge of the polygon
@param {Object} current
@param {Object} next
@constructor | [
"Offset",
"edge",
"of",
"the",
"polygon"
] | 9be25b9f18ad83ca4d3243104ebacadbc392d32e | https://github.com/w8r/polygon-offset/blob/9be25b9f18ad83ca4d3243104ebacadbc392d32e/src/edge.js#L8-L29 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.